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>
|
/// <summary>
|
||||||
/// User who threw the item.
|
/// User who threw the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity User;
|
public IEntity User { get; set; }
|
||||||
|
|
||||||
void ICollideBehavior.CollideWith(IEntity entity)
|
void ICollideBehavior.CollideWith(IEntity entity)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,21 @@
|
|||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
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
|
# Transformable container - normal glass
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -33,7 +48,6 @@
|
|||||||
components:
|
components:
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Consumable/Drinks/glass_clear.rsi
|
sprite: Objects/Consumable/Drinks/glass_clear.rsi
|
||||||
|
|
||||||
- type: SolutionContainer
|
- type: SolutionContainer
|
||||||
fillingState: glass
|
fillingState: glass
|
||||||
maxVol: 50
|
maxVol: 50
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
damageType: Slash
|
damageType: Slash
|
||||||
- type: Item
|
- type: Item
|
||||||
sprite: Objects/Materials/Shards/shard.rsi
|
sprite: Objects/Materials/Shards/shard.rsi
|
||||||
|
- type: DamageOtherOnHit
|
||||||
|
amount: 5
|
||||||
|
damageType: Slash
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ShardGlass
|
id: ShardGlass
|
||||||
@@ -47,6 +50,9 @@
|
|||||||
refineResult:
|
refineResult:
|
||||||
- GlassStack
|
- GlassStack
|
||||||
- MetalStack
|
- MetalStack
|
||||||
|
- type: DamageOtherOnHit
|
||||||
|
amount: 10
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ShardGlassPhoron
|
id: ShardGlassPhoron
|
||||||
name: phoron glass shard
|
name: phoron glass shard
|
||||||
@@ -61,3 +67,5 @@
|
|||||||
refineResult:
|
refineResult:
|
||||||
- GlassStack
|
- GlassStack
|
||||||
- PhoronStack
|
- PhoronStack
|
||||||
|
- type: DamageOtherOnHit
|
||||||
|
amount: 15
|
||||||
|
|||||||
Reference in New Issue
Block a user