forked from Apancore.Studio/simple-makes-complex
Update from 22.06.2025: add MapGen mod outline, fix some require() issues
This commit is contained in:
20
mods/ENVIRONMENT/MapGen/src/MapGenUtils.lua
Normal file
20
mods/ENVIRONMENT/MapGen/src/MapGenUtils.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
local math = math
|
||||
|
||||
-- Utility class with static methods
|
||||
local MapGenUtils = {
|
||||
calculateWeight = function(value, min, max)
|
||||
local center = (min + max) / 2
|
||||
local span = (max - min) / 2
|
||||
return 1 - math.abs((value - center) / span)
|
||||
end,
|
||||
|
||||
---@return boolean
|
||||
isInRange = function(value, range)
|
||||
if value >= range.min and value <= range.max then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
return MapGenUtils
|
||||
Reference in New Issue
Block a user