diff --git a/elepower_farming/machines/planter.lua b/elepower_farming/machines/planter.lua index bd3e5d6..df369f7 100644 --- a/elepower_farming/machines/planter.lua +++ b/elepower_farming/machines/planter.lua @@ -52,21 +52,30 @@ local ranges = { } local function get_formspec(timer, power, state) + local layout_tt = "Item placed here\n will be planted\nout in a 3x3 area" + local layout_bi = "elepower_planter_layout.png" return "size[8,10]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. ele.formspec.power_meter(power).. ele.formspec.state_switcher(7, 0, state).. ele.formspec.create_bar(1, 0, 100 - timer, "#00ff11", true).. "list[context;layout;2.5,0;3,3;]".. + "image[2.5,0;1,1;"..layout_bi.."]".. + "image[3.5,0;1,1;"..layout_bi.."]".. + "image[4.5,0;1,1;"..layout_bi.."]".. + "image[2.5,1;1,1;"..layout_bi.."]".. + "image[3.5,1;1,1;"..layout_bi.."]".. + "image[4.5,1;1,1;"..layout_bi.."]".. + "image[2.5,2;1,1;"..layout_bi.."]".. + "image[3.5,2;1,1;"..layout_bi.."]".. + "image[4.5,2;1,1;"..layout_bi.."]".. + "tooltip[2.5,0;4.5,2;"..layout_tt..";"..eletome.tooltip_color.."]".. "list[context;src;0,3.5;8,2;]".. + "tooltip[0,3.5;8,2; Place stacks of items\n here to keep planter\nsupplied with items to plant;"..eletome.tooltip_color.."]".. "list[current_player;main;0,5.75;8,1;]".. "list[current_player;main;0,7;8,3;8]".. "listring[current_player;main]".. "listring[context;src]".. - "listring[current_player;main]".. - default.get_hotbar_bg(0, 5.75) + "listring[current_player;main]" end local function can_dig(pos, player) @@ -118,6 +127,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player end local function plant(pos, range, stack, inv) + local planted = 0 local range_st = vector.add(ranges[range][1], pos) local range_end = vector.add(ranges[range][2], pos) @@ -132,6 +142,7 @@ local function plant(pos, range, stack, inv) end local to_plant = stack:get_name() + local to_place = nil local amount = 0 local till = true @@ -140,7 +151,7 @@ local function plant(pos, range, stack, inv) amount = amount + stack:get_count() end end - + -- Saplings if ele.helpers.get_item_group(to_plant, "sapling") then to_place = to_plant @@ -156,6 +167,7 @@ local function plant(pos, range, stack, inv) for z = range_st.z, range_end.z do if amount == 0 then break end local place_pos = {x = x, y = range_st.y + y_top, z = z} + local base_pos = {x = place_pos.x, y = place_pos.y - 1, z = place_pos.z} local base_node = minetest.get_node_or_nil(base_pos) @@ -241,6 +253,7 @@ local function on_timer(pos, elapsed) if work == PLANTER_TICK then local planted = 0 for index, slot in ipairs(inv:get_list("layout")) do + if planted >= 9 then break end if not slot:is_empty() then planted = planted + plant(pos, index, slot, inv) diff --git a/elepower_machines/textures/elepower_planter_layout.png b/elepower_machines/textures/elepower_planter_layout.png new file mode 100644 index 0000000..47473b2 Binary files /dev/null and b/elepower_machines/textures/elepower_planter_layout.png differ diff --git a/elepower_tome/i_eletome_additional_info.lua b/elepower_tome/i_eletome_additional_info.lua index b259240..6aa76dd 100644 --- a/elepower_tome/i_eletome_additional_info.lua +++ b/elepower_tome/i_eletome_additional_info.lua @@ -630,7 +630,6 @@ eletome.ai.nodes["elepower_machines:super_power_cell_0"] = {lb_top_img = "e eletome.ai.nodes["elepower_machines:alloy_furnace"] = {lb_top_img = "default_tin_ingot.png", lb_top_tt ="2 Materials\nto be Alloyed", lb_btm_tt = " used per second", - how_use = "" } eletome.ai.nodes["elepower_machines:electrolyzer"] = {how_use_1 = "The Electrolyzer is used to create gases out of certain fluids. The electrolyzer can accept three ".. @@ -643,6 +642,20 @@ eletome.ai.nodes["elepower_machines:electrolyzer"] = {how_use_1 = "The Elec hu_img_2 = "elepower_tome_electrolyzer_assemble.png" } +eletome.ai.nodes["elepower_farming:planter"] = {lb_top_img = "farming_wheat_seed.png", + lb_top_tt = "Seeds or Seedlings", + how_use_1 = "The automatic planter is used to keep a maximum 9x9 field planted with crops. The planter needs to be placed 1 node ".. + "below the ground surface, however it is waterproof and functions perfectly with a node of water above it.\n ".. + "The planter, plants from the most north westerly 3x3 block of nodes (top left corner) to the most south easterly ".. + "3x3 block of nodes (bottom right corner).", + how_use_2 = "The planter has a special interface to allow it to plant. The upper 3x3 grid represents a maximum area of 9x9 around the ".. + "planter ie each grid segment represents a 3x3 area of nodes. The bottom 2 rows of 8 is the planters avaliable inventory of ".. + "items. There must be items of the type specified in the planting grid avaliable in the inventory area for the planter to be ".. + "able to plant, so keep the planters inventory well stocked with seeds or seedlings.", + hu_img_1 = "elepower_tome_complex_auto_planter.png", + hu_img_2 = "elepower_tome_complex_auto_planter_2.png" + } + -- Fluid Pump Page eletome.ai.nodes["elepower_machines:pump"] = {lb_top_img = "elepower_gui_icon_fluid_electrolyzer_in.png", lb_top_tt = "Fluid"} eletome.ai.nodes["fluid_transfer:fluid_transfer_pump"] = {lb_top_img = "elepower_gui_icon_fluid_electrolyzer_in.png", lb_top_tt = "Fluid"} diff --git a/elepower_tome/textures/elepower_tome_complex_auto_planter.png b/elepower_tome/textures/elepower_tome_complex_auto_planter.png new file mode 100644 index 0000000..a880cd3 Binary files /dev/null and b/elepower_tome/textures/elepower_tome_complex_auto_planter.png differ diff --git a/elepower_tome/textures/elepower_tome_complex_auto_planter_2.png b/elepower_tome/textures/elepower_tome_complex_auto_planter_2.png new file mode 100644 index 0000000..99f0571 Binary files /dev/null and b/elepower_tome/textures/elepower_tome_complex_auto_planter_2.png differ diff --git a/elepower_tome/textures/power_network_simple_examples.png b/elepower_tome/textures/power_network_simple_examples.png index d6e8ab9..494e027 100644 Binary files a/elepower_tome/textures/power_network_simple_examples.png and b/elepower_tome/textures/power_network_simple_examples.png differ