Changes the SingularitySystem to use generic visualizers (#15057)
This commit is contained in:
@@ -20,7 +20,6 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SingularityComponent, ComponentHandleState>(HandleSingularityState);
|
||||
SubscribeLocalEvent<SingularityComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,31 +35,4 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
|
||||
SetLevel(uid, state.Level, comp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles ensuring that the singularity has a sprite to see.
|
||||
/// </summary>
|
||||
protected override void OnSingularityStartup(EntityUid uid, SingularityComponent comp, ComponentStartup args)
|
||||
{
|
||||
base.OnSingularityStartup(uid, comp, args);
|
||||
if (TryComp<SpriteComponent>(uid, out var sprite))
|
||||
{
|
||||
sprite.LayerMapReserveBlank(comp.Layer);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles updating the visible state of the singularity to reflect its current level.
|
||||
/// </summary>
|
||||
private void OnAppearanceChange(EntityUid uid, SingularityComponent comp, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if(!_appearanceSystem.TryGetData<byte>(uid, SingularityVisuals.Level, out var level, args.Component))
|
||||
return;
|
||||
|
||||
args.Sprite.LayerSetSprite(comp.Layer,
|
||||
new SpriteSpecifier.Rsi(new ResourcePath($"{comp.BaseSprite.RsiPath}_{level}.rsi"), $"{comp.BaseSprite.RsiState}_{level}"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user