Add planter
This commit is contained in:
parent
06b5466e40
commit
0a06d5ea20
|
@ -22,13 +22,46 @@ function owl_tech.is_sapling(pos)
|
|||
return false
|
||||
end
|
||||
----------------------------------------------
|
||||
--can plant sapling in pos
|
||||
function owl_tech.can_plant_sapling(pos)
|
||||
--can plant plant in pos
|
||||
function owl_tech.can_plant_plant(pos)
|
||||
if (minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name== "mcl_farming:soil_wet"then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
----------------------------------------------
|
||||
--can plant plant in pos
|
||||
function owl_tech.can_plant_sapling(pos)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name,"soil_sapling")>1
|
||||
and minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name =="air" then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
-----------------------------------------------
|
||||
|
||||
|
||||
--prepear for plant sampling
|
||||
function owl_tech.prepear_for_sapling_plant(pos,distance)
|
||||
local meta= minetest.get_meta(pos)
|
||||
meta:set_int("distance",distance)
|
||||
end
|
||||
----------------------------------------------
|
||||
--looking for new sapling
|
||||
function owl_tech.look_for_place_new_sapling(pos)
|
||||
local meta= minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local fluid_its = inv:get_stack('sapling', 1)
|
||||
for i = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--x
|
||||
for j = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--z
|
||||
if owl_tech.can_plant_sapling({x=pos.x+i,y=pos.y,z=pos.z+j}) and fluid_its:get_count()>0
|
||||
and not fluid_its:is_empty() then
|
||||
minetest.place_node({x=pos.x+i,y=pos.y+1,z=pos.z+j}, {name=fluid_its:get_name()})
|
||||
local inv=meta:get_inventory()
|
||||
local fluid_its = inv:get_stack('sapling', 1)
|
||||
fluid_its:set_count(fluid_its:get_count()-1)
|
||||
inv:set_stack('sapling', 1, fluid_its)
|
||||
return -- plant 1 plant for each( if plant vore - hase bug)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
------------------------------------------------
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
owl_tech_advanced_steam_machins = true
|
||||
|
||||
--X-ray for look ore (can cause lag)
|
||||
owl_tech_x_ray_look =true
|
||||
owl_tech_x_ray_look = false
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
|||
local name = minetest.get_current_modname()
|
||||
local path = minetest.get_modpath(name)
|
||||
|
||||
--USE for get tire machine 1)Name 2)name 3)voltage 4)max_charge 5)color_code 6)metal name for crafte 7)has_macerator 8)help item list 9)has_alloy_smeter 10)has_siev 11)has_furnance 12)forge hammer 13)has vertical miner 14)delay verticalminer 15)has quarry 16 )distance quarry
|
||||
-- 10)forge hammer for i, value in ipairs(metals_ore_array) do
|
||||
--[[USE for get tire machine 1)Name 2)name 3)voltage 4)max_charge 5)color_code 6)metal name for crafte 7)has_macerator 8)help item list 9)has_alloy_smeter
|
||||
10)has_siev 11)has_furnance 12)forge hammer 13)has vertical miner 14)delay verticalminer 15)has quarry 16 )distance quarry 17)wood planter 18)wood_chopper 19)distance ]]
|
||||
|
||||
local table_all_machines={
|
||||
{"Base","base",32,1600,"#575757","steel",true,{"owl_tech:diamond","owl_tech:copper_heat_element","owl_tech:steel_mesh","mesecons_pistons:piston_normal_off"},true,true,true,true,true,18,true,16}
|
||||
{"Base","base",32,1600,"#575757","steel",true,{"owl_tech:diamond","owl_tech:copper_heat_element","owl_tech:steel_mesh","mesecons_pistons:piston_normal_off"},true,true
|
||||
,true,true,true,18,true,16,true,true,2}
|
||||
}
|
||||
|
||||
for i = 1, #table_all_machines, 1 do
|
||||
|
@ -193,7 +194,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -331,7 +332,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -466,7 +467,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -584,7 +585,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -615,7 +616,6 @@ for i = 1, #table_all_machines, 1 do
|
|||
if owl_tech.can_forge_hammer_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) then-- chek for all itemslot and machine tire
|
||||
local amount=owl_tech.calculate_recipe_tire_bonus(meta,FORGE_HAMMER_RECIPS[name][2],FORGE_HAMMER_RECIPS[name][5])
|
||||
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||
minetest.chat_send_all(steam_new)
|
||||
owl_tech:set_charge(meta,steam_new)
|
||||
owl_tech.add_item_redines(meta,amount)
|
||||
end
|
||||
|
@ -715,7 +715,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1,dst=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,dst=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -807,7 +807,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1,dst=1},
|
||||
groups = {pickaxey=2, owl_tech_machine=1,dst=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
|
@ -865,4 +865,94 @@ for i = 1, #table_all_machines, 1 do
|
|||
}
|
||||
})
|
||||
end
|
||||
if table_all_machines[i][17] then
|
||||
local function set_formspect_wood_planter(meta)
|
||||
local max_charge = owl_tech:get_charge_max(meta)
|
||||
local curent_charge = owl_tech:get_charge(meta)
|
||||
local delay = meta:get_int("work_delay")
|
||||
local formspec = "size[9,8.75]"..
|
||||
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"label[2.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Steam vertical miner"))).."]"..
|
||||
"list[context;sapling;5.5,1.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(5.5,1.5,1,1)..
|
||||
"label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||
"label[0,2.5;"..minetest.formspec_escape(minetest.colorize("#313131", (delay.."--delay"))).."]"..
|
||||
"listring[context;sapling]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_player;main]"
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_wood_planter", {
|
||||
description = S(table_all_machines[i][1].." quarry"),
|
||||
_doc_items_longdesc = S("Dig the Hole"),
|
||||
tiles = {
|
||||
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_sapling.png",
|
||||
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_sapling.png",
|
||||
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_sapling.png",
|
||||
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_sapling.png",
|
||||
},
|
||||
is_ground_content = false,
|
||||
stack_max = 64,
|
||||
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 5,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
owl_tech:add_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||
meta:set_int("work_delay",0)
|
||||
set_formspect_wood_planter(meta)
|
||||
owl_tech.prepear_for_sapling_plant(pos,table_all_machines[i][19])
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("sapling", 1)
|
||||
timer:start(2)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local fluid_its = inv:get_stack('sapling', 1)
|
||||
if meta:get_int("work_delay")==0 and owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta)
|
||||
and minetest.get_item_group((fluid_its:get_name()),"sapling")>0 then
|
||||
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||
owl_tech:set_charge(meta,steam_new)
|
||||
owl_tech.look_for_place_new_sapling(pos)
|
||||
meta:set_int("work_delay",table_all_machines[i][14])
|
||||
end
|
||||
if meta:get_int("work_delay")>0 then
|
||||
meta:set_int("work_delay",meta:get_int("work_delay")-1)
|
||||
end
|
||||
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})).name,"owl_tech_electro_wire")>0
|
||||
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||
end
|
||||
end
|
||||
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||
set_formspect_wood_planter(meta)
|
||||
timer:start(0.2)
|
||||
end
|
||||
})
|
||||
--Crafte controller
|
||||
minetest.register_craft({
|
||||
type = "shaped",
|
||||
output = "owl_tech:"..table_all_machines[i][2].."_wood_planter",
|
||||
recipe = {
|
||||
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||
{table_all_machines[i][8][1],"owl_tech:circuit_tire_"..i,table_all_machines[i][8][1],}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
|
@ -275,6 +275,60 @@ for i, value in ipairs(metals_ore_array) do
|
|||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
--fence
|
||||
local p = {-2/16, -0.5, -2/16, 2/16, 0.5, 2/16}
|
||||
local x1 = {-0.5, 4/16, -1/16, -2/16, 7/16, 1/16} --oben(quer) -x
|
||||
local x12 = {-0.5, -2/16, -1/16, -2/16, 1/16, 1/16} --unten(quer) -x
|
||||
local x2 = {2/16, 4/16, -1/16, 0.5, 7/16, 1/16} --oben(quer) x
|
||||
local x22 = {2/16, -2/16, -1/16, 0.5, 1/16, 1/16} --unten(quer) x
|
||||
local z1 = {-1/16, 4/16, -0.5, 1/16, 7/16, -2/16} --oben(quer) -z
|
||||
local z12 = {-1/16, -2/16, -0.5, 1/16, 1/16, -2/16} --unten(quer) -z
|
||||
local z2 = {-1/16, 4/16, 2/16, 1/16, 7/16, 0.5} --oben(quer) z
|
||||
local z22 = {-1/16, -2/16, 2/16, 1/16, 1/16, 0.5} --unten(quer) z
|
||||
|
||||
-- Collision box
|
||||
local cp = {-2/16, -0.5, -2/16, 2/16, 1.01, 2/16}
|
||||
local cx1 = {-0.5, -0.5, -2/16, -2/16, 1.01, 2/16} --unten(quer) -x
|
||||
local cx2 = {2/16, -0.5, -2/16, 0.5, 1.01, 2/16} --unten(quer) x
|
||||
local cz1 = {-2/16, -0.5, -0.5, 2/16, 1.01, -2/16} --unten(quer) -z
|
||||
local cz2 = {-2/16, -0.5, 2/16, 2/16, 1.01, 0.5} --unten(quer) z
|
||||
|
||||
minetest.register_node("owl_tech:"..metals_ore_array[i][1].."_fence", { --copypast from mc2
|
||||
description = S(metals_ore_array[i][2].." fence"),
|
||||
_doc_items_longdesc = S("Fences are structures which block the way. Fences will connect to each other and solid blocks. They cannot be jumped over with a simple jump."),
|
||||
tiles = {"default_steel_block.png^[colorize:"..metals_ore_array[i][5]..":128"},
|
||||
inventory_image = "mcl_fences_fence_mask.png^" .. "default_steel_block.png^[colorize:"..metals_ore_array[i][5]..":128" .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
||||
wield_image = "mcl_fences_fence_mask.png^" .. "default_steel_block.png^[colorize:"..metals_ore_array[i][5]..":128" .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = { pickaxey= 1, fence_wood = 1, },
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
connect_sides = { "front", "back", "left", "right" },
|
||||
connects_to = {"group:fence_wood"},
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {p},
|
||||
connect_front = {z1,z12},
|
||||
connect_back = {z2,z22,},
|
||||
connect_left = {x1,x12},
|
||||
connect_right = {x2,x22},
|
||||
},
|
||||
collision_box = {
|
||||
type = "connected",
|
||||
fixed = {cp},
|
||||
connect_front = {cz1},
|
||||
connect_back = {cz2,},
|
||||
connect_left = {cx1},
|
||||
connect_right = {cx2},
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 5,
|
||||
})
|
||||
|
||||
|
||||
--Cafte plate
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
|
|
Loading…
Reference in New Issue