diff --git a/Content.Server/_White/CustomGhostSpriteSystem/CustomGhostSpriteSystem.cs b/Content.Server/_White/CustomGhostSpriteSystem/CustomGhostSpriteSystem.cs index bfe87d1bc8..94e0e72ebe 100644 --- a/Content.Server/_White/CustomGhostSpriteSystem/CustomGhostSpriteSystem.cs +++ b/Content.Server/_White/CustomGhostSpriteSystem/CustomGhostSpriteSystem.cs @@ -1,7 +1,5 @@ -using Content.Server.Ghost.Components; using Content.Shared.Ghost; using Content.Shared._White.CustomGhostSystem; -using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -19,12 +17,13 @@ public sealed class CustomGhostSpriteSystem : EntitySystem public override void Initialize() { base.Initialize(); + SubscribeLocalEvent(OnShit); } private void OnShit(EntityUid uid, GhostComponent component, PlayerAttachedEvent args) { - if(!_playerManager.TryGetSessionByEntity(uid, out var session)) + if (!_playerManager.TryGetSessionByEntity(uid, out var session)) return; TrySetCustomSprite(uid, session.Name); @@ -37,32 +36,22 @@ public sealed class CustomGhostSpriteSystem : EntitySystem foreach (var customGhostPrototype in prototypes) { - if (string.Equals(customGhostPrototype.Ckey, ckey, StringComparison.CurrentCultureIgnoreCase)) - { - _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.Sprite, customGhostPrototype.CustomSpritePath.ToString()); - _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.SizeOverride, customGhostPrototype.SizeOverride); + if (!string.Equals(customGhostPrototype.Ckey, ckey, StringComparison.CurrentCultureIgnoreCase)) + continue; - if(customGhostPrototype.AlphaOverride > 0) - { - _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.AlphaOverride, customGhostPrototype.AlphaOverride); - } + _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.Sprite, customGhostPrototype.CustomSpritePath.ToString()); + _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.SizeOverride, customGhostPrototype.SizeOverride); - if (customGhostPrototype.GhostName != string.Empty) - { - _metaData.SetEntityName(ghostUid, customGhostPrototype.GhostName); - } + if (customGhostPrototype.AlphaOverride > 0) + _appearanceSystem.SetData(ghostUid, CustomGhostAppearance.AlphaOverride, customGhostPrototype.AlphaOverride); - if (customGhostPrototype.GhostDescription != string.Empty) - { - _metaData.SetEntityDescription(ghostUid, customGhostPrototype.GhostDescription); - } + if (customGhostPrototype.GhostName != string.Empty) + _metaData.SetEntityName(ghostUid, customGhostPrototype.GhostName ?? "null"); + if (customGhostPrototype.GhostDescription != string.Empty) + _metaData.SetEntityDescription(ghostUid, customGhostPrototype.GhostDescription); - - - return; - } - + return; } } } diff --git a/Content.Shared/_White/CustomGhostSystem/CustomGhostPrototype.cs b/Content.Shared/_White/CustomGhostSystem/CustomGhostPrototype.cs index 454fce7ffe..7bc492a925 100644 --- a/Content.Shared/_White/CustomGhostSystem/CustomGhostPrototype.cs +++ b/Content.Shared/_White/CustomGhostSystem/CustomGhostPrototype.cs @@ -25,7 +25,7 @@ public sealed class CustomGhostPrototype : IPrototype public float AlphaOverride { get; } = -1; [DataField("ghostName")] - public string GhostName = string.Empty; + public string? GhostName = string.Empty; [DataField("ghostDescription")] public string GhostDescription = string.Empty; diff --git a/Resources/Prototypes/_White/Ghosts/custom_ghosts.yml b/Resources/Prototypes/_White/Ghosts/custom_ghosts.yml index 187f7bbb08..e0ef685f8e 100644 --- a/Resources/Prototypes/_White/Ghosts/custom_ghosts.yml +++ b/Resources/Prototypes/_White/Ghosts/custom_ghosts.yml @@ -22,13 +22,21 @@ ghostName: Winter's Scar ghostDescription: ... +#- type: customGhost +# id: animeshka-ghost +# ckey: animeshka +# sprite: White/Ghosts/animeshka-ghost.rsi +# alpha: 0.7 +# ghostName: Грабля +# ghostDescription: Ну привет уебан! + - type: customGhost id: animeshka-ghost - ckey: animeshka + ckey: theredrd sprite: White/Ghosts/animeshka-ghost.rsi alpha: 0.7 - ghostName: Грабля - ghostDescription: Ну привет уебан! + ghostName: null + ghostDescription: ... - type: customGhost id: shelupon-ghost