Remove warnings from cargo system (#36159)
* Remove warnings from cargo system * Guard statement early exit and cleaner object instantiation * Whitespace * Add AnimationPlayer as a component of telepads
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user