From a8daa417c485ee20716ec050d4c676b5c91af773 Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 12 Jun 2020 13:39:00 -0500 Subject: [PATCH] Add GitHub workflow and luacheck (#545) Add badge to README Fix luacheck warnings Remove node_ownership globals (and support) --- .github/workflows/check-release.yml | 11 +++++ .luacheckrc | 48 +++++++++++++++++++ README.md | 3 ++ technic/helpers.lua | 2 +- technic/machines/HV/nuclear_reactor.lua | 2 +- technic/machines/LV/geothermal.lua | 2 +- technic/machines/LV/music_player.lua | 1 - technic/machines/LV/solar_panel.lua | 2 +- technic/machines/LV/water_mill.lua | 4 +- technic/machines/MV/hydro_turbine.lua | 4 +- technic/machines/MV/lighting.lua | 14 +++--- technic/machines/MV/power_radiator.lua | 2 - technic/machines/MV/tool_workshop.lua | 5 +- technic/machines/other/coal_alloy_furnace.lua | 4 +- technic/machines/other/frames.lua | 24 +++++----- technic/machines/other/injector.lua | 2 +- technic/machines/register/battery_box.lua | 4 +- technic/machines/register/common.lua | 6 +-- technic/machines/register/generator.lua | 11 ++--- technic/machines/register/grindings.lua | 1 - technic/machines/register/recipes.lua | 4 +- technic/machines/register/solar_array.lua | 1 - technic/machines/switching_station.lua | 6 +-- technic/radiation.lua | 1 - technic/tools/flashlight.lua | 4 +- technic/tools/mining_drill.lua | 15 +++--- technic/tools/vacuum.lua | 2 +- technic_chests/register.lua | 1 - technic_cnc/cnc.lua | 1 - technic_cnc/cnc_api.lua | 4 +- wrench/support.lua | 4 +- 31 files changed, 115 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/check-release.yml create mode 100644 .luacheckrc diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000..fb2ee39 --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,11 @@ +on: [push, pull_request] +name: Check & Release +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: lint + uses: Roang-zero1/factorio-mod-luacheck@master + with: + luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/technic/master/.luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..96a7aac --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,48 @@ +unused_args = false +allow_defined_top = true +max_line_length = 999 + +globals = { + "technic", "minetest", + "srcstack", +} + +read_globals = { + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn"}}, + + "intllib", "VoxelArea", + "default", "stairsplus", + + "PseudoRandom", "ItemStack", + "mg", "tubelib", "vector", + + "moretrees", "bucket", + "unified_inventory", "digilines", + + "pipeworks", "screwdriver", + "VoxelManip", "unifieddyes", + + "Settings", "mesecon", + "digiline_remote", + + "protector", "isprotect", + "homedecor_expect_infinite_stacks", +} + +files["concrete/init.lua"].ignore = { "steel_ingot" } +files["technic/machines/MV/tool_workshop.lua"].ignore = { "pos" } +files["technic/machines/other/frames.lua"].ignore = { "item_texture", "item_type", "adj", "connected", "" } +files["technic/machines/register/battery_box.lua"].ignore = { "pos", "tube_upgrade" } +files["technic/machines/register/cables.lua"].ignore = { "name", "from_below", "p" } +files["technic/machines/register/common.lua"].ignore = { "result" } + +files["technic/machines/register/generator.lua"].ignore = { "node" } +files["technic/machines/switching_station.lua"].ignore = { "pos1", "tier", "poshash" } +files["technic/radiation.lua"].ignore = { "LAVA_VISC" } +files["technic/tools/chainsaw.lua"].ignore = { "pos" } +files["technic/tools/mining_drill.lua"].ignore = { "mode" } +files["technic_chests/register.lua"].ignore = { "fs_helpers", "name", "locked_after_place" } + +files["technic_cnc/cnc.lua"].ignore = { "multiplier" } +files["wrench/init.lua"].ignore = { "name", "stack" } diff --git a/README.md b/README.md index afe1b34..a518bed 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ Technic ======= +[![Build status](https://github.com/minetest-mods/technic/workflows/Check%20&%20Release/badge.svg)](https://github.com/minetest-mods/technic/actions) +[![License](https://img.shields.io/badge/license-LGPLv2.0%2B-purple.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html) + Credits for contributing to the project (in alphabetical order): * kpoppel * Nekogloop diff --git a/technic/helpers.lua b/technic/helpers.lua index b89b180..5361fa3 100644 --- a/technic/helpers.lua +++ b/technic/helpers.lua @@ -83,7 +83,7 @@ function technic.get_or_load_node(pos) local node = minetest.get_node_or_nil(pos) if node then return node end local vm = VoxelManip() - local MinEdge, MaxEdge = vm:read_from_map(pos, pos) + local _, _ = vm:read_from_map(pos, pos) return nil end diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua index 231b6b3..c6ed4df 100644 --- a/technic/machines/HV/nuclear_reactor.lua +++ b/technic/machines/HV/nuclear_reactor.lua @@ -455,7 +455,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", { technic_run = run, technic_on_disable = function(pos, node) local timer = minetest.get_node_timer(pos) - timer:start(1) + timer:start(1) end, on_timer = function(pos, node) local meta = minetest.get_meta(pos) diff --git a/technic/machines/LV/geothermal.lua b/technic/machines/LV/geothermal.lua index c66547e..abe6951 100644 --- a/technic/machines/LV/geothermal.lua +++ b/technic/machines/LV/geothermal.lua @@ -27,7 +27,7 @@ minetest.register_craftitem("technic:geothermal", { local check_node_around = function(pos) local node = minetest.get_node(pos) if node.name == "default:water_source" or node.name == "default:water_flowing" then return 1 end - if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end + if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end return 0 end diff --git a/technic/machines/LV/music_player.lua b/technic/machines/LV/music_player.lua index 262fe5f..3bbb441 100644 --- a/technic/machines/LV/music_player.lua +++ b/technic/machines/LV/music_player.lua @@ -24,7 +24,6 @@ local run = function(pos, node) local meta = minetest.get_meta(pos) local eu_input = meta:get_int("LV_EU_input") local machine_name = S("%s Music Player"):format("LV") - local machine_node = "technic:music_player" local demand = 150 local current_track = meta:get_int("current_track") diff --git a/technic/machines/LV/solar_panel.lua b/technic/machines/LV/solar_panel.lua index 6143fa9..b3daedc 100644 --- a/technic/machines/LV/solar_panel.lua +++ b/technic/machines/LV/solar_panel.lua @@ -51,7 +51,7 @@ minetest.register_node("technic:solar_panel", { technic_machine=1, technic_lv=1}, connect_sides = {"bottom"}, sounds = default.node_sound_wood_defaults(), - description = S("Small Solar %s Generator"):format("LV"), + description = S("Small Solar %s Generator"):format("LV"), active = false, drawtype = "nodebox", paramtype = "light", diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua index ed3c1e1..e26224e 100644 --- a/technic/machines/LV/water_mill.lua +++ b/technic/machines/LV/water_mill.lua @@ -29,8 +29,8 @@ end local run = function(pos, node) local meta = minetest.get_meta(pos) local water_flow = 0 - local production_level = 0 - local eu_supply = 0 + local production_level + local eu_supply local max_output = 4 * 45 -- keeping it around 180, little more than previous 150 :) local positions = { diff --git a/technic/machines/MV/hydro_turbine.lua b/technic/machines/MV/hydro_turbine.lua index 19dfebb..0d4904c 100644 --- a/technic/machines/MV/hydro_turbine.lua +++ b/technic/machines/MV/hydro_turbine.lua @@ -30,8 +30,8 @@ end local run = function(pos, node) local meta = minetest.get_meta(pos) local water_flow = 0 - local production_level = 0 - local eu_supply = 0 + local production_level + local eu_supply local max_output = 40 * 45 -- Generates 1800EU/s local positions = { diff --git a/technic/machines/MV/lighting.lua b/technic/machines/MV/lighting.lua index 8ff2702..2254ecf 100644 --- a/technic/machines/MV/lighting.lua +++ b/technic/machines/MV/lighting.lua @@ -45,7 +45,6 @@ function technic_homedecor_node_is_owned(pos, placer) end end -local dirs1 = {20, 23, 22, 21} local dirs2 = {9, 18, 7, 12} local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_thing) @@ -58,7 +57,6 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t local under = pointed_thing.under local pitch = placer:get_look_pitch() local pname = minetest.get_node(under).name - local node = minetest.get_node(above) local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local wield_name = itemstack:get_name() @@ -159,7 +157,7 @@ minetest.register_node('technic:homedecor_glowlight_half_yellow_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX, + light_source = minetest.LIGHT_MAX, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, @@ -240,7 +238,7 @@ minetest.register_node('technic:homedecor_glowlight_quarter_yellow_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX-1, + light_source = minetest.LIGHT_MAX-1, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, @@ -322,7 +320,7 @@ minetest.register_node('technic:homedecor_glowlight_half_white_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX, + light_source = minetest.LIGHT_MAX, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, @@ -403,7 +401,7 @@ minetest.register_node('technic:homedecor_glowlight_quarter_white_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX-1, + light_source = minetest.LIGHT_MAX-1, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, @@ -484,7 +482,7 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_yellow_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX-1, + light_source = minetest.LIGHT_MAX-1, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, @@ -565,7 +563,7 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_white_active', { paramtype = "light", paramtype2 = "facedir", walkable = true, - light_source = LIGHT_MAX-1, + light_source = minetest.LIGHT_MAX-1, sounds = default.node_sound_wood_defaults(), groups = { snappy = 3, not_in_creative_inventory=1}, diff --git a/technic/machines/MV/power_radiator.lua b/technic/machines/MV/power_radiator.lua index 623af34..a5d2ed6 100644 --- a/technic/machines/MV/power_radiator.lua +++ b/technic/machines/MV/power_radiator.lua @@ -177,8 +177,6 @@ minetest.register_abm({ -- The supply radius local rad = power_radius - local meta1 = nil - local pos1 = {} local used_charge = 0 -- Index all nodes within supply range diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua index a220ac0..678a1fd 100644 --- a/technic/machines/MV/tool_workshop.lua +++ b/technic/machines/MV/tool_workshop.lua @@ -39,7 +39,6 @@ local run = function(pos, node) local inv = meta:get_inventory() local eu_input = meta:get_int("MV_EU_input") local machine_name = S("%s Tool Workshop"):format("MV") - local machine_node = "technic:tool_workshop" -- Setup meta data if it does not exist. if not eu_input then @@ -71,7 +70,7 @@ local run = function(pos, node) meta:set_int("MV_EU_demand", 0) return end - + if eu_input < workshop_demand[EU_upgrade+1] then meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) elseif eu_input >= workshop_demand[EU_upgrade+1] then @@ -105,7 +104,7 @@ minetest.register_node("technic:tool_workshop", { inv:set_size("src", 1) inv:set_size("upgrade1", 1) inv:set_size("upgrade2", 1) - end, + end, can_dig = technic.machine_can_dig, allow_metadata_inventory_put = technic.machine_inventory_put, allow_metadata_inventory_take = technic.machine_inventory_take, diff --git a/technic/machines/other/coal_alloy_furnace.lua b/technic/machines/other/coal_alloy_furnace.lua index 30db8ed..c2de151 100644 --- a/technic/machines/other/coal_alloy_furnace.lua +++ b/technic/machines/other/coal_alloy_furnace.lua @@ -77,14 +77,12 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - + if inv:get_size("src") == 1 then -- Old furnace -> convert it inv:set_size("src", 2) inv:set_stack("src", 2, inv:get_stack("src2", 1)) inv:set_size("src2", 0) end - - local recipe = nil for i, name in pairs({ "fuel_totaltime", diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua index b74d806..e65902c 100644 --- a/technic/machines/other/frames.lua +++ b/technic/machines/other/frames.lua @@ -1,7 +1,5 @@ local S = technic.getter -frames = {} - local infinite_stacks = minetest.settings:get_bool("creative_mode") and minetest.get_modpath("unified_inventory") == nil @@ -100,7 +98,7 @@ end local function add_table(table, toadd) local i = 1 while true do - o = table[i] + local o = table[i] if o == toadd then return end if o == nil then break end i = i + 1 @@ -261,8 +259,8 @@ for zp = 0, 1 do sunlight_propagates = true, frame_connect_all = function(nodename) - l2 = {} - l1 = { + local l2 = {} + local l1 = { { x = -1, y = 0, z = 0 }, { x = 1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = -1 }, { x = 0, y = 0, z = 1 } @@ -311,7 +309,7 @@ for zp = 0, 1 do local node = minetest.get_node(pos) if node.name ~= "air" then if is_supported_node(node.name) then - obj = minetest.add_entity(pos, "technic:frame_entity") + local obj = minetest.add_entity(pos, "technic:frame_entity") obj:get_luaentity():set_node({ name = itemstack:get_name() }) end else @@ -349,8 +347,8 @@ for zp = 0, 1 do end -- Run script hook - local _, callback - for _, callback in ipairs(minetest.registered_on_placenodes) do + local callback = nil + for _, _ in ipairs(minetest.registered_on_placenodes) do -- Copy pos and node because callback can modify them local pos_copy = { x = pos.x, y = pos.y, z = pos.z } local newnode_copy = { name = def.name, param1 = 0, param2 = 0 } @@ -364,7 +362,7 @@ for zp = 0, 1 do itemstack:take_item() end - obj = minetest.add_entity(pos, "technic:frame_entity") + local obj = minetest.add_entity(pos, "technic:frame_entity") obj:get_luaentity():set_node({ name = node.name }) return itemstack @@ -414,7 +412,7 @@ minetest.register_entity("technic:frame_entity", { item_texture = minetest.registered_items[itemname].inventory_image item_type = minetest.registered_items[itemname].type end - prop = { + local prop = { is_visible = true, textures = { node.name }, } @@ -589,7 +587,7 @@ local function connected(pos, c, adj) end local function get_connected_nodes(pos) - c = { pos } + local c = { pos } local nodename = minetest.get_node(pos).name if frames_pos[pos_to_string(pos)] then nodename = frames_pos[pos_to_string(pos)] @@ -695,7 +693,7 @@ local function swap_template(pos, new) local saved_node = meta:get_string("saved_node") meta:set_string("saved_node", "") technic.swap_node(pos, new) - local meta = minetest.get_meta(pos) + meta = minetest.get_meta(pos) meta:set_string("saved_node", saved_node) end @@ -857,7 +855,7 @@ minetest.register_node("technic:template_disabled", { on_destruct = template_on_destruct, after_dig_node = template_drops, on_punch = function(pos, node, puncher) - local meta = minetest.get_meta(pos) + local _ = minetest.get_meta(pos) swap_template(pos, "technic:template_connector") end }) diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua index c192614..2bf85b6 100644 --- a/technic/machines/other/injector.lua +++ b/technic/machines/other/injector.lua @@ -40,7 +40,7 @@ local function inject_items (pos) end end end - + end minetest.register_craft({ diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index bf4d96a..af8fd60 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -312,7 +312,6 @@ function technic.register_battery_box(data) local charge = meta:get_int("internal_EU_charge") local cpercent = math.floor(charge / max_charge * 100) local inv = meta:get_inventory() - local node = minetest.get_node(pos) meta:set_string("infotext", S("%s Battery Box"):format(tier)) meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, cpercent)) meta:set_string("channel", ltier.."_battery_box"..minetest.pos_to_string(pos)) @@ -335,7 +334,6 @@ function technic.register_battery_box(data) after_dig_node = technic.machine_after_dig_node, on_receive_fields = function(pos, formname, fields, sender) local meta = minetest.get_meta(pos) - local nodename = minetest.get_node(pos).name if fields.edit_channel then minetest.show_formspec(sender:get_player_name(), "technic:battery_box_edit_channel"..minetest.pos_to_string(pos), @@ -344,7 +342,7 @@ function technic.register_battery_box(data) or fields["fs_helpers_cycling:0:split_dst_stacks"] or fields["fs_helpers_cycling:1:split_src_stacks"] or fields["fs_helpers_cycling:1:split_dst_stacks"] then - local meta = minetest.get_meta(pos) + meta = minetest.get_meta(pos) if not pipeworks.may_configure(pos, sender) then return end fs_helpers.on_receive_fields(pos, fields) local EU_upgrade, tube_upgrade = 0, 0 diff --git a/technic/machines/register/common.lua b/technic/machines/register/common.lua index 9d88702..0e7658b 100644 --- a/technic/machines/register/common.lua +++ b/technic/machines/register/common.lua @@ -65,7 +65,7 @@ function technic.send_items(pos, x_velocity, z_velocity, output_name) if output_name == nil then output_name = "dst" end - + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local i = 0 @@ -84,7 +84,6 @@ function technic.send_items(pos, x_velocity, z_velocity, output_name) end end - function technic.smelt_item(meta, result, speed) local inv = meta:get_inventory() meta:set_int("cook_time", meta:get_int("cook_time") + 1) @@ -109,10 +108,9 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function) if send_function == nil then send_function = technic.send_items end - + local node = minetest.get_node(pos) local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() local pos1 = vector.new(pos) local x_velocity = 0 local z_velocity = 0 diff --git a/technic/machines/register/generator.lua b/technic/machines/register/generator.lua index f8d7e6a..9120e29 100644 --- a/technic/machines/register/generator.lua +++ b/technic/machines/register/generator.lua @@ -41,9 +41,9 @@ function technic.register_generator(data) "image[4,1;1,1;default_furnace_fire_bg.png]".. "list[current_player;main;0,5;8,4;]".. "listring[]" - + local desc = S("Fuel-Fired %s Generator"):format(tier) - + local run = function(pos, node) local meta = minetest.get_meta(pos) local burn_time = meta:get_int("burn_time") @@ -162,7 +162,6 @@ function technic.register_generator(data) fs_helpers.on_receive_fields(pos, fields) local meta = minetest.get_meta(pos) local node = minetest.get_node(pos) - local form = generator_formspec local form_buttons = "" if not string.find(node.name, ":lv_") then form_buttons = fs_helpers.cycling_button( @@ -204,15 +203,15 @@ function technic.register_generator(data) technic_run = run, technic_on_disable = function(pos, node) local timer = minetest.get_node_timer(pos) - timer:start(1) - end, + timer:start(1) + end, on_timer = function(pos, node) local meta = minetest.get_meta(pos) local node = minetest.get_node(pos) -- Connected back? if meta:get_int(tier.."_EU_timeout") > 0 then return false end - + local burn_time = meta:get_int("burn_time") or 0 if burn_time <= 0 then diff --git a/technic/machines/register/grindings.lua b/technic/machines/register/grindings.lua index 9231166..3238725 100644 --- a/technic/machines/register/grindings.lua +++ b/technic/machines/register/grindings.lua @@ -1,6 +1,5 @@ local S = technic.getter local moretrees = minetest.get_modpath("moretrees") -local mesecons_materials = minetest.get_modpath("mesecons_materials") local dye = minetest.get_modpath("dye") -- sawdust, the finest wood/tree grinding diff --git a/technic/machines/register/recipes.lua b/technic/machines/register/recipes.lua index f9e2458..921d1c8 100644 --- a/technic/machines/register/recipes.lua +++ b/technic/machines/register/recipes.lua @@ -39,7 +39,7 @@ local function register_recipe(typename, data) else data.output = ItemStack(data.output):to_string() end - + local recipe = {time = data.time, input = {}, output = data.output} local index = get_recipe_index(data.input) if not index then @@ -49,7 +49,7 @@ local function register_recipe(typename, data) for _, stack in ipairs(data.input) do recipe.input[ItemStack(stack):get_name()] = ItemStack(stack):get_count() end - + technic.recipes[typename].recipes[index] = recipe if have_ui and technic.recipes[typename].output_size == 1 then unified_inventory.register_craft({ diff --git a/technic/machines/register/solar_array.lua b/technic/machines/register/solar_array.lua index 03f11d9..443ac90 100644 --- a/technic/machines/register/solar_array.lua +++ b/technic/machines/register/solar_array.lua @@ -56,7 +56,6 @@ function technic.register_solar_array(data) }, on_construct = function(pos) local meta = minetest.get_meta(pos) - local name = minetest.get_node(pos).name meta:set_int(tier.."_EU_supply", 0) end, technic_run = run, diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 7f3a0b9..56a0db0 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -249,12 +249,8 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) if not technic.powerctrl_state then return end local meta = minetest.get_meta(pos) - local meta1 = nil + local meta1 local pos1 = {} - local PR_EU = 0 -- EUs from PR nodes - local BA_PR_EU = 0 -- EUs from BA nodes (discharching) - local BA_RE_EU = 0 -- EUs to BA nodes (charging) - local RE_EU = 0 -- EUs to RE nodes local tier = "" local PR_nodes diff --git a/technic/radiation.lua b/technic/radiation.lua index e4ed5c5..4f511ab 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -244,7 +244,6 @@ to be safe, and limits the range at which source/player interactions need to be considered. --]] local abdomen_offset = 1 -local cache_scaled_shielding = {} local rad_dmg_cutoff = 0.2 local radiated_players = {} diff --git a/technic/tools/flashlight.lua b/technic/tools/flashlight.lua index a4ac608..84decbb 100644 --- a/technic/tools/flashlight.lua +++ b/technic/tools/flashlight.lua @@ -99,7 +99,7 @@ minetest.register_globalstep(function(dtime) if node and node.name == "air" then minetest.set_node(rounded_pos, {name="technic:light"}) end - local node = minetest.get_node_or_nil(old_pos) + node = minetest.get_node_or_nil(old_pos) if node and node.name == "technic:light" then minetest.remove_node(old_pos) end @@ -118,6 +118,6 @@ minetest.register_node("technic:light", { walkable = false, buildable_to = true, sunlight_propagates = true, - light_source = LIGHT_MAX, + light_source = minetest.LIGHT_MAX, pointable = false, }) diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index cb16914..e54e73d 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -154,9 +154,9 @@ local function drill_dig_it(pos, player, mode) if mode == 1 then drill_dig_it0(pos, player) end - + if mode == 2 then -- 3 deep - dir = drill_dig_it1(player) + local dir = drill_dig_it1(player) if dir == 0 then -- x+ drill_dig_it0(pos, player) pos.x = pos.x + 1 @@ -186,9 +186,9 @@ local function drill_dig_it(pos, player, mode) drill_dig_it0 (pos,player) end end - + if mode==3 then -- 3 wide - dir=drill_dig_it1(player) + local dir = drill_dig_it1(player) if dir==0 or dir==1 then -- x drill_dig_it0 (pos,player) pos.z=pos.z+1 @@ -204,7 +204,7 @@ local function drill_dig_it(pos, player, mode) drill_dig_it0 (pos,player) end end - + if mode==4 then -- 3 tall, selected in the middle drill_dig_it0 (pos,player) pos.y=pos.y-1 @@ -227,7 +227,7 @@ local function drill_dig_it(pos, player, mode) drill_dig_it4(pos,player) end end - + minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,}) end @@ -240,6 +240,7 @@ end local function mining_drill_mk2_setmode(user,itemstack) local player_name=user:get_player_name() local item=itemstack:to_table() + local mode = nil local meta=minetest.deserialize(item["metadata"]) if meta==nil then meta={} @@ -286,7 +287,6 @@ end local function mining_drill_mk2_handler(itemstack, user, pointed_thing) local keys = user:get_player_control() - local player_name = user:get_player_name() local meta = minetest.deserialize(itemstack:get_metadata()) if not meta or not meta.mode or keys.sneak then return mining_drill_mk2_setmode(user, itemstack) @@ -309,7 +309,6 @@ end local function mining_drill_mk3_handler(itemstack, user, pointed_thing) local keys = user:get_player_control() - local player_name = user:get_player_name() local meta = minetest.deserialize(itemstack:get_metadata()) if not meta or not meta.mode or keys.sneak then return mining_drill_mk3_setmode(user, itemstack) diff --git a/technic/tools/vacuum.lua b/technic/tools/vacuum.lua index 86e6b64..7b01af8 100644 --- a/technic/tools/vacuum.lua +++ b/technic/tools/vacuum.lua @@ -44,7 +44,7 @@ minetest.register_tool("technic:vacuum", { end end end - + technic.set_RE_wear(itemstack, meta.charge, vacuum_max_charge) itemstack:set_metadata(minetest.serialize(meta)) return itemstack diff --git a/technic_chests/register.lua b/technic_chests/register.lua index 9f63617..f8b108b 100644 --- a/technic_chests/register.lua +++ b/technic_chests/register.lua @@ -84,7 +84,6 @@ end local function set_formspec(pos, data, page) local meta = minetest.get_meta(pos) - local node = minetest.get_node(pos) local formspec = data.base_formspec formspec = formspec..fs_helpers.cycling_button( meta, diff --git a/technic_cnc/cnc.lua b/technic_cnc/cnc.lua index 1116aee..cb81bd4 100644 --- a/technic_cnc/cnc.lua +++ b/technic_cnc/cnc.lua @@ -72,7 +72,6 @@ else end end -local shape = {} local onesize_products = { slope = 2, slope_edge = 1, diff --git a/technic_cnc/cnc_api.lua b/technic_cnc/cnc_api.lua index c33ef49..3026b47 100644 --- a/technic_cnc/cnc_api.lua +++ b/technic_cnc/cnc_api.lua @@ -237,7 +237,7 @@ technic_cnc.programs = { type = "fixed", fixed = { { 4/16, -8/16, 4/16, 8/16, 8/16, 8/16 }, - { 0, -8/16, 0, 4/16, 8/16, 8/16 }, + { 0, -8/16, 0, 4/16, 8/16, 8/16 }, { -4/16, -8/16, -4/16, 0, 8/16, 8/16 }, { -8/16, -8/16, -8/16, -4/16, 8/16, 8/16 } } @@ -257,7 +257,7 @@ technic_cnc.programs = { } } }, - + } -- Allow disabling certain programs for some node. Default is allowing all types for all nodes diff --git a/wrench/support.lua b/wrench/support.lua index 21aebfc..78ffa03 100644 --- a/wrench/support.lua +++ b/wrench/support.lua @@ -15,12 +15,10 @@ Syntax: inventory is always stored (Ex. active state for machines) --]] -wrench.META_TYPE_INT = 0 wrench.META_TYPE_FLOAT = 1 wrench.META_TYPE_STRING = 2 -local INT, STRING, FLOAT = - wrench.META_TYPE_INT, +local STRING, FLOAT = wrench.META_TYPE_STRING, wrench.META_TYPE_FLOAT