Inline UID
This commit is contained in:
@@ -31,19 +31,19 @@ namespace Content.Server.Fluids.Components
|
||||
public FixedPoint2 MaxVolume
|
||||
{
|
||||
get =>
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
|
||||
? solution.MaxVolume
|
||||
: FixedPoint2.Zero;
|
||||
set
|
||||
{
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
|
||||
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
||||
{
|
||||
solution.MaxVolume = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FixedPoint2 CurrentVolume => EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
|
||||
public FixedPoint2 CurrentVolume => EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
|
||||
? solution.CurrentVolume
|
||||
: FixedPoint2.Zero;
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace Content.Server.Fluids.Components
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||
if (!solutionsSys.TryGetSolution(Owner.Uid, SolutionName, out var contents) ||
|
||||
_currentlyUsing.Contains(eventArgs.Using.Uid) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using.Uid, out MopComponent? mopComponent) ||
|
||||
if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) ||
|
||||
_currentlyUsing.Contains(eventArgs.Using) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) ||
|
||||
mopComponent.Mopping)
|
||||
{
|
||||
return false;
|
||||
@@ -74,7 +74,7 @@ namespace Content.Server.Fluids.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
_currentlyUsing.Add(eventArgs.Using.Uid);
|
||||
_currentlyUsing.Add(eventArgs.Using);
|
||||
|
||||
// IMO let em move while doing it.
|
||||
var doAfterArgs = new DoAfterEventArgs(eventArgs.User, 1.0f, target: eventArgs.Target)
|
||||
@@ -84,10 +84,10 @@ namespace Content.Server.Fluids.Components
|
||||
};
|
||||
var result = await EntitySystem.Get<DoAfterSystem>().WaitDoAfter(doAfterArgs);
|
||||
|
||||
_currentlyUsing.Remove(eventArgs.Using.Uid);
|
||||
_currentlyUsing.Remove(eventArgs.Using);
|
||||
|
||||
if (result == DoAfterStatus.Cancelled ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
mopComponent.Deleted ||
|
||||
CurrentVolume <= 0 ||
|
||||
!Owner.InRangeUnobstructed(mopComponent.Owner))
|
||||
@@ -108,8 +108,8 @@ namespace Content.Server.Fluids.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
var solution = solutionsSys.SplitSolution(Owner.Uid, contents, transferAmount);
|
||||
if (!solutionsSys.TryAddSolution(mopComponent.Owner.Uid, mopContents, solution))
|
||||
var solution = solutionsSys.SplitSolution(Owner, contents, transferAmount);
|
||||
if (!solutionsSys.TryAddSolution(mopComponent.Owner, mopContents, solution))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.Fluids.Components
|
||||
{
|
||||
get
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution);
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution);
|
||||
return solution;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace Content.Server.Fluids.Components
|
||||
*/
|
||||
var solutionSystem = EntitySystem.Get<SolutionContainerSystem>();
|
||||
|
||||
if (!solutionSystem.TryGetSolution(Owner.Uid, SolutionName, out var contents ) ||
|
||||
if (!solutionSystem.TryGetSolution(Owner, SolutionName, out var contents ) ||
|
||||
Mopping ||
|
||||
!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||
{
|
||||
@@ -106,12 +106,12 @@ namespace Content.Server.Fluids.Components
|
||||
if (eventArgs.Target == null)
|
||||
{
|
||||
// Drop the liquid on the mop on to the ground
|
||||
solutionSystem.SplitSolution(Owner.Uid, contents, FixedPoint2.Min(ResidueAmount, CurrentVolume))
|
||||
solutionSystem.SplitSolution(Owner, contents, FixedPoint2.Min(ResidueAmount, CurrentVolume))
|
||||
.SpillAt(eventArgs.ClickLocation, "PuddleSmear");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Target.Uid, out PuddleComponent? puddleComponent) ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Target, out PuddleComponent? puddleComponent) ||
|
||||
!solutionSystem.TryGetSolution(puddleComponent.OwnerUid, puddleComponent.SolutionName, out var puddleSolution))
|
||||
return false;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Content.Server.Fluids.Components
|
||||
Mopping = false;
|
||||
|
||||
if (result == DoAfterStatus.Cancelled ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
puddleComponent.Deleted)
|
||||
return false;
|
||||
|
||||
@@ -143,21 +143,21 @@ namespace Content.Server.Fluids.Components
|
||||
// is the puddle cleaned?
|
||||
if (puddleSolution.TotalVolume - transferAmount <= 0)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(puddleComponent.Owner.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) puddleComponent.Owner);
|
||||
|
||||
// After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly.
|
||||
// we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite.
|
||||
solutionSystem.SplitSolution(Owner.Uid, contents, transferAmount)
|
||||
solutionSystem.SplitSolution(Owner, contents, transferAmount)
|
||||
.SplitSolution(ResidueAmount)
|
||||
.SpillAt(eventArgs.ClickLocation, "PuddleSmear", combine: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove solution from the puddle
|
||||
solutionSystem.SplitSolution(eventArgs.Target.Uid, puddleSolution, transferAmount);
|
||||
solutionSystem.SplitSolution(eventArgs.Target, puddleSolution, transferAmount);
|
||||
|
||||
// and from the mop
|
||||
solutionSystem.SplitSolution(Owner.Uid, contents, transferAmount);
|
||||
solutionSystem.SplitSolution(Owner, contents, transferAmount);
|
||||
}
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _pickupSound.GetSound(), Owner);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.Fluids.Components
|
||||
public bool Overflown;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public FixedPoint2 CurrentVolume => EntitySystem.Get<PuddleSystem>().CurrentVolume(Owner.Uid);
|
||||
public FixedPoint2 CurrentVolume => EntitySystem.Get<PuddleSystem>().CurrentVolume(Owner);
|
||||
|
||||
[ViewVariables] [DataField("overflowVolume")]
|
||||
public FixedPoint2 OverflowVolume = DefaultOverflowVolume;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Fluids.Components
|
||||
public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype,
|
||||
bool sound = true, bool combine = true)
|
||||
{
|
||||
return solution.SpillAt(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates, prototype, sound, combine: combine);
|
||||
return solution.SpillAt(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates, prototype, sound, combine: combine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,7 +118,7 @@ namespace Content.Server.Fluids.Components
|
||||
{
|
||||
foreach (var entity in tileRef.GetEntitiesInTileFast(gridTileLookupSystem))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out PuddleComponent? p))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out PuddleComponent? p))
|
||||
{
|
||||
puddle = p;
|
||||
return true;
|
||||
@@ -167,9 +167,9 @@ namespace Content.Server.Fluids.Components
|
||||
foreach (var spillEntity in spillEntities)
|
||||
{
|
||||
if (EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetRefillableSolution(spillEntity.Uid, out var solutionContainerComponent))
|
||||
.TryGetRefillableSolution(spillEntity, out var solutionContainerComponent))
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>().Refill(spillEntity.Uid, solutionContainerComponent,
|
||||
EntitySystem.Get<SolutionContainerSystem>().Refill(spillEntity, solutionContainerComponent,
|
||||
solution.SplitSolution(FixedPoint2.Min(
|
||||
solutionContainerComponent.AvailableVolume,
|
||||
solutionContainerComponent.MaxSpillRefill))
|
||||
@@ -183,20 +183,20 @@ namespace Content.Server.Fluids.Components
|
||||
{
|
||||
foreach (var spillEntity in spillEntities)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(spillEntity.Uid, out PuddleComponent? puddleComponent)) continue;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(spillEntity, out PuddleComponent? puddleComponent)) continue;
|
||||
|
||||
if (!overflow && puddleSystem.WouldOverflow(puddleComponent.Owner.Uid, solution, puddleComponent)) return null;
|
||||
if (!overflow && puddleSystem.WouldOverflow(puddleComponent.Owner, solution, puddleComponent)) return null;
|
||||
|
||||
if (!puddleSystem.TryAddSolution(puddleComponent.Owner.Uid, solution, sound)) continue;
|
||||
if (!puddleSystem.TryAddSolution(puddleComponent.Owner, solution, sound)) continue;
|
||||
|
||||
return puddleComponent;
|
||||
}
|
||||
}
|
||||
|
||||
var puddleEnt = serverEntityManager.SpawnEntity(prototype, spillGridCoords);
|
||||
var newPuddleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(puddleEnt.Uid);
|
||||
var newPuddleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(puddleEnt);
|
||||
|
||||
puddleSystem.TryAddSolution(newPuddleComponent.Owner.Uid, solution, sound);
|
||||
puddleSystem.TryAddSolution(newPuddleComponent.Owner, solution, sound);
|
||||
|
||||
return newPuddleComponent;
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ namespace Content.Server.Fluids.Components
|
||||
public FixedPoint2 CurrentVolume {
|
||||
get
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution);
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution);
|
||||
return solution?.CurrentVolume ?? FixedPoint2.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
return false;
|
||||
|
||||
if (CurrentVolume <= 0)
|
||||
@@ -99,13 +99,13 @@ namespace Content.Server.Fluids.Components
|
||||
if(curTime < _cooldownEnd)
|
||||
return true;
|
||||
|
||||
var playerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User.Uid).Coordinates;
|
||||
var playerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates;
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
||||
return true;
|
||||
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var contents))
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var contents))
|
||||
return true;
|
||||
|
||||
var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized;
|
||||
@@ -124,35 +124,35 @@ namespace Content.Server.Fluids.Components
|
||||
var diffNorm = diffPos.Normalized;
|
||||
var diffLength = diffPos.Length;
|
||||
|
||||
var target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User.Uid).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||
var target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||
|
||||
if (target.TryDistance(IoCManager.Resolve<IEntityManager>(), playerPos, out var distance) && distance > SprayDistance)
|
||||
target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User.Uid).Coordinates.Offset(diffNorm * SprayDistance);
|
||||
target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance);
|
||||
|
||||
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner.Uid, contents, _transferAmount);
|
||||
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner, contents, _transferAmount);
|
||||
|
||||
if (solution.TotalVolume <= FixedPoint2.Zero)
|
||||
break;
|
||||
|
||||
var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor.Uid).LocalRotation = rotation;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).LocalRotation = rotation;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(vapor.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(vapor, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f));
|
||||
appearance.SetData(VaporVisuals.State, true);
|
||||
}
|
||||
|
||||
// Add the solution to the vapor and actually send the thing
|
||||
var vaporComponent = IoCManager.Resolve<IEntityManager>().GetComponent<VaporComponent>(vapor.Uid);
|
||||
var vaporComponent = IoCManager.Resolve<IEntityManager>().GetComponent<VaporComponent>(vapor);
|
||||
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
||||
vaporSystem.TryAddSolution(vaporComponent, solution);
|
||||
|
||||
// impulse direction is defined in world-coordinates, not local coordinates
|
||||
var impulseDirection = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor.Uid).WorldRotation.ToVec();
|
||||
var impulseDirection = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).WorldRotation.ToVec();
|
||||
vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime);
|
||||
|
||||
if (_impulse > 0f && IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User.Uid, out IPhysBody? body))
|
||||
if (_impulse > 0f && IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out IPhysBody? body))
|
||||
{
|
||||
body.ApplyLinearImpulse(-impulseDirection * _impulse);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ namespace Content.Server.Fluids.Components
|
||||
_lastUseTime = curTime;
|
||||
_cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime);
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out ItemCooldownComponent? cooldown))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemCooldownComponent? cooldown))
|
||||
{
|
||||
cooldown.CooldownStart = _lastUseTime;
|
||||
cooldown.CooldownEnd = _cooldownEnd;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
var queueDelete = new RemQueue<EvaporationComponent>();
|
||||
foreach (var evaporationComponent in EntityManager.EntityQuery<EvaporationComponent>())
|
||||
{
|
||||
var uid = evaporationComponent.Owner.Uid;
|
||||
var uid = (EntityUid) evaporationComponent.Owner;
|
||||
evaporationComponent.Accumulator += frameTime;
|
||||
|
||||
if (!_solutionContainerSystem.TryGetSolution(uid, evaporationComponent.SolutionName, out var solution))
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
foreach (var evaporationComponent in queueDelete)
|
||||
{
|
||||
EntityManager.RemoveComponent(evaporationComponent.Owner.Uid, evaporationComponent);
|
||||
EntityManager.RemoveComponent(evaporationComponent.Owner, evaporationComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
private void UpdateVisuals(EntityUid uid, PuddleComponent puddleComponent)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(puddleComponent.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || EmptyHolder(uid, puddleComponent) ||
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(puddleComponent.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || EmptyHolder(uid, puddleComponent) ||
|
||||
!EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearanceComponent))
|
||||
{
|
||||
return;
|
||||
@@ -96,7 +96,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
|
||||
if (!_solutionContainerSystem.TryGetDrainableSolution(args.Target.Uid, out var solution))
|
||||
if (!_solutionContainerSystem.TryGetDrainableSolution(args.Target, out var solution))
|
||||
return;
|
||||
|
||||
if (solution.DrainAvailable == FixedPoint2.Zero)
|
||||
@@ -105,8 +105,8 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
Verb verb = new();
|
||||
verb.Text = Loc.GetString("spill-target-verb-get-data-text");
|
||||
// TODO VERB ICONS spill icon? pouring out a glass/beaker?
|
||||
verb.Act = () => _solutionContainerSystem.SplitSolution(args.Target.Uid,
|
||||
solution, solution.DrainAvailable).SpillAt(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).Coordinates, "PuddleSmear");
|
||||
verb.Act = () => _solutionContainerSystem.SplitSolution(args.Target,
|
||||
solution, solution.DrainAvailable).SpillAt(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target).Coordinates, "PuddleSmear");
|
||||
verb.Impact = LogImpact.Medium; // dangerous reagent reaction are logged separately.
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
@@ -121,10 +121,10 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
private void OnUnanchored(EntityUid uid, PuddleComponent puddle, UnanchoredEvent unanchoredEvent)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddle.Owner.Uid).Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddle.Owner).Anchored)
|
||||
return;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(puddle.Owner.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) puddle.Owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,7 +147,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
if (!Resolve(uid, ref puddleComponent))
|
||||
return true;
|
||||
|
||||
return !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName,
|
||||
return !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName,
|
||||
out var solution)
|
||||
|| solution.Contents.Count == 0;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
if (!Resolve(uid, ref puddleComponent))
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
return _solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName,
|
||||
return _solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName,
|
||||
out var solution)
|
||||
? solution.CurrentVolume
|
||||
: FixedPoint2.Zero;
|
||||
@@ -172,7 +172,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
return false;
|
||||
|
||||
if (solution.TotalVolume == 0 ||
|
||||
!_solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName,
|
||||
!_solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName,
|
||||
out var puddleSolution))
|
||||
{
|
||||
return false;
|
||||
@@ -180,13 +180,13 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
|
||||
var result = _solutionContainerSystem
|
||||
.TryAddSolution(puddleComponent.Owner.Uid, puddleSolution, solution);
|
||||
.TryAddSolution(puddleComponent.Owner, puddleSolution, solution);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RaiseLocalEvent(puddleComponent.Owner.Uid, new SolutionChangedEvent());
|
||||
RaiseLocalEvent(puddleComponent.Owner, new SolutionChangedEvent());
|
||||
|
||||
if (checkForOverflow)
|
||||
{
|
||||
@@ -241,12 +241,12 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
{
|
||||
var adjacentPuddle = adjacent();
|
||||
var quantity = FixedPoint2.Min(overflowSplit, adjacentPuddle.OverflowVolume);
|
||||
var puddleSolution = _solutionContainerSystem.EnsureSolution(puddleComponent.Owner.Uid,
|
||||
var puddleSolution = _solutionContainerSystem.EnsureSolution(puddleComponent.Owner,
|
||||
puddleComponent.SolutionName);
|
||||
var spillAmount = _solutionContainerSystem.SplitSolution(puddleComponent.Owner.Uid,
|
||||
var spillAmount = _solutionContainerSystem.SplitSolution(puddleComponent.Owner,
|
||||
puddleSolution, quantity);
|
||||
|
||||
TryAddSolution(adjacentPuddle.Owner.Uid, spillAmount, false, false);
|
||||
TryAddSolution(adjacentPuddle.Owner, spillAmount, false, false);
|
||||
nextPuddles.Add(adjacentPuddle);
|
||||
}
|
||||
}
|
||||
@@ -288,11 +288,11 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
puddle = default;
|
||||
|
||||
// We're most likely in space, do nothing.
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner.Uid).GridID.IsValid())
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner).GridID.IsValid())
|
||||
return false;
|
||||
|
||||
var mapGrid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner.Uid).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner.Uid).Coordinates;
|
||||
var mapGrid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner).Coordinates;
|
||||
|
||||
if (!coords.Offset(direction).TryGetTileRef(out var tile))
|
||||
{
|
||||
@@ -305,7 +305,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner.Uid).Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puddleComponent.Owner).Anchored)
|
||||
return false;
|
||||
|
||||
foreach (var entity in mapGrid.GetInDir(coords, direction))
|
||||
@@ -330,8 +330,9 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
puddle ??= () =>
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner.Uid).EntityPrototype?.ID,
|
||||
mapGrid.DirectionToGrid(coords, direction)).Uid);
|
||||
IEntity tempQualifier = IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner).EntityPrototype?.ID,
|
||||
mapGrid.DirectionToGrid(coords, direction));
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(tempQualifier);
|
||||
};
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user