示例#1
0
    private void OnRemoved(EntityUid uid, ChargerComponent component, EntRemovedFromContainerMessage args)
    {
        if (args.Container.ID != component.ChargerSlot.ID)
        {
            return;
        }

        component.UpdateStatus();
    }
示例#2
0
    private void OnInserted(EntityUid uid, ChargerComponent component, EntInsertedIntoContainerMessage args)
    {
        if (!component.Initialized)
        {
            return;
        }

        if (args.Container.ID != component.ChargerSlot.ID)
        {
            return;
        }

        // try get a battery directly on the inserted entity
        if (!TryComp(args.Entity, out component.HeldBattery))
        {
            // or by checking for a power cell slot on the inserted entity
            _cellSystem.TryGetBatteryFromSlot(args.Entity, out component.HeldBattery);
        }

        component.UpdateStatus();
    }
示例#3
0
 private void OnPowerChanged(EntityUid uid, ChargerComponent component, PowerChangedEvent args)
 {
     component.UpdateStatus();
 }