Inline UID
This commit is contained in:
@@ -40,8 +40,8 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
if (!string.IsNullOrEmpty(_meatPrototype))
|
||||
{
|
||||
var meat = IoCManager.Resolve<IEntityManager>().SpawnEntity(_meatPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(meat.Uid).EntityName = _meatName;
|
||||
var meat = IoCManager.Resolve<IEntityManager>().SpawnEntity(_meatPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(meat).EntityName = _meatName;
|
||||
}
|
||||
|
||||
if (_meatParts != 0)
|
||||
@@ -67,7 +67,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(victim.Uid, out butcherable))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(victim, out butcherable))
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
|
||||
return false;
|
||||
@@ -97,7 +97,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
public async void TrySpike(IEntity victim, IEntity user)
|
||||
{
|
||||
var victimUid = victim.Uid;
|
||||
var victimUid = (EntityUid) victim;
|
||||
if (_beingButchered.Contains(victimUid)) return;
|
||||
|
||||
SharedButcherableComponent? butcherable;
|
||||
@@ -106,7 +106,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return;
|
||||
|
||||
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(victim.Uid, out var state) &&
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(victim, out var state) &&
|
||||
!state.IsDead())
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
||||
@@ -154,7 +154,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
|
||||
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(victim.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) victim);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ namespace Content.Server.Kitchen.Components
|
||||
/// </summary>
|
||||
[ViewVariables] private uint _currentCookTimerTime = 1;
|
||||
|
||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
|
||||
private bool HasContents => EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetSolution(Owner.Uid, SolutionName, out var solution) &&
|
||||
.TryGetSolution(Owner, SolutionName, out var solution) &&
|
||||
(solution.Contents.Count > 0 || _storage.ContainedEntities.Count > 0);
|
||||
|
||||
private bool _uiDirty = true;
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
_currentCookTimerTime = _cookTimeDefault;
|
||||
|
||||
EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(Owner.Uid, SolutionName);
|
||||
EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(Owner, SolutionName);
|
||||
|
||||
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "microwave_entity_container",
|
||||
out _);
|
||||
@@ -184,12 +184,12 @@ namespace Content.Server.Kitchen.Components
|
||||
}
|
||||
|
||||
if (_uiDirty && EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
.TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
UserInterface?.SetState(new MicrowaveUpdateUserInterfaceState
|
||||
(
|
||||
solution.Contents.ToArray(),
|
||||
_storage.ContainedEntities.Select(item => item.Uid).ToArray(),
|
||||
_storage.ContainedEntities.Select(item => (EntityUid) item).ToArray(),
|
||||
_busy,
|
||||
_currentCookTimeButtonIndex,
|
||||
_currentCookTimerTime
|
||||
@@ -206,7 +206,7 @@ namespace Content.Server.Kitchen.Components
|
||||
finalState = MicrowaveVisualState.Broken;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PowerDeviceVisuals.VisualState, finalState);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor) || !Powered)
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor) || !Powered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
var itemEntity = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(eventArgs.User.Uid).GetActiveHand?.Owner;
|
||||
var itemEntity = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(eventArgs.User).GetActiveHand?.Owner;
|
||||
|
||||
if (itemEntity == null)
|
||||
{
|
||||
@@ -251,15 +251,15 @@ namespace Content.Server.Kitchen.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SolutionTransferComponent?>(itemEntity.Uid, out var attackPourable))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SolutionTransferComponent?>(itemEntity, out var attackPourable))
|
||||
{
|
||||
var solutionsSystem = EntitySystem.Get<SolutionContainerSystem>();
|
||||
if (!solutionsSystem.TryGetDrainableSolution(itemEntity.Uid, out var attackSolution))
|
||||
if (!solutionsSystem.TryGetDrainableSolution(itemEntity, out var attackSolution))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!solutionsSystem.TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
if (!solutionsSystem.TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -275,8 +275,8 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
//Move units from attackSolution to targetSolution
|
||||
var removedSolution = EntitySystem.Get<SolutionContainerSystem>()
|
||||
.Drain(itemEntity.Uid, attackSolution, realTransferAmount);
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(Owner.Uid, solution, removedSolution))
|
||||
.Drain(itemEntity, attackSolution, realTransferAmount);
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(Owner, solution, removedSolution))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(itemEntity.Uid, typeof(ItemComponent), out var food))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(itemEntity, typeof(ItemComponent), out var food))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, "microwave-component-interact-using-transfer-fail");
|
||||
return false;
|
||||
@@ -312,18 +312,18 @@ namespace Content.Server.Kitchen.Components
|
||||
var solidsDict = new Dictionary<string, int>();
|
||||
foreach (var item in _storage.ContainedEntities)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype == null)
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (solidsDict.ContainsKey(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID))
|
||||
if (solidsDict.ContainsKey(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype.ID))
|
||||
{
|
||||
solidsDict[IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID]++;
|
||||
solidsDict[IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype.ID]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
solidsDict.Add(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID, 1);
|
||||
solidsDict.Add(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype.ID, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,13 +366,13 @@ namespace Content.Server.Kitchen.Components
|
||||
if (recipeToCook != null)
|
||||
{
|
||||
SubtractContents(recipeToCook);
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipeToCook.Result, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipeToCook.Result, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
else
|
||||
{
|
||||
VaporizeReagents();
|
||||
VaporizeSolids();
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_badRecipeName, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_badRecipeName, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,18 +390,18 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
private void VaporizeReagents()
|
||||
{
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>().RemoveAllSolution(Owner.Uid, solution);
|
||||
EntitySystem.Get<SolutionContainerSystem>().RemoveAllSolution(Owner, solution);
|
||||
}
|
||||
}
|
||||
|
||||
private void VaporizeReagentQuantity(Solution.ReagentQuantity reagentQuantity)
|
||||
{
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryRemoveReagent(Owner.Uid, solution, reagentQuantity.ReagentId, reagentQuantity.Quantity);
|
||||
.TryRemoveReagent(Owner, solution, reagentQuantity.ReagentId, reagentQuantity.Quantity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ namespace Content.Server.Kitchen.Components
|
||||
{
|
||||
var item = _storage.ContainedEntities.ElementAt(i);
|
||||
_storage.Remove(item);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +433,8 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
private void SubtractContents(FoodRecipePrototype recipe)
|
||||
{
|
||||
var solutionUid = Owner.Uid;
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
var solutionUid = (EntityUid) Owner;
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -451,15 +451,15 @@ namespace Content.Server.Kitchen.Components
|
||||
{
|
||||
foreach (var item in _storage.ContainedEntities)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype == null)
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID == recipeSolid.Key)
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item).EntityPrototype.ID == recipeSolid.Key)
|
||||
{
|
||||
_storage.Remove(item);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -474,7 +474,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return MicrowaveSuccessState.RecipeFail;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
return MicrowaveSuccessState.RecipeFail;
|
||||
}
|
||||
@@ -517,7 +517,7 @@ namespace Content.Server.Kitchen.Components
|
||||
{
|
||||
var headCount = 0;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent?>(victim.Uid, out var body))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent?>(victim, out var body))
|
||||
{
|
||||
var headSlots = body.GetSlotsOfType(BodyPartType.Head);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
if (args.Handled) return;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(args.User.Uid))
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(args.User))
|
||||
{
|
||||
component.Owner.PopupMessage(args.User,
|
||||
Loc.GetString("reagent-grinder-component-interact-using-no-hands"));
|
||||
@@ -67,13 +67,13 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
// First, check if user is trying to insert a beaker.
|
||||
// No promise it will be a beaker right now, but whatever.
|
||||
// Maybe this should whitelist "beaker" in the prototype id of heldEnt?
|
||||
if (_solutionsSystem.TryGetFitsInDispenser(heldEnt.Uid, out var beaker))
|
||||
if (_solutionsSystem.TryGetFitsInDispenser(heldEnt, out var beaker))
|
||||
{
|
||||
component.BeakerContainer.Insert(heldEnt);
|
||||
component.HeldBeaker = beaker;
|
||||
EnqueueUiUpdate(component);
|
||||
//We are done, return. Insert the beaker and exit!
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached,
|
||||
component.BeakerContainer.ContainedEntity != null);
|
||||
@@ -85,7 +85,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
}
|
||||
|
||||
//Next, see if the user is trying to insert something they want to be ground/juiced.
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(heldEnt.Uid, out ExtractableComponent? juice))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(heldEnt, out ExtractableComponent? juice))
|
||||
{
|
||||
//Entity did NOT pass the whitelist for grind/juice.
|
||||
//Wouldn't want the clown grinding up the Captain's ID card now would you?
|
||||
@@ -113,7 +113,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
if (args.Handled) return;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
switch (message.Message)
|
||||
{
|
||||
case SharedReagentGrinderComponent.ReagentGrinderGrindStartMessage msg:
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) ||
|
||||
!receiver.Powered) break;
|
||||
ClickSound(component);
|
||||
DoWork(component, message.Session.AttachedEntity!,
|
||||
@@ -169,7 +169,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
break;
|
||||
|
||||
case SharedReagentGrinderComponent.ReagentGrinderJuiceStartMessage msg:
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver2) ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver2) ||
|
||||
!receiver2.Powered) break;
|
||||
ClickSound(component);
|
||||
DoWork(component, message.Session.AttachedEntity!,
|
||||
@@ -193,7 +193,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
break;
|
||||
|
||||
case SharedReagentGrinderComponent.ReagentGrinderEjectChamberContentMessage msg:
|
||||
if (component.Chamber.ContainedEntities.TryFirstOrDefault(x => x.Uid == msg.EntityID, out var ent))
|
||||
if (component.Chamber.ContainedEntities.TryFirstOrDefault(x => x == msg.EntityID, out var ent))
|
||||
{
|
||||
component.Chamber.Remove(ent);
|
||||
ent.RandomOffset(0.4f);
|
||||
@@ -226,11 +226,11 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
foreach (var entity in comp.Chamber.ContainedEntities)
|
||||
{
|
||||
if (canJuice || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out ExtractableComponent? component)) continue;
|
||||
if (canJuice || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ExtractableComponent? component)) continue;
|
||||
|
||||
canJuice = component.JuiceSolution != null;
|
||||
canGrind = component.GrindableSolution != null
|
||||
&& _solutionsSystem.TryGetSolution(entity.Uid, component.GrindableSolution, out _);
|
||||
&& _solutionsSystem.TryGetSolution(entity, component.GrindableSolution, out _);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,10 +239,10 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
(
|
||||
comp.Busy,
|
||||
comp.BeakerContainer.ContainedEntity != null,
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(comp.Owner.Uid, out ApcPowerReceiverComponent? receiver) && receiver.Powered,
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(comp.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered,
|
||||
canJuice,
|
||||
canGrind,
|
||||
comp.Chamber.ContainedEntities.Select(item => item.Uid).ToArray(),
|
||||
comp.Chamber.ContainedEntities.Select(item => (EntityUid) item).ToArray(),
|
||||
//Remember the beaker can be null!
|
||||
comp.HeldBeaker?.Contents.ToArray()
|
||||
));
|
||||
@@ -264,14 +264,14 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
component.BeakerContainer.Remove(beaker);
|
||||
|
||||
if (user == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(beaker.Uid, out var item))
|
||||
if (user == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(beaker, out var item))
|
||||
return;
|
||||
hands.PutInHandOrDrop(item);
|
||||
|
||||
component.HeldBeaker = null;
|
||||
EnqueueUiUpdate(component);
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached,
|
||||
component.BeakerContainer.ContainedEntity != null);
|
||||
@@ -286,7 +286,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
SharedReagentGrinderComponent.GrinderProgram program)
|
||||
{
|
||||
//Have power, are we busy, chamber has anything to grind, a beaker for the grounds to go?
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) || !receiver.Powered ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered ||
|
||||
component.Busy || component.Chamber.ContainedEntities.Count <= 0 ||
|
||||
component.BeakerContainer.ContainedEntity == null || component.HeldBeaker == null)
|
||||
{
|
||||
@@ -308,18 +308,18 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
foreach (var item in component.Chamber.ContainedEntities.ToList())
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item.Uid, out ExtractableComponent? extract)
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out ExtractableComponent? extract)
|
||||
|| extract.GrindableSolution == null
|
||||
|| !_solutionsSystem.TryGetSolution(item.Uid, extract.GrindableSolution, out var solution)) continue;
|
||||
|| !_solutionsSystem.TryGetSolution(item, extract.GrindableSolution, out var solution)) continue;
|
||||
|
||||
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
|
||||
RaiseLocalEvent(item.Uid, juiceEvent, false);
|
||||
RaiseLocalEvent(item, juiceEvent, false);
|
||||
if (component.HeldBeaker.CurrentVolume + solution.CurrentVolume * juiceEvent.Scalar >
|
||||
component.HeldBeaker.MaxVolume) continue;
|
||||
solution.ScaleSolution(juiceEvent.Scalar);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, solution);
|
||||
_solutionsSystem.RemoveAllSolution(beakerEntity.Uid, solution);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity, component.HeldBeaker, solution);
|
||||
_solutionsSystem.RemoveAllSolution(beakerEntity, solution);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) item);
|
||||
}
|
||||
|
||||
component.Busy = false;
|
||||
@@ -334,24 +334,24 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
foreach (var item in component.Chamber.ContainedEntities.ToList())
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ExtractableComponent?>(item.Uid, out var juiceMe)
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ExtractableComponent?>(item, out var juiceMe)
|
||||
|| juiceMe.JuiceSolution == null)
|
||||
{
|
||||
Logger.Warning("Couldn't find a juice solution on entityUid:{0}", item.Uid);
|
||||
Logger.Warning("Couldn't find a juice solution on entityUid:{0}", item);
|
||||
continue;
|
||||
}
|
||||
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<StackComponent>(item.Uid))
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<StackComponent>(item))
|
||||
{
|
||||
RaiseLocalEvent(item.Uid, juiceEvent);
|
||||
RaiseLocalEvent(item, juiceEvent);
|
||||
}
|
||||
|
||||
if (component.HeldBeaker.CurrentVolume +
|
||||
juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar >
|
||||
component.HeldBeaker.MaxVolume) continue;
|
||||
juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity, component.HeldBeaker, juiceMe.JuiceSolution);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) item);
|
||||
}
|
||||
|
||||
bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage());
|
||||
|
||||
Reference in New Issue
Block a user