fix stair more machines
@ -1,173 +1,100 @@
|
||||
doors = {}
|
||||
|
||||
-- Registers a door - REDEFINITION ONLY | DOORS MOD MUST HAVE BEEN LOADED BEFORE
|
||||
-- name: The name of the door
|
||||
-- def: a table with the folowing fields:
|
||||
-- description
|
||||
-- inventory_image
|
||||
-- groups
|
||||
-- tiles_bottom: the tiles of the bottom part of the door {front, side}
|
||||
-- tiles_top: the tiles of the bottom part of the door {front, side}
|
||||
-- If the following fields are not defined the default values are used
|
||||
-- node_box_bottom
|
||||
-- node_box_top
|
||||
-- selection_box_bottom
|
||||
-- selection_box_top
|
||||
-- only_placer_can_open: if true only the player who placed the door can
|
||||
-- open it
|
||||
|
||||
function doors:register_door(name, def)
|
||||
def.groups.not_in_creative_inventory = 1
|
||||
|
||||
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
|
||||
|
||||
if not def.node_box_bottom then
|
||||
def.node_box_bottom = box
|
||||
end
|
||||
if not def.node_box_top then
|
||||
def.node_box_top = box
|
||||
end
|
||||
if not def.selection_box_bottom then
|
||||
def.selection_box_bottom= box
|
||||
end
|
||||
if not def.selection_box_top then
|
||||
def.selection_box_top = box
|
||||
-- make doors open/close with signal
|
||||
local function door_signal_overwrite(name)
|
||||
local table = minetest.registered_nodes[name]; if not table then return end
|
||||
local table2 = {}
|
||||
for i,v in pairs(table) do
|
||||
table2[i] = v
|
||||
end
|
||||
|
||||
local tt = def.tiles_top
|
||||
local tb = def.tiles_bottom
|
||||
|
||||
local function after_dig_node(pos, name)
|
||||
if minetest.get_node(pos).name == name then
|
||||
minetest.remove_node(pos)
|
||||
-- this will make door toggle whenever its used
|
||||
table2.mesecons = {effector = {
|
||||
action_on = function (pos,node,ttl)
|
||||
if ttl<0 then return end
|
||||
local meta = minetest.get_meta(pos);local name = meta:get_string("doors_owner");
|
||||
-- create virtual player
|
||||
local clicker = {};
|
||||
function clicker:get_player_name() return name end; -- define method get_player_name() returning owner name so that we can call on_rightclick function in door
|
||||
table.on_rightclick(pos, node, clicker)
|
||||
--minetest.swap_node(pos, {name = "protector:trapdoor", param1 = node.param1, param2 = node.param2})
|
||||
end
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||
pos.y = pos.y+dir
|
||||
if not minetest.get_node(pos).name == check_name then
|
||||
return
|
||||
end
|
||||
local p2 = minetest.get_node(pos).param2
|
||||
p2 = params[p2+1]
|
||||
|
||||
local meta = minetest.get_meta(pos):to_table()
|
||||
minetest.set_node(pos, {name=replace_dir, param2=p2})
|
||||
minetest.get_meta(pos):from_table(meta)
|
||||
|
||||
pos.y = pos.y-dir
|
||||
meta = minetest.get_meta(pos):to_table()
|
||||
minetest.set_node(pos, {name=replace, param2=p2})
|
||||
minetest.get_meta(pos):from_table(meta)
|
||||
end
|
||||
|
||||
local function on_mesecons_signal_open (pos, node)
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
|
||||
local function on_mesecons_signal_close (pos, node)
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
}
|
||||
};
|
||||
|
||||
local function check_player_priv(pos, player)
|
||||
if not def.only_placer_can_open then
|
||||
return true
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local pn = player:get_player_name()
|
||||
return meta:get_string("doors_owner") == pn
|
||||
end
|
||||
minetest.register_node(":"..name, table2)
|
||||
end
|
||||
|
||||
minetest.after(0,function()
|
||||
door_signal_overwrite("doors:door_wood_a");door_signal_overwrite("doors:door_wood_b");
|
||||
door_signal_overwrite("doors:door_steel_a");door_signal_overwrite("doors:door_steel_b");
|
||||
door_signal_overwrite("doors:trapdoor");door_signal_overwrite("doors:trapdoor_open");
|
||||
door_signal_overwrite("doors:trapdoor_steel");door_signal_overwrite("doors:trapdoor_steel_open");
|
||||
|
||||
minetest.register_node(":"..name.."_b_1", {
|
||||
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = name,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.node_box_bottom
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_1")
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
if check_player_priv(pos, puncher) then
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
);
|
||||
|
||||
local function make_it_noclip(name)
|
||||
|
||||
local table = minetest.registered_nodes[name]; if not table then return end
|
||||
local table2 = {}
|
||||
for i,v in pairs(table) do
|
||||
table2[i] = v
|
||||
end
|
||||
table2.walkable = false; -- cant be walked on
|
||||
minetest.register_node(":"..name, table2)
|
||||
end
|
||||
|
||||
minetest.after(0,function()
|
||||
make_it_noclip("doors:trapdoor_open");
|
||||
make_it_noclip("doors:trapdoor_steel_open");
|
||||
end);
|
||||
|
||||
|
||||
|
||||
local function make_it_nondiggable_but_removable(name, dropname)
|
||||
|
||||
local table = minetest.registered_nodes[name]; if not table then return end
|
||||
local table2 = {}
|
||||
for i,v in pairs(table) do
|
||||
table2[i] = v
|
||||
end
|
||||
table2.groups.level = 99; -- cant be digged, but it can be removed by owner or if not protected
|
||||
table2.on_punch = function(pos, node, puncher, pointed_thing) -- remove node if owner repeatedly punches it 3x
|
||||
local pname = puncher:get_player_name();
|
||||
local meta = minetest.get_meta(pos);
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if pname==owner or not minetest.is_protected(pos,pname) then -- can be dug by owner or if unprotected
|
||||
local t0 = meta:get_int("punchtime");local count = meta:get_int("punchcount");
|
||||
local t = minetest.get_gametime();
|
||||
|
||||
if t-t0<2 then count = (count +1 ) % 3 else count = 0 end
|
||||
|
||||
if count == 1 then
|
||||
minetest.chat_send_player(pname, "#steel door: punch me one more time to remove me");
|
||||
end
|
||||
end,
|
||||
|
||||
mesecons = {effector = {
|
||||
action_on = on_mesecons_signal_open
|
||||
}},
|
||||
|
||||
can_dig = check_player_priv,
|
||||
})
|
||||
|
||||
minetest.register_node(":"..name.."_b_2", {
|
||||
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = name,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.node_box_bottom
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_2")
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
if check_player_priv(pos, puncher) then
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
if count == 2 then -- remove steel door and drop it
|
||||
minetest.set_node(pos, {name = "air"});
|
||||
local stack = ItemStack(dropname);minetest.add_item(pos,stack)
|
||||
end
|
||||
end,
|
||||
|
||||
meta:set_int("punchcount",count);meta:set_int("punchtime",t);
|
||||
--minetest.chat_send_all("punch by "..name .. " count " .. count)
|
||||
end
|
||||
end
|
||||
minetest.register_node(":"..name, table2)
|
||||
end
|
||||
|
||||
mesecons = {effector = {
|
||||
action_off = on_mesecons_signal_close
|
||||
}},
|
||||
|
||||
can_dig = check_player_priv,
|
||||
})
|
||||
end
|
||||
|
||||
doors:register_door("doors:door_wood", {
|
||||
description = "Wooden Door",
|
||||
inventory_image = "doors_wood.png",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
||||
tiles_bottom = {"doors_wood_b.png", "doors_brown.png"},
|
||||
tiles_top = {"doors_wood_a.png", "doors_brown.png"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
doors:register_door("doors:door_steel", {
|
||||
description = "Steel Door",
|
||||
inventory_image = "doors_steel.png",
|
||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
||||
tiles_bottom = {"doors_steel_b.png", "doors_grey.png"},
|
||||
tiles_top = {"doors_steel_a.png", "doors_grey.png"},
|
||||
only_placer_can_open = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.after(0,function()
|
||||
make_it_nondiggable_but_removable("doors:door_steel_a","doors:door_steel");
|
||||
make_it_nondiggable_but_removable("doors:door_steel_b","doors:door_steel");
|
||||
|
||||
make_it_nondiggable_but_removable("doors:trapdoor_steel","doors:trapdoor_steel");
|
||||
make_it_nondiggable_but_removable("doors:trapdoor_steel_open","doors:trapdoor_steel");
|
||||
end);
|
||||
|
||||
|
||||
-- make trapdoor open close and when open make it unwalkable
|
||||
|
||||
|
||||
-- make protected trapdoor open close and when open make it unwalkable
|
||||
|
||||
local function trapdoor_open_overwrite()
|
||||
local name = "protector:trapdoor_open";
|
||||
|
@ -48,7 +48,6 @@ basic_machines.plant_table = {["farming:seed_barley"]="farming:barley_1",["farm
|
||||
-- *** END OF SETTINGS *** --
|
||||
|
||||
|
||||
|
||||
local punchset = {};
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
@ -58,10 +57,9 @@ minetest.register_on_joinplayer(function(player)
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- MOVER --
|
||||
minetest.register_node("basic_machines:mover", {
|
||||
description = "Mover",
|
||||
description = "Mover - universal digging/harvesting/teleporting/transporting machine, its upgradeable.",
|
||||
tiles = {"compass_top.png","default_furnace_top.png", "basic_machine_side.png","basic_machine_side.png","basic_machine_side.png","basic_machine_side.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -99,7 +97,7 @@ minetest.register_node("basic_machines:mover", {
|
||||
return
|
||||
end -- only owner can set up mover, ppl sharing protection can only look
|
||||
|
||||
local x0,y0,z0,x1,y1,z1,x2,y2,z2,prefer,mode;
|
||||
local x0,y0,z0,x1,y1,z1,x2,y2,z2,prefer,mode,mreverse;
|
||||
|
||||
x0=meta:get_int("x0");y0=meta:get_int("y0");z0=meta:get_int("z0");x1=meta:get_int("x1");y1=meta:get_int("y1");z1=meta:get_int("z1");x2=meta:get_int("x2");y2=meta:get_int("y2");z2=meta:get_int("z2");
|
||||
|
||||
@ -108,9 +106,9 @@ minetest.register_node("basic_machines:mover", {
|
||||
machines.pos2[player:get_player_name()] = {x=pos.x+x2,y=pos.y+y2,z=pos.z+z2};machines.mark_pos2(player:get_player_name()) -- mark pos2
|
||||
|
||||
prefer = meta:get_string("prefer");
|
||||
local mreverse = meta:get_int("reverse");
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local mode_list = {["normal"]=1,["dig"]=2, ["drop"]=3,["reverse"]=4, ["object"]=5, ["inventory"]=6, ["transport"]=7};
|
||||
--local inv_mode_list = {[1]=["normal"],[2]="dig", [3]="drop",[4]="reverse", [5]="object", [6]="inventory"};
|
||||
local mode_list = {["normal"]=1,["dig"]=2, ["drop"]=3, ["object"]=4, ["inventory"]=5, ["transport"]=6};
|
||||
|
||||
local mode = mode_list[meta:get_string("mode")] or "";
|
||||
|
||||
@ -155,11 +153,11 @@ minetest.register_node("basic_machines:mover", {
|
||||
"field[0.25,2.5;1,1;x2;Target;"..x2.."] field[1.25,2.5;1,1;y2;;"..y2.."] field[2.25,2.5;1,1;z2;;"..z2.."]"..
|
||||
"dropdown[3,2.25;1.5,1;inv2;".. inv_list2 .. ";" .. inv2 .."]"..
|
||||
"button_exit[4,4.4;1,1;OK;OK] field[0.25,3.5;3,1;prefer;filter;"..prefer.."]"..
|
||||
"button[3,4.4;1,1;help;help]"..
|
||||
"button[4.,3.25;1,1;help;help]"..
|
||||
"label[0.,4.0;MODE selection]"..
|
||||
"dropdown[0,4.5;3,1;mode;normal,dig,drop,reverse,object,inventory,transport;".. mode .."]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade;3,3.3;1,1;]"..
|
||||
"label[3,2.9;upgrade]";
|
||||
"dropdown[0,4.5;3,1;mode;normal,dig,drop,object,inventory,transport;".. mode .."]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade;3,4.3;1,1;]".."label[3,3.9;upgrade]" ..
|
||||
"field[3.25,3.5;1,1;reverse;reverse;"..mreverse.."]";
|
||||
|
||||
--"field[0.25,4.5;2,1;mode;mode;"..mode.."]";
|
||||
|
||||
@ -191,6 +189,7 @@ minetest.register_node("basic_machines:mover", {
|
||||
local x0=meta:get_int("x0"); local y0=meta:get_int("y0"); local z0=meta:get_int("z0");
|
||||
|
||||
local mode = meta:get_string("mode");
|
||||
local mreverse = meta:get_int("reverse")
|
||||
local pos1 = {x=x0+pos.x,y=y0+pos.y,z=z0+pos.z}; -- where to take from
|
||||
local pos2 = {x=meta:get_int("x2")+pos.x,y=meta:get_int("y2")+pos.y,z=meta:get_int("z2")+pos.z}; -- where to put
|
||||
|
||||
@ -209,7 +208,7 @@ minetest.register_node("basic_machines:mover", {
|
||||
pos2 = {x=meta:get_int("x2")-x0+pos1.x,y=meta:get_int("y2")-y0+pos1.y,z=meta:get_int("z2")-z0+pos1.z}; -- translation from pos1
|
||||
end
|
||||
|
||||
if mode == "reverse" then -- reverse pos1, pos2
|
||||
if mreverse ~= 0 then -- reverse pos1, pos2
|
||||
local post = {x=pos1.x,y=pos1.y,z=pos1.z};
|
||||
pos1 = {x=pos2.x,y=pos2.y,z=pos2.z};
|
||||
pos2 = {x=post.x,y=post.y,z=post.z};
|
||||
@ -398,7 +397,7 @@ minetest.register_node("basic_machines:mover", {
|
||||
else return -- item not found in chest
|
||||
end
|
||||
|
||||
if mode == "reverse" then -- planting mode: check if transform seed->plant is needed
|
||||
if mreverse ~= 0 then -- planting mode: check if transform seed->plant is needed
|
||||
if basic_machines.plant_table[prefer]~=nil then
|
||||
prefer = basic_machines.plant_table[prefer];
|
||||
end
|
||||
@ -521,12 +520,23 @@ minetest.register_node("basic_machines:mover", {
|
||||
if dig then nodeupdate(pos1) end
|
||||
minetest.set_node(pos1, {name = "air"});
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
action_off = function (pos, node,ttl) -- this toggles reverse option of mover
|
||||
if type(ttl)~="number" then ttl = 1 end
|
||||
local meta = minetest.get_meta(pos);
|
||||
local mreverse = meta:get_int("reverse");
|
||||
if mreverse ~= 0 then mreverse = 0 else mreverse = 1 end
|
||||
meta:set_int("reverse",mreverse);
|
||||
end
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- KEYPAD
|
||||
-- KEYPAD --
|
||||
|
||||
local function use_keypad(pos,ttl) -- position, time to live ( how many times can signal travel before vanishing to prevent infinite recursion )
|
||||
|
||||
@ -609,7 +619,7 @@ local function check_keypad(pos,name,ttl) -- called only when manually activated
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:keypad", {
|
||||
description = "Keypad",
|
||||
description = "Keypad - basic way to activated machines by signal it sends",
|
||||
tiles = {"keypad.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -661,10 +671,10 @@ minetest.register_node("basic_machines:keypad", {
|
||||
|
||||
|
||||
|
||||
-- DETECTOR
|
||||
-- DETECTOR --
|
||||
|
||||
minetest.register_node("basic_machines:detector", {
|
||||
description = "Detector",
|
||||
description = "Detector - can detect blocks/players/objects and activate machines",
|
||||
tiles = {"detector.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -780,7 +790,6 @@ minetest.register_node("basic_machines:detector", {
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"basic_machines:detector"},
|
||||
neighbors = {""},
|
||||
@ -866,10 +875,10 @@ minetest.register_abm({
|
||||
end,
|
||||
})
|
||||
|
||||
-- DISTRIBUTOR: spreads one signal to two outputs
|
||||
-- DISTRIBUTOR --
|
||||
|
||||
minetest.register_node("basic_machines:distributor", {
|
||||
description = "Distributor",
|
||||
description = "Distributor - can forward signal up to 16 different targets",
|
||||
tiles = {"distributor.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -1030,7 +1039,7 @@ minetest.register_node("basic_machines:distributor", {
|
||||
)
|
||||
|
||||
|
||||
-- LIGHT
|
||||
-- LIGHT --
|
||||
|
||||
minetest.register_node("basic_machines:light_off", {
|
||||
description = "Light off",
|
||||
@ -1062,7 +1071,7 @@ minetest.register_node("basic_machines:light_on", {
|
||||
|
||||
punchset.known_nodes = {["basic_machines:mover"]=true,["basic_machines:keypad"]=true,["basic_machines:detector"]=true};
|
||||
|
||||
-- handles set up punches
|
||||
-- SETUP BY PUNCHING
|
||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||
|
||||
local name = puncher:get_player_name(); if name==nil then return end
|
||||
@ -1320,7 +1329,7 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||
end)
|
||||
|
||||
|
||||
-- handles forms processing for all machines
|
||||
-- FORM PROCESSING for all machines
|
||||
minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
|
||||
-- MOVER
|
||||
@ -1337,12 +1346,13 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
local text = "SETUP: For interactive setup "..
|
||||
"punch the mover and then punch source1, source2, target node (follow instructions). Put locked chest with fuel within distance 1 from mover. For advanced setup right click mover. Positions are defined by x y z coordinates (see top of mover for orientation). Mover itself is at coordinates 0 0 0. "..
|
||||
"\n\nMODES of operation: normal (just teleport block), dig (digs and gives you resulted node - good for harvesting farms), drop "..
|
||||
"(drops node on ground), reverse(takes from target position, places on source positions - good for planting a farm), object (teleportation of player and objects. distance between source1/2 defines teleport radius). "..
|
||||
"(drops node on ground), object (teleportation of player and objects. distance between source1/2 defines teleport radius). "..
|
||||
"By setting 'filter' only selected nodes are moved.\nInventory mode can exchange items between node inventories. You need to select inventory name for source/target from the dropdown list on the right and enter node to be moved into filter."..
|
||||
"\n You can reverse start/end position by setting reverse nonzero. This is useful for placing stuff at many locations-planting." ..
|
||||
"\n\n FUEL CONSUMPTION depends on blocks to be moved and distance. For example, stone or tree is harder to move than dirt, harvesting wheat is very cheap and and moving lava is very hard."..
|
||||
"\n\n UPGRADE mover by moving mese blocks in upgrade inventory. Each mese block increases mover range by 10, fuel consumption is divided by (number of mese blocks)+1 in upgrade. Max 10 blocks are used for upgrade. Dont forget to right click mover to refresh after upgrade. "..
|
||||
"\n\n Activate mover by keypad/detector signal or mese signal (if mesecons mod) .";
|
||||
local form = "size [5,7] textarea[0,0;5.5,8.5;help;MOVER HELP;".. text.."]"
|
||||
local form = "size [6,7] textarea[0,0;6.5,8.5;help;MOVER HELP;".. text.."]"
|
||||
minetest.show_formspec(name, "basic_machines:help_mover", form)
|
||||
end
|
||||
|
||||
@ -1361,6 +1371,10 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
meta:set_string("mode",fields.mode);
|
||||
end
|
||||
|
||||
if fields.reverse then
|
||||
meta:set_string("reverse",fields.reverse);
|
||||
end
|
||||
|
||||
if fields.inv1 then
|
||||
meta:set_string("inv1",fields.inv1);
|
||||
end
|
||||
@ -1520,7 +1534,7 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- DISTRIBUTOR
|
||||
local fname = "basic_machines:distributor_"
|
||||
@ -1610,7 +1624,9 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
|
||||
end)
|
||||
|
||||
-- CRAFTS
|
||||
|
||||
|
||||
-- CRAFTS --
|
||||
|
||||
minetest.register_craft({
|
||||
output = "basic_machines:mover",
|
||||
|
@ -126,7 +126,7 @@ local recycler_update_meta = function(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:recycler", {
|
||||
description = "Recycler",
|
||||
description = "Recycler - use to get some ingredients back from crafted things",
|
||||
tiles = {"recycler.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
@ -18,12 +18,12 @@ local battery_update_meta = function(pos)
|
||||
local capacity = meta:get_float("capacity");
|
||||
local energy = math.ceil(10*meta:get_float("energy"))/10;
|
||||
local form =
|
||||
"size[8,5.5]" .. -- width, height
|
||||
"size[8,6.5]" .. -- width, height
|
||||
"label[0,0;FUEL] ".."label[6,0;UPGRADE] "..
|
||||
"label[1,0;ENERGY ".. energy .."/ ".. capacity..", maximum power output ".. (capacity*0.1) .."]"..
|
||||
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade") .. " (mese and diamond block)]"..
|
||||
"list["..list_name..";fuel;0.,0.5;1,1;]".. "list["..list_name..";upgrade;6.,0.5;2,1;]" ..
|
||||
"list[current_player;main;0,1.5;8,4;]"..
|
||||
"list[current_player;main;0,2.5;8,4;]"..
|
||||
"button[4.5,0.35;1.5,1;OK;REFRESH]";
|
||||
meta:set_string("formspec", form);
|
||||
end
|
||||
@ -102,13 +102,13 @@ battery_upgrade = function(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:battery", {
|
||||
description = "battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it",
|
||||
description = "battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it. Its upgradeable.",
|
||||
tiles = {"basic_machine_outlet.png","basic_machine_side.png","basic_machine_battery.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext","battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it when activated");
|
||||
meta:set_string("infotext","battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it when activated by keypad");
|
||||
meta:set_string("owner",placer:get_player_name());
|
||||
local inv = meta:get_inventory();inv:set_size("fuel", 1*1); -- place to put crystals
|
||||
inv:set_size("upgrade", 2*1);
|
||||
@ -239,11 +239,11 @@ local generator_update_meta = function(pos)
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
|
||||
local form =
|
||||
"size[8,5.5]" .. -- width, height
|
||||
"size[8,6.5]" .. -- width, height
|
||||
"label[0,0;POWER CRYSTALS] ".."label[6,0;UPGRADE] "..
|
||||
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade") .. " (gold and diamond block)]"..
|
||||
"list["..list_name..";fuel;0.,0.5;1,1;]".. "list["..list_name..";upgrade;6.,0.5;2,1;]" ..
|
||||
"list[current_player;main;0,1.5;8,4;]"..
|
||||
"list[current_player;main;0,2.5;8,4;]"..
|
||||
"button[4.5,0.35;1.5,1;OK;REFRESH]";
|
||||
meta:set_string("formspec", form);
|
||||
end
|
||||
@ -268,7 +268,7 @@ generator_upgrade = function(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:generator", {
|
||||
description = "generator - generates power crystals that provide power",
|
||||
description = "Generator - very expensive, generates power crystals that provide power. Its upgradeable.",
|
||||
tiles = {"basic_machine_side.png","basic_machine_side.png","basic_machine_generator.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -393,7 +393,7 @@ function basic_machines.check_power(pos, power_draw) -- mover checks power sourc
|
||||
|
||||
energy = energy-power_draw;
|
||||
if energy<0 then
|
||||
meta:set_string("infotext", "try to use better fuel to accomodate power draw ".. power_draw);
|
||||
meta:set_string("infotext", "used fuel provides too little power for current power draw ".. power_draw);
|
||||
return 0
|
||||
end -- recharge wasnt enough, needs to be repeated manually, return 0 power available
|
||||
meta:set_float("energy", energy);
|
||||
@ -417,11 +417,10 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "basic_machines:generator",
|
||||
recipe = {
|
||||
{"default:diamondblock","default:diamondblock","default:diamondblock"},
|
||||
{"","",""},
|
||||
{"default:diamondblock","basic_machines:battery","default:diamondblock"},
|
||||
{"default:diamondblock","default:diamondblock","default:diamondblock"}
|
||||
|
||||
@ -429,47 +428,19 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craftitem("basic_machines:power_cell", {
|
||||
description = "Power cell",
|
||||
description = "Power cell - provides 1 power",
|
||||
inventory_image = "power_cell.png",
|
||||
stack_max = 999
|
||||
stack_max = 25
|
||||
})
|
||||
|
||||
minetest.register_craftitem("basic_machines:power_block", {
|
||||
description = "Power block",
|
||||
description = "Power block - provides 10 power",
|
||||
inventory_image = "power_block.png",
|
||||
stack_max = 999
|
||||
stack_max = 25
|
||||
})
|
||||
|
||||
minetest.register_craftitem("basic_machines:power_rod", {
|
||||
description = "Power rod",
|
||||
description = "Power rod - provides 100 power",
|
||||
inventory_image = "power_rod.png",
|
||||
stack_max = 999
|
||||
})
|
||||
|
||||
|
||||
|
||||
--OLD: for compatibility with outlets
|
||||
|
||||
|
||||
local outlet_power_demand = 300;
|
||||
minetest.register_node("basic_machines:outlet", {
|
||||
description = "Power outlet - generates power for machines",
|
||||
tiles = {"outlet.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({ -- replace old outlets with batteries
|
||||
nodenames = {"basic_machines:outlet"},
|
||||
neighbors = {""},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.set_node(pos,{name="basic_machines:battery"});
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext","upgraded from outlet. please dig and place again.")
|
||||
end
|
||||
});
|
||||
|
||||
|
||||
-- END OLD
|
||||
stack_max = 25
|
||||
})
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.1 KiB |
@ -567,7 +567,7 @@ minetest.register_node("es:vault", {
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_blast = function() end,
|
||||
on_blast = function() end,
|
||||
})
|
||||
|
||||
--BONEBLOCK
|
||||
@ -860,7 +860,7 @@ minetest.register_node("es:mud", {
|
||||
|
||||
minetest.register_node("es:mud_flowing", {
|
||||
description = "Flowing mud",
|
||||
drawtype = "liquid",--change to liquid for a solid look
|
||||
--drawtype = "liquid",--change to liquid for a solid look
|
||||
tiles = {"es_mud.png"},
|
||||
|
||||
alpha = 250,
|
||||
|
@ -36,13 +36,20 @@ stairs.register_stair_and_slab("marble", "es:marble",
|
||||
"Marble Block Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("marble bricks", "es:marble_bricks",
|
||||
stairs.register_stair_and_slab("marblebricks", "es:marble_bricks",
|
||||
{cracky = 1},
|
||||
{"technic_marble_bricks.png" },
|
||||
"Marble Brick Block Stair",
|
||||
"Marble Brick Block Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("granitebricks", "es:granite_bricks",
|
||||
{cracky = 1},
|
||||
{"technic_granite_bricks.png" },
|
||||
"Granite Brick Block Stair",
|
||||
"Granite Brick Block Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
|
||||
--Extreme Survival Stairs
|
||||
stairs.register_stair_and_slab("Ruby", "es:rubyblock",
|
||||
|
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 797 B After Width: | Height: | Size: 872 B |
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 634 B |