Make GenerateRandomValues() return 0

Its possible if no health, thirst or stress was set, it may sent back an empty table, which would then break the finish consume function in the server
This commit is contained in:
Jim Shield
2025-10-10 01:57:01 +01:00
parent 38d0b04e71
commit d7a8a20491

View File

@@ -15,6 +15,7 @@ function GenerateRandomValues(data)
transData[k] = v transData[k] = v
end end
end end
if transData.hunger > 0 then if transData.hunger > 0 then
transData.hunger = transData.hunger > 100 and 100 or transData.hunger transData.hunger = transData.hunger > 100 and 100 or transData.hunger
end end
@@ -26,12 +27,13 @@ function GenerateRandomValues(data)
if transData.stress > 0 then if transData.stress > 0 then
transData.stress = transData.stress > 100 and 100 or transData.stress transData.stress = transData.stress > 100 and 100 or transData.stress
end end
return transData["time"], return transData["time"],
transData["heal"], transData["heal"],
transData["armor"], transData["armor"],
{ {
hunger = transData["hunger"], hunger = transData["hunger"] or 0,
thirst = transData["thirst"], thirst = transData["thirst"] or 0,
stress = transData["stress"] stress = transData["stress"] or 0
} }
end end