Add GitHub workflow and luacheck (#545)
Add badge to README Fix luacheck warnings Remove node_ownership globals (and support)
This commit is contained in:
parent
befe3ecc86
commit
a8daa417c4
11
.github/workflows/check-release.yml
vendored
Normal file
11
.github/workflows/check-release.yml
vendored
Normal file
@ -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
|
48
.luacheckrc
Normal file
48
.luacheckrc
Normal file
@ -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" }
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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},
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -84,8 +84,6 @@ minetest.register_abm({
|
||||
inv:set_size("src2", 0)
|
||||
end
|
||||
|
||||
local recipe = nil
|
||||
|
||||
for i, name in pairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
@ -112,7 +111,6 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
|
||||
|
||||
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
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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 = {}
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
|
@ -156,7 +156,7 @@ local function drill_dig_it(pos, player, mode)
|
||||
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
|
||||
@ -188,7 +188,7 @@ local function drill_dig_it(pos, player, mode)
|
||||
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
|
||||
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -72,7 +72,6 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
local shape = {}
|
||||
local onesize_products = {
|
||||
slope = 2,
|
||||
slope_edge = 1,
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user