BatteryWeaponPowerCell tweaks (#33500)
* BatteryWeaponPowerCell tweaks * add update ammo ev & shuttle guns tweaks * MilonPL requested changes * revert changes in OnPowerCellChanged * Add events to get charge info & change current charge --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,9 @@ public sealed partial class PowerCellSystem : SharedPowerCellSystem
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, ExaminedEvent>(OnCellSlotExamined);
|
||||
// funny
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, BeingMicrowavedEvent>(OnSlotMicrowaved);
|
||||
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, GetChargeEvent>(OnGetCharge);
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, ChangeChargeEvent>(OnChangeCharge);
|
||||
}
|
||||
|
||||
private void OnSlotMicrowaved(EntityUid uid, PowerCellSlotComponent component, BeingMicrowavedEvent args)
|
||||
@@ -244,4 +247,20 @@ public sealed partial class PowerCellSystem : SharedPowerCellSystem
|
||||
args.PushMarkup(Loc.GetString("power-cell-component-examine-details-no-battery"));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetCharge(Entity<PowerCellSlotComponent> entity, ref GetChargeEvent args)
|
||||
{
|
||||
if (!TryGetBatteryFromSlot(entity, out var batteryUid, out _))
|
||||
return;
|
||||
|
||||
RaiseLocalEvent(batteryUid.Value, ref args);
|
||||
}
|
||||
|
||||
private void OnChangeCharge(Entity<PowerCellSlotComponent> entity, ref ChangeChargeEvent args)
|
||||
{
|
||||
if (!TryGetBatteryFromSlot(entity, out var batteryUid, out _))
|
||||
return;
|
||||
|
||||
RaiseLocalEvent(batteryUid.Value, ref args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user