update the mod
171
coal_furnace.lua
@ -1,171 +0,0 @@
|
|||||||
minetest.register_alias("coal_furnace", "technic:coal_furnace")
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'technic:coal_furnace',
|
|
||||||
recipe = {
|
|
||||||
{'default:stone', 'default:stone', 'default:stone'},
|
|
||||||
{'default:stone', '', 'default:stone'},
|
|
||||||
{'default:stone', 'default:stone', 'default:stone'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
coal_furnace_formspec =
|
|
||||||
"invsize[8,9;]"..
|
|
||||||
"image[1,1;1,2;technic_power_meter_bg.png]"..
|
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
|
||||||
"list[current_player;main;0,5;8,4;]"..
|
|
||||||
"label[0,0;Coal Furnace]")
|
|
||||||
|
|
||||||
minetest.register_node("technic:coal_furnace", {
|
|
||||||
description = "Coal furnace",
|
|
||||||
tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png",
|
|
||||||
"technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=2},
|
|
||||||
legacy_facedir_simple = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
technic_power_machine=1,
|
|
||||||
internal_EU_buffer=0;
|
|
||||||
interal_EU_buffer_size=2000;
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
meta:set_string("formspec", coal_furnace_formspec)
|
|
||||||
meta:set_string("infotext", "Coal furnace")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("src", 1)
|
|
||||||
inv:set_size("dst", 4)
|
|
||||||
local EU_used = 0
|
|
||||||
local furnace_is_cookin = 0
|
|
||||||
local cooked = nil
|
|
||||||
meta:set_float("internal_EU_buffer",0)
|
|
||||||
meta:set_float("internal_EU_buffer_size",2000)
|
|
||||||
|
|
||||||
end,
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
local meta = minetest.env:get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if not inv:is_empty("dst") then
|
|
||||||
return false
|
|
||||||
elseif not inv:is_empty("src") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("technic:coal_furnace_active", {
|
|
||||||
description = "Coal Furnace",
|
|
||||||
tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png",
|
|
||||||
"technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
light_source = 8,
|
|
||||||
drop = "technic:coal_furnace",
|
|
||||||
groups = {cracky=2, not_in_creative_inventory=1},
|
|
||||||
legacy_facedir_simple = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
internal_EU_buffer=0;
|
|
||||||
interal_EU_buffer_size=2000;
|
|
||||||
technic_power_machine=1,
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
meta:set_string("formspec", electric_furnace_formspec)
|
|
||||||
meta:set_string("infotext", "Coal furnace");
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("src", 1)
|
|
||||||
inv:set_size("dst", 4)
|
|
||||||
local EU_used = 0
|
|
||||||
local furnace_is_cookin = 0
|
|
||||||
local cooked = nil
|
|
||||||
end,
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
local meta = minetest.env:get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if not inv:is_empty("dst") then
|
|
||||||
return false
|
|
||||||
elseif not inv:is_empty("src") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"technic:coal_furnace","technic:coal_furnace_active"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
internal_EU_buffer=meta:get_float("internal_EU_buffer")
|
|
||||||
internal_EU_buffer_size=meta:get_float("internal_EU_buffer")
|
|
||||||
local load = math.floor(internal_EU_buffer/2000 * 100)
|
|
||||||
meta:set_string("formspec",
|
|
||||||
"invsize[8,9;]"..
|
|
||||||
"image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"..
|
|
||||||
(load)..":technic_power_meter_fg.png]"..
|
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
|
||||||
"list[current_player;main;0,5;8,4;]"..
|
|
||||||
"label[0,0;Electric Furnace]")
|
|
||||||
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
|
|
||||||
local furnace_is_cookin = meta:get_float("furnace_is_cookin")
|
|
||||||
|
|
||||||
|
|
||||||
local srclist = inv:get_list("src")
|
|
||||||
local cooked=nil
|
|
||||||
|
|
||||||
if srclist then
|
|
||||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if (furnace_is_cookin == 1) then
|
|
||||||
if internal_EU_buffer>=150 then
|
|
||||||
internal_EU_buffer=internal_EU_buffer-150;
|
|
||||||
meta:set_float("internal_EU_buffer",internal_EU_buffer)
|
|
||||||
meta:set_float("src_time", meta:get_float("src_time") + 3)
|
|
||||||
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
|
|
||||||
-- check if there's room for output in "dst" list
|
|
||||||
if inv:room_for_item("dst",cooked.item) then
|
|
||||||
-- Put result in "dst" list
|
|
||||||
inv:add_item("dst", cooked.item)
|
|
||||||
-- take stuff from "src" list
|
|
||||||
srcstack = inv:get_stack("src", 1)
|
|
||||||
srcstack:take_item()
|
|
||||||
inv:set_stack("src", 1, srcstack)
|
|
||||||
else
|
|
||||||
print("Furnace inventory full!")
|
|
||||||
end
|
|
||||||
meta:set_string("src_time", 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if srclist then
|
|
||||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
|
||||||
if cooked.time>0 then
|
|
||||||
hacky_swap_node(pos,"technic:coal_furnace_active")
|
|
||||||
meta:set_string("infotext","Furnace active")
|
|
||||||
meta:set_string("furnace_is_cookin",1)
|
|
||||||
meta:set_string("src_time", 0)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
hacky_swap_node(pos,"technic:coal_furnace")
|
|
||||||
meta:set_string("infotext","Furnace inactive")
|
|
||||||
meta:set_string("furnace_is_cookin",0)
|
|
||||||
meta:set_string("src_time", 0)
|
|
||||||
|
|
||||||
|
|
||||||
end,
|
|
||||||
})
|
|
@ -1,3 +0,0 @@
|
|||||||
-- Please note that item_drop module already contains item_pickup
|
|
||||||
enable_item_drop=false
|
|
||||||
enable_item_pickup=true
|
|
1
technic/modpack.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
1
technic/pipeworks/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*~
|
34
technic/pipeworks/README
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
This simple mod uses nodeboxes to supply a complete set of 3D flanged pipes,
|
||||||
|
along with "valve" and "pump" devices.
|
||||||
|
|
||||||
|
Unlike the previous version of this mod, these pipes are rounded, and when
|
||||||
|
placed, they'll automatically join together as needed. Pipes can go vertically
|
||||||
|
or horizontally, and there are enough nodes defined to allow for all possible
|
||||||
|
connections. Valves and pumps can only be placed horizontally, and will
|
||||||
|
automatically rotate and join with neighboring pipes as objects are added, as
|
||||||
|
well as joining with each other under certain circumstances.
|
||||||
|
|
||||||
|
Pipes come in two variants: one type bears one or more dark windows on each
|
||||||
|
pipe, suggesting they're empty, while the other type bears green-tinted
|
||||||
|
windows, as if full (the two colors should also be easy to select if you want
|
||||||
|
to change them in a paint program). These windows only appear on straight
|
||||||
|
lengths and on certain junctions.
|
||||||
|
|
||||||
|
There are no crafting recipes, yet, but you can use /giveme as usual, namely
|
||||||
|
"/giveme pipeworks:pipe 999" or so, and then place them as needed. See
|
||||||
|
init.lua for more details.
|
||||||
|
|
||||||
|
This mod is intended to be used as a basis or at least as sort of a model for
|
||||||
|
something else to build on (perhaps a nicer-looking oil mod?), and does not
|
||||||
|
provide any of the code necessary to cause anything to flow through them. Like
|
||||||
|
the pipes, the valve and pump don't do anything useful yet, but you can punch
|
||||||
|
them to turn them "on" and "off". Note that the valve and pump textures and
|
||||||
|
shapes are not yet complete (hence their boxy appearance).
|
||||||
|
|
||||||
|
This mod is a work in progress.
|
||||||
|
|
||||||
|
Please note that owing to the nature of this mod, I have opted to use 64px
|
||||||
|
textures. Anything less just looks terrible.
|
||||||
|
|
||||||
|
If you don't need the old node names from the previous version of this mod,
|
||||||
|
edit init.lua and comment-out the 'dofile' line at the top.
|
176
technic/pipeworks/autoplace.lua
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
-- autorouting for pipes
|
||||||
|
|
||||||
|
function pipe_scanforobjects(pos)
|
||||||
|
pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded")
|
||||||
|
pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded")
|
||||||
|
pipe_autoroute(pos, "_loaded")
|
||||||
|
|
||||||
|
pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty")
|
||||||
|
pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty")
|
||||||
|
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty")
|
||||||
|
pipe_autoroute(pos, "_empty")
|
||||||
|
end
|
||||||
|
|
||||||
|
function pipe_autoroute(pos, state)
|
||||||
|
nctr = minetest.env:get_node(pos)
|
||||||
|
if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end
|
||||||
|
|
||||||
|
pipes_scansurroundings(pos)
|
||||||
|
|
||||||
|
nsurround = pxm..pxp..pym..pyp..pzm..pzp
|
||||||
|
if nsurround == "000000" then nsurround = "110000" end
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:pipe_"..nsurround..state })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- autorouting for pneumatic tubes
|
||||||
|
|
||||||
|
function tube_scanforobjects(pos)
|
||||||
|
tube_autoroute({ x=pos.x-1, y=pos.y , z=pos.z })
|
||||||
|
tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z })
|
||||||
|
tube_autoroute({ x=pos.x , y=pos.y-1, z=pos.z })
|
||||||
|
tube_autoroute({ x=pos.x , y=pos.y+1, z=pos.z })
|
||||||
|
tube_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 })
|
||||||
|
tube_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 })
|
||||||
|
tube_autoroute(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tube_autoroute(pos)
|
||||||
|
nctr = minetest.env:get_node(pos)
|
||||||
|
print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice"))
|
||||||
|
if (string.find(nctr.name, "pipeworks:tube_") == nil)
|
||||||
|
and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end
|
||||||
|
|
||||||
|
pxm=0
|
||||||
|
pxp=0
|
||||||
|
pym=0
|
||||||
|
pyp=0
|
||||||
|
pzm=0
|
||||||
|
pzp=0
|
||||||
|
|
||||||
|
nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
|
||||||
|
nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
|
||||||
|
nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
|
||||||
|
nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
|
||||||
|
nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
|
||||||
|
nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
|
||||||
|
|
||||||
|
if (string.find(nxm.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nxm.name, "tubedevice") == 1 then pxm=1 end
|
||||||
|
if (string.find(nxp.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nxp.name, "tubedevice") == 1 then pxp=1 end
|
||||||
|
if (string.find(nym.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nym.name, "tubedevice") == 1 then pym=1 end
|
||||||
|
if (string.find(nyp.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nyp.name, "tubedevice") == 1 then pyp=1 end
|
||||||
|
if (string.find(nzm.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nzm.name, "tubedevice") == 1 then pzm=1 end
|
||||||
|
if (string.find(nzp.name, "pipeworks:tube_") ~= nil)
|
||||||
|
or minetest.get_item_group(nzp.name, "tubedevice") == 1 then pzp=1 end
|
||||||
|
|
||||||
|
nsurround = pxm..pxp..pym..pyp..pzm..pzp
|
||||||
|
if minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:tube_"..nsurround })
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- auto-rotation code for various devices the tubes attach to
|
||||||
|
|
||||||
|
function pipe_device_autorotate(pos, state, bname)
|
||||||
|
|
||||||
|
if state == nil then
|
||||||
|
nname = bname
|
||||||
|
else
|
||||||
|
nname = bname.."_"..state
|
||||||
|
end
|
||||||
|
|
||||||
|
local nctr = minetest.env:get_node(pos)
|
||||||
|
|
||||||
|
pipes_scansurroundings(pos)
|
||||||
|
|
||||||
|
if (pxm+pxp) ~= 0 then
|
||||||
|
minetest.env:add_node(pos, { name = nname.."_x" })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if (pzm+pzp) ~= 0 then
|
||||||
|
minetest.env:add_node(pos, { name = nname.."_z" })
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function pipes_scansurroundings(pos)
|
||||||
|
pxm=0
|
||||||
|
pxp=0
|
||||||
|
pym=0
|
||||||
|
pyp=0
|
||||||
|
pzm=0
|
||||||
|
pzp=0
|
||||||
|
|
||||||
|
nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
|
||||||
|
nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
|
||||||
|
nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
|
||||||
|
nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
|
||||||
|
nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
|
||||||
|
nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
|
||||||
|
|
||||||
|
if (string.find(nxm.name, "pipeworks:pipe_") ~= nil) then pxm=1 end
|
||||||
|
if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end
|
||||||
|
if (string.find(nym.name, "pipeworks:pipe_") ~= nil) then pym=1 end
|
||||||
|
if (string.find(nyp.name, "pipeworks:pipe_") ~= nil) then pyp=1 end
|
||||||
|
if (string.find(nzm.name, "pipeworks:pipe_") ~= nil) then pzm=1 end
|
||||||
|
if (string.find(nzp.name, "pipeworks:pipe_") ~= nil) then pzp=1 end
|
||||||
|
|
||||||
|
for p in ipairs(pipes_devicelist) do
|
||||||
|
pdev = pipes_devicelist[p]
|
||||||
|
if (string.find(nxm.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
|
||||||
|
(string.find(nxm.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
|
||||||
|
(string.find(nxm.name, "pipeworks:"..pdev.."_x") ~= nil) then
|
||||||
|
pxm=1
|
||||||
|
end
|
||||||
|
|
||||||
|
if (string.find(nxp.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
|
||||||
|
(string.find(nxp.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
|
||||||
|
(string.find(nxp.name, "pipeworks:"..pdev.."_x") ~= nil) then
|
||||||
|
pxp=1
|
||||||
|
end
|
||||||
|
|
||||||
|
if (string.find(nzm.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
|
||||||
|
(string.find(nzm.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
|
||||||
|
(string.find(nzm.name, "pipeworks:"..pdev.."_z") ~= nil) then
|
||||||
|
pzm=1
|
||||||
|
end
|
||||||
|
|
||||||
|
if (string.find(nzp.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
|
||||||
|
(string.find(nzp.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
|
||||||
|
(string.find(nzp.name, "pipeworks:"..pdev.."_z") ~= nil) then
|
||||||
|
pzp=1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- storage tanks and intake grates have vertical connections
|
||||||
|
-- also, so they require a special case
|
||||||
|
|
||||||
|
if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
|
||||||
|
(string.find(nym.name, "pipeworks:intake") ~= nil) or
|
||||||
|
(string.find(nym.name, "pipeworks:outlet") ~= nil) then
|
||||||
|
pym=1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function pipe_look_for_stackable_tanks(pos)
|
||||||
|
tym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
|
||||||
|
|
||||||
|
if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or
|
||||||
|
string.find(tym.name, "pipeworks:expansion_tank_") ~= nil then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:expansion_tank_0"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
46
technic/pipeworks/changelog.txt
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
Changelog
|
||||||
|
---------
|
||||||
|
|
||||||
|
2012-08-24: Added square-ish pneumatic tubes, with their own autoplace code
|
||||||
|
(they do not connect to the steel pipes or their related devices).
|
||||||
|
|
||||||
|
2012-08-22: Added outlet grate, made it participate in autoplace algorithm.
|
||||||
|
Extended storage tank to show fill level in 10% steps (0% to 100%). Added
|
||||||
|
"expansion tank" that appears if the user stacks tanks upwards. (Downwards is
|
||||||
|
not checked).
|
||||||
|
|
||||||
|
2012-08-21: Made storage tank participate in autoplace algorithm. Tuned API a
|
||||||
|
little to allow for more flexible placement. Re-organized code a bit to allow
|
||||||
|
for some upcoming rules changes. Made storage tanks' upper/lower fittins and
|
||||||
|
intake grate participate in autoplace algorithm.
|
||||||
|
|
||||||
|
2012-08-20: Added temporary nodes for storage tank and intake grating, but
|
||||||
|
without autoplace.
|
||||||
|
|
||||||
|
2012-08-19: Pumps and valves now fully participate in the
|
||||||
|
auto-rotate/auto-place algorithm.
|
||||||
|
|
||||||
|
2012-08-18: Total rewrite again. All pipes are now nice and round-looking, and
|
||||||
|
they auto-connect! Also added temporary nodes for pump and valve (each with an
|
||||||
|
on/off setting - punch to change). No crafting recipes yet and the pipes still
|
||||||
|
don't do anything useful yet. Soon.
|
||||||
|
|
||||||
|
2012-08-06: Moved this changelog off the forum post and into a separate file.
|
||||||
|
|
||||||
|
2012-08-05 (multiple updates): Rewrote pipeworks to use loops and tables to
|
||||||
|
create the nodes. Requires far less code now. Added -X, +X, -Y, +Y, -Z, +Z
|
||||||
|
capped stubs and a short centered horizontal segment. Changed node definitions
|
||||||
|
so that the aforementioned "short centered" segment is given on dig/drop.
|
||||||
|
Renamed it to just "pipeworks:pipe" (and pipe_loaded). Added empty/loaded
|
||||||
|
indicator images to the capped ends, removed some redundant comments. Made the
|
||||||
|
empty/loaded indication at the capped end more prominent.
|
||||||
|
|
||||||
|
2012-07-21: Added screenshot showing pipes as they look now that nodebox
|
||||||
|
texture rotation is fixed.
|
||||||
|
|
||||||
|
2012-07-18: Changed the mod name and all internals to 'pipeworks' instead of
|
||||||
|
'pipes'... after a couple of mistakes :-)
|
||||||
|
|
||||||
|
2012-07-12: moved project to github.
|
||||||
|
|
||||||
|
2012-06-23: Initial release, followed by reworking the textures a bit.
|
94
technic/pipeworks/crafts.lua
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
-- Crafting recipes for pipeworks
|
||||||
|
|
||||||
|
-- If the technic mod is present, then don't bother registering these recipes
|
||||||
|
-- as that mod supplies its own.
|
||||||
|
|
||||||
|
if io.open(minetest.get_modpath("pipeworks").."/../technic/init.lua", "r") == nil then
|
||||||
|
|
||||||
|
-- If homedecor is not installed, we need to register a few of its crafts
|
||||||
|
-- manually so we can use them.
|
||||||
|
|
||||||
|
if minetest.get_modpath("homedecor") == nil then
|
||||||
|
|
||||||
|
minetest.register_craftitem(":homedecor:plastic_sheeting", {
|
||||||
|
description = "Plastic sheet",
|
||||||
|
inventory_image = "pipeworks_plastic_sheeting.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "homedecor:plastic_sheeting",
|
||||||
|
recipe = "default:junglegrass",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = 'fuel',
|
||||||
|
recipe = 'homedecor:plastic_sheeting',
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:pipe_110000_empty 12",
|
||||||
|
recipe = {
|
||||||
|
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
||||||
|
{ "", "", "" },
|
||||||
|
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:pump 2",
|
||||||
|
recipe = {
|
||||||
|
{ "default:stone", "default:stone", "default:stone" },
|
||||||
|
{ "default:steel_ingot", "default:stick", "default:steel_ingot" },
|
||||||
|
{ "default:stone", "default:stone", "default:stone" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:valve 2",
|
||||||
|
recipe = {
|
||||||
|
{ "", "default:stick", "" },
|
||||||
|
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
||||||
|
{ "", "default:steel_ingot", "" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:storage_tank 2",
|
||||||
|
recipe = {
|
||||||
|
{ "", "default:steel_ingot", "default:steel_ingot" },
|
||||||
|
{ "default:steel_ingot", "default:glass", "default:steel_ingot" },
|
||||||
|
{ "default:steel_ingot", "default:steel_ingot", "" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:intake 2",
|
||||||
|
recipe = {
|
||||||
|
{ "", "default:steel_ingot", "" },
|
||||||
|
{ "default:steel_ingot", "", "default:steel_ingot" },
|
||||||
|
{ "", "default:steel_ingot", "" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:outlet 2",
|
||||||
|
recipe = {
|
||||||
|
{ "default:steel_ingot", "", "default:steel_ingot" },
|
||||||
|
{ "", "default:steel_ingot", "" },
|
||||||
|
{ "default:steel_ingot", "", "default:steel_ingot" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:tube 12",
|
||||||
|
recipe = {
|
||||||
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
|
{ "", "", "" },
|
||||||
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
2
technic/pipeworks/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
|
471
technic/pipeworks/devices.lua
Normal file
@ -0,0 +1,471 @@
|
|||||||
|
-- List of devices that should participate in the autoplace algorithm
|
||||||
|
|
||||||
|
pipes_devicelist = {
|
||||||
|
"pump",
|
||||||
|
"valve",
|
||||||
|
"storage_tank_0",
|
||||||
|
"storage_tank_1",
|
||||||
|
"storage_tank_2",
|
||||||
|
"storage_tank_3",
|
||||||
|
"storage_tank_4",
|
||||||
|
"storage_tank_5",
|
||||||
|
"storage_tank_6",
|
||||||
|
"storage_tank_7",
|
||||||
|
"storage_tank_8",
|
||||||
|
"storage_tank_9",
|
||||||
|
"storage_tank_10"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- tables
|
||||||
|
|
||||||
|
minetest.register_alias("pipeworks:pump", "pipeworks:pump_off_x")
|
||||||
|
minetest.register_alias("pipeworks:valve", "pipeworks:valve_off_x")
|
||||||
|
minetest.register_alias("pipeworks:storage_tank", "pipeworks:storage_tank_0_x")
|
||||||
|
|
||||||
|
pipe_pumpbody_x = {
|
||||||
|
{ -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_pumpbody_z = {
|
||||||
|
{ -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvebody_x = {
|
||||||
|
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvebody_z = {
|
||||||
|
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvehandle_on_x = {
|
||||||
|
{ -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvehandle_on_z = {
|
||||||
|
{ -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvehandle_off_x = {
|
||||||
|
{ -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_valvehandle_off_z = {
|
||||||
|
{ -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Now define the nodes.
|
||||||
|
|
||||||
|
local states = { "on", "off" }
|
||||||
|
local dgroups = ""
|
||||||
|
|
||||||
|
for s in ipairs(states) do
|
||||||
|
|
||||||
|
if states[s] == "off" then
|
||||||
|
dgroups = {snappy=3, pipe=1}
|
||||||
|
else
|
||||||
|
dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
|
||||||
|
end
|
||||||
|
|
||||||
|
local pumpboxes = {}
|
||||||
|
pipe_addbox(pumpboxes, pipe_leftstub)
|
||||||
|
pipe_addbox(pumpboxes, pipe_pumpbody_x)
|
||||||
|
pipe_addbox(pumpboxes, pipe_rightstub)
|
||||||
|
local tilex = "pipeworks_pump_ends.png"
|
||||||
|
local tilez = "pipeworks_pump_"..states[s]..".png"
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:pump_"..states[s].."_x", {
|
||||||
|
description = "Pump Module ("..states[s]..")",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_pump_top_x.png",
|
||||||
|
"pipeworks_pump_sides.png",
|
||||||
|
tilex,
|
||||||
|
tilex,
|
||||||
|
"pipeworks_pump_sides.png",
|
||||||
|
tilez
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = pumpboxes
|
||||||
|
},
|
||||||
|
groups = dgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_device_autorotate(pos, states[s], "pipeworks:pump")
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
drop = "pipeworks:pump_off_x"
|
||||||
|
})
|
||||||
|
|
||||||
|
local pumpboxes = {}
|
||||||
|
pipe_addbox(pumpboxes, pipe_frontstub)
|
||||||
|
pipe_addbox(pumpboxes, pipe_pumpbody_z)
|
||||||
|
pipe_addbox(pumpboxes, pipe_backstub)
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:pump_"..states[s].."_z", {
|
||||||
|
description = "Pump Module ("..states[s]..", Z-axis)",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_pump_top_z.png",
|
||||||
|
"pipeworks_pump_sides.png",
|
||||||
|
tilez,
|
||||||
|
tilez,
|
||||||
|
"pipeworks_pump_sides.png",
|
||||||
|
tilex
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = pumpboxes
|
||||||
|
},
|
||||||
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_device_autorotate(pos, states[s], "pipeworks:pump")
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
drop = "pipeworks:pump_off_x"
|
||||||
|
})
|
||||||
|
|
||||||
|
local valveboxes = {}
|
||||||
|
pipe_addbox(valveboxes, pipe_leftstub)
|
||||||
|
pipe_addbox(valveboxes, pipe_valvebody_x)
|
||||||
|
if states[s] == "off" then
|
||||||
|
pipe_addbox(valveboxes, pipe_valvehandle_off_x)
|
||||||
|
else
|
||||||
|
pipe_addbox(valveboxes, pipe_valvehandle_on_x)
|
||||||
|
end
|
||||||
|
pipe_addbox(valveboxes, pipe_rightstub)
|
||||||
|
local tilex = "pipeworks_valvebody_ends.png"
|
||||||
|
local tilez = "pipeworks_valvebody_sides.png"
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:valve_"..states[s].."_x", {
|
||||||
|
description = "Valve ("..states[s]..")",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_valvebody_top_"..states[s].."_x.png",
|
||||||
|
"pipeworks_valvebody_bottom.png",
|
||||||
|
tilex,
|
||||||
|
tilex,
|
||||||
|
tilez,
|
||||||
|
tilez,
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = valveboxes
|
||||||
|
},
|
||||||
|
groups = dgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_device_autorotate(pos, states[s], "pipeworks:valve")
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
drop = "pipeworks:valve_off_x",
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local valveboxes = {}
|
||||||
|
pipe_addbox(valveboxes, pipe_frontstub)
|
||||||
|
pipe_addbox(valveboxes, pipe_valvebody_z)
|
||||||
|
if states[s] == "off" then
|
||||||
|
pipe_addbox(valveboxes, pipe_valvehandle_off_z)
|
||||||
|
else
|
||||||
|
pipe_addbox(valveboxes, pipe_valvehandle_on_z)
|
||||||
|
end
|
||||||
|
pipe_addbox(valveboxes, pipe_backstub)
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:valve_"..states[s].."_z", {
|
||||||
|
description = "Valve ("..states[s]..", Z-axis)",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_valvebody_top_"..states[s].."_z.png",
|
||||||
|
"pipeworks_valvebody_bottom.png",
|
||||||
|
tilez,
|
||||||
|
tilez,
|
||||||
|
tilex,
|
||||||
|
tilex,
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = valveboxes
|
||||||
|
},
|
||||||
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_device_autorotate(pos, states[s], "pipeworks:valve")
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
drop = "pipeworks:valve_off_x",
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- intake grate
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:intake", {
|
||||||
|
description = "Intake grate",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_intake_top.png",
|
||||||
|
"pipeworks_intake_sides.png",
|
||||||
|
"pipeworks_intake_sides.png",
|
||||||
|
"pipeworks_intake_sides.png",
|
||||||
|
"pipeworks_intake_sides.png",
|
||||||
|
"pipeworks_intake_sides.png"
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, pipe=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- outlet grate
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:outlet", {
|
||||||
|
description = "Outlet grate",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_outlet_top.png",
|
||||||
|
"pipeworks_outlet_sides.png",
|
||||||
|
"pipeworks_outlet_sides.png",
|
||||||
|
"pipeworks_outlet_sides.png",
|
||||||
|
"pipeworks_outlet_sides.png",
|
||||||
|
"pipeworks_outlet_sides.png"
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, pipe=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- tanks
|
||||||
|
|
||||||
|
for fill = 0, 10 do
|
||||||
|
if fill == 0 then
|
||||||
|
filldesc="empty"
|
||||||
|
sgroups = {snappy=3, pipe=1, tankfill=fill+1}
|
||||||
|
else
|
||||||
|
filldesc=fill.."0% full"
|
||||||
|
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:expansion_tank_"..fill, {
|
||||||
|
description = "Expansion Tank ("..filldesc..")... You hacker, you.",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_front_"..fill..".png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:storage_tank_"..fill.."_x",
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_look_for_stackable_tanks(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
pipelike=0,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",0)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:storage_tank_"..fill.."_x", {
|
||||||
|
description = "Fluid Storage Tank ("..filldesc..")",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_front_"..fill..".png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = sgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_look_for_stackable_tanks(pos)
|
||||||
|
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
|
||||||
|
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
|
||||||
|
end
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:storage_tank_"..fill.."_z", {
|
||||||
|
description = "Fluid Storage Tank (Z axis, "..filldesc..")... You hacker, you.",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_front_"..fill..".png",
|
||||||
|
"pipeworks_storage_tank_back.png",
|
||||||
|
"pipeworks_storage_tank_fittings.png",
|
||||||
|
"pipeworks_storage_tank_fittings.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:storage_tank_"..fill.."_x",
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_look_for_stackable_tanks(pos)
|
||||||
|
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
|
||||||
|
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
|
||||||
|
end
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- various actions
|
||||||
|
|
||||||
|
local axes = { "x", "z" }
|
||||||
|
|
||||||
|
for a in ipairs(axes) do
|
||||||
|
minetest.register_on_punchnode(function (pos, node)
|
||||||
|
if node.name=="pipeworks:valve_on_"..axes[a] then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:valve_off_"..axes[a] })
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",0)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function (pos, node)
|
||||||
|
if node.name=="pipeworks:valve_off_"..axes[a] then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:valve_on_"..axes[a] })
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function (pos, node)
|
||||||
|
if node.name=="pipeworks:pump_on_"..axes[a] then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:pump_off_"..axes[a] })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function (pos, node)
|
||||||
|
if node.name=="pipeworks:pump_off_"..axes[a] then
|
||||||
|
minetest.env:add_node(pos, { name = "pipeworks:pump_on_"..axes[a] })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
322
technic/pipeworks/init.lua
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
-- Pipeworks mod by Vanessa Ezekowitz - 2012-08-05
|
||||||
|
--
|
||||||
|
-- Entirely my own code. This mod supplies various shapes of pipes
|
||||||
|
-- and devices that they can connect to such as pumps, valves, etc.
|
||||||
|
-- All pipes autoconnect as you lay them out, and devices will auto-
|
||||||
|
-- connect to them.
|
||||||
|
--
|
||||||
|
-- License: WTFPL
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Un-comment the following dofile line to re-enable the old pipe nodes.
|
||||||
|
-- dofile(minetest.get_modpath("pipeworks").."/oldpipes.lua")
|
||||||
|
|
||||||
|
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
|
||||||
|
|
||||||
|
pipe_leftstub = {
|
||||||
|
{ -32/64, -2/64, -6/64, 1/64, 2/64, 6/64 }, -- pipe segment against -X face
|
||||||
|
{ -32/64, -4/64, -5/64, 1/64, 4/64, 5/64 },
|
||||||
|
{ -32/64, -5/64, -4/64, 1/64, 5/64, 4/64 },
|
||||||
|
{ -32/64, -6/64, -2/64, 1/64, 6/64, 2/64 },
|
||||||
|
|
||||||
|
{ -32/64, -3/64, -8/64, -30/64, 3/64, 8/64 }, -- (the flange for it)
|
||||||
|
{ -32/64, -5/64, -7/64, -30/64, 5/64, 7/64 },
|
||||||
|
{ -32/64, -6/64, -6/64, -30/64, 6/64, 6/64 },
|
||||||
|
{ -32/64, -7/64, -5/64, -30/64, 7/64, 5/64 },
|
||||||
|
{ -32/64, -8/64, -3/64, -30/64, 8/64, 3/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_rightstub = {
|
||||||
|
{ -1/64, -2/64, -6/64, 32/64, 2/64, 6/64 }, -- pipe segment against +X face
|
||||||
|
{ -1/64, -4/64, -5/64, 32/64, 4/64, 5/64 },
|
||||||
|
{ -1/64, -5/64, -4/64, 32/64, 5/64, 4/64 },
|
||||||
|
{ -1/64, -6/64, -2/64, 32/64, 6/64, 2/64 },
|
||||||
|
|
||||||
|
{ 30/64, -3/64, -8/64, 32/64, 3/64, 8/64 }, -- (the flange for it)
|
||||||
|
{ 30/64, -5/64, -7/64, 32/64, 5/64, 7/64 },
|
||||||
|
{ 30/64, -6/64, -6/64, 32/64, 6/64, 6/64 },
|
||||||
|
{ 30/64, -7/64, -5/64, 32/64, 7/64, 5/64 },
|
||||||
|
{ 30/64, -8/64, -3/64, 32/64, 8/64, 3/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_bottomstub = {
|
||||||
|
{ -2/64, -32/64, -6/64, 2/64, 1/64, 6/64 }, -- pipe segment against -Y face
|
||||||
|
{ -4/64, -32/64, -5/64, 4/64, 1/64, 5/64 },
|
||||||
|
{ -5/64, -32/64, -4/64, 5/64, 1/64, 4/64 },
|
||||||
|
{ -6/64, -32/64, -2/64, 6/64, 1/64, 2/64 },
|
||||||
|
|
||||||
|
{ -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 }, -- (the flange for it)
|
||||||
|
{ -5/64, -32/64, -7/64, 5/64, -30/64, 7/64 },
|
||||||
|
{ -6/64, -32/64, -6/64, 6/64, -30/64, 6/64 },
|
||||||
|
{ -7/64, -32/64, -5/64, 7/64, -30/64, 5/64 },
|
||||||
|
{ -8/64, -32/64, -3/64, 8/64, -30/64, 3/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pipe_topstub = {
|
||||||
|
{ -2/64, -1/64, -6/64, 2/64, 32/64, 6/64 }, -- pipe segment against +Y face
|
||||||
|
{ -4/64, -1/64, -5/64, 4/64, 32/64, 5/64 },
|
||||||
|
{ -5/64, -1/64, -4/64, 5/64, 32/64, 4/64 },
|
||||||
|
{ -6/64, -1/64, -2/64, 6/64, 32/64, 2/64 },
|
||||||
|
|
||||||
|
{ -3/64, 30/64, -8/64, 3/64, 32/64, 8/64 }, -- (the flange for it)
|
||||||
|
{ -5/64, 30/64, -7/64, 5/64, 32/64, 7/64 },
|
||||||
|
{ -6/64, 30/64, -6/64, 6/64, 32/64, 6/64 },
|
||||||
|
{ -7/64, 30/64, -5/64, 7/64, 32/64, 5/64 },
|
||||||
|
{ -8/64, 30/64, -3/64, 8/64, 32/64, 3/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_frontstub = {
|
||||||
|
{ -6/64, -2/64, -32/64, 6/64, 2/64, 1/64 }, -- pipe segment against -Z face
|
||||||
|
{ -5/64, -4/64, -32/64, 5/64, 4/64, 1/64 },
|
||||||
|
{ -4/64, -5/64, -32/64, 4/64, 5/64, 1/64 },
|
||||||
|
{ -2/64, -6/64, -32/64, 2/64, 6/64, 1/64 },
|
||||||
|
|
||||||
|
{ -8/64, -3/64, -32/64, 8/64, 3/64, -30/64 }, -- (the flange for it)
|
||||||
|
{ -7/64, -5/64, -32/64, 7/64, 5/64, -30/64 },
|
||||||
|
{ -6/64, -6/64, -32/64, 6/64, 6/64, -30/64 },
|
||||||
|
{ -5/64, -7/64, -32/64, 5/64, 7/64, -30/64 },
|
||||||
|
{ -3/64, -8/64, -32/64, 3/64, 8/64, -30/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_backstub = {
|
||||||
|
{ -6/64, -2/64, -1/64, 6/64, 2/64, 32/64 }, -- pipe segment against -Z face
|
||||||
|
{ -5/64, -4/64, -1/64, 5/64, 4/64, 32/64 },
|
||||||
|
{ -4/64, -5/64, -1/64, 4/64, 5/64, 32/64 },
|
||||||
|
{ -2/64, -6/64, -1/64, 2/64, 6/64, 32/64 },
|
||||||
|
|
||||||
|
{ -8/64, -3/64, 30/64, 8/64, 3/64, 32/64 }, -- (the flange for it)
|
||||||
|
{ -7/64, -5/64, 30/64, 7/64, 5/64, 32/64 },
|
||||||
|
{ -6/64, -6/64, 30/64, 6/64, 6/64, 32/64 },
|
||||||
|
{ -5/64, -7/64, 30/64, 5/64, 7/64, 32/64 },
|
||||||
|
{ -3/64, -8/64, 30/64, 3/64, 8/64, 32/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_selectboxes = {
|
||||||
|
{ -32/64, -8/64, -8/64, 8/64, 8/64, 8/64 },
|
||||||
|
{ -8/64 , -8/64, -8/64, 32/64, 8/64, 8/64 },
|
||||||
|
{ -8/64 , -32/64, -8/64, 8/64, 8/64, 8/64 },
|
||||||
|
{ -8/64 , -8/64, -8/64, 8/64, 32/64, 8/64 },
|
||||||
|
{ -8/64 , -8/64, -32/64, 8/64, 8/64, 8/64 },
|
||||||
|
{ -8/64 , -8/64, -8/64, 8/64, 8/64, 32/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_bendsphere = {
|
||||||
|
{ -4/64, -4/64, -4/64, 4/64, 4/64, 4/64 },
|
||||||
|
{ -5/64, -3/64, -3/64, 5/64, 3/64, 3/64 },
|
||||||
|
{ -3/64, -5/64, -3/64, 3/64, 5/64, 3/64 },
|
||||||
|
{ -3/64, -3/64, -5/64, 3/64, 3/64, 5/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Functions
|
||||||
|
|
||||||
|
dbg = function(s)
|
||||||
|
if DEBUG == 1 then
|
||||||
|
print('[PIPEWORKS] ' .. s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function pipes_fix_image_names(table, replacement)
|
||||||
|
outtable={}
|
||||||
|
for i in ipairs(table) do
|
||||||
|
outtable[i]=string.gsub(table[i], "_XXXXX", replacement)
|
||||||
|
end
|
||||||
|
|
||||||
|
return outtable
|
||||||
|
end
|
||||||
|
|
||||||
|
function pipe_addbox(t, b)
|
||||||
|
for i in ipairs(b)
|
||||||
|
do table.insert(t, b[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- now define the nodes!
|
||||||
|
|
||||||
|
for xm = 0, 1 do
|
||||||
|
for xp = 0, 1 do
|
||||||
|
for ym = 0, 1 do
|
||||||
|
for yp = 0, 1 do
|
||||||
|
for zm = 0, 1 do
|
||||||
|
for zp = 0, 1 do
|
||||||
|
local outboxes = {}
|
||||||
|
local outsel = {}
|
||||||
|
local outimgs = {}
|
||||||
|
|
||||||
|
if yp==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_topstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[4])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
if ym==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_bottomstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[3])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
if xp==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_rightstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[2])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
if xm==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_leftstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[1])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
if zp==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_backstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[6])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
if zm==1 then
|
||||||
|
pipe_addbox(outboxes, pipe_frontstub)
|
||||||
|
table.insert(outsel, pipe_selectboxes[5])
|
||||||
|
table.insert(outimgs, "pipeworks_pipe_end.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_plain.png")
|
||||||
|
end
|
||||||
|
|
||||||
|
local jx = xp+xm
|
||||||
|
local jy = yp+ym
|
||||||
|
local jz = zp+zm
|
||||||
|
|
||||||
|
if (jx+jy+jz) == 1 then
|
||||||
|
if xm == 1 then
|
||||||
|
table.remove(outimgs, 3)
|
||||||
|
table.insert(outimgs, 3, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
if xp == 1 then
|
||||||
|
table.remove(outimgs, 4)
|
||||||
|
table.insert(outimgs, 4, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
if ym == 1 then
|
||||||
|
table.remove(outimgs, 1)
|
||||||
|
table.insert(outimgs, 1, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
if xp == 1 then
|
||||||
|
table.remove(outimgs, 2)
|
||||||
|
table.insert(outimgs, 2, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
if zm == 1 then
|
||||||
|
table.remove(outimgs, 5)
|
||||||
|
table.insert(outimgs, 5, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
if zp == 1 then
|
||||||
|
table.remove(outimgs, 6)
|
||||||
|
table.insert(outimgs, 6, "pipeworks_pipe_end_XXXXX.png")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (jx==1 and jy==1 and jz~=1) or (jx==1 and jy~=1 and jz==1) or (jx~= 1 and jy==1 and jz==1) then
|
||||||
|
pipe_addbox(outboxes, pipe_bendsphere)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (jx==2 and jy~=2 and jz~=2) then
|
||||||
|
table.remove(outimgs, 5)
|
||||||
|
table.remove(outimgs, 5)
|
||||||
|
table.insert(outimgs, 5, "pipeworks_windowed_XXXXX.png")
|
||||||
|
table.insert(outimgs, 5, "pipeworks_windowed_XXXXX.png")
|
||||||
|
end
|
||||||
|
|
||||||
|
if (jx~=2 and jy~=2 and jz==2) or (jx~=2 and jy==2 and jz~=2) then
|
||||||
|
table.remove(outimgs, 3)
|
||||||
|
table.remove(outimgs, 3)
|
||||||
|
table.insert(outimgs, 3, "pipeworks_windowed_XXXXX.png")
|
||||||
|
table.insert(outimgs, 3, "pipeworks_windowed_XXXXX.png")
|
||||||
|
end
|
||||||
|
|
||||||
|
local pname = xm..xp..ym..yp..zm..zp
|
||||||
|
local pgroups = ""
|
||||||
|
|
||||||
|
if pname ~= "110000" then
|
||||||
|
pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
|
||||||
|
pipedesc = "Pipe segment (empty, "..pname..")... You hacker, you."
|
||||||
|
else
|
||||||
|
pgroups = {snappy=3, pipe=1}
|
||||||
|
pipedesc = "Pipe segment"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:pipe_"..pname.."_empty", {
|
||||||
|
description = pipedesc,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = pipes_fix_image_names(outimgs, "_empty"),
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outsel
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outboxes
|
||||||
|
},
|
||||||
|
groups = pgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:pipe_110000_empty",
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:pipe_"..pname.."_loaded", {
|
||||||
|
description = "Pipe segment (loaded, "..pname..")... You hacker, you.",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = pipes_fix_image_names(outimgs, "_loaded"),
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outsel
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outboxes
|
||||||
|
},
|
||||||
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:pipe_110000_loaded",
|
||||||
|
pipelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("pipelike",1)
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
pipe_scanforobjects(pos)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath("pipeworks").."/tubes.lua")
|
||||||
|
dofile(minetest.get_modpath("pipeworks").."/devices.lua")
|
||||||
|
dofile(minetest.get_modpath("pipeworks").."/autoplace.lua")
|
||||||
|
dofile(minetest.get_modpath("pipeworks").."/crafts.lua")
|
||||||
|
|
||||||
|
print("Pipeworks loaded!")
|
360
technic/pipeworks/oldpipes.lua
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
-- This file is basically most of the old init.lua and only supplies the
|
||||||
|
-- old nodes created by the previous verison of Pipeworks.
|
||||||
|
--
|
||||||
|
-- License: WTFPL
|
||||||
|
--
|
||||||
|
|
||||||
|
local nodenames = {
|
||||||
|
"vertical",
|
||||||
|
"horizontal",
|
||||||
|
"junction_xy",
|
||||||
|
"junction_xz",
|
||||||
|
"bend_xy_down",
|
||||||
|
"bend_xy_up",
|
||||||
|
"bend_xz",
|
||||||
|
"crossing_xz",
|
||||||
|
"crossing_xy",
|
||||||
|
"crossing_xyz",
|
||||||
|
"pipe_segment",
|
||||||
|
"cap_neg_x",
|
||||||
|
"cap_pos_x",
|
||||||
|
"cap_neg_y",
|
||||||
|
"cap_pos_y",
|
||||||
|
"cap_neg_z",
|
||||||
|
"cap_pos_z"
|
||||||
|
}
|
||||||
|
|
||||||
|
local descriptions = {
|
||||||
|
"vertical",
|
||||||
|
"horizontal",
|
||||||
|
"junction between X and Y axes",
|
||||||
|
"junction between X and Z axes",
|
||||||
|
"downward bend between X and Y axes",
|
||||||
|
"upward bend between X and Y axes",
|
||||||
|
"bend between X/Z axes",
|
||||||
|
"4-way crossing between X and Z axes",
|
||||||
|
"4-way crossing between X/Z and Y axes",
|
||||||
|
"6-way crossing",
|
||||||
|
"basic segment",
|
||||||
|
"capped, negative X half only",
|
||||||
|
"capped, positive X half only",
|
||||||
|
"capped, negative Y half only",
|
||||||
|
"capped, positive Y half only",
|
||||||
|
"capped, negative Z half only",
|
||||||
|
"capped, positive Z half only"
|
||||||
|
}
|
||||||
|
|
||||||
|
local nodeimages = {
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_plain.png"},
|
||||||
|
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png"},
|
||||||
|
|
||||||
|
{"pipeworks_plain.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png"},
|
||||||
|
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png"},
|
||||||
|
|
||||||
|
-- horizontal short segment
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_plain.png",
|
||||||
|
"pipeworks_plain.png"},
|
||||||
|
|
||||||
|
-- capped
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png"},
|
||||||
|
|
||||||
|
{"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png",
|
||||||
|
"pipeworks_pipe_end.png",
|
||||||
|
"pipeworks_windowed_XXXXX.png"},
|
||||||
|
}
|
||||||
|
|
||||||
|
local selectionboxes = {
|
||||||
|
{ -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 },
|
||||||
|
{ -0.5, -0.15, -0.15, 0.5, 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.5, -0.15, 0.5, 0.5, 0.15 },
|
||||||
|
{ -0.5, -0.15, -0.15, 0.5, 0.15, 0.5 },
|
||||||
|
{ -0.15, -0.5, -0.15, 0.5, 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.15, -0.15, 0.5, 0.5, 0.15 },
|
||||||
|
{ -0.15, -0.15, -0.15, 0.5, 0.15, 0.5 },
|
||||||
|
{ -0.5, -0.15, -0.5, 0.5, 0.15, 0.5 },
|
||||||
|
{ -0.5, -0.5, -0.15, 0.5, 0.5, 0.15 },
|
||||||
|
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||||
|
{ -0.3, -0.15, -0.15, 0.3, 0.15, 0.15 },
|
||||||
|
{ -0.5, -0.15, -0.15, 0, 0.15, 0.15 },
|
||||||
|
{ 0, -0.15, -0.15, 0.5, 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.5, -0.15, 0.15, 0, 0.15 },
|
||||||
|
{ -0.15, 0, -0.15, 0.15, 0.5, 0.15 },
|
||||||
|
{ -0.15, -0.15, -0.5, 0.15, 0.15, 0 },
|
||||||
|
{ -0.15, -0.15, 0, 0.15, 0.15, 0.5 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local nodeboxes = {
|
||||||
|
{{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical
|
||||||
|
{ -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
|
||||||
|
{ -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- horizontal
|
||||||
|
{ -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical with X/Z junction
|
||||||
|
{ -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
|
||||||
|
{ -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
|
||||||
|
{ 0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- horizontal with X/Z junction
|
||||||
|
{ -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
|
||||||
|
{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
|
||||||
|
{ -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- bend down from X/Z to Y axis
|
||||||
|
{ -0.1 , -0.45, -0.1 , 0.1 , 0.1 , 0.1 },
|
||||||
|
{ -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.15, 0.45 , -0.15, 0.15, 0.5, 0.15 }, -- bend up from X/Z to Y axis
|
||||||
|
{ -0.1 , -0.1 , -0.1 , 0.1 , 0.45, 0.1 },
|
||||||
|
{ -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- bend between X and Z axes
|
||||||
|
{ -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
|
||||||
|
{ -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 4-way crossing between X and Z axes
|
||||||
|
{ -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
|
||||||
|
{ -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
|
||||||
|
{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- 4-way crossing between X/Z and Y axes
|
||||||
|
{ -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
|
||||||
|
{ -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
|
||||||
|
{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
|
||||||
|
{ -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 6-way crossing (all 3 axes)
|
||||||
|
{ -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
|
||||||
|
{ 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
|
||||||
|
{ -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
|
||||||
|
{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 },
|
||||||
|
{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 },
|
||||||
|
{ -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
|
||||||
|
{ -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.3 , -0.15, -0.15, -0.25, 0.15, 0.15 }, -- main center segment
|
||||||
|
{ -0.25, -0.1 , -0.1 , 0.25, 0.1 , 0.1 },
|
||||||
|
{ 0.25, -0.15, -0.15, 0.3 , 0.15, 0.15 }},
|
||||||
|
|
||||||
|
{{ -0.5, -0.15, -0.15, -0.45, 0.15, 0.15 }, -- anchored at -X
|
||||||
|
{ -0.45, -0.1, -0.1, -0.2, 0.1, 0.1 },
|
||||||
|
{ -0.2, -0.15, -0.15, -0.15, 0.15, 0.15 },
|
||||||
|
{ -0.15, -0.12, -0.12, -0.1, 0.12, 0.12 },
|
||||||
|
{ -0.1, -0.08, -0.08, -0.05, 0.08, 0.08 },
|
||||||
|
{ -0.05, -0.04, -0.04, 0, 0.04, 0.04 }},
|
||||||
|
|
||||||
|
{{ 0.45, -0.15, -0.15, 0.5, 0.15, 0.15 }, -- anchored at +X
|
||||||
|
{ 0.2, -0.1, -0.1, 0.45, 0.1, 0.1 },
|
||||||
|
{ 0.15, -0.15, -0.15, 0.2, 0.15, 0.15 },
|
||||||
|
{ 0.1, -0.12, -0.12, 0.15, 0.12, 0.12 },
|
||||||
|
{ 0.05, -0.08, -0.08, 0.1, 0.08, 0.08 },
|
||||||
|
{ 0, -0.04, -0.04, 0.05, 0.04, 0.04 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.5, -0.15, 0.15, -0.45, 0.15 }, -- anchored at -Y
|
||||||
|
{ -0.1, -0.45, -0.1, 0.1, -0.2, 0.1 },
|
||||||
|
{ -0.15, -0.2, -0.15, 0.15, -0.15, 0.15 },
|
||||||
|
{ -0.12, -0.15, -0.12, 0.12, -0.1, 0.12 },
|
||||||
|
{ -0.08, -0.1, -0.08, 0.08, -0.05, 0.08 },
|
||||||
|
{ -0.04, -0.05, -0.04, 0.04, 0, 0.04 }},
|
||||||
|
|
||||||
|
{{ -0.15, 0.45, -0.15, 0.15, 0.5, 0.15 }, -- anchored at +Y
|
||||||
|
{ -0.1, 0.2, -0.1, 0.1, 0.45, 0.1 },
|
||||||
|
{ -0.15, 0.15, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
{ -0.12, 0.1, -0.12, 0.12, 0.15, 0.12 },
|
||||||
|
{ -0.08, 0.05, -0.08, 0.08, 0.1, 0.08 } ,
|
||||||
|
{ -0.04, 0, -0.04, 0.04, 0.05, 0.04 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.15, -0.5, 0.15, 0.15, -0.45 }, -- anchored at -Z
|
||||||
|
{ -0.1, -0.1, -0.45, 0.1, 0.1, -0.2 },
|
||||||
|
{ -0.15, -0.15, -0.2, 0.15, 0.15, -0.15 },
|
||||||
|
{ -0.12, -0.12, -0.15, 0.12, 0.12, -0.1 },
|
||||||
|
{ -0.08, -0.08, -0.1, 0.08, 0.08, -0.05 },
|
||||||
|
{ -0.04, -0.04, -0.05, 0.04, 0.04, 0 }},
|
||||||
|
|
||||||
|
{{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- anchored at +Z
|
||||||
|
{ -0.1, -0.1, 0.2, 0.1, 0.1, 0.45 },
|
||||||
|
{ -0.15, -0.15, 0.15, 0.15, 0.15, 0.2 },
|
||||||
|
{ -0.12, -0.12, 0.1, 0.12, 0.12, 0.15 },
|
||||||
|
{ -0.08, -0.08, 0.05, 0.08, 0.08, 0.1 },
|
||||||
|
{ -0.04, -0.04, 0, 0.04, 0.04, 0.05 }},
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_image_names(node, replacement)
|
||||||
|
outtable={}
|
||||||
|
for i in ipairs(nodeimages[node]) do
|
||||||
|
outtable[i]=string.gsub(nodeimages[node][i], "_XXXXX", replacement)
|
||||||
|
end
|
||||||
|
|
||||||
|
return outtable
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Now define the actual nodes
|
||||||
|
|
||||||
|
for node in ipairs(nodenames) do
|
||||||
|
|
||||||
|
if node ~= 2 then
|
||||||
|
pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
|
||||||
|
else
|
||||||
|
pgroups = {snappy=3, pipe=1}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:"..nodenames[node], {
|
||||||
|
description = "Empty Pipe ("..descriptions[node]..")",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = fix_image_names(node, "_empty"),
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = selectionboxes[node],
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = nodeboxes[node]
|
||||||
|
},
|
||||||
|
groups = pgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:pipe"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:"..nodenames[node].."_loaded", {
|
||||||
|
description = "Loaded Pipe ("..descriptions[node]..")",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = fix_image_names(node, "_loaded"),
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = selectionboxes[node],
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = nodeboxes[node]
|
||||||
|
},
|
||||||
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:pipe"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
BIN
technic/pipeworks/textures/pipeworks_intake_sides.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
technic/pipeworks/textures/pipeworks_intake_top.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_outlet_sides.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_outlet_top.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
technic/pipeworks/textures/pipeworks_pipe_end.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
technic/pipeworks/textures/pipeworks_pipe_end_empty.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
technic/pipeworks/textures/pipeworks_pipe_end_loaded.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
technic/pipeworks/textures/pipeworks_plain.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
technic/pipeworks/textures/pipeworks_plastic_sheeting.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
technic/pipeworks/textures/pipeworks_pump_ends.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
technic/pipeworks/textures/pipeworks_pump_off.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
technic/pipeworks/textures/pipeworks_pump_on.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
technic/pipeworks/textures/pipeworks_pump_sides.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
technic/pipeworks/textures/pipeworks_pump_top_x.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
technic/pipeworks/textures/pipeworks_pump_top_z.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_back.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_fittings.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_0.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_1.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_10.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_2.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_3.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_4.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_5.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_6.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_7.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_8.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_storage_tank_front_9.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_testobject.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_end.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_inv.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_noctr.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_plain.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_short.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
technic/pipeworks/textures/pipeworks_tube_transparent.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
technic/pipeworks/textures/pipeworks_valvebody_bottom.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_ends.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_sides.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_off.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_off_x.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_off_z.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_on.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_on_x.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
technic/pipeworks/textures/pipeworks_valvebody_top_on_z.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
technic/pipeworks/textures/pipeworks_windowed_empty.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
technic/pipeworks/textures/pipeworks_windowed_loaded.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
217
technic/pipeworks/tubes.lua
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
-- This file supplies pneumatic tubes and a 'test' device
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:testobject", {
|
||||||
|
description = "Pneumatic tube test ojbect",
|
||||||
|
tiles = {
|
||||||
|
"pipeworks_testobject.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, tubedevice=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- tables
|
||||||
|
|
||||||
|
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
|
||||||
|
|
||||||
|
tube_leftstub = {
|
||||||
|
{ -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -X face
|
||||||
|
}
|
||||||
|
|
||||||
|
tube_rightstub = {
|
||||||
|
{ -9/64, -9/64, -9/64, 32/64, 9/64, 9/64 }, -- tube segment against +X face
|
||||||
|
}
|
||||||
|
|
||||||
|
tube_bottomstub = {
|
||||||
|
{ -9/64, -32/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -Y face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tube_topstub = {
|
||||||
|
{ -9/64, -9/64, -9/64, 9/64, 32/64, 9/64 }, -- tube segment against +Y face
|
||||||
|
}
|
||||||
|
|
||||||
|
tube_frontstub = {
|
||||||
|
{ -9/64, -9/64, -32/64, 9/64, 9/64, 9/64 }, -- tube segment against -Z face
|
||||||
|
}
|
||||||
|
|
||||||
|
tube_backstub = {
|
||||||
|
{ -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face
|
||||||
|
}
|
||||||
|
|
||||||
|
tube_selectboxes = {
|
||||||
|
{ -32/64, -10/64, -10/64, 10/64, 10/64, 10/64 },
|
||||||
|
{ -10/64 , -10/64, -10/64, 32/64, 10/64, 10/64 },
|
||||||
|
{ -10/64 , -32/64, -10/64, 10/64, 10/64, 10/64 },
|
||||||
|
{ -10/64 , -10/64, -10/64, 10/64, 32/64, 10/64 },
|
||||||
|
{ -10/64 , -10/64, -32/64, 10/64, 10/64, 10/64 },
|
||||||
|
{ -10/64 , -10/64, -10/64, 10/64, 10/64, 32/64 }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Functions
|
||||||
|
|
||||||
|
function tube_addbox(t, b)
|
||||||
|
for i in ipairs(b)
|
||||||
|
do table.insert(t, b[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- now define the nodes!
|
||||||
|
|
||||||
|
for xm = 0, 1 do
|
||||||
|
for xp = 0, 1 do
|
||||||
|
for ym = 0, 1 do
|
||||||
|
for yp = 0, 1 do
|
||||||
|
for zm = 0, 1 do
|
||||||
|
for zp = 0, 1 do
|
||||||
|
local outboxes = {}
|
||||||
|
local outsel = {}
|
||||||
|
local outimgs = {}
|
||||||
|
|
||||||
|
if yp==1 then
|
||||||
|
tube_addbox(outboxes, tube_topstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[4])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
if ym==1 then
|
||||||
|
tube_addbox(outboxes, tube_bottomstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[3])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
if xp==1 then
|
||||||
|
tube_addbox(outboxes, tube_rightstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[2])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
if xm==1 then
|
||||||
|
tube_addbox(outboxes, tube_leftstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[1])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
if zp==1 then
|
||||||
|
tube_addbox(outboxes, tube_backstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[6])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
if zm==1 then
|
||||||
|
tube_addbox(outboxes, tube_frontstub)
|
||||||
|
table.insert(outsel, tube_selectboxes[5])
|
||||||
|
table.insert(outimgs, "pipeworks_tube_noctr.png")
|
||||||
|
else
|
||||||
|
table.insert(outimgs, "pipeworks_tube_plain.png")
|
||||||
|
end
|
||||||
|
|
||||||
|
local jx = xp+xm
|
||||||
|
local jy = yp+ym
|
||||||
|
local jz = zp+zm
|
||||||
|
|
||||||
|
if (jx+jy+jz) == 1 then
|
||||||
|
if xm == 1 then
|
||||||
|
table.remove(outimgs, 3)
|
||||||
|
table.insert(outimgs, 3, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
if xp == 1 then
|
||||||
|
table.remove(outimgs, 4)
|
||||||
|
table.insert(outimgs, 4, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
if ym == 1 then
|
||||||
|
table.remove(outimgs, 1)
|
||||||
|
table.insert(outimgs, 1, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
if xp == 1 then
|
||||||
|
table.remove(outimgs, 2)
|
||||||
|
table.insert(outimgs, 2, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
if zm == 1 then
|
||||||
|
table.remove(outimgs, 5)
|
||||||
|
table.insert(outimgs, 5, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
if zp == 1 then
|
||||||
|
table.remove(outimgs, 6)
|
||||||
|
table.insert(outimgs, 6, "pipeworks_tube_end.png")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local tname = xm..xp..ym..yp..zm..zp
|
||||||
|
local tgroups = ""
|
||||||
|
|
||||||
|
if tname ~= "000000" then
|
||||||
|
tgroups = {snappy=3, tube=1, not_in_creative_inventory=1}
|
||||||
|
tubedesc = "Pneumatic tube segment ("..tname..")... You hacker, you."
|
||||||
|
iimg=nil
|
||||||
|
wscale = {x=1,y=1,z=1}
|
||||||
|
else
|
||||||
|
tgroups = {snappy=3, tube=1}
|
||||||
|
tubedesc = "Pneumatic tube segment"
|
||||||
|
iimg="pipeworks_tube_inv.png"
|
||||||
|
outimgs = {
|
||||||
|
"pipeworks_tube_short.png",
|
||||||
|
"pipeworks_tube_short.png",
|
||||||
|
"pipeworks_tube_end.png",
|
||||||
|
"pipeworks_tube_end.png",
|
||||||
|
"pipeworks_tube_short.png",
|
||||||
|
"pipeworks_tube_short.png"
|
||||||
|
}
|
||||||
|
outboxes = { -24/64, -9/64, -9/64, 24/64, 9/64, 9/64 }
|
||||||
|
outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
|
||||||
|
wscale = {x=1,y=1,z=0.01}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("pipeworks:tube_"..tname, {
|
||||||
|
description = tubedesc,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = outimgs,
|
||||||
|
inventory_image=iimg,
|
||||||
|
wield_image=iimg,
|
||||||
|
wield_scale=wscale,
|
||||||
|
paramtype = "light",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outsel
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = outboxes
|
||||||
|
},
|
||||||
|
groups = tgroups,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
walkable = true,
|
||||||
|
stack_max = 99,
|
||||||
|
drop = "pipeworks:tube_000000",
|
||||||
|
tubelike=1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_int("tubelike",1)
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -19,6 +19,16 @@ alloy_recipes[registered_recipes_count].src2_count=count1
|
|||||||
alloy_recipes[registered_recipes_count].dst_name=string3
|
alloy_recipes[registered_recipes_count].dst_name=string3
|
||||||
alloy_recipes[registered_recipes_count].dst_count=count3
|
alloy_recipes[registered_recipes_count].dst_count=count3
|
||||||
registered_recipes_count=registered_recipes_count+1
|
registered_recipes_count=registered_recipes_count+1
|
||||||
|
if UI_recipes_hook then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "alloy",
|
||||||
|
output = string3.." "..count3,
|
||||||
|
recipe = {
|
||||||
|
{string1.." "..count1},
|
||||||
|
{string2.." "..count2},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4)
|
register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4)
|
||||||
@ -26,7 +36,7 @@ register_alloy_recipe ("moreores:copper_ingot",3, "moreores:tin_ingot",1, "moreo
|
|||||||
register_alloy_recipe ("technic:iron_dust",3, "technic:chromium_dust",1, "technic:stainless_steel_dust",4)
|
register_alloy_recipe ("technic:iron_dust",3, "technic:chromium_dust",1, "technic:stainless_steel_dust",4)
|
||||||
register_alloy_recipe ("default:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4)
|
register_alloy_recipe ("default:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4)
|
||||||
register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3)
|
register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3)
|
||||||
register_alloy_recipe ("technic:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3)
|
register_alloy_recipe ("moreores:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3)
|
||||||
register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1)
|
register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1)
|
||||||
register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",1, "technic:doped_silicon_wafer",1)
|
register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",1, "technic:doped_silicon_wafer",1)
|
||||||
|
|
||||||
@ -421,4 +431,4 @@ minetest.register_abm({
|
|||||||
inv:set_stack("fuel", 1, stack)
|
inv:set_stack("fuel", 1, stack)
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
@ -206,7 +206,7 @@ minetest.register_abm({
|
|||||||
MV_nodes[1].y=pos1.y
|
MV_nodes[1].y=pos1.y
|
||||||
MV_nodes[1].z=pos1.z
|
MV_nodes[1].z=pos1.z
|
||||||
MV_nodes[1].visited=false
|
MV_nodes[1].visited=false
|
||||||
|
|
||||||
table_index=1
|
table_index=1
|
||||||
repeat
|
repeat
|
||||||
check_MV_node (PR_nodes,RE_nodes,MV_nodes,table_index)
|
check_MV_node (PR_nodes,RE_nodes,MV_nodes,table_index)
|
||||||
@ -318,4 +318,4 @@ meta = minetest.env:get_meta(pos1)
|
|||||||
if meta:get_float("mv_cablelike")==1 then new_node_added=add_new_MVcable_node(MV_nodes,pos1) end
|
if meta:get_float("mv_cablelike")==1 then new_node_added=add_new_MVcable_node(MV_nodes,pos1) end
|
||||||
if minetest.env:get_node(pos1).name == "technic:solar_panel_mv" then new_node_added=add_new_MVcable_node(PR_nodes,pos1) end
|
if minetest.env:get_node(pos1).name == "technic:solar_panel_mv" then new_node_added=add_new_MVcable_node(PR_nodes,pos1) end
|
||||||
end
|
end
|
||||||
|
|
@ -29,33 +29,32 @@ minetest.register_tool("technic:water_can", {
|
|||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return end
|
return end
|
||||||
|
|
||||||
n = minetest.env:get_node(pointed_thing.under)
|
n = minetest.env:get_node(pointed_thing.under)
|
||||||
|
|
||||||
|
item=itemstack:to_table()
|
||||||
|
local load=nil
|
||||||
|
if item["metadata"]=="" then load=0
|
||||||
|
else load=tonumber(item["metadata"])
|
||||||
|
end
|
||||||
|
|
||||||
if n.name == "default:water_source" then
|
if n.name == "default:water_source" then
|
||||||
item=itemstack:to_table()
|
|
||||||
local load=tonumber((item["wear"]))
|
|
||||||
if load==0 then load =65535 end
|
|
||||||
load=get_RE_item_load(load,water_can_max_load)
|
|
||||||
if load+1<17 then
|
if load+1<17 then
|
||||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||||
load=load+1;
|
load=load+1;
|
||||||
load=set_RE_item_load(load,water_can_max_load)
|
item["metadata"]=tostring(load)
|
||||||
item["wear"]=tostring(load)
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
itemstack:replace(item)
|
itemstack:replace(item)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
item=itemstack:to_table()
|
item=itemstack:to_table()
|
||||||
load=tonumber((item["wear"]))
|
if load==0 then return end
|
||||||
if load==0 then load =65535 end
|
|
||||||
load=get_RE_item_load(load,water_can_max_load)
|
|
||||||
if load==0 then return end
|
|
||||||
|
|
||||||
if n.name == "default:water_flowing" then
|
if n.name == "default:water_flowing" then
|
||||||
minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
|
minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
|
||||||
load=load-1;
|
load=load-1;
|
||||||
load=set_RE_item_load(load,water_can_max_load)
|
item["metadata"]=tostring(load)
|
||||||
item["wear"]=tostring(load)
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
itemstack:replace(item)
|
itemstack:replace(item)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -64,8 +63,8 @@ minetest.register_tool("technic:water_can", {
|
|||||||
if n.name == "air" then
|
if n.name == "air" then
|
||||||
minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
|
minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
|
||||||
load=load-1;
|
load=load-1;
|
||||||
load=set_RE_item_load(load,water_can_max_load)
|
item["metadata"]=tostring(load)
|
||||||
item["wear"]=tostring(load)
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
itemstack:replace(item)
|
itemstack:replace(item)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -78,7 +77,45 @@ minetest.register_tool("technic:lava_can", {
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
|
item=itemstack:to_table()
|
||||||
|
local load=nil
|
||||||
|
if item["metadata"]=="" then load=0
|
||||||
|
else load=tonumber(item["metadata"])
|
||||||
|
end
|
||||||
|
|
||||||
|
if n.name == "default:water_source" then
|
||||||
|
if load+1<17 then
|
||||||
|
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||||
|
load=load+1;
|
||||||
|
item["metadata"]=tostring(load)
|
||||||
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
|
itemstack:replace(item)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
item=itemstack:to_table()
|
||||||
|
if load==0 then return end
|
||||||
|
|
||||||
|
if n.name == "default:lava_flowing" then
|
||||||
|
minetest.env:add_node(pointed_thing.under, {name="default:lava_source"})
|
||||||
|
load=load-1;
|
||||||
|
item["metadata"]=tostring(load)
|
||||||
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
|
itemstack:replace(item)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
n = minetest.env:get_node(pointed_thing.above)
|
||||||
|
if n.name == "air" then
|
||||||
|
minetest.env:add_node(pointed_thing.above, {name="default:lava_source"})
|
||||||
|
load=load-1;
|
||||||
|
item["metadata"]=tostring(load)
|
||||||
|
set_RE_wear(item,load,water_can_max_load)
|
||||||
|
itemstack:replace(item)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return end
|
return end
|
||||||
|
|
@ -26,7 +26,7 @@ minetest.register_craft({
|
|||||||
output = 'technic:chainsaw',
|
output = 'technic:chainsaw',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'},
|
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'},
|
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:battery'},
|
||||||
{'','','moreores:copper_ingot'},
|
{'','','moreores:copper_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -71,4 +71,13 @@ minetest.register_node("technic:concrete_post", {
|
|||||||
|
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
stairsplus.register_stair_and_slab_and_panel_and_micro("concrete", "technic:concrete",
|
||||||
|
{cracky=3},
|
||||||
|
{"technic_concrete_block.png"},
|
||||||
|
"Concrete Stairs",
|
||||||
|
"Concrete Slab",
|
||||||
|
"Concrete Panel",
|
||||||
|
"Concrete Microblock",
|
||||||
|
"concrete")
|
10
technic/technic/config.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
enable_item_drop=false
|
||||||
|
enable_item_pickup=true
|
||||||
|
enable_technic_inventory=true
|
||||||
|
enable_mining_drill=true
|
||||||
|
enable_mining_laser=true
|
||||||
|
enable_flashlight=true
|
||||||
|
enable_rubber_tree_generation=true
|
||||||
|
enable_marble_generation=true
|
||||||
|
enable_granite_generation=true
|
||||||
|
enable_obsidian_generation=true
|
21
technic/technic/creative.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
technic.creative_inventory_size = 0
|
||||||
|
technic.creative_list = {}
|
||||||
|
|
||||||
|
-- Create detached creative inventory after loading all mods
|
||||||
|
minetest.after(0, function()
|
||||||
|
local inv = minetest.create_detached_inventory("technic_creative", {})
|
||||||
|
technic.creative_list = {}
|
||||||
|
for name,def in pairs(minetest.registered_items) do
|
||||||
|
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
|
||||||
|
and def.description and def.description ~= "" then
|
||||||
|
table.insert(technic.creative_list, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(technic.creative_list)
|
||||||
|
--inv:set_size("main", #technic.creative_list)
|
||||||
|
--for _,itemstring in ipairs(technic.creative_list) do
|
||||||
|
-- local stack = ItemStack(itemstring)
|
||||||
|
-- inv:add_item("main", stack)
|
||||||
|
--end
|
||||||
|
--technic.creative_inventory_size = #technic.creative_list
|
||||||
|
end)
|
@ -2,4 +2,4 @@ moreores
|
|||||||
flowers
|
flowers
|
||||||
pipeworks
|
pipeworks
|
||||||
mesecons
|
mesecons
|
||||||
farming
|
stairsplus
|
@ -107,8 +107,9 @@ minetest.register_abm({
|
|||||||
local load = math.floor(internal_EU_buffer/2000 * 100)
|
local load = math.floor(internal_EU_buffer/2000 * 100)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
|
"background[-1,-1;10,11;technic_electric_furnace_GUI.png]"..
|
||||||
"image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"..
|
"image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"..
|
||||||
(load)..":technic_power_meter_fg.png]"..
|
(load)..":technic_power_meter_fg.png]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"list[current_name;src;3,1;1,1;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;5,1;2,2;]"..
|
||||||
"list[current_player;main;0,5;8,4;]"..
|
"list[current_player;main;0,5;8,4;]"..
|
@ -13,7 +13,7 @@ flashlight_max_charge=30000
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "technic:flashlight",
|
output = "technic:flashlight",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"glass","glass","glass"},
|
{"technic:rubber","glass","technic:rubber"},
|
||||||
{"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"},
|
{"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"},
|
||||||
{"","technic:battery",""}
|
{"","technic:battery",""}
|
||||||
}
|
}
|
176
technic/technic/flashlight_old.lua
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621
|
||||||
|
|
||||||
|
flashlight_max_charge=30000
|
||||||
|
|
||||||
|
minetest.register_tool("technic:flashlight", {
|
||||||
|
description = "Flashlight",
|
||||||
|
inventory_image = "technic_flashlight.png",
|
||||||
|
stack_max = 1,
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "technic:flashlight",
|
||||||
|
recipe = {
|
||||||
|
{"glass","glass","glass"},
|
||||||
|
{"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"},
|
||||||
|
{"","technic:battery",""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
local players = {}
|
||||||
|
local player_positions = {}
|
||||||
|
local last_wielded = {}
|
||||||
|
|
||||||
|
function round(num)
|
||||||
|
return math.floor(num + 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
table.insert(players, player_name)
|
||||||
|
last_wielded[player_name] = flashlight_weared(player)
|
||||||
|
local pos = player:getpos()
|
||||||
|
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||||
|
local wielded_item = player:get_wielded_item():get_name()
|
||||||
|
if flashlight_weared(player)==true then
|
||||||
|
-- Neuberechnung des Lichts erzwingen
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"})
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="air"})
|
||||||
|
end
|
||||||
|
player_positions[player_name] = {}
|
||||||
|
player_positions[player_name]["x"] = rounded_pos.x;
|
||||||
|
player_positions[player_name]["y"] = rounded_pos.y;
|
||||||
|
player_positions[player_name]["z"] = rounded_pos.z;
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
for i,v in ipairs(players) do
|
||||||
|
if v == player_name then
|
||||||
|
table.remove(players, i)
|
||||||
|
last_wielded[player_name] = nil
|
||||||
|
-- Neuberechnung des Lichts erzwingen
|
||||||
|
local pos = player:getpos()
|
||||||
|
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"})
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="air"})
|
||||||
|
player_positions[player_name]["x"] = nil
|
||||||
|
player_positions[player_name]["y"] = nil
|
||||||
|
player_positions[player_name]["z"] = nil
|
||||||
|
player_positions[player_name]["m"] = nil
|
||||||
|
player_positions[player_name] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
for i,player_name in ipairs(players) do
|
||||||
|
local player = minetest.env:get_player_by_name(player_name)
|
||||||
|
if flashlight_weared(player)==true then
|
||||||
|
-- Fackel ist in der Hand
|
||||||
|
local pos = player:getpos()
|
||||||
|
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||||
|
if (last_wielded[player_name] ~= true) or (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then
|
||||||
|
-- Fackel gerade in die Hand genommen oder zu neuem Node bewegt
|
||||||
|
local is_air = minetest.env:get_node_or_nil(rounded_pos)
|
||||||
|
if is_air == nil or (is_air ~= nil and (is_air.name == "air" or is_air.name == "technic:light")) then
|
||||||
|
-- wenn an aktueller Position "air" ist, Fackellicht setzen
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="technic:light"})
|
||||||
|
end
|
||||||
|
if (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then
|
||||||
|
-- wenn Position geänder, dann altes Licht löschen
|
||||||
|
local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]}
|
||||||
|
-- Neuberechnung des Lichts erzwingen
|
||||||
|
local is_light = minetest.env:get_node_or_nil(old_pos)
|
||||||
|
if is_light ~= nil and is_light.name == "technic:light" then
|
||||||
|
minetest.env:add_node(old_pos,{type="node",name="technic:light_off"})
|
||||||
|
minetest.env:add_node(old_pos,{type="node",name="air"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- gemerkte Position ist nun die gerundete neue Position
|
||||||
|
player_positions[player_name]["x"] = rounded_pos.x
|
||||||
|
player_positions[player_name]["y"] = rounded_pos.y
|
||||||
|
player_positions[player_name]["z"] = rounded_pos.z
|
||||||
|
end
|
||||||
|
|
||||||
|
last_wielded[player_name] = true;
|
||||||
|
elseif last_wielded[player_name] == true then
|
||||||
|
-- Fackel nicht in der Hand, aber beim letzten Durchgang war die Fackel noch in der Hand
|
||||||
|
local pos = player:getpos()
|
||||||
|
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||||
|
repeat
|
||||||
|
local is_light = minetest.env:get_node_or_nil(rounded_pos)
|
||||||
|
if is_light ~= nil and is_light.name == "technic:light" then
|
||||||
|
-- minetest.env:remove_node(rounded_pos)
|
||||||
|
-- Erzwinge Neuberechnung des Lichts
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"})
|
||||||
|
minetest.env:add_node(rounded_pos,{type="node",name="air"})
|
||||||
|
end
|
||||||
|
until minetest.env:get_node_or_nil(rounded_pos) ~= "technic:light"
|
||||||
|
local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]}
|
||||||
|
repeat
|
||||||
|
is_light = minetest.env:get_node_or_nil(old_pos)
|
||||||
|
if is_light ~= nil and is_light.name == "technic:light" then
|
||||||
|
-- minetest.env:remove_node(old_pos)
|
||||||
|
-- Erzwinge Neuberechnung des Lichts
|
||||||
|
minetest.env:add_node(old_pos,{type="node",name="technic:light_off"})
|
||||||
|
minetest.env:add_node(old_pos,{type="node",name="air"})
|
||||||
|
end
|
||||||
|
until minetest.env:get_node_or_nil(old_pos) ~= "technic:light"
|
||||||
|
last_wielded[player_name] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_node("technic:light", {
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"technic_light.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = true,
|
||||||
|
light_propagates = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
light_source = 15,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {0, 0, 0, 0, 0, 0},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_node("technic:light_off", {
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"technic_light.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = true,
|
||||||
|
light_propagates = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {0, 0, 0, 0, 0, 0},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
function flashlight_weared (player)
|
||||||
|
flashlight_on=false
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local hotbar=inv:get_list("main")
|
||||||
|
for i=1,8,1 do
|
||||||
|
|
||||||
|
if hotbar[i]:get_name() == "technic:flashlight" then
|
||||||
|
item=hotbar[i]:to_table()
|
||||||
|
if item["metadata"]=="" or item["metadata"]=="0" then return flashlight_on end --flashlight not charghed
|
||||||
|
charge=tonumber(item["metadata"])
|
||||||
|
if charge-2>0 then
|
||||||
|
flashlight_on=true
|
||||||
|
charge =charge-2;
|
||||||
|
set_RE_wear(item,charge,flashlight_max_charge)
|
||||||
|
item["metadata"]=tostring(charge)
|
||||||
|
hotbar[i]:replace(item)
|
||||||
|
inv:set_stack("main",i,hotbar[i])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return flashlight_on
|
||||||
|
end
|
@ -7,6 +7,13 @@ grinder_recipes[registered_grinder_recipes_count]={}
|
|||||||
grinder_recipes[registered_grinder_recipes_count].src_name=string1
|
grinder_recipes[registered_grinder_recipes_count].src_name=string1
|
||||||
grinder_recipes[registered_grinder_recipes_count].dst_name=string2
|
grinder_recipes[registered_grinder_recipes_count].dst_name=string2
|
||||||
registered_grinder_recipes_count=registered_grinder_recipes_count+1
|
registered_grinder_recipes_count=registered_grinder_recipes_count+1
|
||||||
|
if UI_recipes_hook then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "grinding",
|
||||||
|
output = string2,
|
||||||
|
recipe = string1,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
register_grinder_recipe("default:stone","default:sand")
|
register_grinder_recipe("default:stone","default:sand")
|
||||||
@ -32,7 +39,6 @@ register_grinder_recipe("flowers:flower_tulip","dye:orange 2")
|
|||||||
register_grinder_recipe("flowers:flower_rose","dye:red 2")
|
register_grinder_recipe("flowers:flower_rose","dye:red 2")
|
||||||
register_grinder_recipe("flowers:flower_viola","dye:violet 2")
|
register_grinder_recipe("flowers:flower_viola","dye:violet 2")
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:coal_dust", {
|
minetest.register_craftitem( "technic:coal_dust", {
|
||||||
description = "Coal Dust",
|
description = "Coal Dust",
|
||||||
inventory_image = "technic_coal_dust.png",
|
inventory_image = "technic_coal_dust.png",
|
||||||
@ -317,4 +323,4 @@ if grinder_recipes[i].src_name==item_name then return ItemStack(grinder_recipes[
|
|||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
end
|
end
|
55
technic/technic/grinder_gloopores.lua
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
register_grinder_recipe("gloopores:alatro_lump","technic:alatro_dust 2")
|
||||||
|
register_grinder_recipe("gloopores:kalite_lump","technic:kalite_dust 2")
|
||||||
|
register_grinder_recipe("gloopores:arol_lump","technic:arol_dust 2")
|
||||||
|
register_grinder_recipe("gloopores:talinite_lump","technic:talinite_dust 2")
|
||||||
|
register_grinder_recipe("gloopores:akalin_lump","technic:akalin_dust 2")
|
||||||
|
|
||||||
|
minetest.register_craftitem("technic:alatro_dust", {
|
||||||
|
description = "Alatro Dust",
|
||||||
|
inventory_image = "technic_alatro_dust.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "gloopores:alatro_ingot",
|
||||||
|
recipe = "technic:alatro_dust",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("technicplus:arol_dust", {
|
||||||
|
description = "Arol Dust",
|
||||||
|
inventory_image = "technic_arol_dust.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "gloopores:arol_ingot",
|
||||||
|
recipe = "technic:arol_dust",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("technic:talinite_dust", {
|
||||||
|
description = "Talinite Dust",
|
||||||
|
inventory_image = "technic_talinite_dust.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "gloopores:talinite_ingot",
|
||||||
|
recipe = "technic:talinite_dust",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("technic:akalin_dust", {
|
||||||
|
description = "Akalin Dust",
|
||||||
|
inventory_image = "technic_akalin_dust.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "gloopores:akalin_ingot",
|
||||||
|
recipe = "technic:akalin_dust",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("technic:kalite_dust", {
|
||||||
|
description = "Kalite Dust",
|
||||||
|
inventory_image = "technic_kalite_dust.png",
|
||||||
|
on_use = minetest.item_eat(2)
|
||||||
|
})
|
@ -1,4 +1,4 @@
|
|||||||
-- Minetest 0.4.3 : technic
|
-- Minetest 0.4.4 : technic
|
||||||
|
|
||||||
minetest.register_alias("rebar", "technic:rebar")
|
minetest.register_alias("rebar", "technic:rebar")
|
||||||
minetest.register_alias("concrete", "technic:concrete")
|
minetest.register_alias("concrete", "technic:concrete")
|
||||||
@ -20,46 +20,57 @@ modpath=minetest.get_modpath("technic")
|
|||||||
--Read technic config file
|
--Read technic config file
|
||||||
dofile(modpath.."/config.lua")
|
dofile(modpath.."/config.lua")
|
||||||
|
|
||||||
dofile(modpath.."/concrete.lua")
|
-- world gen
|
||||||
|
dofile(modpath.."/ores.lua")
|
||||||
|
if enable_rubber_tree_generation==true then dofile(modpath.."/rubber.lua") end
|
||||||
|
|
||||||
|
-- chests
|
||||||
dofile(modpath.."/iron_chest.lua")
|
dofile(modpath.."/iron_chest.lua")
|
||||||
dofile(modpath.."/copper_chest.lua")
|
dofile(modpath.."/copper_chest.lua")
|
||||||
dofile(modpath.."/silver_chest.lua")
|
dofile(modpath.."/silver_chest.lua")
|
||||||
dofile(modpath.."/gold_chest.lua")
|
dofile(modpath.."/gold_chest.lua")
|
||||||
dofile(modpath.."/mithril_chest.lua")
|
dofile(modpath.."/mithril_chest.lua")
|
||||||
dofile(modpath.."/electric_furnace.lua")
|
|
||||||
dofile(modpath.."/battery_box.lua")
|
--items
|
||||||
dofile(modpath.."/wires.lua")
|
dofile(modpath.."/concrete.lua")
|
||||||
dofile(modpath.."/wires_mv.lua")
|
dofile(modpath.."/items.lua")
|
||||||
dofile(modpath.."/ores.lua")
|
|
||||||
dofile(modpath.."/tool_workshop.lua")
|
--LV machines
|
||||||
dofile(modpath.."/music_player.lua")
|
dofile(modpath.."/alloy_furnace.lua")
|
||||||
dofile(modpath.."/grinder.lua")
|
|
||||||
dofile(modpath.."/mining_laser_mk1.lua")
|
|
||||||
dofile(modpath.."/injector.lua")
|
|
||||||
dofile(modpath.."/generator.lua")
|
|
||||||
dofile(modpath.."/solar_panel.lua")
|
dofile(modpath.."/solar_panel.lua")
|
||||||
dofile(modpath.."/geothermal.lua")
|
dofile(modpath.."/geothermal.lua")
|
||||||
dofile(modpath.."/water_mill.lua")
|
dofile(modpath.."/water_mill.lua")
|
||||||
dofile(modpath.."/alloy_furnace.lua")
|
dofile(modpath.."/electric_furnace.lua")
|
||||||
dofile(modpath.."/items.lua")
|
dofile(modpath.."/battery_box.lua")
|
||||||
dofile(modpath.."/mining_drill.lua")
|
dofile(modpath.."/wires.lua")
|
||||||
dofile(modpath.."/screwdriver.lua")
|
dofile(modpath.."/tool_workshop.lua")
|
||||||
dofile(modpath.."/sonic_screwdriver.lua")
|
dofile(modpath.."/music_player.lua")
|
||||||
dofile(modpath.."/node_breaker.lua")
|
dofile(modpath.."/generator.lua")
|
||||||
dofile(modpath.."/deployer.lua")
|
dofile(modpath.."/grinder.lua")
|
||||||
dofile(modpath.."/constructor.lua")
|
|
||||||
dofile(modpath.."/tree_tap.lua")
|
|
||||||
dofile(modpath.."/flashlight.lua")
|
|
||||||
dofile(modpath.."/cans.lua")
|
|
||||||
dofile(modpath.."/chainsaw.lua")
|
|
||||||
|
|
||||||
if enable_item_drop then dofile(modpath.."/item_drop.lua") end
|
|
||||||
if enable_item_pickup then dofile(modpath.."/item_pickup.lua") end
|
|
||||||
|
|
||||||
--MV machines
|
--MV machines
|
||||||
|
dofile(modpath.."/wires_mv.lua")
|
||||||
dofile(modpath.."/solar_panel_mv.lua")
|
dofile(modpath.."/solar_panel_mv.lua")
|
||||||
dofile(modpath.."/battery_box_mv.lua")
|
dofile(modpath.."/battery_box_mv.lua")
|
||||||
|
|
||||||
|
--Tools
|
||||||
|
if enable_mining_dril==true then dofile(modpath.."/mining_drill.lua") end
|
||||||
|
if enable_mining_laser==true then dofile(modpath.."/mining_laser_mk1.lua") end
|
||||||
|
if enable_flashlight==true then dofile(modpath.."/flashlight.lua") end
|
||||||
|
dofile(modpath.."/cans.lua")
|
||||||
|
dofile(modpath.."/chainsaw.lua")
|
||||||
|
dofile(modpath.."/tree_tap.lua")
|
||||||
|
dofile(modpath.."/screwdriver.lua")
|
||||||
|
dofile(modpath.."/sonic_screwdriver.lua")
|
||||||
|
|
||||||
|
-- mesecons and tubes related
|
||||||
|
dofile(modpath.."/injector.lua")
|
||||||
|
dofile(modpath.."/node_breaker.lua")
|
||||||
|
dofile(modpath.."/deployer.lua")
|
||||||
|
dofile(modpath.."/constructor.lua")
|
||||||
|
|
||||||
|
if enable_item_drop then dofile(modpath.."/item_drop.lua") end
|
||||||
|
if enable_item_pickup then dofile(modpath.."/item_pickup.lua") end
|
||||||
|
|
||||||
function has_locked_chest_privilege(meta, player)
|
function has_locked_chest_privilege(meta, player)
|
||||||
if player:get_player_name() ~= meta:get_string("owner") then
|
if player:get_player_name() ~= meta:get_string("owner") then
|
||||||
@ -82,4 +93,4 @@ function hacky_swap_node(pos,name)
|
|||||||
meta = minetest.env:get_meta(pos)
|
meta = minetest.env:get_meta(pos)
|
||||||
meta:from_table(meta0)
|
meta:from_table(meta0)
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
248
technic/technic/injector1.lua
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
minetest.register_craftitem("technic:injector", {
|
||||||
|
description = "Injector",
|
||||||
|
stack_max = 99,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("technic:injector", {
|
||||||
|
description = "Injector",
|
||||||
|
tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
|
||||||
|
"technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"invsize[9,9;]"..
|
||||||
|
"list[current_name;main;0,2;8,2;]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]")
|
||||||
|
meta:set_string("infotext", "Injector")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8*4)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
local meta = minetest.env:get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
on_punch = function (pos, node, puncher)
|
||||||
|
local meta = minetest.env:get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
for _,stack in ipairs(inv:get_list("main")) do
|
||||||
|
if stack:get_name() ~="" then
|
||||||
|
inv:remove_item("main",stack)
|
||||||
|
item1=tube_item({x=pos.x+.5,y=pos.y,z=pos.z},stack)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function tube_item(pos, item)
|
||||||
|
-- Take item in any format
|
||||||
|
local stack = ItemStack(item)
|
||||||
|
local obj = minetest.env:add_entity(pos, "technic:tubed_item")
|
||||||
|
obj:get_luaentity():set_item(stack:to_string())
|
||||||
|
obj:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
|
||||||
|
obj:setacceleration({x=0, y=0, z=0})
|
||||||
|
pos.x=pos.x+1
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=1, y=0, z=0}) return obj end
|
||||||
|
pos.x=pos.x-2
|
||||||
|
meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=-1, y=0, z=0}) return obj end
|
||||||
|
pos.x=pos.x+1
|
||||||
|
pos.z=pos.z+1
|
||||||
|
meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=1}) return obj end
|
||||||
|
pos.z=pos.z-2
|
||||||
|
meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=-1}) return obj end
|
||||||
|
pos.z=pos.z+1
|
||||||
|
pos.y=pos.y+1
|
||||||
|
meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=1, z=0}) return obj end
|
||||||
|
pos.y=pos.y-2
|
||||||
|
meta = minetest.env:get_meta(pos)
|
||||||
|
if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=-2, z=0}) return obj end
|
||||||
|
pos.y=pos.y+1
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_entity("technic:tubed_item", {
|
||||||
|
initial_properties = {
|
||||||
|
hp_max = 1,
|
||||||
|
physical = false,
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
visual = "sprite",
|
||||||
|
visual_size = {x=0.5, y=0.5},
|
||||||
|
textures = {""},
|
||||||
|
spritediv = {x=1, y=1},
|
||||||
|
initial_sprite_basepos = {x=0, y=0},
|
||||||
|
is_visible = false,
|
||||||
|
start_pos={}
|
||||||
|
},
|
||||||
|
|
||||||
|
itemstring = '',
|
||||||
|
physical_state = false,
|
||||||
|
|
||||||
|
set_item = function(self, itemstring)
|
||||||
|
self.itemstring = itemstring
|
||||||
|
local stack = ItemStack(itemstring)
|
||||||
|
local itemtable = stack:to_table()
|
||||||
|
local itemname = nil
|
||||||
|
if itemtable then
|
||||||
|
itemname = stack:to_table().name
|
||||||
|
end
|
||||||
|
local item_texture = nil
|
||||||
|
local item_type = ""
|
||||||
|
if minetest.registered_items[itemname] then
|
||||||
|
item_texture = minetest.registered_items[itemname].inventory_image
|
||||||
|
item_type = minetest.registered_items[itemname].type
|
||||||
|
end
|
||||||
|
prop = {
|
||||||
|
is_visible = true,
|
||||||
|
visual = "sprite",
|
||||||
|
textures = {"unknown_item.png"}
|
||||||
|
}
|
||||||
|
if item_texture and item_texture ~= "" then
|
||||||
|
prop.visual = "sprite"
|
||||||
|
prop.textures = {item_texture}
|
||||||
|
prop.visual_size = {x=0.3, y=0.3}
|
||||||
|
else
|
||||||
|
prop.visual = "wielditem"
|
||||||
|
prop.textures = {itemname}
|
||||||
|
prop.visual_size = {x=0.15, y=0.15}
|
||||||
|
end
|
||||||
|
self.object:set_properties(prop)
|
||||||
|
end,
|
||||||
|
|
||||||
|
get_staticdata = function(self)
|
||||||
|
|
||||||
|
return minetest.serialize({
|
||||||
|
itemstring=self.itemstring,
|
||||||
|
velocity=self.object:getvelocity(),
|
||||||
|
start_pos=self.start_pos
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
if staticdata=="" or staticdata==nil then return end
|
||||||
|
local item = minetest.deserialize(staticdata)
|
||||||
|
local stack = ItemStack(item.itemstring)
|
||||||
|
local itemtable = stack:to_table()
|
||||||
|
local itemname = nil
|
||||||
|
if itemtable then
|
||||||
|
itemname = stack:to_table().name
|
||||||
|
end
|
||||||
|
|
||||||
|
if itemname then
|
||||||
|
self.start_pos=item.start_pos
|
||||||
|
self.object:setvelocity(item.velocity)
|
||||||
|
self.object:setacceleration({x=0, y=0, z=0})
|
||||||
|
self.object:setpos(item.start_pos)
|
||||||
|
end
|
||||||
|
self:set_item(item.itemstring)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
if self.start_pos then
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local node = minetest.env:get_node(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
local velocity=self.object:getvelocity()
|
||||||
|
|
||||||
|
if not velocity then return end
|
||||||
|
|
||||||
|
if math.abs(velocity.x)==1 then
|
||||||
|
local next_node=math.abs(pos.x-self.start_pos.x)
|
||||||
|
if next_node >= 1 then
|
||||||
|
self.start_pos.x=self.start_pos.x+velocity.x
|
||||||
|
if check_pos_vector (self.start_pos, velocity)==0 then
|
||||||
|
check_next_step (self.start_pos, velocity)
|
||||||
|
self.object:setpos(self.start_pos)
|
||||||
|
self.object:setvelocity(velocity)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if math.abs(velocity.y)==1 then
|
||||||
|
local next_node=math.abs(pos.y-self.start_pos.y)
|
||||||
|
if next_node >= 1 then
|
||||||
|
self.start_pos.y=self.start_pos.y+velocity.y
|
||||||
|
if check_pos_vector (self.start_pos, velocity)==0 then
|
||||||
|
check_next_step (self.start_pos, velocity)
|
||||||
|
self.object:setpos(self.start_pos)
|
||||||
|
self.object:setvelocity(velocity)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if math.abs(velocity.z)==1 then
|
||||||
|
local next_node=math.abs(pos.z-self.start_pos.z)
|
||||||
|
if next_node >= 1 then
|
||||||
|
self.start_pos.z=self.start_pos.z+velocity.z
|
||||||
|
if check_pos_vector (self.start_pos, velocity)==0 then
|
||||||
|
check_next_step (self.start_pos, velocity)
|
||||||
|
self.object:setpos(self.start_pos)
|
||||||
|
self.object:setvelocity(velocity)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function check_next_step (pos,velocity)
|
||||||
|
local meta
|
||||||
|
local tubelike
|
||||||
|
|
||||||
|
if velocity.x==0 then
|
||||||
|
meta = minetest.env:get_meta({x=pos.x-1,y=pos.y,z=pos.z})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=-1 velocity.y=0 velocity.z=0 return end
|
||||||
|
meta = minetest.env:get_meta({x=pos.x+1,y=pos.y,z=pos.z})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=1 velocity.y=0 velocity.z=0 return end
|
||||||
|
end
|
||||||
|
|
||||||
|
if velocity.z==0 then
|
||||||
|
meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z+1})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=1 return end
|
||||||
|
meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z-1})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=-1 return end
|
||||||
|
end
|
||||||
|
|
||||||
|
if velocity.y==0 then
|
||||||
|
meta = minetest.env:get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=0 velocity.y=1 velocity.z=0 return end
|
||||||
|
meta = minetest.env:get_meta({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
|
tubelike=meta:get_int("tubelike")
|
||||||
|
if tubelike==1 then velocity.x=0 velocity.y=-1 velocity.z=0 return end
|
||||||
|
end
|
||||||
|
|
||||||
|
--velocity.x=0
|
||||||
|
--velocity.y=0
|
||||||
|
--velocity.z=0
|
||||||
|
end
|
||||||
|
|
||||||
|
function check_pos_vector (pos,velocity)
|
||||||
|
added={}
|
||||||
|
added.x=pos.x+velocity.x
|
||||||
|
added.y=pos.y+velocity.y
|
||||||
|
added.z=pos.z+velocity.z
|
||||||
|
local meta=minetest.env:get_meta(added)
|
||||||
|
--print(dump(added).." : "..tubelike)
|
||||||
|
if meta:get_int("tubelike")==1 then return 1 end
|
||||||
|
return 0
|
||||||
|
end
|
@ -54,15 +54,6 @@ minetest.register_node("technic:iron_chest", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 9*4)
|
inv:set_size("main", 9*4)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
|
||||||
ntop1 = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z})
|
|
||||||
ntop = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
|
||||||
if ntop.name ~= "air" then
|
|
||||||
minetest.node_dig(pos, ntop1, placer)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local meta = minetest.env:get_meta(pos);
|
local meta = minetest.env:get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -170,7 +161,3 @@ on_construct = function(pos)
|
|||||||
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
|
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
function add_item (player)
|
|
||||||
player:get_inventory():add_item("main", "blabla 1")
|
|
||||||
end
|
|
@ -55,27 +55,27 @@ minetest.register_node( "technic:diamond_block", {
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:green_energy_crystal',
|
output = 'technic:green_energy_crystal',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_green'},
|
{'moreores:gold_ingot', 'technic:battery', 'dye:green'},
|
||||||
{'technic:battery', 'technic:red_energy_crystal', 'technic:battery'},
|
{'technic:battery', 'technic:red_energy_crystal', 'technic:battery'},
|
||||||
{'group:dye,basecolor_green', 'technic:battery', 'moreores:gold_ingot'},
|
{'dye:green', 'technic:battery', 'moreores:gold_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:blue_energy_crystal',
|
output = 'technic:blue_energy_crystal',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_blue'},
|
{'moreores:gold_ingot', 'technic:battery', 'dye:blue'},
|
||||||
{'technic:battery', 'technic:green_energy_crystal', 'technic:battery'},
|
{'technic:battery', 'technic:green_energy_crystal', 'technic:battery'},
|
||||||
{'group:dye,basecolor_green', 'technic:battery', 'moreores:gold_ingot'},
|
{'dye:blue', 'technic:battery', 'moreores:gold_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:red_energy_crystal',
|
output = 'technic:red_energy_crystal',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_red'},
|
{'moreores:gold_ingot', 'technic:battery', 'dye:red'},
|
||||||
{'technic:battery', 'technic:diamond_block', 'technic:battery'},
|
{'technic:battery', 'technic:diamond_block', 'technic:battery'},
|
||||||
{'group:dye,basecolor_red', 'technic:battery', 'moreores:gold_ingot'},
|
{'dye:red', 'technic:battery', 'moreores:gold_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -25,8 +25,8 @@ minetest.register_craft({
|
|||||||
output = 'technic:mining_drill',
|
output = 'technic:mining_drill',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:red_energy_crystal', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'},
|
||||||
{'', 'moreores:copper_ingot', ''},
|
{'', 'technic:red_energy_crystal', 'moreores:copper_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
145
technic/technic/mithril_subspace_chest.lua
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:mithril_chest 1',
|
||||||
|
recipe = {
|
||||||
|
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
|
||||||
|
{'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'},
|
||||||
|
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:mithril_locked_chest 1',
|
||||||
|
recipe = {
|
||||||
|
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
|
||||||
|
{'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'},
|
||||||
|
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:mithril_locked_chest 1',
|
||||||
|
recipe = {
|
||||||
|
{'default:steel_ingot'},
|
||||||
|
{'technic:mithril_chest'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("technic:mithril_chest", {
|
||||||
|
description = "Mithril Chest",
|
||||||
|
tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png",
|
||||||
|
"technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_front.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"invsize[13,9;]"..
|
||||||
|
"list[current_name;main;0,0;13,4;]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]")
|
||||||
|
meta:set_string("infotext", "Mithril Chest")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 13*4)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
local meta = minetest.env:get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
|
to_list, to_index, count, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" moves stuff in chest at "..minetest.pos_to_string(pos))
|
||||||
|
return minetest.node_metadata_inventory_move_allow_all(
|
||||||
|
pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_offer = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" moves stuff to chest at "..minetest.pos_to_string(pos))
|
||||||
|
return minetest.node_metadata_inventory_offer_allow_all(
|
||||||
|
pos, listname, index, stack, player)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" takes stuff from chest at "..minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("technic:mithril_locked_chest", {
|
||||||
|
description = "Mithril Locked Chest",
|
||||||
|
tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png",
|
||||||
|
"technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_locked.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name() or "")
|
||||||
|
meta:set_string("infotext", "Mithril Locked Chest (owned by "..
|
||||||
|
meta:get_string("owner")..")")
|
||||||
|
end,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"invsize[13,9;]"..
|
||||||
|
"list[current_name;main;0,0;13,4;]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]")
|
||||||
|
meta:set_string("infotext", "Mithril Locked Chest")
|
||||||
|
meta:set_string("owner", "")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 13*4)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
local meta = minetest.env:get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
if not has_locked_chest_privilege(meta, player) then
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" tried to access a locked chest belonging to "..
|
||||||
|
meta:get_string("owner").." at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
if not has_locked_chest_privilege(meta, player) then
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" tried to access a locked chest belonging to "..
|
||||||
|
meta:get_string("owner").." at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
if not has_locked_chest_privilege(meta, player) then
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" tried to access a locked chest belonging to "..
|
||||||
|
meta:get_string("owner").." at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" moves stuff in locked chest at "..minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
})
|
@ -30,6 +30,14 @@ minetest.register_node( "technic:granite", {
|
|||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node( "technic:obsidian", {
|
||||||
|
description = "Obsidian",
|
||||||
|
tiles = { "technic_obsidian.png" },
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble",
|
stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble",
|
||||||
{cracky=3},
|
{cracky=3},
|
||||||
{"technic_marble.png"},
|
{"technic_marble.png"},
|
||||||
@ -54,6 +62,14 @@ stairsplus.register_stair_and_slab_and_panel_and_micro("granite", "technic:grani
|
|||||||
"Granite Panel",
|
"Granite Panel",
|
||||||
"Granite Microblock",
|
"Granite Microblock",
|
||||||
"granite")
|
"granite")
|
||||||
|
stairsplus.register_stair_and_slab_and_panel_and_micro("obsidian", "technic:obsidian",
|
||||||
|
{cracky=3},
|
||||||
|
{"technic_obsidian.png"},
|
||||||
|
"Obsidian Stairs",
|
||||||
|
"Obsidian Slab",
|
||||||
|
"Obsidian Panel",
|
||||||
|
"Obsidian Microblock",
|
||||||
|
"obsidian")
|
||||||
|
|
||||||
minetest.register_node( "technic:mineral_diamond", {
|
minetest.register_node( "technic:mineral_diamond", {
|
||||||
description = "Diamond Ore",
|
description = "Diamond Ore",
|
||||||
@ -192,10 +208,132 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -300)
|
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -450)
|
||||||
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80)
|
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80)
|
||||||
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100)
|
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100)
|
||||||
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 4, -31000, 2)
|
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 4, -31000, 2)
|
||||||
generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32)
|
generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32)
|
||||||
generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90)
|
generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90)
|
||||||
end)
|
generate_stratus("technic:obsidian",
|
||||||
|
{"default:stone"},
|
||||||
|
{"default:lava_source"},{"default:air"},
|
||||||
|
minp, maxp, seed+4, 10, 25, 7, -450, -31000, -450)
|
||||||
|
end)
|
||||||
|
|
||||||
|
function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max)
|
||||||
|
if maxp.y < height_min or minp.y > height_max then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- it will be only generate a stratus for every 100 m of area
|
||||||
|
local stratus_per_volume=1
|
||||||
|
local area=45
|
||||||
|
local y_min = math.max(minp.y, height_min)
|
||||||
|
local y_max = math.min(maxp.y, height_max)
|
||||||
|
local volume = ((maxp.x-minp.x+1)/area)*((y_max-y_min+1)/area)*((maxp.z-minp.z+1)/area)
|
||||||
|
local pr = PseudoRandom(seed)
|
||||||
|
local blocks = math.floor(stratus_per_volume*volume)
|
||||||
|
print(" <<"..dump(name)..">>");
|
||||||
|
if blocks == 0 then
|
||||||
|
blocks = 1
|
||||||
|
end
|
||||||
|
print(" blocks: "..dump(blocks).." in vol: "..dump(volume).." ("..dump(maxp.x-minp.x+1)..","..dump(y_max-y_min+1)..","..dump(maxp.z-minp.z+1)..")")
|
||||||
|
for i=1,blocks do
|
||||||
|
local x = pr:next(1,stratus_chance)
|
||||||
|
if x == 1 then
|
||||||
|
-- TODO deep
|
||||||
|
local y0=y_max-radius_y+1
|
||||||
|
if y0 < y_min then
|
||||||
|
y0=y_min
|
||||||
|
else
|
||||||
|
y0=pr:next(y_min, y0)
|
||||||
|
end
|
||||||
|
local x0 = maxp.x-radius+1
|
||||||
|
if x0 < minp.x then
|
||||||
|
x0 = minp.x
|
||||||
|
else
|
||||||
|
x0 = pr:next(minp.x, x0)
|
||||||
|
end
|
||||||
|
local z0 = maxp.z-radius+1
|
||||||
|
if z0 < minp.z then
|
||||||
|
x0 = minp.z
|
||||||
|
else
|
||||||
|
z0 = pr:next(minp.z, z0)
|
||||||
|
end
|
||||||
|
local p0 = {x=x0, y=y0, z=z0}
|
||||||
|
local n = minetest.env:get_node(p0).name
|
||||||
|
local i = 0
|
||||||
|
--print(" upper node "..n)
|
||||||
|
x = 0
|
||||||
|
for k, v in ipairs(ceilin) do
|
||||||
|
if n == v then
|
||||||
|
x = 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if x == 1 then
|
||||||
|
-- search for the node to replace
|
||||||
|
--print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min))
|
||||||
|
for y1=y0-1,y_min,-1 do
|
||||||
|
p0.y=y1
|
||||||
|
n = minetest.env:get_node(p0).name
|
||||||
|
x = 0
|
||||||
|
for k, v in ipairs(wherein) do
|
||||||
|
if n == v then
|
||||||
|
x = 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if x == 1 then
|
||||||
|
y0=y1-deep
|
||||||
|
if y0 < y_min then
|
||||||
|
y0 = y_min
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local rx=pr:next(radius/2,radius)+1
|
||||||
|
local rz=pr:next(radius/2,radius)+1
|
||||||
|
local ry=pr:next(radius_y/2,radius_y)+1
|
||||||
|
--print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")")
|
||||||
|
for x1=0,rx do
|
||||||
|
rz = rz + 3 - pr:next(1,6)
|
||||||
|
if rz < 1 then
|
||||||
|
rz = 1
|
||||||
|
end
|
||||||
|
for z1=pr:next(1,3),rz do
|
||||||
|
local ry0=ry+ pr:next(1,3)
|
||||||
|
for y1=pr:next(1,3),ry0 do
|
||||||
|
local x2 = x0+x1
|
||||||
|
local y2 = y0+y1
|
||||||
|
local z2 = z0+z1
|
||||||
|
local p2 = {x=x2, y=y2, z=z2}
|
||||||
|
n = minetest.env:get_node(p2).name
|
||||||
|
x = 0
|
||||||
|
for k, v in ipairs(wherein) do
|
||||||
|
if n == v then
|
||||||
|
x = 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if x == 1 then
|
||||||
|
if ceil == nil then
|
||||||
|
minetest.env:set_node(p2, {name=name})
|
||||||
|
i = i +1
|
||||||
|
else
|
||||||
|
local p3 = {p2.x,p2.y+1,p2}
|
||||||
|
if minetest.env:get_node(p3).name == ceil then
|
||||||
|
minetest.env:set_node(p2, {name=name})
|
||||||
|
i = i +1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--print("generate_ore done")
|
||||||
|
end
|
@ -54,7 +54,7 @@ minetest.register_abm(
|
|||||||
local light = minetest.env:get_node_light(pos1, nil)
|
local light = minetest.env:get_node_light(pos1, nil)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
if light == nil then light = 0 end
|
if light == nil then light = 0 end
|
||||||
if light >= 14 then
|
if light >= 12 then
|
||||||
meta:set_string("infotext", "Solar Panel is active ")
|
meta:set_string("infotext", "Solar Panel is active ")
|
||||||
meta:set_float("active",1)
|
meta:set_float("active",1)
|
||||||
local internal_EU_buffer=meta:get_float("internal_EU_buffer")
|
local internal_EU_buffer=meta:get_float("internal_EU_buffer")
|