Световые приколы (#200)

* add: new visuals to health analyzer and new graphic funny light

* fix: fix pointlight and analyzer visuals
This commit is contained in:
ThereDrD0
2024-03-16 18:30:57 +03:00
committed by GitHub
parent 0aac8fa3d9
commit 8ccf29a2fc
7 changed files with 70 additions and 9 deletions

View File

@@ -19,6 +19,7 @@ public abstract class SharedPowerCellSystem : EntitySystem
SubscribeLocalEvent<PowerCellSlotComponent, EntInsertedIntoContainerMessage>(OnCellInserted);
SubscribeLocalEvent<PowerCellSlotComponent, EntRemovedFromContainerMessage>(OnCellRemoved);
SubscribeLocalEvent<PowerCellSlotComponent, ContainerIsInsertingAttemptEvent>(OnCellInsertAttempt);
SubscribeLocalEvent<PowerCellSlotComponent, PowerCellChangedEvent>(OnPowerChanged);
}
private void OnRejuvenate(EntityUid uid, PowerCellSlotComponent component, RejuvenateEvent args)
@@ -30,6 +31,16 @@ public abstract class SharedPowerCellSystem : EntitySystem
RaiseLocalEvent(itemSlot.Item.Value, args);
}
private void OnPowerChanged(EntityUid uid, PowerCellSlotComponent component, PowerCellChangedEvent _)
{
if (!component.Initialized)
return;
var charged = HasDrawCharge(uid);
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
}
private void OnCellInsertAttempt(EntityUid uid, PowerCellSlotComponent component, ContainerIsInsertingAttemptEvent args)
{
if (!component.Initialized)
@@ -51,14 +62,18 @@ public abstract class SharedPowerCellSystem : EntitySystem
if (args.Container.ID != component.CellSlotId)
return;
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, true);
RaiseLocalEvent(uid, new PowerCellChangedEvent(false), false);
var charged = HasDrawCharge(uid);
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
RaiseLocalEvent(uid, new PowerCellChangedEvent(false));
}
protected virtual void OnCellRemoved(EntityUid uid, PowerCellSlotComponent component, EntRemovedFromContainerMessage args)
{
if (args.Container.ID != component.CellSlotId)
return;
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false);
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
}