From: keronshb <54602815+keronshb@users.noreply.github.com>
Date: Thu, 11 Apr 2024 17:40:02 +0000 (-0400)
Subject: Immovable Rod changes (#26757)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=036abacbb731c0d1128a4c6cd1658f64dd488985;p=space-station-14.git
Immovable Rod changes (#26757)
---
diff --git a/Content.Server/ImmovableRod/ImmovableRodComponent.cs b/Content.Server/ImmovableRod/ImmovableRodComponent.cs
index f360591479..05fa3d9d9b 100644
--- a/Content.Server/ImmovableRod/ImmovableRodComponent.cs
+++ b/Content.Server/ImmovableRod/ImmovableRodComponent.cs
@@ -1,3 +1,4 @@
+using Content.Shared.Damage;
using Robust.Shared.Audio;
namespace Content.Server.ImmovableRod;
@@ -36,4 +37,16 @@ public sealed partial class ImmovableRodComponent : Component
///
[DataField("destroyTiles")]
public bool DestroyTiles = true;
+
+ ///
+ /// If true, this will gib & delete bodies
+ ///
+ [DataField]
+ public bool ShouldGib = true;
+
+ ///
+ /// Damage done, if not gibbing
+ ///
+ [DataField]
+ public DamageSpecifier? Damage;
}
diff --git a/Content.Server/ImmovableRod/ImmovableRodSystem.cs b/Content.Server/ImmovableRod/ImmovableRodSystem.cs
index 429361cd8c..c8f36e864c 100644
--- a/Content.Server/ImmovableRod/ImmovableRodSystem.cs
+++ b/Content.Server/ImmovableRod/ImmovableRodSystem.cs
@@ -1,9 +1,10 @@
using Content.Server.Body.Systems;
+using Content.Server.Polymorph.Components;
using Content.Server.Popups;
using Content.Shared.Body.Components;
+using Content.Shared.Damage;
using Content.Shared.Examine;
using Content.Shared.Popups;
-using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -22,6 +23,8 @@ public sealed class ImmovableRodSystem : EntitySystem
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
+ [Dependency] private readonly DamageableSystem _damageable = default!;
+ [Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Update(float frameTime)
{
@@ -64,11 +67,11 @@ public sealed class ImmovableRodSystem : EntitySystem
var vel = component.DirectionOverride.Degrees switch
{
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
- _ => xform.WorldRotation.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
+ _ => _transform.GetWorldRotation(uid).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
};
_physics.ApplyLinearImpulse(uid, vel, body: phys);
- xform.LocalRotation = (vel - xform.WorldPosition).ToWorldAngle() + MathHelper.PiOver2;
+ xform.LocalRotation = (vel - _transform.GetWorldPosition(uid)).ToWorldAngle() + MathHelper.PiOver2;
}
}
@@ -94,12 +97,28 @@ public sealed class ImmovableRodSystem : EntitySystem
return;
}
- // gib em
+ // dont delete/hurt self if polymoprhed into a rod
+ if (TryComp(uid, out var polymorphed))
+ {
+ if (polymorphed.Parent == ent)
+ return;
+ }
+
+ // gib or damage em
if (TryComp(ent, out var body))
{
component.MobCount++;
-
_popup.PopupEntity(Loc.GetString("immovable-rod-penetrated-mob", ("rod", uid), ("mob", ent)), uid, PopupType.LargeCaution);
+
+ if (!component.ShouldGib)
+ {
+ if (component.Damage == null || !TryComp(ent, out var damageable))
+ return;
+
+ _damageable.SetDamage(ent, damageable, component.Damage);
+ return;
+ }
+
_bodySystem.GibBody(ent, body: body);
return;
}
diff --git a/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml b/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml
index f46abe8a5a..aad12a5025 100644
--- a/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml
+++ b/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml
@@ -11,8 +11,6 @@
state: icon
noRot: false
- type: ImmovableRod
- - type: TimedDespawn
- lifetime: 30.0
- type: Physics
bodyType: Dynamic
linearDamping: 0
@@ -36,8 +34,15 @@
location: immovable rod
- type: entity
+ id: ImmovableRodDespawn
parent: ImmovableRod
+ components:
+ - type: TimedDespawn
+ lifetime: 30.0
+
+- type: entity
id: ImmovableRodSlow
+ parent: ImmovableRodDespawn
suffix: Slow
components:
- type: ImmovableRod
@@ -45,7 +50,7 @@
maxSpeed: 5
- type: entity
- parent: ImmovableRod
+ parent: ImmovableRodDespawn
id: ImmovableRodKeepTiles
suffix: Keep Tiles
components:
@@ -53,6 +58,33 @@
destroyTiles: false
hitSoundProbability: 1.0
+# For Wizard Polymorph
+- type: entity
+ parent: ImmovableRod
+ id: ImmovableRodWizard
+ suffix: Wizard
+ components:
+ - type: ImmovableRod
+ minSpeed: 35
+ destroyTiles: false
+ randomizeVelocity: false
+ shouldGib: false
+ damage:
+ types:
+ Blunt: 200
+ - type: MovementIgnoreGravity
+ gravityState: true
+ - type: InputMover
+ - type: MovementSpeedModifier
+ weightlessAcceleration: 5
+ weightlessModifier: 2
+ weightlessFriction: 0
+ friction: 0
+ frictionNoInput: 0
+ - type: CanMoveInAir
+ - type: MovementAlwaysTouching
+ - type: NoSlip
+
- type: entity
parent: ImmovableRodKeepTiles
id: ImmovableRodKeepTilesStill