Add OnDamaged method to IOnDamageBehavior (#685)
* Add OnDamaged method to IOnDamageBehavior * Adds Source, SourceMob to OnDamage.
This commit is contained in:
committed by
GitHub
parent
3292939756
commit
934f6fb7e2
@@ -92,15 +92,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
||||
var ray = new CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
||||
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user);
|
||||
|
||||
Hit(rayCastResults, energyModifier);
|
||||
Hit(rayCastResults, energyModifier, user);
|
||||
AfterEffects(user, rayCastResults, angle, energyModifier);
|
||||
}
|
||||
|
||||
protected virtual void Hit(RayCastResults ray, float damageModifier)
|
||||
protected virtual void Hit(RayCastResults ray, float damageModifier, IEntity user = null)
|
||||
{
|
||||
if (ray.HitEntity != null && ray.HitEntity.TryGetComponent(out DamageableComponent damage))
|
||||
{
|
||||
damage.TakeDamage(DamageType.Heat, (int)Math.Round(_damage * damageModifier, MidpointRounding.AwayFromZero));
|
||||
damage.TakeDamage(DamageType.Heat, (int)Math.Round(_damage * damageModifier, MidpointRounding.AwayFromZero), Owner, user);
|
||||
//I used Math.Round over Convert.toInt32, as toInt32 always rounds to
|
||||
//even numbers if halfway between two numbers, rather than rounding to nearest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user