Wall slams - Damage on high velocity impact. (#1600)
* Wallslammed! * Removes debug logging * Buff damage to 5 by default
This commit is contained in:
committed by
GitHub
parent
8a66bf0284
commit
079937a9fe
@@ -151,6 +151,7 @@
|
|||||||
"Flippable",
|
"Flippable",
|
||||||
"Airtight",
|
"Airtight",
|
||||||
"MovedByPressure",
|
"MovedByPressure",
|
||||||
|
"DamageOnHighSpeedImpact",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,7 @@ namespace Content.Server.Atmos.Reactions
|
|||||||
mixture.SetMoles(Gas.Phoron, mixture.GetMoles(Gas.Phoron) - phoronBurnRate);
|
mixture.SetMoles(Gas.Phoron, mixture.GetMoles(Gas.Phoron) - phoronBurnRate);
|
||||||
mixture.SetMoles(Gas.Oxygen, mixture.GetMoles(Gas.Oxygen) - (phoronBurnRate * oxygenBurnRate));
|
mixture.SetMoles(Gas.Oxygen, mixture.GetMoles(Gas.Oxygen) - (phoronBurnRate * oxygenBurnRate));
|
||||||
|
|
||||||
if(superSaturation)
|
mixture.AdjustMoles(superSaturation ? Gas.Tritium : Gas.CarbonDioxide, phoronBurnRate);
|
||||||
mixture.AdjustMoles(Gas.Tritium, phoronBurnRate);
|
|
||||||
else
|
|
||||||
mixture.AdjustMoles(Gas.CarbonDioxide, phoronBurnRate);
|
|
||||||
|
|
||||||
energyReleased += Atmospherics.FirePhoronEnergyReleased * (phoronBurnRate);
|
energyReleased += Atmospherics.FirePhoronEnergyReleased * (phoronBurnRate);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Robust.Shared.GameObjects.Components.Transform;
|
|||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -323,7 +324,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
switch (_state)
|
switch (_state)
|
||||||
{
|
{
|
||||||
case ProcessState.TileEqualize:
|
case ProcessState.TileEqualize:
|
||||||
if(ProcessTileEqualize())
|
ProcessTileEqualize();
|
||||||
_state = ProcessState.ActiveTiles;
|
_state = ProcessState.ActiveTiles;
|
||||||
return;
|
return;
|
||||||
case ProcessState.ActiveTiles:
|
case ProcessState.ActiveTiles:
|
||||||
@@ -335,7 +336,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
_state = ProcessState.HighPressureDelta;
|
_state = ProcessState.HighPressureDelta;
|
||||||
return;
|
return;
|
||||||
case ProcessState.HighPressureDelta:
|
case ProcessState.HighPressureDelta:
|
||||||
if(ProcessHighPressureDelta())
|
ProcessHighPressureDelta();
|
||||||
_state = ProcessState.Hotspots;
|
_state = ProcessState.Hotspots;
|
||||||
break;
|
break;
|
||||||
case ProcessState.Hotspots:
|
case ProcessState.Hotspots:
|
||||||
@@ -347,7 +348,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
UpdateCounter++;
|
UpdateCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessTileEqualize()
|
public void ProcessTileEqualize()
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -360,10 +361,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
number = 0;
|
number = 0;
|
||||||
// Process the rest next time.
|
// Process the rest next time.
|
||||||
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
|
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessActiveTiles()
|
public bool ProcessActiveTiles()
|
||||||
@@ -411,7 +412,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessHighPressureDelta()
|
public void ProcessHighPressureDelta()
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -427,10 +428,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
number = 0;
|
number = 0;
|
||||||
// Process the rest next time.
|
// Process the rest next time.
|
||||||
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
|
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessHotspots()
|
private bool ProcessHotspots()
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Shared.Audio;
|
||||||
|
using Content.Shared.GameObjects;
|
||||||
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Random;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components.Damage
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public class DamageOnHighSpeedImpactComponent : Component, ICollideBehavior
|
||||||
|
{
|
||||||
|
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
|
public override string Name => "DamageOnHighSpeedImpact";
|
||||||
|
|
||||||
|
public DamageType Damage { get; set; } = DamageType.Brute;
|
||||||
|
public float MinimumSpeed { get; set; } = 20f;
|
||||||
|
public int BaseDamage { get; set; } = 5;
|
||||||
|
public float Factor { get; set; } = 0.75f;
|
||||||
|
public string SoundHit { get; set; } = "";
|
||||||
|
public float StunChance { get; set; } = 0.25f;
|
||||||
|
public int StunMinimumDamage { get; set; } = 10;
|
||||||
|
public float StunSeconds { get; set; }
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
serializer.DataField(this, x => Damage, "damage", DamageType.Brute);
|
||||||
|
serializer.DataField(this, x => MinimumSpeed, "minimumSpeed", 20f);
|
||||||
|
serializer.DataField(this, x => BaseDamage, "baseDamage", 5);
|
||||||
|
serializer.DataField(this, x => Factor, "factor", 1f);
|
||||||
|
serializer.DataField(this, x => SoundHit, "soundHit", "");
|
||||||
|
serializer.DataField(this, x => StunChance, "stunChance", 0.25f);
|
||||||
|
serializer.DataField(this, x => StunSeconds, "stunSeconds", 1f);
|
||||||
|
serializer.DataField(this, x => StunMinimumDamage, "stunMinimumDamage", 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CollideWith(IEntity collidedWith)
|
||||||
|
{
|
||||||
|
if (!Owner.TryGetComponent(out ICollidableComponent collidable) || !Owner.TryGetComponent(out DamageableComponent damageable)) return;
|
||||||
|
|
||||||
|
var speed = collidable.LinearVelocity.Length;
|
||||||
|
|
||||||
|
if (speed < MinimumSpeed) return;
|
||||||
|
|
||||||
|
var damage = (int) (BaseDamage * (speed / MinimumSpeed) * Factor);
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(SoundHit))
|
||||||
|
EntitySystem.Get<AudioSystem>().PlayFromEntity(SoundHit, collidedWith, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent(out StunnableComponent stun) && _robustRandom.Prob(StunChance))
|
||||||
|
stun.Stun(StunSeconds);
|
||||||
|
|
||||||
|
damageable.TakeDamage(Damage, damage, collidedWith, Owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Resources/Audio/Effects/hit_kick.ogg
Normal file
BIN
Resources/Audio/Effects/hit_kick.ogg
Normal file
Binary file not shown.
@@ -18,6 +18,8 @@
|
|||||||
state: generic_door
|
state: generic_door
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: MovedByPressure
|
- type: MovedByPressure
|
||||||
|
- type: DamageOnHighSpeedImpact
|
||||||
|
soundHit: /Audio/Effects/bang.ogg
|
||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
shapes:
|
shapes:
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
- type: Hands
|
- type: Hands
|
||||||
- type: MovementSpeedModifier
|
- type: MovementSpeedModifier
|
||||||
- type: MovedByPressure
|
- type: MovedByPressure
|
||||||
|
- type: DamageOnHighSpeedImpact
|
||||||
|
soundHit: /Audio/Effects/hit_kick.ogg
|
||||||
- type: Hunger
|
- type: Hunger
|
||||||
- type: Thirst
|
- type: Thirst
|
||||||
# Organs
|
# Organs
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: MovedByPressure
|
- type: MovedByPressure
|
||||||
|
- type: DamageOnHighSpeedImpact
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
Reference in New Issue
Block a user