mirror of https://github.com/mt-mods/pipeworks.git
code and registrations cleanup (#101)
* code and registrations cleanup * don't expose materials to global env --------- Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>pull/103/head
parent
dd6950f7b0
commit
578e45257b
@ -1,13 +1,10 @@
|
||||
name: luacheck
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
luacheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: apt
|
||||
run: sudo apt-get install -y luarocks
|
||||
- name: luacheck install
|
||||
run: luarocks install --local luacheck
|
||||
- name: luacheck run
|
||||
run: $HOME/.luarocks/bin/luacheck ./
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Luacheck
|
||||
uses: lunarmodules/luacheck@master
|
@ -0,0 +1,67 @@
|
||||
local materials = {
|
||||
stone = "default:stone",
|
||||
desert_stone = "default:desert_stone",
|
||||
desert_sand = "default:desert_sand",
|
||||
chest = "default:chest",
|
||||
copper_ingot = "default:copper_ingot",
|
||||
steel_ingot = "default:steel_ingot",
|
||||
gold_ingot = "default:gold_ingot",
|
||||
mese = "default:mese",
|
||||
mese_crystal = "default:mese_crystal",
|
||||
mese_crystal_fragment = "default:mese_crystal_fragment",
|
||||
teleporter = "default:mese",
|
||||
glass = "default:glass"
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mcl_core") then
|
||||
materials = {
|
||||
stone = "mcl_core:stone",
|
||||
desert_stone = "mcl_core:redsandstone",
|
||||
desert_sand = "mcl_core:sand",
|
||||
chest = "mcl_chests:chest",
|
||||
steel_ingot = "mcl_core:iron_ingot",
|
||||
gold_ingot = "mcl_core:gold_ingot",
|
||||
mese = "mesecons_torch:redstoneblock",
|
||||
mese_crystal = "mesecons:redstone",
|
||||
mese_crystal_fragment = "mesecons:redstone",
|
||||
teleporter = "mesecons_torch:redstoneblock",
|
||||
copper_ingot = "mcl_copper:copper_ingot",
|
||||
glass = "mcl_core:glass",
|
||||
}
|
||||
elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
|
||||
materials = {
|
||||
stone = "fl_stone:stone",
|
||||
desert_stone = "fl_stone:desert_stone",
|
||||
desert_sand = "fl_stone:desert_sand",
|
||||
chest = "fl_storage:wood_chest",
|
||||
steel_ingot = "fl_ores:iron_ingot",
|
||||
gold_ingot = "fl_ores:gold_ingot",
|
||||
mese = "fl_ores:iron_ingot",
|
||||
mese_crystal = "fl_ores:iron_ingot",
|
||||
mese_crystal_fragment = "fl_ores:iron_ingot",
|
||||
teleporter = "fl_ores:iron_ingot",
|
||||
copper_ingot = "fl_ores:copper_ingot",
|
||||
glass = "fl_glass:framed_glass",
|
||||
}
|
||||
elseif minetest.get_modpath("hades_core") then
|
||||
materials = {
|
||||
stone = "hades_core:stone",
|
||||
desert_stone = "hades_core:stone_baked",
|
||||
desert_sand = "hades_core:volcanic_sand",
|
||||
chest = "hades_chests:chest";
|
||||
steel_ingot = "hades_core:steel_ingot",
|
||||
gold_ingot = "hades_core:gold_ingot",
|
||||
mese = "hades_core:mese",
|
||||
mese_crystal = "hades_core:mese_crystal",
|
||||
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
|
||||
teleporter = "hades_materials:teleporter_device",
|
||||
copper_ingot = "hades_core:copper_ingot",
|
||||
tin_ingot = "hades_core:tin_ingot",
|
||||
glass = "hades_core:glass",
|
||||
}
|
||||
if minetest.get_modpath("hades_default") then
|
||||
materials.desert_sand = "hades_default:desert_sand"
|
||||
end
|
||||
end
|
||||
|
||||
return materials
|
@ -0,0 +1,68 @@
|
||||
local materials = ...
|
||||
local S = minetest.get_translator("pipeworks")
|
||||
|
||||
local straight = function(pos, node, velocity, stack) return {velocity} end
|
||||
local steel_tex = "[combine:16x16^[noalpha^[colorize:#D3D3D3"
|
||||
if minetest.get_modpath("default") then steel_tex = "default_steel_block.png" end
|
||||
|
||||
-- register an embedded tube
|
||||
function pipeworks.register_embedded_tube(nodename, opts)
|
||||
minetest.register_node(nodename, {
|
||||
description = opts.description,
|
||||
tiles = {
|
||||
opts.base_texture,
|
||||
opts.base_texture,
|
||||
opts.base_texture,
|
||||
opts.base_texture,
|
||||
opts.base_texture .. "^pipeworks_tube_connection_metallic.png",
|
||||
opts.base_texture .. "^pipeworks_tube_connection_metallic.png",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {
|
||||
cracky = 1,
|
||||
oddly_breakable_by_hand = 1,
|
||||
tubedevice = 1,
|
||||
dig_glass = 2,
|
||||
pickaxey=1,
|
||||
handy=1
|
||||
},
|
||||
_mcl_hardness = 0.8,
|
||||
legacy_facedir_simple = true,
|
||||
_sound_def = {
|
||||
key = "node_sound_stone_defaults",
|
||||
},
|
||||
tube = {
|
||||
connect_sides = {
|
||||
front = 1,
|
||||
back = 1
|
||||
},
|
||||
priority = 50,
|
||||
can_go = straight,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||
end
|
||||
},
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
on_rotate = pipeworks.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = nodename .. " 1",
|
||||
recipe = {
|
||||
{ opts.base_ingredient, opts.base_ingredient, opts.base_ingredient },
|
||||
{ opts.base_ingredient, "pipeworks:tube_1", opts.base_ingredient },
|
||||
{ opts.base_ingredient, opts.base_ingredient, opts.base_ingredient }
|
||||
},
|
||||
})
|
||||
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = nodename
|
||||
end
|
||||
|
||||
-- steelblock embedded tube
|
||||
pipeworks.register_embedded_tube("pipeworks:steel_block_embedded_tube", {
|
||||
description = S("Airtight steelblock embedded tube"),
|
||||
base_texture = steel_tex,
|
||||
base_ingredient = materials.steel_ingot
|
||||
})
|
@ -1,39 +1,6 @@
|
||||
local S = minetest.get_translator("pipeworks")
|
||||
|
||||
local straight = function(pos, node, velocity, stack) return {velocity} end
|
||||
local steel_tex = "[combine:16x16^[noalpha^[colorize:#D3D3D3"
|
||||
if minetest.get_modpath("default") then steel_tex = "default_steel_block.png" end
|
||||
|
||||
minetest.register_node("pipeworks:steel_block_embedded_tube", {
|
||||
description = S("Airtight steelblock embedded tube"),
|
||||
tiles = {
|
||||
steel_tex, steel_tex,
|
||||
steel_tex, steel_tex,
|
||||
steel_tex .. "^pipeworks_tube_connection_metallic.png",
|
||||
steel_tex .. "^pipeworks_tube_connection_metallic.png",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1, dig_glass = 2, pickaxey=1, handy=1},
|
||||
_mcl_hardness=0.8,
|
||||
legacy_facedir_simple = true,
|
||||
_sound_def = {
|
||||
key = "node_sound_stone_defaults",
|
||||
},
|
||||
tube = {
|
||||
connect_sides = {front = 1, back = 1,},
|
||||
priority = 50,
|
||||
can_go = straight,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||
end,
|
||||
},
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
on_rotate = pipeworks.on_rotate,
|
||||
})
|
||||
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_block_embedded_tube"
|
||||
|
||||
local pane_box = {
|
||||
type = "fixed",
|
Loading…
Reference in new issue