Divergent/mods/Arszis Radiation Overhaul -.../gamedata/scripts/accurate_radiation_stats.sc...

17 lines
585 B
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
max_rads = 3870
-- Replace number in radioactive food with the accurate one
local gc = game.translate_string
ui_item_build_desc_footer = ui_item.build_desc_footer
ui_item.build_desc_footer = function(obj, sec, str)
local res = ui_item_build_desc_footer(obj, sec, str)
if res:find(gc("st_msv")) then
local eat_rad = ini_sys:r_float_ex(sec,"eat_radiation")
if eat_rad and (eat_rad > 0) then
local num = round(math.abs(eat_rad) * max_rads)
res = res:gsub("(%+[ ]*)(%d+%.*%d*)([ ]*)(" .. gc("st_msv") .. ")", "%1" .. num .. "%3%4")
end
end
return res
end