OnHitEntities now returns a bool and takes a read only list
This commit is contained in:
@@ -75,8 +75,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
serializer.DataField(ref _cooldownTime, "cooldownTime", 1f);
|
||||
}
|
||||
|
||||
public virtual void OnHitEntities(IEnumerable<IEntity> entities)
|
||||
public virtual bool OnHitEntities(IReadOnlyList<IEntity> entities)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void IAttack.Attack(AttackEventArgs eventArgs)
|
||||
@@ -105,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
}
|
||||
}
|
||||
|
||||
OnHitEntities(hitEntities);
|
||||
if(OnHitEntities(hitEntities)) return;
|
||||
|
||||
var audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
var emitter = hitEntities.Count == 0 ? eventArgs.User : hitEntities[0];
|
||||
|
||||
@@ -45,10 +45,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
serializer.DataField(ref _slowdownTime, "slowdownTime", 5f);
|
||||
}
|
||||
|
||||
public override void OnHitEntities(IEnumerable<IEntity> entities)
|
||||
public override bool OnHitEntities(IReadOnlyList<IEntity> entities)
|
||||
{
|
||||
if (!Activated)
|
||||
return;
|
||||
if (!Activated || entities.Count == 0)
|
||||
return false;
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
.Play("/Audio/weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
@@ -62,6 +62,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
else
|
||||
stunnable.Slowdown(_slowdownTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UseEntity(UseEntityEventArgs eventArgs)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
state: stunbaton_off
|
||||
|
||||
- type: Stunbaton
|
||||
damage: 0.25
|
||||
range: 0.75
|
||||
arcwidth: 0
|
||||
arc: default
|
||||
|
||||
Reference in New Issue
Block a user