private void OnHandleState(EntityUid uid, HandheldLightComponent component, ref ComponentHandleState args) { if (args.Current is not SharedHandheldLightComponent.HandheldLightComponentState state) { return; } component.Level = state.Charge; }
private void OnHandleState(EntityUid uid, HandheldLightComponent component, ref ComponentHandleState args) { if (args.Current is not SharedHandheldLightComponent.HandheldLightComponentState state) { return; } component.Level = state.Charge; if (state.Activated == component.Activated) { return; } component.Activated = state.Activated; // really hand-held lights should be using a separate unshaded layer. (see FlashlightVisualizer) // this prefix stuff is largely for backwards compatibility with RSIs/yamls that have not been updated. if (component.AddPrefix && TryComp(uid, out ItemComponent? item)) { _itemSys.SetHeldPrefix(uid, state.Activated ? "on" : "off", item); } }