This commit is contained in:
pagliaccio 2013-07-13 13:19:07 +02:00
commit ad0bef9d90
4 changed files with 530 additions and 515 deletions

View File

@ -1,187 +1,194 @@
--- HV battery box
local max_charge = 1500000
local max_charge_rate = 3000
local max_discharge_rate = 5000
-- HV battery box
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_battery_box 1', output = 'technic:hv_battery_box 1',
recipe = { recipe = {
{'technic:mv_battery_box', 'technic:mv_battery_box', 'technic:mv_battery_box'}, {'technic:mv_battery_box', 'technic:mv_battery_box', 'technic:mv_battery_box'},
{'technic:mv_battery_box', 'technic:hv_transformer', 'technic:mv_battery_box'}, {'technic:mv_battery_box', 'technic:hv_transformer', 'technic:mv_battery_box'},
{'', 'technic:hv_cable', ''}, {'', 'technic:hv_cable', ''},
} }
}) })
local battery_box_formspec = local battery_box_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]".. "image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;technic_battery_reload.png]".. "image[4,1;1,1;technic_battery_reload.png]"..
"list[current_name;dst;5,1;1,1;]".. "list[current_name;dst;5,1;1,1;]"..
"label[0,0;HV Battery Box]".. "label[0,0;HV Battery Box]"..
"label[3,0;Charge]".. "label[3,0;Charge]"..
"label[5,0;Discharge]".. "label[5,0;Discharge]"..
"label[1,3;Power level]".. "label[1,3;Power level]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
minetest.register_node( minetest.register_node("technic:hv_battery_box", {
"technic:hv_battery_box", { description = "HV Battery Box",
description = "HV Battery Box", tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png",
tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png", "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png",
"technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png"}, "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop="technic:hv_battery_box", drop = "technic:hv_battery_box",
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
meta:set_string("infotext", "HV Battery Box")
meta:set_float("technic_hv_power_machine", 1)
meta:set_string("formspec", battery_box_formspec)
meta:set_int("HV_EU_demand", 0) -- How much this node can charge
meta:set_int("HV_EU_supply", 0) -- How much this node can discharge
meta:set_int("HV_EU_input", 0) -- How much power this machine is getting.
meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1)
inv:set_size("dst", 1)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
return false
else
return true
end
end,
})
for i = 1,8,1 do
minetest.register_node("technic:hv_battery_box"..i, {
description = "HV Battery Box",
tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png",
"technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
"technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
"technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
"technic_hv_battery_box_side0.png^technic_power_meter"..i..".png"},
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
paramtype="light",
light_source=9,
drop="technic:hv_battery_box",
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
meta:set_string("infotext", "HV Battery Box") if not inv:is_empty("src") or not inv:is_empty("dst") then
meta:set_float("technic_hv_power_machine", 1) minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
meta:set_string("formspec", battery_box_formspec) return false
meta:set_int("HV_EU_demand", 0) -- How much can this node charge else
meta:set_int("HV_EU_supply", 0) -- How much can this node discharge return true
meta:set_int("HV_EU_input", 0) -- How much power is this machine getting. end
meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1)
inv:set_size("dst", 1)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
return false
else
return true
end
end, end,
}) })
for i=1,8,1 do
minetest.register_node(
"technic:hv_battery_box"..i,
{description = "HV Battery Box",
tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
"technic_hv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
paramtype="light",
light_source=9,
drop="technic:hv_battery_box",
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
return false
else
return true
end
end,
})
end end
local power_tools = technic.HV_power_tools local power_tools = technic.HV_power_tools
local charge_HV_tools = function(meta, charge) local function charge_HV_tools(meta, charge)
--charge registered power tools --charge registered power tools
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("src")==false then if not inv:is_empty("src") then
local srcstack = inv:get_stack("src", 1) local srcstack = inv:get_stack("src", 1)
local src_item=srcstack:to_table() local src_item = srcstack:to_table()
local src_meta=get_item_meta(src_item["metadata"]) local src_meta = get_item_meta(src_item["metadata"])
local toolname = src_item["name"] local toolname = src_item["name"]
if power_tools[toolname] ~= nil then if power_tools[toolname] ~= nil then
-- Set meta data for the tool if it didn't do it itself :-( -- Set meta data for the tool if it didn't do it itself :-(
src_meta=get_item_meta(src_item["metadata"]) src_meta = get_item_meta(src_item["metadata"])
if src_meta==nil then if src_meta==nil then
src_meta={} src_meta = {}
src_meta["technic_hv_power_tool"]=true src_meta["technic_hv_power_tool"] = true
src_meta["charge"]=0 src_meta["charge"] = 0
else else
if src_meta["technic_hv_power_tool"]==nil then if src_meta["technic_hv_power_tool"] == nil then
src_meta["technic_hv_power_tool"]=true src_meta["technic_hv_power_tool"] = true
src_meta["charge"]=0 src_meta["charge"] = 0
end end
end
-- Do the charging
local item_max_charge = power_tools[toolname]
local load = src_meta["charge"]
local load_step = 1000 -- how much to charge per tick
if load<item_max_charge and charge>0 then
if charge-load_step<0 then load_step=charge end
if load+load_step>item_max_charge then load_step=item_max_charge-load end
load=load+load_step
charge=charge-load_step
technic.set_RE_wear(src_item,load,item_max_charge)
src_meta["charge"] = load
src_item["metadata"] = set_item_meta(src_meta)
inv:set_stack("src", 1, src_item)
end
end end
end -- Do the charging
return charge -- return the remaining charge in the battery local item_max_charge = power_tools[toolname]
end local tool_charge = src_meta["charge"]
local charge_step = 1000 -- how much to charge per tick
local discharge_HV_tools = function(meta, charge, max_charge) if tool_charge < item_max_charge and tool_charge > 0 then
-- discharging registered power tools if tool_charge - charge_step < 0 then
local inv = meta:get_inventory() charge_step = charge
if inv:is_empty("dst") == false then end
srcstack = inv:get_stack("dst", 1) if tool_charge + charge_step > item_max_charge then
src_item=srcstack:to_table() charge_step = item_max_charge - tool_charge
local src_meta=get_item_meta(src_item["metadata"]) end
local toolname = src_item["name"] tool_charge = tool_charge + charge_step
if power_tools[toolname] ~= nil then charge = charge - charge_step
-- Set meta data for the tool if it didn't do it itself :-( technic.set_RE_wear(src_item, tool_charge, item_max_charge)
src_meta=get_item_meta(src_item["metadata"]) src_meta["charge"] = tool_charge
if src_meta==nil then src_item["metadata"] = set_item_meta(src_meta)
src_meta={} inv:set_stack("src", 1, src_item)
src_meta["technic_hv_power_tool"]=true
src_meta["charge"]=0
else
if src_meta["technic_hv_power_tool"]==nil then
src_meta["technic_hv_power_tool"]=true
src_meta["charge"]=0
end
end
-- Do the discharging
local item_max_charge = power_tools[toolname]
local load = src_meta["charge"]
local load_step = 4000 -- how much to discharge per tick
if load>0 and charge<max_charge then
if charge+load_step>max_charge then load_step=max_charge-charge end
if load-load_step<0 then load_step=load end
load=load-load_step
charge=charge+load_step
technic.set_RE_wear(src_item,load,item_max_charge)
src_meta["charge"]=load
src_item["metadata"]=set_item_meta(src_meta)
inv:set_stack("dst", 1, src_item)
end
end
end end
return charge -- return the remaining charge in the battery end
end end
return charge -- return the remaining charge in the battery
end
minetest.register_abm( local function discharge_HV_tools(meta, charge, max_charge)
{nodenames = {"technic:hv_battery_box","technic:hv_battery_box1","technic:hv_battery_box2","technic:hv_battery_box3","technic:hv_battery_box4", -- discharging registered power tools
"technic:hv_battery_box5","technic:hv_battery_box6","technic:hv_battery_box7","technic:hv_battery_box8" local inv = meta:get_inventory()
}, if not inv:is_empty("dst") then
interval = 1, srcstack = inv:get_stack("dst", 1)
chance = 1, src_item = srcstack:to_table()
action = function(pos, node, active_object_count, active_object_count_wider) local src_meta = get_item_meta(src_item["metadata"])
local meta = minetest.env:get_meta(pos) local toolname = src_item["name"]
local max_charge = 1500000 -- Set maximum charge for the device here if power_tools[toolname] ~= nil then
local max_charge_rate = 3000 -- Set maximum rate of charging -- Set meta data for the tool if it didn't do it itself :-(
local max_discharge_rate = 5000 -- Set maximum rate of discharging (16000) src_meta = get_item_meta(src_item["metadata"]) or {}
local eu_input = meta:get_int("HV_EU_input") if src_meta["technic_hv_power_tool"] == nil then
local current_charge = meta:get_int("internal_EU_charge") -- Battery charge right now src_meta["technic_hv_power_tool"] = true
src_meta["charge"] = 0
end
-- Do the discharging
local item_max_charge = power_tools[toolname]
local tool_charge = src_meta["charge"]
local charge_step = 4000 -- how much to discharge per tick
if tool_charge > 0 and charge < max_charge then
if tool_charge + charge_step > max_charge then
charge_step = max_charge - charge
end
if tool_charge - charge_step < 0 then
charge_step = charge
end
tool_charge = tool_charge - charge_step
charge = charge + charge_step
technic.set_RE_wear(src_item, tool_charge, item_max_charge)
src_meta["charge"] = tool_charge
src_item["metadata"] = set_item_meta(src_meta)
inv:set_stack("dst", 1, src_item)
end
end
end
return charge -- return the remaining charge in the battery
end
minetest.register_abm({
nodenames = {"technic:hv_battery_box", "technic:hv_battery_box1", "technic:hv_battery_box2",
"technic:hv_battery_box3", "technic:hv_battery_box4", "technic:hv_battery_box5",
"technic:hv_battery_box6", "technic:hv_battery_box7", "technic:hv_battery_box8"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.env:get_meta(pos)
local eu_input = meta:get_int("HV_EU_input")
local current_charge = meta:get_int("internal_EU_charge") -- Battery charge right now
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "HV") technic.switching_station_timeout_count(pos, "HV")
-- Charge/discharge the battery with the input EUs -- Charge/discharge the battery with the input EUs
if eu_input >=0 then if eu_input >= 0 then
current_charge = math.min(current_charge+eu_input, max_charge) current_charge = math.min(current_charge + eu_input, max_charge)
else else
current_charge = math.max(current_charge+eu_input, 0) current_charge = math.max(current_charge + eu_input, 0)
end end
-- Charging/discharging tools here -- Charging/discharging tools here
@ -195,37 +202,40 @@ minetest.register_abm(
meta:set_int("HV_EU_supply", math.min(max_discharge_rate, current_charge)) meta:set_int("HV_EU_supply", math.min(max_discharge_rate, current_charge))
meta:set_int("internal_EU_charge", current_charge) meta:set_int("internal_EU_charge", current_charge)
--dprint("BA: input:"..eu_input.." supply="..meta:get_int("HV_EU_supply").." demand="..meta:get_int("HV_EU_demand").." current:"..current_charge)
-- Select node textures -- Select node textures
local i=math.ceil((current_charge/max_charge)*8) local charge_count = math.ceil((current_charge / max_charge) * 8)
if i > 8 then i = 8 end if charge_count > 8 then
local j = meta:get_float("last_side_shown") charge_count = 8
if i~=j then end
if i>0 then hacky_swap_node(pos,"technic:hv_battery_box"..i) local last_count = meta:get_float("last_side_shown")
elseif i==0 then hacky_swap_node(pos,"technic:hv_battery_box") end if charge_count ~= last_count then
meta:set_float("last_side_shown",i) if charge_count > 0 then
hacky_swap_node(pos,"technic:hv_battery_box"..charge_count)
else
hacky_swap_node(pos,"technic:hv_battery_box")
end
meta:set_float("last_side_shown", charge_count)
end end
local load = math.floor(current_charge/max_charge * 100) local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec", meta:set_string("formspec",
battery_box_formspec.. battery_box_formspec..
"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]" ..charge_percent..":technic_power_meter_fg.png]")
)
if eu_input == 0 then if eu_input == 0 then
meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge.." (idle)") meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge.." (idle)")
else else
meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge) meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge)
end end
end end
}) })
-- Register as a battery type -- Register as a battery type
-- Battery type machines function as power reservoirs and can both receive and give back power -- Battery type machines function as power reservoirs and can both receive and give back power
technic.register_HV_machine("technic:hv_battery_box","BA") technic.register_HV_machine("technic:hv_battery_box","BA")
for i=1,8,1 do for i=1,8,1 do
technic.register_HV_machine("technic:hv_battery_box"..i,"BA") technic.register_HV_machine("technic:hv_battery_box"..i,"BA")
end end

