Redo formspec locations, Add graphite ingot, Lead block texture change, Add casing for Nuclear Processing Machines, Start progress on Enrichment Plant

This commit is contained in:
Evert Prants 2018-07-21 23:03:17 +00:00
parent 3376233bf0
commit b00ddce531
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
38 changed files with 443 additions and 313 deletions

View File

@ -47,6 +47,12 @@ minetest.register_craftitem("elepower_dynamics:zinc_ingot", {
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
minetest.register_craftitem("elepower_dynamics:lead_lump", {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -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

View File

@ -6,7 +6,6 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
elefarm = rawget(_G, "elefarm") or {}
elefarm.modpath = modpath
dofile(modpath.."/formspec.lua")
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/nodes/init.lua")
dofile(modpath.."/crafting.lua")

View File

@ -71,6 +71,22 @@ local function harvest(pos, harvested, fdir)
return harvested
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 refresh = false
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 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("src_time", work)
@ -155,7 +171,7 @@ ele.register_machine("elepower_farming:harvester", {
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)
end,

View File

@ -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 meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -238,7 +255,7 @@ local function on_timer(pos, elapsed)
local power_percent = math.floor((storage / capacity)*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("src_time", work)
@ -270,7 +287,7 @@ ele.register_base_device("elepower_farming:planter", {
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,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take,

View File

@ -89,6 +89,23 @@ local function spawn(pos, mob)
return
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 refresh = false
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 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("src_time", work)
@ -167,7 +184,7 @@ ele.register_machine("elepower_farming:spawner", {
inv:set_size("src", 1)
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,
can_dig = can_dig,
on_timer = on_timer,

View File

@ -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 refresh = false
local meta = minetest.get_meta(pos)
@ -118,7 +136,7 @@ local function on_timer(pos, elapsed)
timer = math.floor(100 * time / time_max)
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
end
@ -149,7 +167,7 @@ ele.register_machine("elepower_farming:tree_processor", {
local inv = meta:get_inventory()
inv:set_size("dst", 1)
meta:set_string("formspec", elefarm.formspec.tree_processor(0, 0))
meta:set_string("formspec", get_formspec(0, 0))
end,
tiles = {
"elefarming_machine_tree_processor.png", "elefarming_machine_base.png", "elefarming_machine_side.png",

View File

@ -29,6 +29,10 @@ local alloy_recipes = {
recipe = { "elepower_dynamics:silicon", "elepower_dynamics:gold_dust 4" },
output = "elepower_dynamics:silicon_wafer",
},
{
recipe = { "default:coal_lump", "elepower_dynamics:coal_dust 4" },
output = "elepower_dynamics:graphite_ingot",
},
}
-- Register alloy furnace recipes

View File

@ -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

View File

@ -8,7 +8,6 @@ elepm.modpath = modpath
-- Utility
dofile(modpath.."/craft.lua")
dofile(modpath.."/formspec.lua")
-- Machines
dofile(modpath.."/machines/init.lua")

View File

@ -1,6 +1,63 @@
-- This is a crafter type machine base.
-- 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)
local craft_type = nodedef.craft_type
if not craft_type or not elepm.craft.types[craft_type] then

View File

@ -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
function ele.register_fluid_generator(nodename, nodedef)
local fuel = nodedef.fuel
@ -67,7 +81,7 @@ function ele.register_fluid_generator(nodename, nodedef)
local active_node = nodename.."_active"
ele.helpers.swap_node(pos, active_node)
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,
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
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,
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 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
}

View File

@ -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)
if not nodedef.groups then
nodedef.groups = {}
@ -58,7 +75,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
ele.helpers.swap_node(pos, active_node)
end
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) ..
"\n" .. ele.capacity_text(capacity, storage))
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
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) ..
"\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 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
ele.register_machine(nodename, nodedef)

View File

@ -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 meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
@ -34,7 +54,7 @@ function elepm.register_storage(nodename, nodedef)
local rounded = math.floor(percent * 100)
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" ..
ele.capacity_text(capacity, storage))
@ -112,7 +132,7 @@ function elepm.register_storage(nodename, nodedef)
local inv = meta:get_inventory()
inv:set_size("out", 1)
inv:set_size("in", 1)
meta:set_string("formspec", ele.formspec.get_storage_formspec(0))
meta:set_string("formspec", get_formspec(0))
end
for i = 0, levels do

View File

@ -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 meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
@ -144,11 +167,11 @@ local function alloy_furnace_timer(pos, elapsed)
if fuel_totaltime ~= 0 then
active = "Active"
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")
result = true
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")
minetest.get_node_timer(pos):stop()
end
@ -205,7 +228,7 @@ ele.register_base_device("elepower_machines:coal_alloy_furnace", {
inv:set_size("dst", 4)
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,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take,

View File

@ -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 meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
@ -46,7 +64,7 @@ local function grindstone_timer(pos, elapsed)
if not recipe or recipe.time == 0 then
meta:set_int("src_time", 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")
return
end
@ -86,7 +104,7 @@ local function grindstone_timer(pos, elapsed)
end
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_max", target_time)
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("dst", 2)
meta:set_string("formspec", elepm.get_grindstone_formspec(0))
meta:set_string("formspec", get_formspec(0))
end,
tube = false,
allow_metadata_inventory_put = allow_metadata_inventory_put,

View File

@ -1,16 +1,28 @@
-- Basic
dofile(elepm.modpath.."/machines/bases/init.lua")
dofile(elepm.modpath.."/machines/accumulator.lua")
dofile(elepm.modpath.."/machines/furnace.lua")
dofile(elepm.modpath.."/machines/alloy_furnace.lua")
dofile(elepm.modpath.."/machines/coal_alloy_furnace.lua")
dofile(elepm.modpath.."/machines/pulverizer.lua")
dofile(elepm.modpath.."/machines/grindstone.lua")
dofile(elepm.modpath.."/machines/sawmill.lua")
dofile(elepm.modpath.."/machines/generator.lua")
dofile(elepm.modpath.."/machines/storage.lua")
dofile(elepm.modpath.."/machines/lava_cooler.lua")
dofile(elepm.modpath.."/machines/solderer.lua")
dofile(elepm.modpath.."/machines/lava_generator.lua")
dofile(elepm.modpath.."/machines/steam_turbine.lua")
local mp = elepm.modpath .. "/machines/"
-- Bases
dofile(mp .. "bases/init.lua")
-- Generation
dofile(mp .. "generator.lua")
dofile(mp .. "lava_generator.lua")
dofile(mp .. "steam_turbine.lua")
-- Storage
dofile(mp .. "storage.lua")
-- Processing
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")

View File

@ -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 refresh = false
@ -77,7 +112,7 @@ local function lava_cooler_timer(pos, elapsed)
meta:set_int("storage", 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))
return refresh
@ -107,7 +142,7 @@ ele.register_machine("elepower_machines:lava_cooler", {
inv:set_size("dst", 1)
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,
on_timer = lava_cooler_timer,
on_receive_fields = function (pos, formname, fields, sender)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View 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,
})

View File

@ -8,36 +8,36 @@
minetest.register_node("elepower_nuclear:coolant", {
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"},
})
minetest.register_node("elepower_nuclear: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"},
})
minetest.register_node("elepower_nuclear:heavy_water", {
description = "Heavy Water",
groups = {not_in_creative_inventory = 1},
tiles = {"default_water.png"},
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, water = 1},
tiles = {"elenuclear_heavy_water.png"},
})
minetest.register_node("elepower_nuclear:tritium", {
description = "Tritium Gas",
groups = {not_in_creative_inventory = 1},
tiles = {"default_water.png"},
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, gas = 1},
tiles = {"elenuclear_gas.png"},
})
minetest.register_node("elepower_nuclear:deuterium", {
description = "Deuterium Gas",
groups = {not_in_creative_inventory = 1},
tiles = {"default_water.png"},
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = 1, gas = 1},
tiles = {"elenuclear_gas.png"},
})
minetest.register_node("elepower_nuclear:helium", {
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"},
})

View File

@ -9,3 +9,4 @@ elenuclear.modpath = modpath
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/fluids.lua")
dofile(modpath.."/crafting.lua")

View 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,
})

View File

@ -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")

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,9 +1,24 @@
-- Formspec helper: Add power bar
-- Formspec helpers
ele.formspec = {}
function ele.formspec.power_meter(pw_percent)
return "image[0,0;1,2.8;elepower_gui_barbg.png"..
"^[lowpart:"..pw_percent..":elepower_gui_bar.png]"..
"image[0,0;1,2.8;elepower_gui_gauge.png]"
function ele.formspec.create_bar(x, y, metric, color, small)
if not metric or metric < 0 then metric = 0 end
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View File

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 489 B

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB