mirror of
https://github.com/minetest-mods/technic.git
synced 2025-07-07 18:50:41 +02:00
Correct (almost) all luacheck warnings
Also includes a few code opimizations: - Combined mining drill functions - Shorter alias registration (unused?) - Add TODOs to address later
This commit is contained in:
@ -112,10 +112,13 @@ local function set_forcefield_formspec(meta)
|
||||
else
|
||||
formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
|
||||
end
|
||||
-- TODO: String replacement with %s will stop working with client-side translations
|
||||
if meta:get_int("enabled") == 0 then
|
||||
formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
formspec = formspec.."button[0,1.75;5,1;enable;"..
|
||||
S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
else
|
||||
formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
formspec = formspec.."button[0,1.75;5,1;disable;"..
|
||||
S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
end
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
@ -47,14 +47,19 @@ local function set_quarry_demand(meta)
|
||||
local radius = meta:get_int("size")
|
||||
local diameter = radius*2 + 1
|
||||
local machine_name = S("%s Quarry"):format("HV")
|
||||
if meta:get_int("enabled") == 0 or meta:get_int("purge_on") == 1 then
|
||||
meta:set_string("infotext", S(meta:get_int("purge_on") == 1 and "%s purging cache" or "%s Disabled"):format(machine_name))
|
||||
local do_purge = meta:get_int("purge_on") == 1
|
||||
if meta:get_int("enabled") == 0 or do_purge then
|
||||
local infotext = do_purge and
|
||||
S("%s purging cache") or S("%s Disabled")
|
||||
meta:set_string("infotext", infotext:format(machine_name))
|
||||
meta:set_int("HV_EU_demand", 0)
|
||||
elseif meta:get_int("dug") == diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) then
|
||||
meta:set_string("infotext", S("%s Finished"):format(machine_name))
|
||||
meta:set_int("HV_EU_demand", 0)
|
||||
else
|
||||
meta:set_string("infotext", S(meta:get_int("HV_EU_input") >= quarry_demand and "%s Active" or "%s Unpowered"):format(machine_name))
|
||||
local infotext = meta:get_int("HV_EU_input") >= quarry_demand
|
||||
and S("%s Active") or S("%s Unpowered")
|
||||
meta:set_string("infotext", infotext:format(machine_name))
|
||||
meta:set_int("HV_EU_demand", quarry_demand)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user