SSD Indicator (#19701)
This commit is contained in:
32
Content.Client/SSDIndicator/SSDIndicatorSystem.cs
Normal file
32
Content.Client/SSDIndicator/SSDIndicatorSystem.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Content.Shared.CCVar;
|
||||||
|
using Content.Shared.SSDIndicator;
|
||||||
|
using Content.Shared.StatusIcon;
|
||||||
|
using Content.Shared.StatusIcon.Components;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.Client.SSDIndicator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles displaying SSD indicator as status icon
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SSDIndicatorSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<SSDIndicatorComponent, GetStatusIconsEvent>(OnGetStatusIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetStatusIcon(EntityUid uid, SSDIndicatorComponent component, ref GetStatusIconsEvent args)
|
||||||
|
{
|
||||||
|
if (!component.IsSSD || !_cfg.GetCVar(CCVars.ICShowSSDIndicator))
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1461,6 +1461,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<string> ICRandomSpeciesWeights =
|
public static readonly CVarDef<string> ICRandomSpeciesWeights =
|
||||||
CVarDef.Create("ic.random_species_weights", "SpeciesWeights", CVar.SERVER);
|
CVarDef.Create("ic.random_species_weights", "SpeciesWeights", CVar.SERVER);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Control displaying SSD indicators near players
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<bool> ICShowSSDIndicator =
|
||||||
|
CVarDef.Create("ic.show_ssd_indicator", true, CVar.CLIENTONLY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Salvage
|
* Salvage
|
||||||
*/
|
*/
|
||||||
|
|||||||
21
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Normal file
21
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Content.Shared.StatusIcon;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Shared.SSDIndicator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows status icon when player in SSD
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
[AutoGenerateComponentState]
|
||||||
|
public sealed partial class SSDIndicatorComponent : Component
|
||||||
|
{
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[AutoNetworkedField]
|
||||||
|
public bool IsSSD = true;
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
|
||||||
|
public string Icon = "SSDIcon";
|
||||||
|
}
|
||||||
27
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs
Normal file
27
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Content.Shared.Mind.Components;
|
||||||
|
|
||||||
|
namespace Content.Shared.SSDIndicator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle changing player SSD indicator status
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SSDIndicatorSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
SubscribeLocalEvent<SSDIndicatorComponent, MindAddedMessage>(OnMindAdded);
|
||||||
|
SubscribeLocalEvent<SSDIndicatorComponent, MindRemovedMessage>(OnMindRemoved);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMindAdded(EntityUid uid, SSDIndicatorComponent component, MindAddedMessage args)
|
||||||
|
{
|
||||||
|
component.IsSSD = false;
|
||||||
|
Dirty(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMindRemoved(EntityUid uid, SSDIndicatorComponent component, MindRemovedMessage args)
|
||||||
|
{
|
||||||
|
component.IsSSD = true;
|
||||||
|
Dirty(uid, component);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -312,6 +312,7 @@
|
|||||||
deathPenalty: 0.01 # However they really ought to be living and intact, otherwise they're worth 100x less.
|
deathPenalty: 0.01 # However they really ought to be living and intact, otherwise they're worth 100x less.
|
||||||
- type: ContentEye
|
- type: ContentEye
|
||||||
- type: SleepEmitSound
|
- type: SleepEmitSound
|
||||||
|
- type: SSDIndicator
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
save: false
|
save: false
|
||||||
|
|||||||
6
Resources/Prototypes/StatusEffects/ssd.yml
Normal file
6
Resources/Prototypes/StatusEffects/ssd.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- type: statusIcon
|
||||||
|
id: SSDIcon
|
||||||
|
icon:
|
||||||
|
sprite: /Textures/Effects/ssd.rsi
|
||||||
|
state: default0
|
||||||
|
locationPreference: Left
|
||||||
BIN
Resources/Textures/Effects/ssd.rsi/default0.png
Normal file
BIN
Resources/Textures/Effects/ssd.rsi/default0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
14
Resources/Textures/Effects/ssd.rsi/meta.json
Normal file
14
Resources/Textures/Effects/ssd.rsi/meta.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Take from https://github.com/Skyrat-SS13/Skyrat-tg/blob/92377cd6203bc4d93a6e289d7b857e19bb6cf338/modular_skyrat/modules/indicators/icons/ssd_indicator.dmi",
|
||||||
|
"size": {
|
||||||
|
"x": 32,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "default0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user