View File

@ -5,8 +5,8 @@
-- Forcefield Generator is a HV machine. -- Forcefield Generator is a HV machine.
-- How expensive is the generator? Leaves room for upgrades lowering the power drain? -- How expensive is the generator? Leaves room for upgrades lowering the power drain?
local forcefield_power_drain = 10 -- default 10 local forcefield_power_drain = 10
local forcefield_update_interval = 1 local forcefield_step_interval = 1
minetest.register_craft({ minetest.register_craft({
output = 'technic:forcefield_emitter_off', output = 'technic:forcefield_emitter_off',
@ -17,143 +17,138 @@ minetest.register_craft({
} }
}) })
-- Idea: Let forcefields have different colors by upgrade slot. -- Idea: Let forcefields have different colors by upgrade slot.
-- Idea: Let forcefields add up by detecting if one hits another. -- Idea: Let forcefields add up by detecting if one hits another.
-- ___ __ -- ___ __
-- / \/ \ -- / \/ \
-- | | -- | |
-- \___/\___/ -- \___/\___/
--
local function add_forcefield(pos, range)
for x=-range,range do
for y=-range,range do
for z=-range,range do
if ((x*x+y*y+z*z) <= (range * range + range)) then
if ((range-1) * (range-1) + (range-1) <= x*x+y*y+z*z) then
local np={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local n = minetest.env:get_node(np).name
if (n == "air") then
minetest.env:add_node(np, {name = "technic:forcefield"})
end
end
end
end
end
end
return true
end
local function remove_forcefield(p, range) local function update_forcefield(pos, range, active)
for x=-range,range do local vm = VoxelManip()
for y=-range,range do local p1 = {x = pos.x-range, y = pos.y-range, z = pos.z-range}
for z=-range,range do local p2 = {x = pos.x+range, y = pos.y+range, z = pos.z+range}
if ((x*x+y*y+z*z) <= (range * range + range)) then local MinEdge, MaxEdge = vm:read_from_map(p1, p2)
if ((range-1) * (range-1) + (range-1) <= x*x+y*y+z*z) then local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
local np={x=p.x+x,y=p.y+y,z=p.z+z} local data = vm:get_data()
local n = minetest.env:get_node(np).name
if (n == "technic:forcefield") then local c_air = minetest.get_content_id("air")
minetest.env:remove_node(np) local c_field = minetest.get_content_id("technic:forcefield")
end
for z=-range, range do
for y=-range, range do
local vi = area:index(pos.x+(-range), pos.y+y, pos.z+z)
for x=-range, range do
if x*x+y*y+z*z <= range * range + range and
x*x+y*y+z*z >= (range-1) * (range-1) + (range-1) and
((active and data[vi] == c_air) or ((not active) and data[vi] == c_field)) then
if active then
data[vi] = c_field
else
data[vi] = c_air
end end
end end
vi = vi + 1
end end
end end
end end
vm:set_data(data)
vm:update_liquids()
vm:write_to_map()
vm:update_map()
end end
local get_forcefield_formspec = function(range) local get_forcefield_formspec = function(range)
-- return "invsize[8,9;]".. (if upgrades added later - colors for instance)
return "invsize[3,4;]".. return "invsize[3,4;]"..
"label[0,0;Forcefield emitter]".. "label[0,0;Forcefield emitter]"..
"label[1,1;Range]".. "label[1,1;Range]"..
"label[1,2;"..range.."]".. "label[1,2;"..range.."]"..
"button[0,2;1,1;subtract;-]".. "button[0,2;1,1;subtract;-]"..
"button[2,2;1,1;add;+]".. "button[2,2;1,1;add;+]"..
"button[0,3;3,1;toggle;Enable/Disable]" -- .. "button[0,3;3,1;toggle;Enable/Disable]"
-- "list[current_player;main;0,5;8,4;]"
end end
local forcefield_receive_fields = function(pos, formname, fields, sender) local forcefield_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
local range = meta:get_int("range") local range = meta:get_int("range")
if fields.add then range = range + 1 end
if fields.subtract then range = range - 1 end
if fields.toggle then
if meta:get_int("enabled") == 1 then
meta:set_int("enabled", 0)
else
meta:set_int("enabled", 1)
end
end
-- Smallest field is 5. Anything less is asking for trouble.
-- Largest is 20. It is a matter of pratical node handling.
if range < 5 then range = 5 end
if range > 20 then range = 20 end
if range <= 20 and range >= 5 and meta:get_int("range") ~= range then if fields.add then range = range + 1 end
remove_forcefield(pos, meta:get_int("range")) if fields.subtract then range = range - 1 end
meta:set_int("range", range) if fields.toggle then
meta:set_string("formspec", get_forcefield_formspec(range)) if meta:get_int("enabled") == 1 then
end meta:set_int("enabled", 0)
end else
meta:set_int("enabled", 1)
local forcefield_check = function(pos) end
local meta = minetest.env:get_meta(pos)
local node = minetest.env:get_node(pos)
local eu_input = meta:get_int("HV_EU_input")
local eu_demand = meta:get_int("HV_EU_demand")
local enabled = meta:get_int("enabled")
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "HV")
local power_requirement
if enabled == 1 then
power_requirement = math.floor(4*math.pi*math.pow(meta:get_int("range"), 2)) * forcefield_power_drain
else
power_requirement = eu_demand
end
if eu_input == 0 then
meta:set_string("infotext", "Forcefield Generator Unpowered")
meta:set_int("HV_EU_demand", 100)
meta:set_int("enabled", 0)
if node.name == "technic:forcefield_emitter_on" then
remove_forcefield(pos, meta:get_int("range"))
hacky_swap_node(pos, "technic:forcefield_emitter_off")
end
elseif eu_input == power_requirement then
if meta:get_int("enabled") == 1 then
if node.name == "technic:forcefield_emitter_off" then
hacky_swap_node(pos, "technic:forcefield_emitter_on")
meta:set_string("infotext", "Forcefield Generator Active")
add_forcefield(pos, meta:get_int("range"))
else
-- Range updated. Move the forcefield.
add_forcefield(pos, meta:get_int("range"))
end
else
if node.name == "technic:forcefield_emitter_on" then
remove_forcefield(pos, meta:get_int("range"))
hacky_swap_node(pos, "technic:forcefield_emitter_off")
meta:set_int("HV_EU_demand", 100)
meta:set_string("infotext", "Forcefield Generator Idle")
end
end
else
meta:set_int("HV_EU_demand", power_requirement)
end
return true
end
local mesecons = {effector = {
action_on = function(pos, node)
minetest.env:get_meta(pos):set_int("enabled", 0)
end,
action_off = function(pos, node)
minetest.env:get_meta(pos):set_int("enabled", 1)
end end
}}
-- Smallest field is 5. Anything less is asking for trouble.
-- Largest is 20. It is a matter of pratical node handling.
if range < 5 then range = 5 end
if range > 20 then range = 20 end
if range <= 20 and range >= 5 and meta:get_int("range") ~= range then
update_forcefield(pos, meta:get_int("range"), false)
meta:set_int("range", range)
meta:set_string("formspec", get_forcefield_formspec(range))
end
end
local function forcefield_step(pos)
local meta = minetest.env:get_meta(pos)
local node = minetest.env:get_node(pos)
local eu_input = meta:get_int("HV_EU_input")
local eu_demand = meta:get_int("HV_EU_demand")
local enabled = meta:get_int("enabled")
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "HV")
local power_requirement = 0
if enabled == 1 then
power_requirement = math.floor(
4 * math.pi * math.pow(meta:get_int("range"), 2)
) * forcefield_power_drain
else
power_requirement = eu_demand
end
if meta:get_int("enabled") == 0 then
if node.name == "technic:forcefield_emitter_on" then
update_forcefield(pos, meta:get_int("range"), false)
hacky_swap_node(pos, "technic:forcefield_emitter_off")
meta:set_int("HV_EU_demand", 100)
meta:set_string("infotext", "Forcefield Generator Disabled")
end
elseif eu_input < power_requirement then
meta:set_string("infotext", "Forcefield Generator Unpowered")
if node.name == "technic:forcefield_emitter_on" then
update_forcefield(pos, meta:get_int("range"), false)
hacky_swap_node(pos, "technic:forcefield_emitter_off")
end
elseif eu_input >= power_requirement then
if node.name == "technic:forcefield_emitter_off" then
hacky_swap_node(pos, "technic:forcefield_emitter_on")
meta:set_string("infotext", "Forcefield Generator Active")
end
update_forcefield(pos, meta:get_int("range"), true)
end
meta:set_int("HV_EU_demand", power_requirement)
return true
end
local mesecons = {
effector = {
action_on = function(pos, node)
minetest.env:get_meta(pos):set_int("enabled", 0)
end,
action_off = function(pos, node)
minetest.env:get_meta(pos):set_int("enabled", 1)
end
}
}
minetest.register_node("technic:forcefield_emitter_off", { minetest.register_node("technic:forcefield_emitter_off", {
description = "Forcefield emitter", description = "Forcefield emitter",
@ -161,10 +156,10 @@ minetest.register_node("technic:forcefield_emitter_off", {
tiles = {"technic_forcefield_emitter_off.png"}, tiles = {"technic_forcefield_emitter_off.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky = 1}, groups = {cracky = 1},
on_timer = forcefield_check, on_timer = forcefield_step,
on_receive_fields = forcefield_receive_fields, on_receive_fields = forcefield_receive_fields,
on_construct = function(pos) on_construct = function(pos)
minetest.env:get_node_timer(pos):start(forcefield_update_interval) minetest.env:get_node_timer(pos):start(forcefield_step_interval)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
meta:set_float("technic_hv_power_machine", 1) meta:set_float("technic_hv_power_machine", 1)
meta:set_int("HV_EU_input", 0) meta:set_int("HV_EU_input", 0)
@ -183,10 +178,10 @@ minetest.register_node("technic:forcefield_emitter_on", {
is_ground_content = true, is_ground_content = true,
groups = {cracky = 1, not_in_creative_inventory=1}, groups = {cracky = 1, not_in_creative_inventory=1},
drop='"technic:forcefield_emitter_off" 1', drop='"technic:forcefield_emitter_off" 1',
on_timer = forcefield_check, on_timer = forcefield_step,
on_receive_fields = forcefield_receive_fields, on_receive_fields = forcefield_receive_fields,
on_construct = function(pos) on_construct = function(pos)
minetest.env:get_node_timer(pos):start(forcefield_update_interval) minetest.env:get_node_timer(pos):start(forcefield_step_interval)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
-- meta:set_float("technic_hv_power_machine", 1) -- meta:set_float("technic_hv_power_machine", 1)
-- meta:set_float("HV_EU_input", 0) -- meta:set_float("HV_EU_input", 0)
@ -197,7 +192,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
-- meta:set_string("infotext", "Forcefield emitter"); -- meta:set_string("infotext", "Forcefield emitter");
end, end,
on_dig = function(pos, node, digger) on_dig = function(pos, node, digger)
remove_forcefield(pos, minetest.env:get_meta(pos):get_int("range")) update_forcefield(pos, minetest.env:get_meta(pos):get_int("range"), false)
return minetest.node_dig(pos, node, digger) return minetest.node_dig(pos, node, digger)
end, end,
mesecons = mesecons mesecons = mesecons
@ -208,9 +203,17 @@ minetest.register_node("technic:forcefield", {
sunlight_propagates = true, sunlight_propagates = true,
drop = '', drop = '',
light_source = 8, light_source = 8,
tiles = {{name="technic_forcefield_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}}, tiles = {{
name = "technic_forcefield_animated.png",
animation = {
type = "vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0,
},
}},
is_ground_content = true, is_ground_content = true,
groups = {not_in_creative_inventory=1, unbreakable=1}, groups = { not_in_creative_inventory=1, unbreakable=1 },
paramtype = "light", paramtype = "light",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { --hacky way to get the field blue and not see through the ground node_box = { --hacky way to get the field blue and not see through the ground
@ -221,5 +224,5 @@ minetest.register_node("technic:forcefield", {
}, },
}) })
technic.register_HV_machine("technic:forcefield_emitter_on","RE") technic.register_HV_machine("technic:forcefield_emitter_on", "RE")
technic.register_HV_machine("technic:forcefield_emitter_off","RE") technic.register_HV_machine("technic:forcefield_emitter_off", "RE")

View File

@ -5,239 +5,241 @@
-- --
-- The nuclear reactor core needs water and a protective shield to work. -- The nuclear reactor core needs water and a protective shield to work.
-- This is checked now and then and if the machine is tampered with... BOOM! -- This is checked now and then and if the machine is tampered with... BOOM!
local burn_ticks = 24*60 -- [minutes]. How many minutes does the power plant burn per serving? local burn_ticks = 24*60 -- [minutes]. How many minutes does the power plant burn per serving?
local power_supply = 10000 -- [HV] EUs local power_supply = 10000 -- [HV] EUs
local fuel_type = "technic:enriched_uranium" -- This reactor burns this stuff local fuel_type = "technic:enriched_uranium" -- The reactor burns this stuff
-- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator? -- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator?
minetest.register_craft( minetest.register_craft({
{output = 'technic:hv_nuclear_reactor_core', output = 'technic:hv_nuclear_reactor_core',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
} }
}) })
minetest.register_craftitem( minetest.register_craftitem("technic:hv_nuclear_reactor_core",{
"technic:hv_nuclear_reactor_core", description = "Uranium Rod Driven HV Reactor",
{description = "Uranium Rod Driven HV Reactor", stack_max = 1,
stack_max = 1, })
})
local generator_formspec = local generator_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
-- "image[0,0;5,5;technic_generator_menu.png]".. --"image[0,0;5,5;technic_generator_menu.png]"..
"label[0,0;Nuclear Reactor Rod Compartment]".. "label[0,0;Nuclear Reactor Rod Compartment]"..
"list[current_name;src;2,1;3,2;]".. "list[current_name;src;2,1;3,2;]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
-- "Boxy sphere" -- "Boxy sphere"
local nodebox = { local nodebox = {
{ -0.353, -0.353, -0.353, 0.353, 0.353, 0.353 }, -- Box { -0.353, -0.353, -0.353, 0.353, 0.353, 0.353 }, -- Box
{ -0.495, -0.064, -0.064, 0.495, 0.064, 0.064 }, -- Circle +-x { -0.495, -0.064, -0.064, 0.495, 0.064, 0.064 }, -- Circle +-x
{ -0.483, -0.128, -0.128, 0.483, 0.128, 0.128 }, { -0.483, -0.128, -0.128, 0.483, 0.128, 0.128 },
{ -0.462, -0.191, -0.191, 0.462, 0.191, 0.191 }, { -0.462, -0.191, -0.191, 0.462, 0.191, 0.191 },
{ -0.433, -0.249, -0.249, 0.433, 0.249, 0.249 }, { -0.433, -0.249, -0.249, 0.433, 0.249, 0.249 },
{ -0.397, -0.303, -0.303, 0.397, 0.303, 0.303 }, { -0.397, -0.303, -0.303, 0.397, 0.303, 0.303 },
{ -0.305, -0.396, -0.305, 0.305, 0.396, 0.305 }, -- Circle +-y { -0.305, -0.396, -0.305, 0.305, 0.396, 0.305 }, -- Circle +-y
{ -0.250, -0.432, -0.250, 0.250, 0.432, 0.250 }, { -0.250, -0.432, -0.250, 0.250, 0.432, 0.250 },
{ -0.191, -0.461, -0.191, 0.191, 0.461, 0.191 }, { -0.191, -0.461, -0.191, 0.191, 0.461, 0.191 },
{ -0.130, -0.482, -0.130, 0.130, 0.482, 0.130 }, { -0.130, -0.482, -0.130, 0.130, 0.482, 0.130 },
{ -0.066, -0.495, -0.066, 0.066, 0.495, 0.066 }, { -0.066, -0.495, -0.066, 0.066, 0.495, 0.066 },
{ -0.064, -0.064, -0.495, 0.064, 0.064, 0.495 }, -- Circle +-z { -0.064, -0.064, -0.495, 0.064, 0.064, 0.495 }, -- Circle +-z
{ -0.128, -0.128, -0.483, 0.128, 0.128, 0.483 }, { -0.128, -0.128, -0.483, 0.128, 0.128, 0.483 },
{ -0.191, -0.191, -0.462, 0.191, 0.191, 0.462 }, { -0.191, -0.191, -0.462, 0.191, 0.191, 0.462 },
{ -0.249, -0.249, -0.433, 0.249, 0.249, 0.433 }, { -0.249, -0.249, -0.433, 0.249, 0.249, 0.433 },
{ -0.303, -0.303, -0.397, 0.303, 0.303, 0.397 }, { -0.303, -0.303, -0.397, 0.303, 0.303, 0.397 },
} }
minetest.register_node( minetest.register_node("technic:hv_nuclear_reactor_core", {
"technic:hv_nuclear_reactor_core", description = "Nuclear Reactor",
{description = "Nuclear Reactor", tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
-- paramtype2 = "facedir", legacy_facedir_simple = true,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, sounds = default.node_sound_wood_defaults(),
legacy_facedir_simple = true, drawtype="nodebox",
sounds = default.node_sound_wood_defaults(), paramtype = "light",
drawtype="nodebox", node_box = {
paramtype = "light", type = "fixed",
node_box = { fixed = nodebox
type = "fixed", },
fixed = nodebox on_construct = function(pos)
}, local meta = minetest.env:get_meta(pos)
on_construct = function(pos) meta:set_string("infotext", "Nuclear Reactor Core")
local meta = minetest.env:get_meta(pos) meta:set_float("technic_hv_power_machine", 1)
meta:set_string("infotext", "Nuclear Reactor Core") meta:set_int("HV_EU_supply", 0)
meta:set_float("technic_hv_power_machine", 1) meta:set_int("HV_EU_from_fuel", 1) -- Signal to the switching station that this device burns some sort of fuel and needs special handling
meta:set_int("HV_EU_supply", 0) meta:set_int("burn_time", 0)
meta:set_int("HV_EU_from_fuel", 1) -- Signal to the switching station that this device burns some sort of fuel and needs special handling meta:set_string("formspec", generator_formspec)
meta:set_int("burn_time", 0) local inv = meta:get_inventory()
meta:set_string("formspec", generator_formspec) inv:set_size("src", 6)
local inv = meta:get_inventory() end,
inv:set_size("src", 6) can_dig = function(pos,player)
end, local meta = minetest.env:get_meta(pos);
can_dig = function(pos,player) local inv = meta:get_inventory()
local meta = minetest.env:get_meta(pos); if not inv:is_empty("src") then
local inv = meta:get_inventory() minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
if not inv:is_empty("src") then return false
minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty"); else
return false return true
else end
return true end,
end })
end,
})
minetest.register_node( minetest.register_node("technic:hv_nuclear_reactor_core_active", {
"technic:hv_nuclear_reactor_core_active", description = "Uranium Rod Driven HV Reactor",
{description = "Uranium Rod Driven HV Reactor", tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
-- paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, legacy_facedir_simple = true,
legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(),
sounds = default.node_sound_wood_defaults(), drop="technic:hv_nuclear_reactor_core",
drop="technic:hv_nuclear_reactor_core", drawtype="nodebox",
drawtype="nodebox", light_source = 15,
light_source = 15, paramtype = "light",
paramtype = "light", node_box = {
node_box = { type = "fixed",
type = "fixed", fixed = nodebox
fixed = nodebox },
}, 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() if not inv:is_empty("src") then
if not inv:is_empty("src") then minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty"); return false
return false else
else return true
return true end
end end,
end, })
})
local check_reactor_structure = function(pos) local check_reactor_structure = function(pos)
-- The reactor consists of an 11x11x11 cube structure -- The reactor consists of an 11x11x11 cube structure
-- A cross section through the middle: -- A cross section through the middle:
-- CCCCC CCCCC -- CCCCC CCCCC
-- CCCCC CCCCC -- CCCCC CCCCC
-- CCSSS SSSCC -- CCSSS SSSCC
-- CCSCC CCSCC -- CCSCC CCSCC
-- CCSCWWWCSCC -- CCSCWWWCSCC
-- CCSCW#WCSCC -- CCSCW#WCSCC
-- CCSCW|WCSCC -- CCSCW|WCSCC
-- CCSCC|CCSCC -- CCSCC|CCSCC
-- CCSSS|SSSCC -- CCSSS|SSSCC
-- CCCCC|CCCCC -- CCCCC|CCCCC
-- C = Concrete, S = Stainless Steel, W = water node (not floating), #=reactor core, |=HV cable -- C = Concrete, S = Stainless Steel, W = water node (not floating), #=reactor core, |=HV cable
-- The man-hole and the HV cable is only in the middle. -- The man-hole and the HV cable is only in the middle
local water_nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, -- The man-hole is optional
{x=pos.x+1, y=pos.y+1, z=pos.z+1},
"default:water_source")
--print("Water ( 25):"..#water_nodes)
if #water_nodes ~= 25 then
--print("Water supply defect")
return 0
end
local inner_shield_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-2, z=pos.z-2},
{x=pos.x+2, y=pos.y+2, z=pos.z+2},
"technic:concrete")
--print("Concrete 1 ( 96):"..#inner_shield_nodes) local source_water_nodes = minetest.find_nodes_in_area(
if #inner_shield_nodes ~= 96 then {x=pos.x-1, y=pos.y-1, z=pos.z-1},
--print("Inner shield defect") {x=pos.x+1, y=pos.y+1, z=pos.z+1},
return 0 "default:water_source")
end local flowing_water_nodes = minetest.find_nodes_in_area(
local steel_shield_nodes = minetest.find_nodes_in_area({x=pos.x-3, y=pos.y-3, z=pos.z-3}, {x=pos.x-1, y=pos.y-1, z=pos.z-1},
{x=pos.x+3, y=pos.y+3, z=pos.z+3}, {x=pos.x+1, y=pos.y+1, z=pos.z+1},
"default:steelblock") "default:water_flowing")
if not ((#source_water_nodes + #flowing_water_nodes) >= 25) then
return false
end
--print("Steel ( 216):"..#steel_shield_nodes) local inner_shield_nodes = minetest.find_nodes_in_area(
if #steel_shield_nodes ~= 216 then {x=pos.x-2, y=pos.y-2, z=pos.z-2},
--print("Steel shield defect") {x=pos.x+2, y=pos.y+2, z=pos.z+2},
return 0 "technic:concrete")
end if not (#inner_shield_nodes >= 96) then
local outer_shield_nodes = minetest.find_nodes_in_area({x=pos.x-5, y=pos.y-5, z=pos.z-5}, return false
{x=pos.x+5, y=pos.y+5, z=pos.z+5}, end
"technic:concrete")
--print("Concrete 2 (1080):"..#outer_shield_nodes) local steel_shield_nodes = minetest.find_nodes_in_area(
if #outer_shield_nodes ~= (984+#inner_shield_nodes) then {x=pos.x-3, y=pos.y-3, z=pos.z-3},
--print("Outer shield defect") {x=pos.x+3, y=pos.y+3, z=pos.z+3},
return 0 "default:steelblock")
end if not (#steel_shield_nodes >= 216) then
return 1 return false
end end
local outer_shield_nodes = minetest.find_nodes_in_area(
{x=pos.x-5, y=pos.y-5, z=pos.z-5},
{x=pos.x+5, y=pos.y+5, z=pos.z+5},
"technic:concrete")
if not (#outer_shield_nodes >= (984 + #inner_shield_nodes)) then
return false
end
return true
end
local explode_reactor = function(pos) local explode_reactor = function(pos)
print("BOOM A reactor exploded!") print("BOOM A reactor exploded!")
end end
minetest.register_abm( minetest.register_abm({
{nodenames = {"technic:hv_nuclear_reactor_core","technic:hv_nuclear_reactor_core_active"}, nodenames = {"technic:hv_nuclear_reactor_core", "technic:hv_nuclear_reactor_core_active"},
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
local burn_time= meta:get_int("burn_time") local burn_time = meta:get_int("burn_time")
-- If more to burn and the energy produced was used: produce some more -- If more to burn and the energy produced was used: produce some more
if burn_time>0 then if burn_time > 0 then
if meta:get_int("HV_EU_supply") == 0 then if not check_reactor_structure(pos) then
-- We did not use the power explode_reactor(pos)
meta:set_int("HV_EU_supply", power_sypply) end
else if meta:get_int("HV_EU_supply") == 0 then
burn_time = burn_time - 1 -- We did not use the power
meta:set_int("burn_time",burn_time) meta:set_int("HV_EU_supply", power_supply)
meta:set_string("infotext", "Nuclear Reactor Core ("..math.floor(burn_time/(burn_ticks*60)*100).."%)") else
end burn_time = burn_time - 1
meta:set_int("burn_time", burn_time)
local percent = math.floor(burn_time / (burn_ticks * 60) * 100)
meta:set_string("infotext", "Nuclear Reactor Core ("..percent.."%)")
end
end end
-- Burn another piece of coal -- Burn another piece of coal
if burn_time==0 then if burn_time <= 0 then
local inv = meta:get_inventory() local inv = meta:get_inventory()
local correct_fuel_count = 0 local correct_fuel_count = 0
if inv:is_empty("src") == false then if not inv:is_empty("src") then
local srclist= inv:get_list("src") local srclist = inv:get_list("src")
for _, srcstack in pairs(srclist) do for _, srcstack in pairs(srclist) do
if srcstack then if srcstack then
local src_item=srcstack:to_table() local src_item=srcstack:to_table()
if src_item and src_item["name"] == fuel_type then if src_item and src_item["name"] == fuel_type then
correct_fuel_count = correct_fuel_count + 1 correct_fuel_count = correct_fuel_count + 1
end end
end end
end end
-- Check that the reactor is complete as well as the correct number of correct fuel -- Check that the reactor is complete as well as the correct number of correct fuel
if correct_fuel_count == 6 then if correct_fuel_count == 6 then
if check_reactor_structure(pos) == 1 then if not check_reactor_structure(pos) then
burn_time=burn_ticks*60 burn_time = burn_ticks * 60
meta:set_int("burn_time",burn_time) meta:set_int("burn_time", burn_time)
hacky_swap_node (pos,"technic:hv_nuclear_reactor_core_active") hacky_swap_node (pos,"technic:hv_nuclear_reactor_core_active")
meta:set_int("HV_EU_supply", power_supply) meta:set_int("HV_EU_supply", power_supply)
for idx, srcstack in pairs(srclist) do for idx, srcstack in pairs(srclist) do
srcstack:take_item() srcstack:take_item()
inv:set_stack("src", idx, srcstack) inv:set_stack("src", idx, srcstack)
end end
else end
-- BOOM!!! (the reactor was compromised and it should explode after some time) TNT mod inspired?? else
explode_reactor(pos) meta:set_int("HV_EU_supply", 0)
end end
else end
meta:set_int("HV_EU_supply", 0)
end
end
end end
-- Nothing left to burn -- Nothing left to burn
if burn_time==0 then if burn_time == 0 then
meta:set_string("infotext", "Nuclear Reactor Core (idle)") meta:set_string("infotext", "Nuclear Reactor Core (idle)")
hacky_swap_node (pos,"technic:hv_nuclear_reactor_core") hacky_swap_node(pos,"technic:hv_nuclear_reactor_core")
end end
end end
}) })
technic.register_HV_machine ("technic:hv_nuclear_reactor_core","PR") technic.register_HV_machine ("technic:hv_nuclear_reactor_core","PR")
technic.register_HV_machine ("technic:hv_nuclear_reactor_core_active","PR") technic.register_HV_machine ("technic:hv_nuclear_reactor_core_active","PR")

View File

@ -92,7 +92,7 @@ if z2==1 then temp_z2=str_z2 end
minetest.register_node("technic:hv_cable"..count, { minetest.register_node("technic:hv_cable"..count, {
description = "Gigh Voltage Copper Cable", description = "High Voltage Copper Cable",
tiles = {"technic_hv_cable.png"}, tiles = {"technic_hv_cable.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),