Redo formspec locations, Add graphite ingot, Lead block texture change, Add casing for Nuclear Processing Machines, Start progress on Enrichment Plant
@ -47,6 +47,12 @@ minetest.register_craftitem("elepower_dynamics:zinc_ingot", {
|
|||||||
groups = {zinc = 1, ingot = 1}
|
groups = {zinc = 1, ingot = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("elepower_dynamics:graphite_ingot", {
|
||||||
|
description = "Graphite Ingot",
|
||||||
|
inventory_image = "elepower_graphite_ingot.png",
|
||||||
|
groups = {graphite = 1, ingot = 1}
|
||||||
|
})
|
||||||
|
|
||||||
-- Lumps
|
-- Lumps
|
||||||
|
|
||||||
minetest.register_craftitem("elepower_dynamics:lead_lump", {
|
minetest.register_craftitem("elepower_dynamics:lead_lump", {
|
||||||
|
BIN
elepower_dynamics/textures/elepower_graphite_ingot.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.7 KiB |
@ -1,75 +0,0 @@
|
|||||||
|
|
||||||
elefarm.formspec = {}
|
|
||||||
|
|
||||||
local function bar(x,y,metric)
|
|
||||||
return "image["..x..","..y..";0.25,2.8;elepower_gui_barbg.png"..
|
|
||||||
"^[lowpart:"..metric..":elefarming_gui_bar.png]"
|
|
||||||
end
|
|
||||||
|
|
||||||
function elefarm.formspec.planter_formspec(timer, power)
|
|
||||||
return "size[8,10]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
bar(1, 0, 100-timer)..
|
|
||||||
"list[context;layout;2.5,0;3,3;]"..
|
|
||||||
"list[context;src;0,3.5;8,2;]"..
|
|
||||||
"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)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elefarm.formspec.harvester_formspec(timer, power, sludge)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
ele.formspec.fluid_bar(7, 0, sludge)..
|
|
||||||
bar(1, 0, 100-timer)..
|
|
||||||
"list[context;dst;1.5,0;5,3;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elefarm.formspec.tree_processor(timer, power, fluid_buffer, water_buffer, output_buffer)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
bar(1, 0, 100-timer)..
|
|
||||||
ele.formspec.fluid_bar(2, 0, fluid_buffer)..
|
|
||||||
ele.formspec.fluid_bar(3, 0, water_buffer)..
|
|
||||||
ele.formspec.fluid_bar(7, 0, output_buffer)..
|
|
||||||
"list[context;dst;5,1;1,1;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elefarm.formspec.spawner_formspec(timer, power)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
bar(1, 0, 100-timer)..
|
|
||||||
"list[context;src;3.5,1.5;1,1;]"..
|
|
||||||
"image[3.5,1.5;1,1;elefarming_egg_silhouette.png]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
@ -6,7 +6,6 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
|
|||||||
elefarm = rawget(_G, "elefarm") or {}
|
elefarm = rawget(_G, "elefarm") or {}
|
||||||
elefarm.modpath = modpath
|
elefarm.modpath = modpath
|
||||||
|
|
||||||
dofile(modpath.."/formspec.lua")
|
|
||||||
dofile(modpath.."/craftitems.lua")
|
dofile(modpath.."/craftitems.lua")
|
||||||
dofile(modpath.."/nodes/init.lua")
|
dofile(modpath.."/nodes/init.lua")
|
||||||
dofile(modpath.."/crafting.lua")
|
dofile(modpath.."/crafting.lua")
|
||||||
|
@ -71,6 +71,22 @@ local function harvest(pos, harvested, fdir)
|
|||||||
return harvested
|
return harvested
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_formspec(timer, power, sludge)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.fluid_bar(7, 0, sludge)..
|
||||||
|
ele.formspec.create_bar(1, 0, 100 - timer, "#00ff11", true)..
|
||||||
|
"list[context;dst;1.5,0;5,3;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function on_timer(pos, elapsed)
|
local function on_timer(pos, elapsed)
|
||||||
local refresh = false
|
local refresh = false
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -114,7 +130,7 @@ local function on_timer(pos, elapsed)
|
|||||||
local power_percent = math.floor((storage / capacity)*100)
|
local power_percent = math.floor((storage / capacity)*100)
|
||||||
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.harvester_formspec(work_percent, power_percent, sludge))
|
meta:set_string("formspec", get_formspec(work_percent, power_percent, sludge))
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
@ -155,7 +171,7 @@ ele.register_machine("elepower_farming:harvester", {
|
|||||||
|
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.harvester_formspec(0, 0))
|
meta:set_string("formspec", get_formspec(0, 0))
|
||||||
|
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
end,
|
end,
|
||||||
|
@ -51,6 +51,23 @@ local ranges = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function get_formspec(timer, power)
|
||||||
|
return "size[8,10]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.create_bar(1, 0, 100 - timer, "#00ff11", true)..
|
||||||
|
"list[context;layout;2.5,0;3,3;]"..
|
||||||
|
"list[context;src;0,3.5;8,2;]"..
|
||||||
|
"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)
|
||||||
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -238,7 +255,7 @@ local function on_timer(pos, elapsed)
|
|||||||
local power_percent = math.floor((storage / capacity)*100)
|
local power_percent = math.floor((storage / capacity)*100)
|
||||||
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.planter_formspec(work_percent, power_percent))
|
meta:set_string("formspec", get_formspec(work_percent, power_percent))
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
@ -270,7 +287,7 @@ ele.register_base_device("elepower_farming:planter", {
|
|||||||
|
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.planter_formspec(0,0))
|
meta:set_string("formspec", get_formspec(0,0))
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
@ -89,6 +89,23 @@ local function spawn(pos, mob)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_formspec(timer, power)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.create_bar(1, 0, 100 - timer, "#00ff11", true)..
|
||||||
|
"list[context;src;3.5,1.5;1,1;]"..
|
||||||
|
"image[3.5,1.5;1,1;elefarming_egg_silhouette.png]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function on_timer(pos, elapsed)
|
local function on_timer(pos, elapsed)
|
||||||
local refresh = false
|
local refresh = false
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -136,7 +153,7 @@ local function on_timer(pos, elapsed)
|
|||||||
local power_percent = math.floor((storage / capacity)*100)
|
local power_percent = math.floor((storage / capacity)*100)
|
||||||
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.spawner_formspec(work_percent, power_percent))
|
meta:set_string("formspec", get_formspec(work_percent, power_percent))
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", storage)
|
||||||
meta:set_int("src_time", work)
|
meta:set_int("src_time", work)
|
||||||
|
|
||||||
@ -167,7 +184,7 @@ ele.register_machine("elepower_farming:spawner", {
|
|||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
|
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
meta:set_string("formspec", elefarm.formspec.spawner_formspec(0,0))
|
meta:set_string("formspec", get_formspec(0,0))
|
||||||
end,
|
end,
|
||||||
can_dig = can_dig,
|
can_dig = can_dig,
|
||||||
on_timer = on_timer,
|
on_timer = on_timer,
|
||||||
|
@ -21,6 +21,24 @@ local tree_fluid_recipes = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function get_formspec(timer, power, fluid_buffer, water_buffer, output_buffer)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.create_bar(1, 0, 100 - timer, "#00ff11", true)..
|
||||||
|
ele.formspec.fluid_bar(2, 0, fluid_buffer)..
|
||||||
|
ele.formspec.fluid_bar(3, 0, water_buffer)..
|
||||||
|
ele.formspec.fluid_bar(7, 0, output_buffer)..
|
||||||
|
"list[context;dst;5,1;1,1;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function on_timer(pos, elapsed)
|
local function on_timer(pos, elapsed)
|
||||||
local refresh = false
|
local refresh = false
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -118,7 +136,7 @@ local function on_timer(pos, elapsed)
|
|||||||
timer = math.floor(100 * time / time_max)
|
timer = math.floor(100 * time / time_max)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("formspec", elefarm.formspec.tree_processor(timer, power, tree_buffer, water_buffer, out_buffer))
|
meta:set_string("formspec", get_formspec(timer, power, tree_buffer, water_buffer, out_buffer))
|
||||||
|
|
||||||
return refresh
|
return refresh
|
||||||
end
|
end
|
||||||
@ -149,7 +167,7 @@ ele.register_machine("elepower_farming:tree_processor", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
inv:set_size("dst", 1)
|
inv:set_size("dst", 1)
|
||||||
meta:set_string("formspec", elefarm.formspec.tree_processor(0, 0))
|
meta:set_string("formspec", get_formspec(0, 0))
|
||||||
end,
|
end,
|
||||||
tiles = {
|
tiles = {
|
||||||
"elefarming_machine_tree_processor.png", "elefarming_machine_base.png", "elefarming_machine_side.png",
|
"elefarming_machine_tree_processor.png", "elefarming_machine_base.png", "elefarming_machine_side.png",
|
||||||
|
@ -29,6 +29,10 @@ local alloy_recipes = {
|
|||||||
recipe = { "elepower_dynamics:silicon", "elepower_dynamics:gold_dust 4" },
|
recipe = { "elepower_dynamics:silicon", "elepower_dynamics:gold_dust 4" },
|
||||||
output = "elepower_dynamics:silicon_wafer",
|
output = "elepower_dynamics:silicon_wafer",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
recipe = { "default:coal_lump", "elepower_dynamics:coal_dust 4" },
|
||||||
|
output = "elepower_dynamics:graphite_ingot",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Register alloy furnace recipes
|
-- Register alloy furnace recipes
|
||||||
|
@ -1,183 +0,0 @@
|
|||||||
|
|
||||||
-- Specialized formspec for crafters
|
|
||||||
function ele.formspec.get_crafter_formspec(craft_type, power, percent)
|
|
||||||
local craftstats = elepm.craft.types[craft_type]
|
|
||||||
local input_size = craftstats.inputs
|
|
||||||
|
|
||||||
local gui_name = "gui_furnace_arrow"
|
|
||||||
if craftstats.gui_name then
|
|
||||||
gui_name = craftstats.gui_name
|
|
||||||
end
|
|
||||||
|
|
||||||
local bar = "image[4,1.5;1,1;"..gui_name.."_bg.png^[transformR270]"
|
|
||||||
|
|
||||||
if percent ~= nil then
|
|
||||||
bar = "image[4,1.5;1,1;"..gui_name.."_bg.png^[lowpart:"..
|
|
||||||
(percent)..":"..gui_name.."_fg.png^[transformR270]"
|
|
||||||
end
|
|
||||||
|
|
||||||
local in_width = input_size
|
|
||||||
local in_height = 1
|
|
||||||
|
|
||||||
for n = 2, 4 do
|
|
||||||
if input_size % n == 0 and input_size ~= n then
|
|
||||||
in_width = input_size / n
|
|
||||||
in_height = input_size / n
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local y = 1.5
|
|
||||||
local x = 1.5
|
|
||||||
if in_height == 2 then
|
|
||||||
y = 1
|
|
||||||
elseif in_height >= 3 then
|
|
||||||
y = 0.5
|
|
||||||
end
|
|
||||||
|
|
||||||
if in_width >= 2 then
|
|
||||||
x = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
"list[context;src;"..x..","..y..";"..in_width..","..in_height..";]"..
|
|
||||||
bar..
|
|
||||||
"list[context;dst;5,1;2,2;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ele.formspec.get_fluid_generator_formspec(power, percent, buffer)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
ele.formspec.fluid_bar(7, 0, buffer)..
|
|
||||||
"image[3.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
|
||||||
(percent)..":default_furnace_fire_fg.png]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ele.formspec.get_generator_formspec(power, percent)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
"list[context;src;3,1.5;1,1;]"..
|
|
||||||
"image[4,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
|
||||||
percent..":default_furnace_fire_fg.png]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ele.formspec.get_storage_formspec(power)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
"image[2,0.5;1,1;gui_furnace_arrow_bg.png^[transformR180]"..
|
|
||||||
"list[context;out;2,1.5;1,1;]"..
|
|
||||||
"image[5,0.5;1,1;gui_furnace_arrow_bg.png]"..
|
|
||||||
"list[context;in;5,1.5;1,1;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;out]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;in]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elepm.get_coal_alloy_furnace_formspec(fuel_percent, item_percent)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
"list[context;src;2,0.5;2,1;]"..
|
|
||||||
"list[context;fuel;2.5,2.5;1,1;]"..
|
|
||||||
"image[2.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
|
||||||
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
|
|
||||||
"image[4,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
|
||||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
|
||||||
"list[context;dst;5,0.96;2,2;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;fuel]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elepm.get_grindstone_formspec(item_percent)
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
"list[context;src;1.6,1;1,1;]"..
|
|
||||||
"image[3.5,1;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
|
||||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
|
||||||
"list[context;dst;4.5,1;2,1;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
||||||
|
|
||||||
function elepm.get_lava_cooler_formspec(item_percent, coolant_buffer, hot_buffer, power, recipes, recipe)
|
|
||||||
local rclist = {}
|
|
||||||
|
|
||||||
local x = 2.5
|
|
||||||
for j in pairs(recipes) do
|
|
||||||
if j == recipe then
|
|
||||||
rclist[#rclist + 1] = "item_image["..x..",0;1,1;"..j.."]"
|
|
||||||
else
|
|
||||||
rclist[#rclist + 1] = "item_image_button[".. x ..",0;1,1;"..j..";"..j..";]"
|
|
||||||
end
|
|
||||||
x = x + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
return "size[8,8.5]"..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
|
||||||
ele.formspec.power_meter(power)..
|
|
||||||
ele.formspec.fluid_bar(1, 0, coolant_buffer)..
|
|
||||||
ele.formspec.fluid_bar(7, 0, hot_buffer)..
|
|
||||||
"list[context;dst;3.5,1.5;1,1;]"..
|
|
||||||
"image[2.5,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
|
||||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
|
||||||
"image[4.5,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
|
||||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformFXR90]"..
|
|
||||||
table.concat(rclist, "")..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
|
@ -8,7 +8,6 @@ elepm.modpath = modpath
|
|||||||
|
|
||||||
-- Utility
|
-- Utility
|
||||||
dofile(modpath.."/craft.lua")
|
dofile(modpath.."/craft.lua")
|
||||||
dofile(modpath.."/formspec.lua")
|
|
||||||
|
|
||||||
-- Machines
|
-- Machines
|
||||||
dofile(modpath.."/machines/init.lua")
|
dofile(modpath.."/machines/init.lua")
|
||||||
|
@ -1,6 +1,63 @@
|
|||||||
-- This is a crafter type machine base.
|
-- This is a crafter type machine base.
|
||||||
-- It accepts a recipe type registered beforehand.
|
-- It accepts a recipe type registered beforehand.
|
||||||
|
|
||||||
|
-- Specialized formspec for crafters
|
||||||
|
function ele.formspec.get_crafter_formspec(craft_type, power, percent)
|
||||||
|
local craftstats = elepm.craft.types[craft_type]
|
||||||
|
local input_size = craftstats.inputs
|
||||||
|
|
||||||
|
local gui_name = "gui_furnace_arrow"
|
||||||
|
if craftstats.gui_name then
|
||||||
|
gui_name = craftstats.gui_name
|
||||||
|
end
|
||||||
|
|
||||||
|
local bar = "image[4,1.5;1,1;"..gui_name.."_bg.png^[transformR270]"
|
||||||
|
|
||||||
|
if percent ~= nil then
|
||||||
|
bar = "image[4,1.5;1,1;"..gui_name.."_bg.png^[lowpart:"..
|
||||||
|
(percent)..":"..gui_name.."_fg.png^[transformR270]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local in_width = input_size
|
||||||
|
local in_height = 1
|
||||||
|
|
||||||
|
for n = 2, 4 do
|
||||||
|
if input_size % n == 0 and input_size ~= n then
|
||||||
|
in_width = input_size / n
|
||||||
|
in_height = input_size / n
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local y = 1.5
|
||||||
|
local x = 1.5
|
||||||
|
if in_height == 2 then
|
||||||
|
y = 1
|
||||||
|
elseif in_height >= 3 then
|
||||||
|
y = 0.5
|
||||||
|
end
|
||||||
|
|
||||||
|
if in_width >= 2 then
|
||||||
|
x = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
"list[context;src;"..x..","..y..";"..in_width..","..in_height..";]"..
|
||||||
|
bar..
|
||||||
|
"list[context;dst;5,1;2,2;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
function elepm.register_crafter(nodename, nodedef)
|
function elepm.register_crafter(nodename, nodedef)
|
||||||
local craft_type = nodedef.craft_type
|
local craft_type = nodedef.craft_type
|
||||||
if not craft_type or not elepm.craft.types[craft_type] then
|
if not craft_type or not elepm.craft.types[craft_type] then
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
|
|
||||||
|
local function get_formspec(power, percent, buffer)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.fluid_bar(7, 0, buffer)..
|
||||||
|
"image[3.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
|
(percent)..":default_furnace_fire_fg.png]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
-- A generator that creates power using a fuel
|
-- A generator that creates power using a fuel
|
||||||
function ele.register_fluid_generator(nodename, nodedef)
|
function ele.register_fluid_generator(nodename, nodedef)
|
||||||
local fuel = nodedef.fuel
|
local fuel = nodedef.fuel
|
||||||
@ -67,7 +81,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
local active_node = nodename.."_active"
|
local active_node = nodename.."_active"
|
||||||
ele.helpers.swap_node(pos, active_node)
|
ele.helpers.swap_node(pos, active_node)
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", ele.formspec.get_fluid_generator_formspec(pow_percent, 0, flbuffer))
|
meta:set_string("formspec", get_formspec(pow_percent, 0, flbuffer))
|
||||||
meta:set_string("infotext", ("%s Idle\n%s\n%s"):format(nodedef.description,
|
meta:set_string("infotext", ("%s Idle\n%s\n%s"):format(nodedef.description,
|
||||||
ele.capacity_text(capacity, storage), fluid_lib.buffer_to_string(flbuffer)))
|
ele.capacity_text(capacity, storage), fluid_lib.buffer_to_string(flbuffer)))
|
||||||
|
|
||||||
@ -78,7 +92,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||||
|
|
||||||
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
||||||
meta:set_string("formspec", ele.formspec.get_fluid_generator_formspec(pow_percent, percent, flbuffer))
|
meta:set_string("formspec", get_formspec(pow_percent, percent, flbuffer))
|
||||||
meta:set_string("infotext", ("%s Active\n%s\n%s"):format(nodedef.description,
|
meta:set_string("infotext", ("%s Active\n%s\n%s"):format(nodedef.description,
|
||||||
ele.capacity_text(capacity, storage), fluid_lib.buffer_to_string(flbuffer)))
|
ele.capacity_text(capacity, storage), fluid_lib.buffer_to_string(flbuffer)))
|
||||||
|
|
||||||
@ -92,7 +106,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||||
|
|
||||||
meta:set_string("formspec", ele.formspec.get_fluid_generator_formspec(math.floor((storage / capacity) * 100), 0))
|
meta:set_string("formspec", get_formspec(math.floor((storage / capacity) * 100), 0))
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
|
|
||||||
|
local function get_formspec(power, percent)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
"list[context;src;3,1.5;1,1;]"..
|
||||||
|
"image[4,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
|
percent..":default_furnace_fire_fg.png]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
function elepm.register_fuel_generator(nodename, nodedef)
|
function elepm.register_fuel_generator(nodename, nodedef)
|
||||||
if not nodedef.groups then
|
if not nodedef.groups then
|
||||||
nodedef.groups = {}
|
nodedef.groups = {}
|
||||||
@ -58,7 +75,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
|||||||
ele.helpers.swap_node(pos, active_node)
|
ele.helpers.swap_node(pos, active_node)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", ele.formspec.get_generator_formspec(pow_percent, 0))
|
meta:set_string("formspec", get_formspec(pow_percent, 0))
|
||||||
meta:set_string("infotext", ("%s Idle"):format(nodedef.description) ..
|
meta:set_string("infotext", ("%s Idle"):format(nodedef.description) ..
|
||||||
"\n" .. ele.capacity_text(capacity, storage))
|
"\n" .. ele.capacity_text(capacity, storage))
|
||||||
ele.helpers.swap_node(pos, nodename)
|
ele.helpers.swap_node(pos, nodename)
|
||||||
@ -68,7 +85,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
|||||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||||
|
|
||||||
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
||||||
meta:set_string("formspec", ele.formspec.get_generator_formspec(pow_percent, percent))
|
meta:set_string("formspec", get_formspec(pow_percent, percent))
|
||||||
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
||||||
"\n" .. ele.capacity_text(capacity, storage))
|
"\n" .. ele.capacity_text(capacity, storage))
|
||||||
|
|
||||||
@ -83,7 +100,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
|||||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||||
|
|
||||||
meta:set_string("formspec", ele.formspec.get_generator_formspec(math.floor((storage / capacity) * 100), 0))
|
meta:set_string("formspec", get_formspec(math.floor((storage / capacity) * 100), 0))
|
||||||
end
|
end
|
||||||
|
|
||||||
ele.register_machine(nodename, nodedef)
|
ele.register_machine(nodename, nodedef)
|
||||||
|
@ -1,4 +1,24 @@
|
|||||||
|
|
||||||
|
local function get_formspec(power)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
"image[2,0.5;1,1;gui_furnace_arrow_bg.png^[transformR180]"..
|
||||||
|
"list[context;out;2,1.5;1,1;]"..
|
||||||
|
"image[5,0.5;1,1;gui_furnace_arrow_bg.png]"..
|
||||||
|
"list[context;in;5,1.5;1,1;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;out]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;in]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -34,7 +54,7 @@ function elepm.register_storage(nodename, nodedef)
|
|||||||
local rounded = math.floor(percent * 100)
|
local rounded = math.floor(percent * 100)
|
||||||
|
|
||||||
ele.helpers.swap_node(pos, nodename .. "_" .. level)
|
ele.helpers.swap_node(pos, nodename .. "_" .. level)
|
||||||
meta:set_string("formspec", ele.formspec.get_storage_formspec(rounded))
|
meta:set_string("formspec", get_formspec(rounded))
|
||||||
meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" ..
|
meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" ..
|
||||||
ele.capacity_text(capacity, storage))
|
ele.capacity_text(capacity, storage))
|
||||||
|
|
||||||
@ -112,7 +132,7 @@ function elepm.register_storage(nodename, nodedef)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("out", 1)
|
inv:set_size("out", 1)
|
||||||
inv:set_size("in", 1)
|
inv:set_size("in", 1)
|
||||||
meta:set_string("formspec", ele.formspec.get_storage_formspec(0))
|
meta:set_string("formspec", get_formspec(0))
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 0, levels do
|
for i = 0, levels do
|
||||||
|
@ -1,4 +1,27 @@
|
|||||||
|
|
||||||
|
local function get_formspec(fuel_percent, item_percent)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
"list[context;src;2,0.5;2,1;]"..
|
||||||
|
"list[context;fuel;2.5,2.5;1,1;]"..
|
||||||
|
"image[2.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
|
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
|
||||||
|
"image[4,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||||
|
"list[context;dst;5,0.96;2,2;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;fuel]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -144,11 +167,11 @@ local function alloy_furnace_timer(pos, elapsed)
|
|||||||
if fuel_totaltime ~= 0 then
|
if fuel_totaltime ~= 0 then
|
||||||
active = "Active"
|
active = "Active"
|
||||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||||
formspec = elepm.get_coal_alloy_furnace_formspec(fuel_percent, item_percent)
|
formspec = get_formspec(fuel_percent, item_percent)
|
||||||
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace_active")
|
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace_active")
|
||||||
result = true
|
result = true
|
||||||
else
|
else
|
||||||
formspec = elepm.get_coal_alloy_furnace_formspec(100, 0)
|
formspec = get_formspec(100, 0)
|
||||||
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace")
|
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace")
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
end
|
end
|
||||||
@ -205,7 +228,7 @@ ele.register_base_device("elepower_machines:coal_alloy_furnace", {
|
|||||||
inv:set_size("dst", 4)
|
inv:set_size("dst", 4)
|
||||||
inv:set_size("fuel", 1)
|
inv:set_size("fuel", 1)
|
||||||
|
|
||||||
meta:set_string("formspec", elepm.get_coal_alloy_furnace_formspec(100, 0))
|
meta:set_string("formspec", get_formspec(100, 0))
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
@ -1,4 +1,22 @@
|
|||||||
|
|
||||||
|
local function get_formspec(item_percent)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
"list[context;src;1.6,1;1,1;]"..
|
||||||
|
"image[3.5,1;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||||
|
"list[context;dst;4.5,1;2,1;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -46,7 +64,7 @@ local function grindstone_timer(pos, elapsed)
|
|||||||
if not recipe or recipe.time == 0 then
|
if not recipe or recipe.time == 0 then
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
meta:set_int("src_time_max", 0)
|
meta:set_int("src_time_max", 0)
|
||||||
meta:set_string("formspec", elepm.get_grindstone_formspec(0))
|
meta:set_string("formspec", get_formspec(0))
|
||||||
meta:set_string("infotext", "No recipe")
|
meta:set_string("infotext", "No recipe")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -86,7 +104,7 @@ local function grindstone_timer(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local percentile = math.floor(100 * time / target_time)
|
local percentile = math.floor(100 * time / target_time)
|
||||||
meta:set_string("formspec", elepm.get_grindstone_formspec(percentile))
|
meta:set_string("formspec", get_formspec(percentile))
|
||||||
meta:set_int("src_time", time)
|
meta:set_int("src_time", time)
|
||||||
meta:set_int("src_time_max", target_time)
|
meta:set_int("src_time_max", target_time)
|
||||||
meta:set_string("infotext", "Grindstone: ".. percentile .. "%\nPunch me to progress!")
|
meta:set_string("infotext", "Grindstone: ".. percentile .. "%\nPunch me to progress!")
|
||||||
@ -107,7 +125,7 @@ ele.register_base_device("elepower_machines:grindstone", {
|
|||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
inv:set_size("dst", 2)
|
inv:set_size("dst", 2)
|
||||||
|
|
||||||
meta:set_string("formspec", elepm.get_grindstone_formspec(0))
|
meta:set_string("formspec", get_formspec(0))
|
||||||
end,
|
end,
|
||||||
tube = false,
|
tube = false,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
|
@ -1,16 +1,28 @@
|
|||||||
|
|
||||||
-- Basic
|
local mp = elepm.modpath .. "/machines/"
|
||||||
dofile(elepm.modpath.."/machines/bases/init.lua")
|
|
||||||
dofile(elepm.modpath.."/machines/accumulator.lua")
|
-- Bases
|
||||||
dofile(elepm.modpath.."/machines/furnace.lua")
|
dofile(mp .. "bases/init.lua")
|
||||||
dofile(elepm.modpath.."/machines/alloy_furnace.lua")
|
|
||||||
dofile(elepm.modpath.."/machines/coal_alloy_furnace.lua")
|
-- Generation
|
||||||
dofile(elepm.modpath.."/machines/pulverizer.lua")
|
dofile(mp .. "generator.lua")
|
||||||
dofile(elepm.modpath.."/machines/grindstone.lua")
|
dofile(mp .. "lava_generator.lua")
|
||||||
dofile(elepm.modpath.."/machines/sawmill.lua")
|
dofile(mp .. "steam_turbine.lua")
|
||||||
dofile(elepm.modpath.."/machines/generator.lua")
|
|
||||||
dofile(elepm.modpath.."/machines/storage.lua")
|
-- Storage
|
||||||
dofile(elepm.modpath.."/machines/lava_cooler.lua")
|
dofile(mp .. "storage.lua")
|
||||||
dofile(elepm.modpath.."/machines/solderer.lua")
|
|
||||||
dofile(elepm.modpath.."/machines/lava_generator.lua")
|
-- Processing
|
||||||
dofile(elepm.modpath.."/machines/steam_turbine.lua")
|
dofile(mp .. "furnace.lua")
|
||||||
|
dofile(mp .. "sawmill.lua")
|
||||||
|
dofile(mp .. "pulverizer.lua")
|
||||||
|
dofile(mp .. "grindstone.lua")
|
||||||
|
|
||||||
|
-- Crafter
|
||||||
|
dofile(mp .. "alloy_furnace.lua")
|
||||||
|
dofile(mp .. "coal_alloy_furnace.lua")
|
||||||
|
dofile(mp .. "solderer.lua")
|
||||||
|
|
||||||
|
-- Other
|
||||||
|
dofile(mp .. "accumulator.lua")
|
||||||
|
dofile(mp .. "lava_cooler.lua")
|
||||||
|
@ -16,6 +16,41 @@ local cooler_recipes = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function get_formspec(item_percent, coolant_buffer, hot_buffer, power, recipes, recipe)
|
||||||
|
local rclist = {}
|
||||||
|
|
||||||
|
local x = 2.5
|
||||||
|
for j in pairs(recipes) do
|
||||||
|
if j == recipe then
|
||||||
|
rclist[#rclist + 1] = "item_image["..x..",0;1,1;"..j.."]"
|
||||||
|
else
|
||||||
|
rclist[#rclist + 1] = "item_image_button[".. x ..",0;1,1;"..j..";"..j..";]"
|
||||||
|
end
|
||||||
|
x = x + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.fluid_bar(1, 0, coolant_buffer)..
|
||||||
|
ele.formspec.fluid_bar(7, 0, hot_buffer)..
|
||||||
|
"list[context;dst;3.5,1.5;1,1;]"..
|
||||||
|
"image[2.5,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||||
|
"image[4.5,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(item_percent)..":gui_furnace_arrow_fg.png^[transformFXR90]"..
|
||||||
|
table.concat(rclist, "")..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function lava_cooler_timer(pos, elapsed)
|
local function lava_cooler_timer(pos, elapsed)
|
||||||
local refresh = false
|
local refresh = false
|
||||||
|
|
||||||
@ -77,7 +112,7 @@ local function lava_cooler_timer(pos, elapsed)
|
|||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", storage)
|
||||||
meta:set_string("infotext", ("Lava Cooler %s\n%s"):format(active, ele.capacity_text(capacity, storage)))
|
meta:set_string("infotext", ("Lava Cooler %s\n%s"):format(active, ele.capacity_text(capacity, storage)))
|
||||||
|
|
||||||
meta:set_string("formspec", elepm.get_lava_cooler_formspec(timer, coolant_buffer, hot_buffer,
|
meta:set_string("formspec", get_formspec(timer, coolant_buffer, hot_buffer,
|
||||||
power, cooler_recipes, recipe))
|
power, cooler_recipes, recipe))
|
||||||
|
|
||||||
return refresh
|
return refresh
|
||||||
@ -107,7 +142,7 @@ ele.register_machine("elepower_machines:lava_cooler", {
|
|||||||
inv:set_size("dst", 1)
|
inv:set_size("dst", 1)
|
||||||
|
|
||||||
meta:set_string("recipe", "default:cobble")
|
meta:set_string("recipe", "default:cobble")
|
||||||
meta:set_string("formspec", elepm.get_lava_cooler_formspec(0,nil,nil,0,cooler_recipes, "default:cobble"))
|
meta:set_string("formspec", get_formspec(0,nil,nil,0,cooler_recipes, "default:cobble"))
|
||||||
end,
|
end,
|
||||||
on_timer = lava_cooler_timer,
|
on_timer = lava_cooler_timer,
|
||||||
on_receive_fields = function (pos, formname, fields, sender)
|
on_receive_fields = function (pos, formname, fields, sender)
|
||||||
|
Before Width: | Height: | Size: 10 KiB |
27
elepower_nuclear/crafting.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
-- Radiation-shielded Lead Machine Chassis
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "elepower_nuclear:machine_block",
|
||||||
|
recipe = {
|
||||||
|
{"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:graphite_ingot", "elepower_dynamics:induction_coil_advanced"},
|
||||||
|
{"elepower_dynamics:graphite_ingot", "elepower_dynamics:lead_block", "elepower_dynamics:graphite_ingot"},
|
||||||
|
{"elepower_dynamics:lead_block", "elepower_dynamics:graphite_ingot", "elepower_dynamics:lead_block"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Enrichment Plant
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "elepower_nuclear:enrichment_plant",
|
||||||
|
recipe = {
|
||||||
|
{"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:soc", "elepower_dynamics:induction_coil_advanced"},
|
||||||
|
{"elepower_nuclear:graphite_rod", "elepower_nuclear:machine_block", "elepower_nuclear:graphite_rod"},
|
||||||
|
{"elepower_dynamics:wound_silver_coil", "elepower_dynamics:viridisium_gear", "elepower_dynamics:wound_silver_coil"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
elepm.register_craft({
|
||||||
|
type = "grind",
|
||||||
|
recipe = { "elepower_dynamics:graphite_ingot" },
|
||||||
|
output = "elepower_nuclear:graphite_rod 3",
|
||||||
|
time = 6,
|
||||||
|
})
|
@ -8,36 +8,36 @@
|
|||||||
|
|
||||||
minetest.register_node("elepower_nuclear:coolant", {
|
minetest.register_node("elepower_nuclear:coolant", {
|
||||||
description = "Coolant (cold)",
|
description = "Coolant (cold)",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, coolant = 1},
|
||||||
tiles = {"elenuclear_cold_coolant.png"},
|
tiles = {"elenuclear_cold_coolant.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("elepower_nuclear:coolant_hot", {
|
minetest.register_node("elepower_nuclear:coolant_hot", {
|
||||||
description = "Coolant (hot)",
|
description = "Coolant (hot)",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, coolant = 1},
|
||||||
tiles = {"elenuclear_hot_coolant.png"},
|
tiles = {"elenuclear_hot_coolant.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("elepower_nuclear:heavy_water", {
|
minetest.register_node("elepower_nuclear:heavy_water", {
|
||||||
description = "Heavy Water",
|
description = "Heavy Water",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, water = 1},
|
||||||
tiles = {"default_water.png"},
|
tiles = {"elenuclear_heavy_water.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("elepower_nuclear:tritium", {
|
minetest.register_node("elepower_nuclear:tritium", {
|
||||||
description = "Tritium Gas",
|
description = "Tritium Gas",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, gas = 1},
|
||||||
tiles = {"default_water.png"},
|
tiles = {"elenuclear_gas.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("elepower_nuclear:deuterium", {
|
minetest.register_node("elepower_nuclear:deuterium", {
|
||||||
description = "Deuterium Gas",
|
description = "Deuterium Gas",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, gas = 1},
|
||||||
tiles = {"default_water.png"},
|
tiles = {"elenuclear_gas.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("elepower_nuclear:helium", {
|
minetest.register_node("elepower_nuclear:helium", {
|
||||||
description = "Helium Gas",
|
description = "Helium Gas",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, gas = 1},
|
||||||
tiles = {"elenuclear_helium.png"},
|
tiles = {"elenuclear_helium.png"},
|
||||||
})
|
})
|
||||||
|
@ -9,3 +9,4 @@ elenuclear.modpath = modpath
|
|||||||
dofile(modpath.."/craftitems.lua")
|
dofile(modpath.."/craftitems.lua")
|
||||||
dofile(modpath.."/nodes.lua")
|
dofile(modpath.."/nodes.lua")
|
||||||
dofile(modpath.."/fluids.lua")
|
dofile(modpath.."/fluids.lua")
|
||||||
|
dofile(modpath.."/crafting.lua")
|
||||||
|
60
elepower_nuclear/machines/enrichment_plant.lua
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
-- Nuclear fuel enrichment plant
|
||||||
|
|
||||||
|
local function get_formspec(power, heat, progress, water)
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.create_bar(1, 0, heat, "#ffbb11", true)..
|
||||||
|
"list[context;src;2,0.75;1,1;]"..
|
||||||
|
"image[3.5,0.75;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(progress)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||||
|
"list[context;dst;5,0.25;2,2;]"..
|
||||||
|
ele.formspec.fluid_bar(7, 0, water)..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"image[7,3;1,1;elenuclear_radioactive.png]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function enrichment_plant_timer (pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local refresh = false
|
||||||
|
|
||||||
|
return refresh
|
||||||
|
end
|
||||||
|
|
||||||
|
ele.register_machine("elepower_nuclear:enrichment_plant", {
|
||||||
|
description = "Enrichment Plant",
|
||||||
|
tiles = {
|
||||||
|
"elenuclear_machine_top.png", "elenuclear_machine_top.png", "elenuclear_machine_side.png",
|
||||||
|
"elenuclear_machine_side.png", "elenuclear_machine_side.png", "elenuclear_enrichment_plant.png",
|
||||||
|
},
|
||||||
|
groups = {ele_user = 1, cracky = 3, fluid_container = 1},
|
||||||
|
ele_capacity = 16000,
|
||||||
|
ele_usage = 288,
|
||||||
|
ele_inrush = 288,
|
||||||
|
fluid_buffers = {
|
||||||
|
water = {
|
||||||
|
accepts = {"default:water_source"},
|
||||||
|
capacity = 8000,
|
||||||
|
drainable = false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_construct = function (pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 4)
|
||||||
|
|
||||||
|
meta:set_string("formspec", get_formspec(0, 25, 0, nil))
|
||||||
|
end,
|
||||||
|
on_timer = enrichment_plant_timer,
|
||||||
|
})
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
local mp = elenuclear.modpath .. "/machines/"
|
||||||
|
|
||||||
|
minetest.register_node("elepower_nuclear:machine_block", {
|
||||||
|
description = "Radiation-shielded Lead Machine Chassis",
|
||||||
|
tiles = {
|
||||||
|
"elenuclear_machine_top.png", "elepower_lead_block.png", "elenuclear_machine_block.png",
|
||||||
|
"elenuclear_machine_block.png", "elenuclear_machine_block.png", "elenuclear_machine_block.png",
|
||||||
|
},
|
||||||
|
groups = {cracky = 3},
|
||||||
|
})
|
||||||
|
|
||||||
|
dofile(mp.."enrichment_plant.lua")
|
BIN
elepower_nuclear/textures/elenuclear_enrichment_plant.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
elepower_nuclear/textures/elenuclear_gas.png
Normal file
After Width: | Height: | Size: 669 B |
BIN
elepower_nuclear/textures/elenuclear_heavy_water.png
Normal file
After Width: | Height: | Size: 522 B |
BIN
elepower_nuclear/textures/elenuclear_machine_block.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
elepower_nuclear/textures/elenuclear_machine_side.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
elepower_nuclear/textures/elenuclear_machine_top.png
Normal file
After Width: | Height: | Size: 376 B |
BIN
elepower_nuclear/textures/elenuclear_radioactive.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
@ -1,9 +1,24 @@
|
|||||||
-- Formspec helper: Add power bar
|
-- Formspec helpers
|
||||||
|
|
||||||
ele.formspec = {}
|
ele.formspec = {}
|
||||||
|
|
||||||
function ele.formspec.power_meter(pw_percent)
|
function ele.formspec.create_bar(x, y, metric, color, small)
|
||||||
return "image[0,0;1,2.8;elepower_gui_barbg.png"..
|
if not metric or metric < 0 then metric = 0 end
|
||||||
"^[lowpart:"..pw_percent..":elepower_gui_bar.png]"..
|
|
||||||
"image[0,0;1,2.8;elepower_gui_gauge.png]"
|
local width = 1
|
||||||
|
local gauge = "image[0,0;1,2.8;elepower_gui_gauge.png]"
|
||||||
|
|
||||||
|
-- Smaller width bar
|
||||||
|
if small then
|
||||||
|
width = 0.25
|
||||||
|
gauge = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return "image["..x..","..y..";"..width..",2.8;elepower_gui_barbg.png"..
|
||||||
|
"\\^[lowpart\\:"..metric.."\\:elepower_gui_bar.png\\\\^[multiply\\\\:"..color.."]"..
|
||||||
|
gauge
|
||||||
|
end
|
||||||
|
|
||||||
|
function ele.formspec.power_meter(pw_percent)
|
||||||
|
return ele.formspec.create_bar(0, 0, pw_percent, "#00a1ff")
|
||||||
end
|
end
|
||||||
|
BIN
elepower_papi/textures/elepower_gui_bar.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |