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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 DamageOtherOnHitComponent : Component, IThrowCollide
|
||||
{
|
||||
public override string Name => "DamageOtherOnHit";
|
||||
|
||||
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 DoHit(ThrowCollideEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Target.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||
|
||||
damageable.ChangeDamage(_damageType, _amount, _ignoreResistances, eventArgs.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
/// <summary>
|
||||
/// User who threw the item.
|
||||
/// </summary>
|
||||
public IEntity User;
|
||||
public IEntity User { get; set; }
|
||||
|
||||
void ICollideBehavior.CollideWith(IEntity entity)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,21 @@
|
||||
components:
|
||||
- type: Drink
|
||||
isOpen: true
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
acts: [ "Destruction" ]
|
||||
soundCollection: WindowBreak
|
||||
spawn:
|
||||
ShardGlass:
|
||||
min: 1
|
||||
max: 1
|
||||
- type: DamageOnLand
|
||||
amount: 5
|
||||
- type: DamageOtherOnHit
|
||||
amount: 5
|
||||
|
||||
|
||||
# Transformable container - normal glass
|
||||
- type: entity
|
||||
@@ -33,7 +48,6 @@
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Consumable/Drinks/glass_clear.rsi
|
||||
|
||||
- type: SolutionContainer
|
||||
fillingState: glass
|
||||
maxVol: 50
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
damageType: Slash
|
||||
- type: Item
|
||||
sprite: Objects/Materials/Shards/shard.rsi
|
||||
- type: DamageOtherOnHit
|
||||
amount: 5
|
||||
damageType: Slash
|
||||
|
||||
- type: entity
|
||||
id: ShardGlass
|
||||
@@ -47,6 +50,9 @@
|
||||
refineResult:
|
||||
- GlassStack
|
||||
- MetalStack
|
||||
- type: DamageOtherOnHit
|
||||
amount: 10
|
||||
|
||||
- type: entity
|
||||
id: ShardGlassPhoron
|
||||
name: phoron glass shard
|
||||
@@ -61,3 +67,5 @@
|
||||
refineResult:
|
||||
- GlassStack
|
||||
- PhoronStack
|
||||
- type: DamageOtherOnHit
|
||||
amount: 15
|
||||
|
||||
Reference in New Issue
Block a user