mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-16 22:16:02 +01:00
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:
@@ -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
|
||||||
Reference in New Issue
Block a user