Световые приколы (#200)
* add: new visuals to health analyzer and new graphic funny light * fix: fix pointlight and analyzer visuals
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user