mirror of
https://github.com/minetest-mods/technic.git
synced 2025-06-29 23:00:52 +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:
@ -163,12 +163,12 @@ local function form_handler(pos, formname, fields, sender)
|
||||
local inv = meta:get_inventory()
|
||||
local inputstack = inv:get_stack("src", 1)
|
||||
local inputname = inputstack:get_name()
|
||||
local multiplier = 0
|
||||
local size = meta:get_int("size")
|
||||
if size < 1 then size = 1 end
|
||||
|
||||
for k, _ in pairs(fields) do
|
||||
-- Set a multipier for the half/full size capable blocks
|
||||
local multiplier
|
||||
if twosize_products[k] ~= nil then
|
||||
multiplier = size * twosize_products[k]
|
||||
else
|
||||
|
@ -325,11 +325,10 @@ function technic_cnc.register_all(recipeitem, groups, images, description)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- REGISTER NEW TECHNIC_CNC_API's PART 2: technic_cnc..register_element_end(subname, recipeitem, groups, images, desc_element_xyz)
|
||||
-----------------------------------------------------------------------------------------------------------------------
|
||||
function technic_cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end)
|
||||
|
||||
-- TODO: Remove this evil sorcery
|
||||
technic_cnc.register_slope(recipeitem, groups, images, desc_slope)
|
||||
technic_cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying)
|
||||
technic_cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown)
|
||||
@ -354,10 +353,12 @@ end
|
||||
-- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz)
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
function technic_cnc.register_stick_etc(recipeitem, groups, images, desc_stick)
|
||||
-- TODO: Remove this evil sorcery
|
||||
technic_cnc.register_stick(recipeitem, groups, images, desc_stick)
|
||||
end
|
||||
|
||||
function technic_cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double)
|
||||
-- TODO: Remove this evil sorcery
|
||||
technic_cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double)
|
||||
technic_cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double)
|
||||
technic_cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double)
|
||||
|
@ -10,7 +10,17 @@ technic_cnc.use_technic = technic_cnc.technic_modpath
|
||||
if rawget(_G, "intllib") then
|
||||
technic_cnc.getter = intllib.Getter()
|
||||
else
|
||||
technic_cnc.getter = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end
|
||||
-- Intllib copypasta: TODO replace with the client-side translation API
|
||||
technic.getter = function(s,a,...)
|
||||
if a==nil then return s end
|
||||
a={a,...}
|
||||
return s:gsub("(@?)@(%(?)(%d+)(%)?)", function(e,o,n,c)
|
||||
if e==""then
|
||||
return a[tonumber(n)]..(o==""and c or"")
|
||||
end
|
||||
return "@"..o..n..c
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
dofile(modpath.."/cnc.lua")
|
||||
|
Reference in New Issue
Block a user