ECS BatteryComponent (#15337)
This commit is contained in:
@@ -66,7 +66,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
|
||||
Explode(uid, component, args.User);
|
||||
}
|
||||
|
||||
private void OnChargeChanged(EntityUid uid, PowerCellComponent component, ChargeChangedEvent args)
|
||||
private void OnChargeChanged(EntityUid uid, PowerCellComponent component, ref ChargeChangedEvent args)
|
||||
{
|
||||
if (component.IsRigged)
|
||||
{
|
||||
@@ -74,13 +74,10 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp(uid, out BatteryComponent? battery))
|
||||
return;
|
||||
|
||||
if (!TryComp(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
var frac = battery.CurrentCharge / battery.MaxCharge;
|
||||
var frac = args.Charge / args.MaxCharge;
|
||||
var level = (byte) ContentHelpers.RoundToNearestLevels(frac, 1, PowerCellComponent.PowerCellVisualsLevels);
|
||||
_sharedAppearanceSystem.SetData(uid, PowerCellVisuals.ChargeLevel, level, appearance);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user