Fix weapon cooldown serialization while mapping (#15123)

This commit is contained in:
Leon Friedrich
2023-04-06 11:37:50 +12:00
committed by GitHub
parent c851a9af23
commit 29ad3e50ac
7 changed files with 38 additions and 32 deletions

View File

@@ -64,13 +64,17 @@ public abstract partial class SharedGunSystem
DebugTools.Assert((component.AvailableModes & fire) != 0x0);
component.SelectedMode = fire;
var curTime = Timing.CurTime;
var cooldown = TimeSpan.FromSeconds(InteractNextFire);
if (component.NextFire < curTime)
component.NextFire = curTime + cooldown;
else
component.NextFire += cooldown;
if (!Paused(uid))
{
var curTime = Timing.CurTime;
var cooldown = TimeSpan.FromSeconds(InteractNextFire);
if (component.NextFire < curTime)
component.NextFire = curTime + cooldown;
else
component.NextFire += cooldown;
}
Audio.PlayPredicted(component.SoundModeToggle, uid, user);
Popup(Loc.GetString("gun-selected-mode", ("mode", GetLocSelector(fire))), uid, user);