Lava generator, disableable pipeworks support on machines
@ -162,7 +162,7 @@ minetest.register_craft({
|
||||
output = "elepower_dynamics:wound_silver_coil",
|
||||
recipe = {
|
||||
{"", "moreores:silver_ingot", ""},
|
||||
{"moreores:silver_ingot", "elepower_dynamics:iron_ingot", "moreores:silver_ingot"},
|
||||
{"moreores:silver_ingot", "elepower_dynamics:zinc_ingot", "moreores:silver_ingot"},
|
||||
{"", "moreores:silver_ingot", ""}
|
||||
}
|
||||
})
|
||||
|
@ -89,3 +89,10 @@ minetest.register_node("elepower_dynamics:etching_acid_flowing", {
|
||||
|
||||
bucket.register_liquid("elepower_dynamics:etching_acid_source", "elepower_dynamics:etching_acid_flowing",
|
||||
"elepower_dynamics:bucket_etching_acid", "#410800", "Etching Acid Bucket")
|
||||
|
||||
-- Virtual "fluid"
|
||||
minetest.register_node("elepower_dynamics:steam", {
|
||||
description = "Steam",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"elepower_steam.png"},
|
||||
})
|
||||
|
BIN
elepower_dynamics/textures/elepower_steam.png
Normal file
After Width: | Height: | Size: 572 B |
@ -14,7 +14,7 @@ dofile(elefarm.modpath.."/nodes/harvester.lua")
|
||||
dofile(elefarm.modpath.."/nodes/tree_extractor.lua")
|
||||
dofile(elefarm.modpath.."/nodes/tree_processor.lua")
|
||||
|
||||
-- Mobs redo support
|
||||
-- Mobs Redo support
|
||||
if minetest.get_modpath("mobs") ~= nil and mobs.mod and mobs.mod == "redo" then
|
||||
dofile(elefarm.modpath.."/nodes/spawner.lua")
|
||||
end
|
||||
|
@ -309,3 +309,13 @@ minetest.register_craft({
|
||||
{"bucket:bucket_lava", "bucket:bucket_empty"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Lava Generator
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:lava_generator",
|
||||
recipe = {
|
||||
{"elepower_dynamics:wound_silver_coil", "elepower_dynamics:control_circuit", "elepower_dynamics:wound_silver_coil"},
|
||||
{"default:brick", "elepower_machines:machine_block", "default:brick"},
|
||||
{"elepower_dynamics:invar_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:invar_gear"},
|
||||
},
|
||||
})
|
||||
|
@ -51,6 +51,20 @@ function ele.formspec.get_crafter_formspec(craft_type, power, percent)
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
end
|
||||
|
||||
function ele.formspec.get_lava_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..
|
||||
|
@ -109,6 +109,7 @@ ele.register_base_device("elepower_machines:grindstone", {
|
||||
|
||||
meta:set_string("formspec", elepm.get_grindstone_formspec(0))
|
||||
end,
|
||||
tube = false,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
|
@ -12,3 +12,4 @@ 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")
|
||||
|
@ -32,6 +32,7 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
local recipe = meta:get_string("recipe")
|
||||
local consume = cooler_recipes[recipe]
|
||||
local time = meta:get_int("src_time")
|
||||
local active = "Active"
|
||||
|
||||
if storage > usage then
|
||||
if coolant_buffer.amount >= 1000 and hot_buffer.amount >= 1000 then
|
||||
@ -62,8 +63,11 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
refresh = true
|
||||
end
|
||||
else
|
||||
active = "Idle"
|
||||
refresh = false
|
||||
end
|
||||
else
|
||||
active = "Idle"
|
||||
end
|
||||
|
||||
local power = math.floor(100 * storage / capacity)
|
||||
@ -71,6 +75,7 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
|
||||
meta:set_int("src_time", time)
|
||||
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,
|
||||
power, cooler_recipes, recipe))
|
||||
|
100
elepower_machines/machines/lava_generator.lua
Normal file
@ -0,0 +1,100 @@
|
||||
|
||||
ele.register_machine("elepower_machines:lava_generator", {
|
||||
description = "Lava Generator",
|
||||
groups = {
|
||||
fluid_container = 1,
|
||||
ele_provider = 1,
|
||||
oddly_breakable_by_hand = 1,
|
||||
},
|
||||
ele_usage = 64,
|
||||
tiles = {
|
||||
"elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png",
|
||||
"elepower_machine_side.png", "elepower_machine_side.png", "elepower_lava_generator.png",
|
||||
},
|
||||
ele_active_node = true,
|
||||
ele_active_nodedef = {
|
||||
tiles = {
|
||||
"elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png",
|
||||
"elepower_machine_side.png", "elepower_machine_side.png", "elepower_lava_generator_active.png",
|
||||
},
|
||||
},
|
||||
fluid_buffers = {
|
||||
lava = {
|
||||
capacity = 8000,
|
||||
accepts = {"default:lava_source"},
|
||||
drainable = false
|
||||
}
|
||||
},
|
||||
tube = false,
|
||||
on_timer = function (pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local nodename = "elepower_machines:lava_generator"
|
||||
|
||||
local burn_time = meta:get_int("burn_time")
|
||||
local burn_totaltime = meta:get_int("burn_totaltime")
|
||||
|
||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||
local generation = ele.helpers.get_node_property(meta, pos, "usage")
|
||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||
|
||||
-- Fluid buffer
|
||||
local flbuffer = fluid_lib.get_buffer_data(pos, "lava")
|
||||
if not flbuffer or flbuffer.fluid == "" then return false end
|
||||
|
||||
-- If more to burn and the energy produced was used: produce some more
|
||||
if burn_time > 0 then
|
||||
if storage + generation > capacity then
|
||||
return false
|
||||
end
|
||||
|
||||
meta:set_int("storage", storage + generation)
|
||||
|
||||
burn_time = burn_time - 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
end
|
||||
|
||||
local pow_percent = math.floor((storage / capacity) * 100)
|
||||
|
||||
-- Burn another bucket of lava
|
||||
if burn_time == 0 then
|
||||
local inv = meta:get_inventory()
|
||||
if flbuffer.amount >= 1000 then
|
||||
-- Lava burn time
|
||||
local fuel = 60
|
||||
|
||||
meta:set_int("burn_time", fuel)
|
||||
meta:set_int("burn_totaltime", fuel)
|
||||
|
||||
-- Take lava
|
||||
flbuffer.amount = flbuffer.amount - 1000
|
||||
|
||||
local active_node = nodename.."_active"
|
||||
ele.helpers.swap_node(pos, active_node)
|
||||
else
|
||||
meta:set_string("formspec", ele.formspec.get_lava_generator_formspec(pow_percent, 0, flbuffer))
|
||||
meta:set_string("infotext", "Lava Generator Idle\n" .. ele.capacity_text(capacity, storage) ..
|
||||
"\n" .. fluid_lib.buffer_to_string(flbuffer))
|
||||
ele.helpers.swap_node(pos, nodename)
|
||||
return false
|
||||
end
|
||||
end
|
||||
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_lava_generator_formspec(pow_percent, percent, flbuffer))
|
||||
meta:set_string("infotext", "Lava Generator Active\n" .. ele.capacity_text(capacity, storage) ..
|
||||
"\n" .. fluid_lib.buffer_to_string(flbuffer))
|
||||
|
||||
meta:set_int("lava_fluid_storage", flbuffer.amount)
|
||||
|
||||
return true
|
||||
end,
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
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_lava_generator_formspec(math.floor((storage / capacity) * 100), 0))
|
||||
end
|
||||
})
|
BIN
elepower_machines/textures/elepower_lava_generator.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
elepower_machines/textures/elepower_lava_generator_active.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
elepower_machines/textures/elepower_turbine_side.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
43
elepower_nuclear/fluids.lua
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
-------------------
|
||||
-- Virtual Nodes --
|
||||
-------------------
|
||||
|
||||
-- These nodes are used as "fluids"
|
||||
-- They do not actually exist as nodes that should be placed.
|
||||
|
||||
minetest.register_node("elepower_nuclear:coolant", {
|
||||
description = "Coolant (cold)",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"elenuclear_cold_coolant.png"},
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_nuclear:coolant_hot", {
|
||||
description = "Coolant (hot)",
|
||||
groups = {not_in_creative_inventory = 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"},
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_nuclear:tritium", {
|
||||
description = "Tritium Gas",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"default_water.png"},
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_nuclear:deuterium", {
|
||||
description = "Deuterium Gas",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"default_water.png"},
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_nuclear:helium", {
|
||||
description = "Helium Gas",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"elenuclear_helium.png"},
|
||||
})
|
@ -7,3 +7,5 @@ elenuclear = rawget(_G, "elenuclear") or {}
|
||||
elenuclear.modpath = modpath
|
||||
|
||||
dofile(modpath.."/craftitems.lua")
|
||||
dofile(modpath.."/nodes.lua")
|
||||
dofile(modpath.."/fluids.lua")
|
||||
|
0
elepower_nuclear/machines/init.lua
Normal file
2
elepower_nuclear/nodes.lua
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
dofile(elenuclear.modpath.."/machines/init.lua")
|
BIN
elepower_nuclear/textures/elenuclear_cold_coolant.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
elepower_nuclear/textures/elenuclear_helium.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
elepower_nuclear/textures/elenuclear_hot_coolant.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
@ -42,7 +42,7 @@ local pw = minetest.get_modpath("pipeworks") ~= nil
|
||||
]]
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("dst") and inv:is_empty("src")
|
||||
end
|
||||
@ -180,7 +180,19 @@ function ele.register_base_device(nodename, nodedef)
|
||||
|
||||
-- Pipeworks support
|
||||
if pw and nodedef.groups and (nodedef.groups["tubedevice"] or nodedef.groups["tube"]) then
|
||||
nodedef['tube'] = tube
|
||||
if nodedef['tube'] == false then
|
||||
nodedef['tube'] = nil
|
||||
nodedef.groups["tubedevice"] = 0
|
||||
nodedef.groups["tube"] = 0
|
||||
elseif nodedef['tube'] then
|
||||
for key,val in pairs(tube) do
|
||||
if not nodedef['tube'][key] then
|
||||
nodedef['tube'][key] = val
|
||||
end
|
||||
end
|
||||
else
|
||||
nodedef['tube'] = tube
|
||||
end
|
||||
end
|
||||
|
||||
-- Finally, register the damn thing already
|
||||
|