Remove .Owner from melee weapons (#14600)
This commit is contained in:
@@ -124,7 +124,7 @@ public sealed partial class NPCSteeringSystem
|
||||
// Breaking behaviours and the likes.
|
||||
lock (_obstacles)
|
||||
{
|
||||
status = TryHandleFlags(steering, node, bodyQuery);
|
||||
status = TryHandleFlags(uid, steering, node, bodyQuery);
|
||||
}
|
||||
|
||||
// TODO: Need to handle re-pathing in case the target moves around.
|
||||
|
||||
@@ -32,7 +32,7 @@ public sealed partial class NPCSteeringSystem
|
||||
*/
|
||||
|
||||
|
||||
private SteeringObstacleStatus TryHandleFlags(NPCSteeringComponent component, PathPoly poly, EntityQuery<PhysicsComponent> bodyQuery)
|
||||
private SteeringObstacleStatus TryHandleFlags(EntityUid uid, NPCSteeringComponent component, PathPoly poly, EntityQuery<PhysicsComponent> bodyQuery)
|
||||
{
|
||||
DebugTools.Assert(!poly.Data.IsFreeSpace);
|
||||
// TODO: Store PathFlags on the steering comp
|
||||
@@ -41,9 +41,9 @@ public sealed partial class NPCSteeringSystem
|
||||
var layer = 0;
|
||||
var mask = 0;
|
||||
|
||||
if (TryComp<FixturesComponent>(component.Owner, out var manager))
|
||||
if (TryComp<FixturesComponent>(uid, out var manager))
|
||||
{
|
||||
(layer, mask) = _physics.GetHardCollision(component.Owner, manager);
|
||||
(layer, mask) = _physics.GetHardCollision(uid, manager);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,7 +76,7 @@ public sealed partial class NPCSteeringSystem
|
||||
{
|
||||
if (door.State != DoorState.Opening)
|
||||
{
|
||||
_interaction.InteractionActivate(component.Owner, ent);
|
||||
_interaction.InteractionActivate(uid, ent);
|
||||
return SteeringObstacleStatus.Continuing;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public sealed partial class NPCSteeringSystem
|
||||
{
|
||||
// TODO: Use the verb.
|
||||
if (door.State != DoorState.Opening && !door.BeingPried)
|
||||
_doors.TryPryDoor(ent, component.Owner, component.Owner, door, true);
|
||||
_doors.TryPryDoor(ent, uid, uid, door, true);
|
||||
|
||||
return SteeringObstacleStatus.Continuing;
|
||||
}
|
||||
@@ -112,9 +112,7 @@ public sealed partial class NPCSteeringSystem
|
||||
// Try smashing obstacles.
|
||||
else if ((component.Flags & PathFlags.Smashing) != 0x0)
|
||||
{
|
||||
var meleeWeapon = _melee.GetWeapon(component.Owner);
|
||||
|
||||
if (meleeWeapon != null && meleeWeapon.NextAttack <= _timing.CurTime && TryComp<CombatModeComponent>(component.Owner, out var combatMode))
|
||||
if (_melee.TryGetWeapon(uid, out var meleeUid, out var meleeWeapon) && meleeWeapon.NextAttack <= _timing.CurTime && TryComp<CombatModeComponent>(uid, out var combatMode))
|
||||
{
|
||||
combatMode.IsInCombatMode = true;
|
||||
var destructibleQuery = GetEntityQuery<DestructibleComponent>();
|
||||
@@ -127,7 +125,7 @@ public sealed partial class NPCSteeringSystem
|
||||
// TODO: Validate we can damage it
|
||||
if (destructibleQuery.HasComponent(ent))
|
||||
{
|
||||
_melee.AttemptLightAttack(component.Owner, component.Owner, meleeWeapon, ent);
|
||||
_melee.AttemptLightAttack(uid, uid, meleeWeapon, ent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var hitBloodstreams = new List<BloodstreamComponent>();
|
||||
var hitBloodstreams = new List<(EntityUid Entity, BloodstreamComponent Component)>();
|
||||
var bloodQuery = GetEntityQuery<BloodstreamComponent>();
|
||||
|
||||
foreach (var entity in args.HitEntities)
|
||||
@@ -245,7 +245,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
continue;
|
||||
|
||||
if (bloodQuery.TryGetComponent(entity, out var bloodstream))
|
||||
hitBloodstreams.Add(bloodstream);
|
||||
hitBloodstreams.Add((entity, bloodstream));
|
||||
}
|
||||
|
||||
if (!hitBloodstreams.Any())
|
||||
@@ -256,10 +256,10 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
var solutionToInject = removedSolution.SplitSolution(removedVol * comp.TransferEfficiency);
|
||||
var volPerBloodstream = solutionToInject.Volume * (1 / hitBloodstreams.Count);
|
||||
|
||||
foreach (var bloodstream in hitBloodstreams)
|
||||
foreach (var (ent, bloodstream) in hitBloodstreams)
|
||||
{
|
||||
var individualInjection = solutionToInject.SplitSolution(volPerBloodstream);
|
||||
_bloodstream.TryAddToChemicals((bloodstream).Owner, individualInjection, bloodstream);
|
||||
_bloodstream.TryAddToChemicals(ent, individualInjection, bloodstream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user