Add some tests and fix some miscellaneous bugs (#22836)
* Add some tests and fix some bugs * Add more helper methods * remove submodule * fix merge * also fix DirtyAll() * poke
This commit is contained in:
@@ -32,7 +32,7 @@ public sealed partial class DamageOnHighSpeedImpactComponent : Component
|
||||
public float DamageCooldown = 2f;
|
||||
|
||||
[DataField("lastHit", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan LastHit = TimeSpan.Zero;
|
||||
public TimeSpan? LastHit;
|
||||
|
||||
[DataField("damage", required: true), ViewVariables(VVAccess.ReadWrite)]
|
||||
public DamageSpecifier Damage = default!;
|
||||
|
||||
@@ -38,7 +38,8 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem
|
||||
if (speed < component.MinimumSpeed)
|
||||
return;
|
||||
|
||||
if ((_gameTiming.CurTime - component.LastHit).TotalSeconds < component.DamageCooldown)
|
||||
if (component.LastHit != null
|
||||
&& (_gameTiming.CurTime - component.LastHit.Value).TotalSeconds < component.DamageCooldown)
|
||||
return;
|
||||
|
||||
component.LastHit = _gameTiming.CurTime;
|
||||
|
||||
@@ -145,7 +145,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
var impulseVector = direction.Normalized() * strength * physics.Mass;
|
||||
_physics.ApplyLinearImpulse(uid, impulseVector, body: physics);
|
||||
|
||||
if (comp.LandTime <= TimeSpan.Zero)
|
||||
if (comp.LandTime == null || comp.LandTime <= TimeSpan.Zero)
|
||||
{
|
||||
_thrownSystem.LandComponent(uid, comp, physics, playSound);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user