Add harvester and litel fix
This commit is contained in:
parent
b59216f0d2
commit
52e86cd29d
110
api/farming.lua
110
api/farming.lua
|
@ -98,7 +98,7 @@ function owl_tech.get_wood_or_leaves(pos,inv,wood_its,leaves_its)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
--looking frp trees
|
--looking fop trees
|
||||||
function owl_tech:look_for_trees(pos)
|
function owl_tech:look_for_trees(pos)
|
||||||
local meta =minetest.get_meta(pos)
|
local meta =minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
@ -128,7 +128,7 @@ function owl_tech:look_for_trees(pos)
|
||||||
for i = 1,(meta:get_int("distance")*2)+1, 1 do--x
|
for i = 1,(meta:get_int("distance")*2)+1, 1 do--x
|
||||||
for j = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--z
|
for j = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--z
|
||||||
for k = 32 ,0, -1 do--y
|
for k = 32 ,0, -1 do--y
|
||||||
owl_tech.get_wood_or_leaves({x=pos.x-i,y=pos.y+k,z=pos.z+j},inv,wood_its,leaves_its)
|
owl_tech.get_wood_or_leaves({x=pos.x+i,y=pos.y+k,z=pos.z+j},inv,wood_its,leaves_its)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -142,7 +142,6 @@ function owl_tech:look_for_trees(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
@ -166,3 +165,108 @@ function owl_tech:look_for_place_new_sids(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
--Get redy plant in pos
|
||||||
|
function owl_tech:get_ready_plant_in_pos(pos,inv)--ready_to_harvest
|
||||||
|
local wood_its = inv:get_stack('wood', 1)
|
||||||
|
local leaves_its = inv:get_stack('leaves', 1)
|
||||||
|
local vanila_plants= {"wheat","beetroot","potato"}
|
||||||
|
local crop_node=minetest.get_node(pos)
|
||||||
|
for i = 1, #vanila_plants, 1 do
|
||||||
|
if minetest.get_node(pos).name ==vanila_plants[i] then
|
||||||
|
|
||||||
|
local cut_wood = owl_tech.get_node_drop(crop_node.name,"toolname")
|
||||||
|
if ( cut_wood== wood_its:get_name() or wood_its:is_empty())
|
||||||
|
and wood_its:get_count()<64 then
|
||||||
|
if not wood_its:is_empty() then-- Add main output
|
||||||
|
wood_its:set_count(wood_its:get_count()+1)
|
||||||
|
inv:set_stack('wood', 1, wood_its)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
else
|
||||||
|
local item ={name=cut_wood, count=1, wear=0, metadata=""}
|
||||||
|
wood_its:add_item(item)
|
||||||
|
inv:set_stack('wood', 1, wood_its)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_item_group((minetest.get_node(pos)).name,"ready_to_harvest")>0 then
|
||||||
|
local cut_wood = owl_tech.get_node_drop(crop_node.name,"toolname")
|
||||||
|
if ( cut_wood== wood_its:get_name() or wood_its:is_empty())
|
||||||
|
and wood_its:get_count()<64 then
|
||||||
|
if not wood_its:is_empty() then-- Add main output
|
||||||
|
wood_its:set_count(wood_its:get_count()+1)
|
||||||
|
inv:set_stack('wood', 1, wood_its)
|
||||||
|
else
|
||||||
|
local item ={name=cut_wood, count=1, wear=0, metadata=""}
|
||||||
|
wood_its:add_item(item)
|
||||||
|
inv:set_stack('wood', 1, wood_its)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local loot= ""
|
||||||
|
local count = 0
|
||||||
|
for i = 1, #LIST_ALL_CROPS, 1 do
|
||||||
|
if "owl_tech:plant_"..LIST_ALL_CROPS[i][1]..LIST_ALL_CROPS[i][4]==crop_node.name then
|
||||||
|
loot = LIST_ALL_CROPS[i][6]
|
||||||
|
count = LIST_ALL_CROPS[i][7]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ( loot== leaves_its:get_name() or leaves_its:is_empty())
|
||||||
|
and leaves_its:get_count()+count<=64 then
|
||||||
|
if not leaves_its:is_empty() then-- Add main output
|
||||||
|
leaves_its:set_count(leaves_its:get_count()+count)
|
||||||
|
inv:set_stack('leaves', 1, leaves_its)
|
||||||
|
else
|
||||||
|
local item ={name=loot, count=count, wear=0, metadata=""}
|
||||||
|
leaves_its:add_item(item)
|
||||||
|
inv:set_stack('leaves', 1, leaves_its)
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
------------------------------------------------------------------
|
||||||
|
--look for plants
|
||||||
|
function owl_tech:look_for_plants(pos)
|
||||||
|
local meta =minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local wood_its = inv:get_stack('wood', 1)
|
||||||
|
local leaves_its = inv:get_stack('leaves', 1)
|
||||||
|
local rotation = minetest.get_node(pos).param2 % 32 --get rotattion ( return int )
|
||||||
|
if wood_its:is_empty()or (wood_its:get_count()<64) and leaves_its:is_empty()or (leaves_its:get_count()<64) then
|
||||||
|
if rotation==0 then --z-1
|
||||||
|
for i = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--x
|
||||||
|
for j = 1,(meta:get_int("distance")*2)+1, 1 do--z
|
||||||
|
owl_tech:get_ready_plant_in_pos({x=pos.x+i,y=pos.y,z=pos.z-j},inv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if rotation==2 then --z+1
|
||||||
|
for i = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--x
|
||||||
|
for j = 1,(meta:get_int("distance")*2)+1, 1 do--z
|
||||||
|
owl_tech:get_ready_plant_in_pos({x=pos.x+i,y=pos.y,z=pos.z+j},inv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if rotation==3 then --x-1
|
||||||
|
for i = 1,(meta:get_int("distance")*2)+1, 1 do--x
|
||||||
|
for j = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--z
|
||||||
|
owl_tech:get_ready_plant_in_pos({x=pos.x+i,y=pos.y,z=pos.z+j},inv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if rotation==1 then --x+1
|
||||||
|
for i = 1,(meta:get_int("distance")*2)+1, 1 do--x
|
||||||
|
for j = (meta:get_int("distance")*-1), meta:get_int("distance"), 1 do--z
|
||||||
|
owl_tech:get_ready_plant_in_pos({x=pos.x-i,y=pos.y,z=pos.z-j},inv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -58,23 +58,14 @@ end
|
||||||
|
|
||||||
--1)name 2)Name 3)texture base name 4)stages 5)seed texture 6)drop name 7)drop amount 8)cof of grow to up 9) Special node under dirt
|
--1)name 2)Name 3)texture base name 4)stages 5)seed texture 6)drop name 7)drop amount 8)cof of grow to up 9) Special node under dirt
|
||||||
|
|
||||||
local list_all_crops ={
|
|
||||||
{"ruber_wheat","Ruber Wheat","owl_tech_ruber_wheat_",8,"owl_tech.seed_ruber_wheat.png","owl_tech:ruber_dust",2,200,"none"},--ruber
|
|
||||||
{"coaltus","Coaltus","owl_tech_coaltus_",8,"owl_tech.seed_coaltus.png","owl_tech:coal_dust",1,200,"owl_tech:coal_block"},--coal
|
|
||||||
{"copgrow","Copgrow","owl_tech_copgrow_",8,"owl_tech.seed_copgrow.png","owl_tech:copper_dust",1,200,"owl_tech:copper_block"},--copper
|
|
||||||
{"iron_maiden","Iron Maiden","owl_tech_iron_maiden_",8,"owl_tech.seed_iron_maiden.png","owl_tech:iron_dust",1,200,"owl_tech:iron_block"},--gold
|
|
||||||
{"diamond_king","Diamond king","owl_tech_diamond_king_",8,"owl_tech.seed_king_diamond.png","owl_tech:diamond_dust",1,200,"owl_tech:diamond_block"},--diamond
|
|
||||||
{"tin_plague","Tin Plague","owl_tech_tin_plague_",8,"owl_tech.seed_tin_plague.png","owl_tech:tin_dust",1,200,"owl_tech:tin_block"},--tin
|
|
||||||
{"silverr_char","Silver char","owl_tech_silver_char_",8,"owl_tech.seed_silver_char.png","owl_tech:silver_dust",1,200,"owl_tech:silver_block"},--silver
|
|
||||||
{"steel_ball","Steel ball","owl_tech_steel_ball_",8,"owl_tech.seed_steel_ball.png","owl_tech:steel_dust",1,200,"owl_tech:steel_block"}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i = 1, #list_all_crops, 1 do
|
|
||||||
|
for i = 1, #LIST_ALL_CROPS, 1 do
|
||||||
|
|
||||||
local create, name, longdesc
|
local create, name, longdesc
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
create = true
|
create = true
|
||||||
name = S("Premature "..list_all_crops[i][2] )
|
name = S("Premature "..LIST_ALL_CROPS[i][2] )
|
||||||
longdesc = S(
|
longdesc = S(
|
||||||
"Premature plants grow on farmland under sunlight in 8 stages.On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.")
|
"Premature plants grow on farmland under sunlight in 8 stages.On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.")
|
||||||
else
|
else
|
||||||
|
@ -82,13 +73,13 @@ for i = 1, #list_all_crops, 1 do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("owl_tech:seeds_"..list_all_crops[i][1], {
|
minetest.register_craftitem("owl_tech:seeds_"..LIST_ALL_CROPS[i][1], {
|
||||||
description = S(list_all_crops[i][2].." Seeds"),
|
description = S(LIST_ALL_CROPS[i][2].." Seeds"),
|
||||||
_tt_help = S("Grows on farmland"),
|
_tt_help = S("Grows on farmland"),
|
||||||
_doc_items_longdesc = S("Grows into a wheat plant."),
|
_doc_items_longdesc = S("Grows into a wheat plant."),
|
||||||
_doc_items_usagehelp = S(" Place the wheat seeds on farmland (which can be created with a hoe) to plant plant."),
|
_doc_items_usagehelp = S(" Place the wheat seeds on farmland (which can be created with a hoe) to plant plant."),
|
||||||
groups = {craftitem = 1, compostability = 30},
|
groups = {craftitem = 1, compostability = 30},
|
||||||
inventory_image = list_all_crops[i][5],
|
inventory_image = LIST_ALL_CROPS[i][5],
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type =="node" then
|
if pointed_thing.type =="node" then
|
||||||
local node_chek = minetest.get_node(pointed_thing.under)
|
local node_chek = minetest.get_node(pointed_thing.under)
|
||||||
|
@ -98,16 +89,16 @@ for i = 1, #list_all_crops, 1 do
|
||||||
else
|
else
|
||||||
itemstack:clear()
|
itemstack:clear()
|
||||||
end
|
end
|
||||||
minetest.set_node({x=pointed_thing.under.x,y=pointed_thing.under.y+1,z=pointed_thing.under.z},{name="owl_tech:plant_"..list_all_crops[i][1]..1})
|
minetest.set_node({x=pointed_thing.under.x,y=pointed_thing.under.y+1,z=pointed_thing.under.z},{name="owl_tech:plant_"..LIST_ALL_CROPS[i][1]..1})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
for j = 1, list_all_crops[i][4]-1, 1 do
|
for j = 1, LIST_ALL_CROPS[i][4]-1, 1 do
|
||||||
minetest.register_node("owl_tech:plant_"..list_all_crops[i][1]..j, {
|
minetest.register_node("owl_tech:plant_"..LIST_ALL_CROPS[i][1]..j, {
|
||||||
description = S("Premature "..list_all_crops[i][2]),
|
description = S("Premature "..LIST_ALL_CROPS[i][2]),
|
||||||
_doc_items_create_entry = create,
|
_doc_items_create_entry = create,
|
||||||
_doc_items_entry_name = name,
|
_doc_items_entry_name = name,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
|
@ -117,7 +108,7 @@ for i = 1, #list_all_crops, 1 do
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
drop = "owl_tech:seeds_"..list_all_crops[i][1],
|
drop = "owl_tech:seeds_"..LIST_ALL_CROPS[i][1],
|
||||||
tiles = {"owl_tech_ruber_wheat_"..j..".png"},
|
tiles = {"owl_tech_ruber_wheat_"..j..".png"},
|
||||||
inventory_image = "owl_tech_ruber_wheat_"..j..".png",
|
inventory_image = "owl_tech_ruber_wheat_"..j..".png",
|
||||||
wield_image = "owl_tech_ruber_wheat_"..j..".png",
|
wield_image = "owl_tech_ruber_wheat_"..j..".png",
|
||||||
|
@ -134,7 +125,7 @@ for i = 1, #list_all_crops, 1 do
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta= minetest.get_meta(pos)--calculate_grow_cof(pos)
|
local meta= minetest.get_meta(pos)--calculate_grow_cof(pos)
|
||||||
meta:set_int("curent_grow",0)
|
meta:set_int("curent_grow",0)
|
||||||
meta:set_int("max_cof",list_all_crops[i][8])
|
meta:set_int("max_cof",LIST_ALL_CROPS[i][8])
|
||||||
local timer =minetest.get_node_timer(pos)
|
local timer =minetest.get_node_timer(pos)
|
||||||
timer:start(10)
|
timer:start(10)
|
||||||
end,
|
end,
|
||||||
|
@ -142,8 +133,8 @@ for i = 1, #list_all_crops, 1 do
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("curent_grow",meta:get_int("curent_grow")+calculate_grow_cof(pos))
|
meta:set_int("curent_grow",meta:get_int("curent_grow")+calculate_grow_cof(pos))
|
||||||
if meta:get_int("max_cof")<=meta:get_int("curent_grow")
|
if meta:get_int("max_cof")<=meta:get_int("curent_grow")
|
||||||
and (list_all_crops[i][9]=="none" or list_all_crops[i][9] == minetest.get_node({x=pos.x,y=pos.y-4,z=pos.z}).name ) then
|
and (LIST_ALL_CROPS[i][9]=="none" or LIST_ALL_CROPS[i][9] == minetest.get_node({x=pos.x,y=pos.y-4,z=pos.z}).name ) then
|
||||||
minetest.set_node(pos,{name="owl_tech:plant_"..list_all_crops[i][1]..j+1})
|
minetest.set_node(pos,{name="owl_tech:plant_"..LIST_ALL_CROPS[i][1]..j+1})
|
||||||
end
|
end
|
||||||
local timer =minetest.get_node_timer(pos)
|
local timer =minetest.get_node_timer(pos)
|
||||||
timer:start(10)
|
timer:start(10)
|
||||||
|
@ -151,8 +142,8 @@ for i = 1, #list_all_crops, 1 do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("owl_tech:plant_"..list_all_crops[i][1], {
|
minetest.register_node("owl_tech:plant_"..LIST_ALL_CROPS[i][1]..LIST_ALL_CROPS[i][4], {
|
||||||
description = S("Mature "..list_all_crops[i][2]),
|
description = S("Mature "..LIST_ALL_CROPS[i][2]),
|
||||||
_doc_items_longdesc = S("Mature plants are ready to be harvested for wheat and seeds."),
|
_doc_items_longdesc = S("Mature plants are ready to be harvested for wheat and seeds."),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -160,21 +151,21 @@ for i = 1, #list_all_crops, 1 do
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {list_all_crops[i][3].."8.png"},
|
tiles = {LIST_ALL_CROPS[i][3].."8.png"},
|
||||||
inventory_image = list_all_crops[i][3].."8.png",
|
inventory_image = LIST_ALL_CROPS[i][3].."8.png",
|
||||||
wield_image = list_all_crops[i][3].."8.png",
|
wield_image = LIST_ALL_CROPS[i][3].."8.png",
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 4,
|
max_items = 4,
|
||||||
items = {
|
items = {
|
||||||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]} },
|
{ items = {"owl_tech:seeds_"..LIST_ALL_CROPS[i][1]} },
|
||||||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]}, rarity = 2},
|
{ items = {"owl_tech:seeds_"..LIST_ALL_CROPS[i][1]}, rarity = 2},
|
||||||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]}, rarity = 5},
|
{ items = {"owl_tech:seeds_"..LIST_ALL_CROPS[i][1]}, rarity = 5},
|
||||||
{ items = {list_all_crops[i][6].." "..list_all_crops[i][7]} },
|
{ items = {LIST_ALL_CROPS[i][6].." "..LIST_ALL_CROPS[i][7]} },
|
||||||
{ items = {list_all_crops[i][6].." "..list_all_crops[i][7]+1} , rarity = 4}
|
{ items = {LIST_ALL_CROPS[i][6].." "..LIST_ALL_CROPS[i][7]+1} , rarity = 4}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
|
||||||
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, ready_to_harvest=1},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
})
|
})
|
||||||
|
|
|
@ -101,7 +101,7 @@ CROPS_BREED={
|
||||||
wheatwheat={100,"owl_tech:plant_ruber_wheat1"},--ruber
|
wheatwheat={100,"owl_tech:plant_ruber_wheat1"},--ruber
|
||||||
beetrootbeetroot={100,"owl_tech:plant_copgrow1"},--copper
|
beetrootbeetroot={100,"owl_tech:plant_copgrow1"},--copper
|
||||||
carrotcarrot={100,"owl_tech:plant_coaltus1"},--coal
|
carrotcarrot={100,"owl_tech:plant_coaltus1"},--coal
|
||||||
potato_itempotato_item={100,"owl_tech:plant_ironmaiden1"},--iron
|
potatopotato={100,"owl_tech:plant_ironmaiden1"},--iron
|
||||||
plant_ironmaidenplant_coaltus={100,"owl_tech:plant_steel_ball1"},--steel
|
plant_ironmaidenplant_coaltus={100,"owl_tech:plant_steel_ball1"},--steel
|
||||||
plant_coaltusplant_ironmaiden={100,"owl_tech:plant_steel_ball1"},
|
plant_coaltusplant_ironmaiden={100,"owl_tech:plant_steel_ball1"},
|
||||||
plant_coaltusplant_coaltus={100,"owl_tech:plant_diamond_king1"},--diamond
|
plant_coaltusplant_coaltus={100,"owl_tech:plant_diamond_king1"},--diamond
|
||||||
|
@ -123,3 +123,14 @@ CROPS_VALID={
|
||||||
carrot={"mcl_farming:carrot_1"},
|
carrot={"mcl_farming:carrot_1"},
|
||||||
potato_item={"mcl_farming:mcl_farming:potato_1"},
|
potato_item={"mcl_farming:mcl_farming:potato_1"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIST_ALL_CROPS ={
|
||||||
|
{"ruber_wheat","Ruber Wheat","owl_tech_ruber_wheat_",8,"owl_tech.seed_ruber_wheat.png","owl_tech:ruber_dust",2,50,"none"},--ruber
|
||||||
|
{"coaltus","Coaltus","owl_tech_coaltus_",8,"owl_tech.seed_coaltus.png","owl_tech:coal_dust",1,50,"owl_tech:coal_block"},--coal
|
||||||
|
{"copgrow","Copgrow","owl_tech_copgrow_",8,"owl_tech.seed_copgrow.png","owl_tech:copper_dust",1,50,"owl_tech:copper_block"},--copper
|
||||||
|
{"iron_maiden","Iron Maiden","owl_tech_iron_maiden_",8,"owl_tech.seed_iron_maiden.png","owl_tech:iron_dust",1,50,"owl_tech:iron_block"},--gold
|
||||||
|
{"diamond_king","Diamond king","owl_tech_diamond_king_",8,"owl_tech.seed_king_diamond.png","owl_tech:diamond_dust",1,50,"owl_tech:diamond_block"},--diamond
|
||||||
|
{"tin_plague","Tin Plague","owl_tech_tin_plague_",8,"owl_tech.seed_tin_plague.png","owl_tech:tin_dust",1,50,"owl_tech:tin_block"},--tin
|
||||||
|
{"silverr_char","Silver char","owl_tech_silver_char_",8,"owl_tech.seed_silver_char.png","owl_tech:silver_dust",1,50,"owl_tech:silver_block"},--silver
|
||||||
|
{"steel_ball","Steel ball","owl_tech_steel_ball_",8,"owl_tech.seed_steel_ball.png","owl_tech:steel_dust",1,50,"owl_tech:steel_block"}
|
||||||
|
}
|
|
@ -4,11 +4,11 @@ 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
|
--[[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
|
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
|
||||||
20)seed planter ]]
|
20)seed planter 21)seed harvester ]]
|
||||||
|
|
||||||
local table_all_machines={
|
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","owl_tech:bronze_sharp_blade"},true,true
|
{"Base","base",32,1600,"#575757","steel",true,{"owl_tech:diamond","owl_tech:copper_heat_element","owl_tech:steel_mesh","mesecons_pistons:piston_normal_off","owl_tech:bronze_sharp_blade"},true,true
|
||||||
,true,true,true,18,true,16,true,true,2,true}
|
,true,true,true,18,true,16,true,true,2,true,true}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i = 1, #table_all_machines, 1 do
|
for i = 1, #table_all_machines, 1 do
|
||||||
|
@ -1151,4 +1151,90 @@ for i = 1, #table_all_machines, 1 do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
if table_all_machines[i][21] then
|
||||||
|
local function set_formspect_harveste(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(table_all_machines[i][1].." harvester"))).."]"..
|
||||||
|
"list[context;wood;5.5,1.5;1,1;]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(5.5,1.5,1,1)..
|
||||||
|
"list[context;leaves;5.5,2.5;1,1;]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(5.5,2.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;wood]"..
|
||||||
|
"listring[context;leaves]"..
|
||||||
|
"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].."_harvester", {
|
||||||
|
description = S(table_all_machines[i][1].." hervester"),
|
||||||
|
_doc_items_longdesc = S("Harvest all redy plants"),
|
||||||
|
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_tool_shears.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_tool_shears.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^default_tool_shears.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
},
|
||||||
|
is_ground_content = false,
|
||||||
|
stack_max = 64,
|
||||||
|
groups = {pickaxey=2, owl_tech_machine=1,owl_tech_electro_mashine=1,wood=1,leaves=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
|
||||||
|
set_formspect_harveste(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("wood", 1)
|
||||||
|
inv:set_size("leaves", 1)
|
||||||
|
timer:start(2)
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
if owl_tech:get_charge(meta)>=(owl_tech:get_voltage(meta)/16 ) then
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)/16
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech:look_for_plants(pos)
|
||||||
|
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_harveste(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte controller
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "owl_tech:"..table_all_machines[i][2].."_harvester",
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:circuit_tire_"..i,"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].."_frames","owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{table_all_machines[i][8][5],"owl_tech:circuit_tire_"..i,table_all_machines[i][8][5],}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -471,7 +471,7 @@ local function bronze_blast_furnanse_build_correct(pos)
|
||||||
end
|
end
|
||||||
return corect
|
return corect
|
||||||
end
|
end
|
||||||
if rotation==3 then --x+1 dont work!
|
if rotation==3 then --x+1
|
||||||
local corect =true
|
local corect =true
|
||||||
local vm = minetest.get_voxel_manip()
|
local vm = minetest.get_voxel_manip()
|
||||||
local pos1,pos2 = {x=pos.x-4,y=pos.y-1,z=pos.z-1},{x=pos.x,y=pos.y+1,z=pos.z+1}
|
local pos1,pos2 = {x=pos.x-4,y=pos.y-1,z=pos.z-1},{x=pos.x,y=pos.y+1,z=pos.z+1}
|
||||||
|
|
Loading…
Reference in New Issue