]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove warnings from cargo system (#36159)
authorJ <billsmith116@gmail.com>
Sun, 30 Mar 2025 01:11:04 +0000 (01:11 +0000)
committerGitHub <noreply@github.com>
Sun, 30 Mar 2025 01:11:04 +0000 (03:11 +0200)
* Remove warnings from cargo system

* Guard statement early exit and cleaner object instantiation

* Whitespace

* Add AnimationPlayer as a component of telepads

Content.Client/Cargo/Systems/CargoSystem.Telepad.cs
Resources/Prototypes/Entities/Structures/cargo_telepad.yml

index 50d079737de01d8144d100572a125059ec52969a..312c4e8019a419c5927ccd52401a7d4aeeae401f 100644 (file)
@@ -67,8 +67,10 @@ public sealed partial class CargoSystem
         if (!Resolve(uid, ref sprite))
             return;
 
+        if (!TryComp<AnimationPlayerComponent>(uid, out var player))
+            return;
+
         _appearance.TryGetData<CargoTelepadState?>(uid, CargoTelepadVisuals.State, out var state);
-        AnimationPlayerComponent? player = null;
 
         switch (state)
         {
@@ -76,7 +78,7 @@ public sealed partial class CargoSystem
                 if (_player.HasRunningAnimation(uid, TelepadBeamKey))
                     return;
                 _player.Stop(uid, player, TelepadIdleKey);
-                _player.Play(uid, player, CargoTelepadBeamAnimation, TelepadBeamKey);
+                _player.Play((uid, player), CargoTelepadBeamAnimation, TelepadBeamKey);
                 break;
             case CargoTelepadState.Unpowered:
                 sprite.LayerSetVisible(CargoTelepadLayers.Beam, false);
@@ -90,7 +92,7 @@ public sealed partial class CargoSystem
                     _player.HasRunningAnimation(uid, player, TelepadBeamKey))
                     return;
 
-                _player.Play(uid, player, CargoTelepadIdleAnimation, TelepadIdleKey);
+                _player.Play((uid, player), CargoTelepadIdleAnimation, TelepadIdleKey);
                 break;
         }
     }
index a99f35a7d9d1bb3dbe152ea193302a6e8bdaf2c6..a3198b58eae531f79eb8528a04ad93b9eaddbb69 100644 (file)
@@ -1,4 +1,4 @@
-- type: entity
+- type: entity
   id: CargoTelepad
   parent: [ BaseMachinePowered, ConstructibleMachine ]
   name: cargo telepad
@@ -49,3 +49,4 @@
   - type: CollideOnAnchor
   - type: NameIdentifier
     group: CargoTelepads
+  - type: AnimationPlayer