Fragile Deliveries (#36980)

* epic

* tweaks
This commit is contained in:
ScarKy0
2025-04-28 01:04:39 +02:00
committed by GitHub
parent fac4bcd9b2
commit 13a1853168
6 changed files with 115 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
using Content.Shared.Destructible;
using Content.Shared.Examine;
using Content.Shared.GameTicking;
using Content.Shared.NameModifier.EntitySystems;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
@@ -27,6 +27,11 @@ public sealed partial class DeliveryModifierSystem : EntitySystem
SubscribeLocalEvent<DeliveryPriorityComponent, MapInitEvent>(OnPriorityMapInit);
SubscribeLocalEvent<DeliveryPriorityComponent, ExaminedEvent>(OnPriorityExamine);
SubscribeLocalEvent<DeliveryPriorityComponent, GetDeliveryMultiplierEvent>(OnGetPriorityMultiplier);
SubscribeLocalEvent<DeliveryFragileComponent, MapInitEvent>(OnFragileMapInit);
SubscribeLocalEvent<DeliveryFragileComponent, BreakageEventArgs>(OnFragileBreakage);
SubscribeLocalEvent<DeliveryFragileComponent, ExaminedEvent>(OnFragileExamine);
SubscribeLocalEvent<DeliveryFragileComponent, GetDeliveryMultiplierEvent>(OnGetFragileMultiplier);
}
#region Random
@@ -70,6 +75,38 @@ public sealed partial class DeliveryModifierSystem : EntitySystem
}
#endregion
#region Fragile
private void OnFragileMapInit(Entity<DeliveryFragileComponent> ent, ref MapInitEvent args)
{
_delivery.UpdateBrokenVisuals(ent, true);
}
private void OnFragileBreakage(Entity<DeliveryFragileComponent> ent, ref BreakageEventArgs args)
{
ent.Comp.Broken = true;
_delivery.UpdateBrokenVisuals(ent, true);
Dirty(ent);
}
private void OnFragileExamine(Entity<DeliveryFragileComponent> ent, ref ExaminedEvent args)
{
var trueName = _nameModifier.GetBaseName(ent.Owner);
if (ent.Comp.Broken)
args.PushMarkup(Loc.GetString("delivery-fragile-broken-examine", ("type", trueName)));
else
args.PushMarkup(Loc.GetString("delivery-fragile-examine", ("type", trueName)));
}
private void OnGetFragileMultiplier(Entity<DeliveryFragileComponent> ent, ref GetDeliveryMultiplierEvent args)
{
if (ent.Comp.Broken)
args.AdditiveMultiplier += ent.Comp.BrokenMultiplierOffset;
else
args.AdditiveMultiplier += ent.Comp.IntactMultiplierOffset;
}
#endregion
#region Update Loops
public override void Update(float frameTime)
{