ThereDrD кастомгост (#634)
* add null name support for customghost * add custom ghost
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
using Content.Server.Ghost.Components;
|
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared._White.CustomGhostSystem;
|
using Content.Shared._White.CustomGhostSystem;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -19,12 +17,13 @@ public sealed class CustomGhostSpriteSystem : EntitySystem
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<GhostComponent, PlayerAttachedEvent>(OnShit);
|
SubscribeLocalEvent<GhostComponent, PlayerAttachedEvent>(OnShit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnShit(EntityUid uid, GhostComponent component, PlayerAttachedEvent args)
|
private void OnShit(EntityUid uid, GhostComponent component, PlayerAttachedEvent args)
|
||||||
{
|
{
|
||||||
if(!_playerManager.TryGetSessionByEntity(uid, out var session))
|
if (!_playerManager.TryGetSessionByEntity(uid, out var session))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TrySetCustomSprite(uid, session.Name);
|
TrySetCustomSprite(uid, session.Name);
|
||||||
@@ -37,32 +36,22 @@ public sealed class CustomGhostSpriteSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var customGhostPrototype in prototypes)
|
foreach (var customGhostPrototype in prototypes)
|
||||||
{
|
{
|
||||||
if (string.Equals(customGhostPrototype.Ckey, ckey, StringComparison.CurrentCultureIgnoreCase))
|
if (!string.Equals(customGhostPrototype.Ckey, ckey, StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
continue;
|
||||||
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.Sprite, customGhostPrototype.CustomSpritePath.ToString());
|
|
||||||
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.SizeOverride, customGhostPrototype.SizeOverride);
|
|
||||||
|
|
||||||
if(customGhostPrototype.AlphaOverride > 0)
|
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.Sprite, customGhostPrototype.CustomSpritePath.ToString());
|
||||||
{
|
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.SizeOverride, customGhostPrototype.SizeOverride);
|
||||||
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.AlphaOverride, customGhostPrototype.AlphaOverride);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customGhostPrototype.GhostName != string.Empty)
|
if (customGhostPrototype.AlphaOverride > 0)
|
||||||
{
|
_appearanceSystem.SetData(ghostUid, CustomGhostAppearance.AlphaOverride, customGhostPrototype.AlphaOverride);
|
||||||
_metaData.SetEntityName(ghostUid, customGhostPrototype.GhostName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customGhostPrototype.GhostDescription != string.Empty)
|
if (customGhostPrototype.GhostName != string.Empty)
|
||||||
{
|
_metaData.SetEntityName(ghostUid, customGhostPrototype.GhostName ?? "null");
|
||||||
_metaData.SetEntityDescription(ghostUid, customGhostPrototype.GhostDescription);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (customGhostPrototype.GhostDescription != string.Empty)
|
||||||
|
_metaData.SetEntityDescription(ghostUid, customGhostPrototype.GhostDescription);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public sealed class CustomGhostPrototype : IPrototype
|
|||||||
public float AlphaOverride { get; } = -1;
|
public float AlphaOverride { get; } = -1;
|
||||||
|
|
||||||
[DataField("ghostName")]
|
[DataField("ghostName")]
|
||||||
public string GhostName = string.Empty;
|
public string? GhostName = string.Empty;
|
||||||
|
|
||||||
[DataField("ghostDescription")]
|
[DataField("ghostDescription")]
|
||||||
public string GhostDescription = string.Empty;
|
public string GhostDescription = string.Empty;
|
||||||
|
|||||||
@@ -22,13 +22,21 @@
|
|||||||
ghostName: Winter's Scar
|
ghostName: Winter's Scar
|
||||||
ghostDescription: ...
|
ghostDescription: ...
|
||||||
|
|
||||||
|
#- type: customGhost
|
||||||
|
# id: animeshka-ghost
|
||||||
|
# ckey: animeshka
|
||||||
|
# sprite: White/Ghosts/animeshka-ghost.rsi
|
||||||
|
# alpha: 0.7
|
||||||
|
# ghostName: Грабля
|
||||||
|
# ghostDescription: Ну привет уебан!
|
||||||
|
|
||||||
- type: customGhost
|
- type: customGhost
|
||||||
id: animeshka-ghost
|
id: animeshka-ghost
|
||||||
ckey: animeshka
|
ckey: theredrd
|
||||||
sprite: White/Ghosts/animeshka-ghost.rsi
|
sprite: White/Ghosts/animeshka-ghost.rsi
|
||||||
alpha: 0.7
|
alpha: 0.7
|
||||||
ghostName: Грабля
|
ghostName: null
|
||||||
ghostDescription: Ну привет уебан!
|
ghostDescription: ...
|
||||||
|
|
||||||
- type: customGhost
|
- type: customGhost
|
||||||
id: shelupon-ghost
|
id: shelupon-ghost
|
||||||
|
|||||||
Reference in New Issue
Block a user