Health alerts + Modular tools labeling renaming (#708)

* fix health alert

* grips label

* Update grips.yml
This commit is contained in:
Ed
2025-01-08 23:22:58 +03:00
committed by GitHub
parent 815c031a16
commit 00ecf1f4b6
7 changed files with 45 additions and 4 deletions

View File

@@ -47,6 +47,16 @@ namespace Content.Server.Labels
label.CurrentLabel = text;
NameMod.RefreshNameModifiers(uid);
//CP14 Events
var ev = new CP14LabeledEvent()
{
LabeledEntity = uid,
Text = text,
};
RaiseLocalEvent(uid, ev);
//CP14 Events end
Dirty(uid, label);
}

View File

@@ -49,3 +49,10 @@ public abstract partial class SharedLabelSystem : EntitySystem
args.AddModifier("comp-label-format", extraArgs: ("label", entity.Comp.CurrentLabel));
}
}
//CP14 Labeling Event
public sealed class CP14LabeledEvent : EntityEventArgs
{
public EntityUid? LabeledEntity;
public string? Text;
}

View File

@@ -1,6 +1,8 @@
using Content.Shared._CP14.ModularCraft.Components;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Labels.EntitySystems;
using Robust.Shared.Serialization;
namespace Content.Shared._CP14.ModularCraft;
@@ -8,12 +10,23 @@ namespace Content.Shared._CP14.ModularCraft;
public abstract class CP14SharedModularCraftSystem : EntitySystem
{
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedLabelSystem _label = default!;
[Dependency] private readonly MetaDataSystem _meta = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14ModularCraftPartComponent, AfterInteractEvent>(OnAfterInteractPart);
SubscribeLocalEvent<CP14LabeledRenamingComponent, CP14LabeledEvent>(OnLabelRenaming);
}
private void OnLabelRenaming(Entity<CP14LabeledRenamingComponent> ent, ref CP14LabeledEvent args)
{
if (args.Text is null)
return;
_meta.SetEntityName(ent, args.Text);
_label.Label(ent, null);
}
private void OnAfterInteractPart(Entity<CP14ModularCraftPartComponent> start, ref AfterInteractEvent args)

View File

@@ -0,0 +1,9 @@
namespace Content.Shared._CP14.ModularCraft.Components;
/// <summary>
/// Adding an outfit to this item will fully rename the item and automatically unlabel it
/// </summary>
[RegisterComponent]
public sealed partial class CP14LabeledRenamingComponent : Component
{
}

View File

@@ -200,10 +200,12 @@
state: health1
- sprite: /Textures/_CP14/Interface/Alerts/alive.rsi
state: health0
- sprite: /Textures/_CP14/Interface/Alerts/empty.rsi
state: empty
name: alerts-health-name
description: alerts-health-desc
minSeverity: 0
maxSeverity: 4
maxSeverity: 5
- type: alert
id: BorgHealth

View File

@@ -31,12 +31,13 @@
quickEquip: false
breakOnMove: false
- type: CP14MeleeParriable
- type: CP14LabeledRenaming
- type: entity
parent: CP14ModularGripBase
id: CP14ModularGripShort
abstract: true
description: A short handle for a weapon or tool.
description: A tool for your purposes!
components:
- type: CP14ModularCraftStartPoint
startSlots:
@@ -58,7 +59,7 @@
parent: CP14ModularGripBase
id: CP14ModularGripLong
abstract: true
description: long, two-handed handle for heavy weapons or large tools.
description: A tool for your purposes! Now long enough to hold in two hands.
components:
- type: CP14ModularCraftStartPoint
startSlots:

View File

@@ -62,7 +62,6 @@
- id: CP14MobGroupSpawnerHydras
prob: 0.05
- type: entity
parent: CP14BaseStationEventShortDelay
id: CP14MosquitoSpawn