Drinking glasses now break.
- Adds DamageOnLandComponent - Adds DamageOtherOnHitComponent - Drinking glasses break on throw. - Drinking glasses damage others when thrown. - Glass shards also damage others when thrown.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class DamageOnLandComponent : Component, ILand
|
||||
{
|
||||
public override string Name => "DamageOnLand";
|
||||
|
||||
private DamageType _damageType;
|
||||
private int _amount;
|
||||
private bool _ignoreResistances;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _damageType, "damageType", DamageType.Blunt);
|
||||
serializer.DataField(ref _amount, "amount", 1);
|
||||
serializer.DataField(ref _ignoreResistances, "ignoreResistances", false);
|
||||
}
|
||||
|
||||
public void Land(LandEventArgs eventArgs)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||
|
||||
damageable.ChangeDamage(_damageType, _amount, _ignoreResistances, eventArgs.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user