Skip to content

Commit

Permalink
Fix battery self-recharge mispredicts (space-wizards#33384)
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth authored Dec 11, 2024
1 parent 976cae9 commit 1a8e469
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ private void OnBatteryHandleState(EntityUid uid, BatteryAmmoProviderComponent co
component.Shots = state.Shots;
component.Capacity = state.MaxShots;
component.FireCost = state.FireCost;
UpdateAmmoCount(uid, prediction: false);
}

private void OnBatteryGetState(EntityUid uid, BatteryAmmoProviderComponent component, ref ComponentGetState args)
@@ -80,7 +81,10 @@ private void OnBatteryAmmoCount(EntityUid uid, BatteryAmmoProviderComponent comp
/// <summary>
/// Update the battery (server-only) whenever fired.
/// </summary>
protected virtual void TakeCharge(EntityUid uid, BatteryAmmoProviderComponent component) {}
protected virtual void TakeCharge(EntityUid uid, BatteryAmmoProviderComponent component)
{
UpdateAmmoCount(uid, prediction: false);
}

protected void UpdateBatteryAppearance(EntityUid uid, BatteryAmmoProviderComponent component)
{

0 comments on commit 1a8e469

Please sign in to comment.