Skip to content

Commit

Permalink
Remove code to fix math.random returning float instead of int (#4051)
Browse files Browse the repository at this point in the history
Remove code to fix math.random returning float instead of int, engine ticket has been long since fixed
  • Loading branch information
WatchTheFort authored Dec 20, 2024
1 parent 8aeb54e commit 0e4db0d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions unitbasedefs/lootboxes/lootboxnano.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
-- Workaround for engine bug https://github.com/beyond-all-reason/spring/issues/45
local math_random = function(x, y)
return x + math.floor( y * math.random() )
end

local tiers = {
T1 = 1,
T2 = 2,
Expand All @@ -23,7 +18,7 @@ local createCustomBuildList = function(tier)
local buildList = {}

for i = 1, buildListSize do
local buildOption = buildOptions[tier][math_random(1, #buildOptions[tier])]
local buildOption = buildOptions[tier][math.random(1, #buildOptions[tier])]
buildList[i] = buildOption
end

Expand Down Expand Up @@ -77,7 +72,7 @@ local function getRandomModel(tier)
},
}

local randomModel = math_random(1, 2)
local randomModel = math.random(1, 2)

return models[tier][randomModel].objectName, models[tier][randomModel].script
end
Expand Down

0 comments on commit 0e4db0d

Please sign in to comment.