SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

DivideByZeroException if set /time 1000 before full level load #4370

Closed sunnamed434 closed 1 month ago

sunnamed434 commented 3 months ago

Logs:

Loading level: 15%
Loading level: 21%
Loading level: 26%
Loading level: 31%
Loading level: 36%
Loading level: 42%
Loading level: 47%
Loading level: 52%
Loading level: 57%
Loading level: 63%
time 1000
Loading level: 68%
An error occured while executing time [1000]: System.DivideByZeroException: Attempted to divide by zero.
  at SDG.Unturned.LightingManager.set_time (System.UInt32 value) [0x00006] in <157edbe38df54503879dc8058d128628>:0
  at SDG.Unturned.CommandTime.execute (Steamworks.CSteamID executorID, System.String parameter) [0x00092] in <157edbe38df54503879dc8058d128628>:0
  at SDG.Unturned.Command.check (Steamworks.CSteamID executorID, System.String method, System.String parameter) [0x00018] in <157edbe38df54503879dc8058d128628>:0
  at Rocket.Unturned.Commands.UnturnedCommands+UnturnedVanillaCommand.Execute (Rocket.API.IRocketPlayer caller, System.String[] command) [0x0004c] in <78fb97ccc8a0476980e278aa933951ac>:0
  at Rocket.Core.Commands.RocketCommandManager+RegisteredRocketCommand.Execute (Rocket.API.IRocketPlayer caller, System.String[] command) [0x00000] in <09b6a6e399e5417eb969381ca3201ce1>:0
  at Rocket.Core.Commands.RocketCommandManager.Execute (Rocket.API.IRocketPlayer player, System.String command) [0x00176] in <09b6a6e399e5417eb969381ca3201ce1>:0
Unloading 2 Unused Serialized files (Serialized files now loaded: 1)
Loading level: 73%
Loading level: 89%
Loading level: 94%
Unloading 1419 unused Assets to reduce memory usage. Loaded Objects now: 407926.
Total: 592.905900 ms (FindLiveObjects: 75.554200 ms CreateObjectMapping: 7.749900 ms MarkObjects: 506.314900 ms  DeleteObjects: 3.285900 ms)
SDGNelson commented 3 months ago

I did change it to prevent the division by zero, but realized there shouldn't really be a case where this happens anyway because it won't be run if specified in the startup commands. Did you run the command while the level was loading?

sunnamed434 commented 3 months ago

Yep, I executed this command while level was loading