Alpha 4
This commit is contained in:
parent
18bc34b28f
commit
88d9b64519
@ -160,7 +160,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_dynamics:copper_wire",
|
output = "elepower_dynamics:copper_wire 8",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||||
{"default:copper_ingot", "", "default:copper_ingot"},
|
{"default:copper_ingot", "", "default:copper_ingot"},
|
||||||
|
@ -8,5 +8,6 @@ elefarm.modpath = modpath
|
|||||||
|
|
||||||
dofile(modpath.."/treecutter.lua")
|
dofile(modpath.."/treecutter.lua")
|
||||||
dofile(modpath.."/craftitems.lua")
|
dofile(modpath.."/craftitems.lua")
|
||||||
dofile(modpath.."/nodes/init.lua")
|
dofile(modpath.."/nodes.lua")
|
||||||
|
dofile(modpath.."/machines/init.lua")
|
||||||
dofile(modpath.."/crafting.lua")
|
dofile(modpath.."/crafting.lua")
|
||||||
|
@ -113,9 +113,9 @@ local function on_timer(pos, elapsed)
|
|||||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
local active = "Idle"
|
local active = "Idle"
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
local pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
|
|
||||||
if storage > usage and sludge.amount + SLUDGE_PRODUCED < sludge.capacity and is_enabled then
|
if pow_buffer.storage > usage and sludge.amount + SLUDGE_PRODUCED < sludge.capacity and is_enabled then
|
||||||
if work == HARVESTER_TICK then
|
if work == HARVESTER_TICK then
|
||||||
local harvested = {}
|
local harvested = {}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
work = 0
|
work = 0
|
||||||
if #harvested > 0 then
|
if #harvested > 0 then
|
||||||
storage = storage - usage
|
pow_buffer.storage = pow_buffer.storage - usage
|
||||||
sludge.amount = sludge.amount + SLUDGE_PRODUCED
|
sludge.amount = sludge.amount + SLUDGE_PRODUCED
|
||||||
for _,itm in ipairs(harvested) do
|
for _,itm in ipairs(harvested) do
|
||||||
local stack = ItemStack(itm)
|
local stack = ItemStack(itm)
|
||||||
@ -138,7 +138,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
active = "Active"
|
active = "Active"
|
||||||
refresh = true
|
refresh = true
|
||||||
power.usage = usage
|
pow_buffer.usage = usage
|
||||||
ele.helpers.swap_node(pos, "elepower_farming:harvester_active")
|
ele.helpers.swap_node(pos, "elepower_farming:harvester_active")
|
||||||
else
|
else
|
||||||
if not is_enabled then
|
if not is_enabled then
|
||||||
@ -150,11 +150,11 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, sludge, state))
|
meta:set_string("formspec", get_formspec(work_percent, pow_buffer, sludge, state))
|
||||||
meta:set_string("infotext", ("Harvester %s\n%s"):format(active,
|
meta:set_string("infotext", ("Harvester %s\n%s"):format(active,
|
||||||
ele.capacity_text(capacity, storage)))
|
ele.capacity_text(capacity, storage)))
|
||||||
|
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
meta:set_string("sludge_fluid", "elepower_farming:sludge_source")
|
meta:set_string("sludge_fluid", "elepower_farming:sludge_source")
|
14
elepower_farming/machines/init.lua
Normal file
14
elepower_farming/machines/init.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
local mp = elefarm.modpath.."/machines/"
|
||||||
|
|
||||||
|
dofile(mp.."fluids.lua")
|
||||||
|
dofile(mp.."planter.lua")
|
||||||
|
dofile(mp.."harvester.lua")
|
||||||
|
dofile(mp.."tree_extractor.lua")
|
||||||
|
dofile(mp.."tree_processor.lua")
|
||||||
|
dofile(mp.."composter.lua")
|
||||||
|
|
||||||
|
-- Mobs Redo support
|
||||||
|
if minetest.get_modpath("mobs") ~= nil and mobs.mod and mobs.mod == "redo" then
|
||||||
|
dofile(mp.."spawner.lua")
|
||||||
|
end
|
@ -234,10 +234,10 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
local state = meta:get_int("state")
|
local state = meta:get_int("state")
|
||||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
local pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
local active = "Idle"
|
local active = "Idle"
|
||||||
|
|
||||||
if storage > usage and is_enabled then
|
if pow_buffer.storage > usage and is_enabled then
|
||||||
if work == PLANTER_TICK then
|
if work == PLANTER_TICK then
|
||||||
local planted = 0
|
local planted = 0
|
||||||
for index, slot in ipairs(inv:get_list("layout")) do
|
for index, slot in ipairs(inv:get_list("layout")) do
|
||||||
@ -249,7 +249,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
work = 0
|
work = 0
|
||||||
if planted > 0 then
|
if planted > 0 then
|
||||||
storage = storage - usage
|
pow_buffer.storage = pow_buffer.storage - usage
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
work = work + 1
|
work = work + 1
|
||||||
@ -257,18 +257,18 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
active = "Active"
|
active = "Active"
|
||||||
refresh = true
|
refresh = true
|
||||||
power.usage = usage
|
pow_buffer.usage = usage
|
||||||
elseif not is_enabled then
|
elseif not is_enabled then
|
||||||
active = "Off"
|
active = "Off"
|
||||||
end
|
end
|
||||||
|
|
||||||
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
meta:set_string("formspec", get_formspec(work_percent, pow_buffer, state))
|
||||||
meta:set_string("infotext", ("Planter %s\n%s"):format(active,
|
meta:set_string("infotext", ("Planter %s\n%s"):format(active,
|
||||||
ele.capacity_text(capacity, storage)))
|
ele.capacity_text(capacity, storage)))
|
||||||
|
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
return refresh
|
return refresh
|
@ -126,9 +126,10 @@ local function on_timer(pos, elapsed)
|
|||||||
local mob_desc = "None"
|
local mob_desc = "None"
|
||||||
local active = "Active"
|
local active = "Active"
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
local pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
|
|
||||||
if storage > usage and not egg_slot:is_empty() and ele.helpers.get_item_group(egg_name, "spawn_egg") and is_enabled then
|
if pow_buffer.storage > usage and not egg_slot:is_empty() and
|
||||||
|
ele.helpers.get_item_group(egg_name, "spawn_egg") and is_enabled then
|
||||||
local mob_name = egg_name:gsub("_set", "")
|
local mob_name = egg_name:gsub("_set", "")
|
||||||
|
|
||||||
if work == SPAWNER_TICK then
|
if work == SPAWNER_TICK then
|
||||||
@ -141,7 +142,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
work = 0
|
work = 0
|
||||||
if spawned > 0 then
|
if spawned > 0 then
|
||||||
storage = storage - usage
|
pow_buffer.storage = pow_buffer.storage - usage
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
work = work + 1
|
work = work + 1
|
||||||
@ -149,7 +150,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
refresh = true
|
refresh = true
|
||||||
mob_desc = minetest.registered_items[mob_name].description
|
mob_desc = minetest.registered_items[mob_name].description
|
||||||
power.usage = usage
|
pow_buffer.usage = usage
|
||||||
elseif not is_enabled then
|
elseif not is_enabled then
|
||||||
active = "Off"
|
active = "Off"
|
||||||
else
|
else
|
||||||
@ -158,12 +159,12 @@ local function on_timer(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
||||||
active, mob_desc, ele.capacity_text(capacity, storage)))
|
active, mob_desc, ele.capacity_text(capacity, pow_buffer.storage)))
|
||||||
|
|
||||||
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
meta:set_string("formspec", get_formspec(work_percent, pow_buffer, state))
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
return refresh
|
return refresh
|
@ -21,7 +21,7 @@ local tree_fluid_recipes = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function get_formspec(timer, power, fluid_buffer, water_buffer, output_buffer)
|
local function get_formspec(timer, power, fluid_buffer, water_buffer, output_buffer, state)
|
||||||
return "size[8,8.5]"..
|
return "size[8,8.5]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
@ -31,6 +31,7 @@ local function get_formspec(timer, power, fluid_buffer, water_buffer, output_buf
|
|||||||
ele.formspec.fluid_bar(2, 0, fluid_buffer)..
|
ele.formspec.fluid_bar(2, 0, fluid_buffer)..
|
||||||
ele.formspec.fluid_bar(3, 0, water_buffer)..
|
ele.formspec.fluid_bar(3, 0, water_buffer)..
|
||||||
ele.formspec.fluid_bar(7, 0, output_buffer)..
|
ele.formspec.fluid_bar(7, 0, output_buffer)..
|
||||||
|
ele.formspec.state_switcher(7, 2.5, state)..
|
||||||
"list[context;dst;5,1;1,1;]"..
|
"list[context;dst;5,1;1,1;]"..
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
@ -56,8 +57,18 @@ local function on_timer(pos, elapsed)
|
|||||||
local time_max = meta:get_int("src_time_max")
|
local time_max = meta:get_int("src_time_max")
|
||||||
|
|
||||||
local recipe = tree_fluid_recipes[tree_buffer.fluid]
|
local recipe = tree_fluid_recipes[tree_buffer.fluid]
|
||||||
|
local pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
|
|
||||||
|
local state = meta:get_int("state")
|
||||||
|
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
|
local active = "Idle"
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
|
if not is_enabled then
|
||||||
|
active = "Off"
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
if not recipe then
|
if not recipe then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -65,7 +76,7 @@ local function on_timer(pos, elapsed)
|
|||||||
local conditions = water_buffer.amount >= recipe.water and
|
local conditions = water_buffer.amount >= recipe.water and
|
||||||
tree_buffer.amount >= recipe.amount and
|
tree_buffer.amount >= recipe.amount and
|
||||||
out_buffer.amount + recipe.output.amount < out_buffer.capacity and
|
out_buffer.amount + recipe.output.amount < out_buffer.capacity and
|
||||||
storage > usage and
|
pow_buffer.storage > usage and
|
||||||
(out_buffer.fluid == "" or out_buffer.fluid == recipe.output.fluid)
|
(out_buffer.fluid == "" or out_buffer.fluid == recipe.output.fluid)
|
||||||
|
|
||||||
if not conditions then
|
if not conditions then
|
||||||
@ -79,8 +90,9 @@ local function on_timer(pos, elapsed)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
storage = storage - usage
|
pow_buffer.storage = pow_buffer.storage - usage
|
||||||
meta:set_int("storage", storage)
|
pow_buffer.usage = usage
|
||||||
|
active = "Active"
|
||||||
|
|
||||||
if time < time_max then
|
if time < time_max then
|
||||||
time = time + 1
|
time = time + 1
|
||||||
@ -105,6 +117,7 @@ local function on_timer(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not room_for_output then
|
if not room_for_output then
|
||||||
|
active = "Output Full!"
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -131,12 +144,15 @@ local function on_timer(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
local timer = 0
|
||||||
local power = {capacity = capacity, storage = storage}
|
|
||||||
if time_max > 0 then
|
if time_max > 0 then
|
||||||
timer = math.floor(100 * time / time_max)
|
timer = math.floor(100 * time / time_max)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(timer, power, tree_buffer, water_buffer, out_buffer))
|
meta:set_string("formspec", get_formspec(timer, pow_buffer, tree_buffer,
|
||||||
|
water_buffer, out_buffer, state))
|
||||||
|
meta:set_string("infotext", ("Tree Processor %s\n%s"):format(active,
|
||||||
|
ele.capacity_text(capacity, pow_buffer.storage)))
|
||||||
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
|
|
||||||
return refresh
|
return refresh
|
||||||
end
|
end
|
9
elepower_farming/nodes.lua
Normal file
9
elepower_farming/nodes.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
minetest.register_node("elepower_farming:device_frame", {
|
||||||
|
description = "Plastic Device Frame\nSafe for decoration",
|
||||||
|
tiles = {
|
||||||
|
"elefarming_machine_base.png", "elefarming_machine_base.png", "elefarming_machine_side.png",
|
||||||
|
"elefarming_machine_side.png", "elefarming_machine_side.png", "elefarming_machine_side.png",
|
||||||
|
},
|
||||||
|
groups = {oddly_breakable_by_hand = 1, cracky = 1}
|
||||||
|
})
|
@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
minetest.register_node("elepower_farming:device_frame", {
|
|
||||||
description = "Plastic Device Frame\nSafe for decoration",
|
|
||||||
tiles = {
|
|
||||||
"elefarming_machine_base.png", "elefarming_machine_base.png", "elefarming_machine_side.png",
|
|
||||||
"elefarming_machine_side.png", "elefarming_machine_side.png", "elefarming_machine_side.png",
|
|
||||||
},
|
|
||||||
groups = {oddly_breakable_by_hand = 1, cracky = 1}
|
|
||||||
})
|
|
||||||
|
|
||||||
dofile(elefarm.modpath.."/nodes/fluids.lua")
|
|
||||||
dofile(elefarm.modpath.."/nodes/planter.lua")
|
|
||||||
dofile(elefarm.modpath.."/nodes/harvester.lua")
|
|
||||||
dofile(elefarm.modpath.."/nodes/tree_extractor.lua")
|
|
||||||
dofile(elefarm.modpath.."/nodes/tree_processor.lua")
|
|
||||||
dofile(elefarm.modpath.."/nodes/composter.lua")
|
|
||||||
|
|
||||||
-- Mobs Redo support
|
|
||||||
if minetest.get_modpath("mobs") ~= nil and mobs.mod and mobs.mod == "redo" then
|
|
||||||
dofile(elefarm.modpath.."/nodes/spawner.lua")
|
|
||||||
end
|
|
@ -22,6 +22,6 @@ ele.register_fluid_generator("elepower_machines:fuel_burner", {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fuel_burn_time = 4,
|
fuel_burn_time = 8,
|
||||||
fuel_usage = 100,
|
fuel_usage = 100,
|
||||||
})
|
})
|
||||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 889 KiB After Width: | Height: | Size: 918 KiB |
Loading…
Reference in New Issue
Block a user