Fix battery box charging on Windows

This commit is contained in:
SmallJoker 2022-11-24 21:49:20 +01:00
parent aad1b2875a
commit 521c0b74bb
2 changed files with 3 additions and 2 deletions

View File

@ -193,7 +193,7 @@ function technic.register_battery_box(data)
local run = function(pos, node)
local meta = minetest.get_meta(pos)
local network_id = tonumber(meta:get_string(tier.."_network"), 16)
local network_id = tonumber(meta:get_string(tier.."_network"))
if not technic.networks[network_id] then
meta:set_string("infotext", S("%s Battery Box Has No Network"):format(tier))

View File

@ -134,7 +134,8 @@ local check_node_subp = function(network, pos, machines, sw_pos, from_below, net
--dprint(name.." is a "..machines[name])
local meta = minetest.get_meta(pos)
-- Normal tostring() does not have enough precision, neither does meta:set_int()
meta:set_string(network.tier.."_network", string.format("%X", network_id))
-- Bug: Cannot use hexadecimal notation for compression (LuaJIT Windows bug, #911)
meta:set_string(network.tier.."_network", string.format("%.20g", network_id))
if eu_type == technic.producer then
add_network_node(network.PR_nodes, pos, network_id)