Portable Tank
This commit is contained in:
parent
d40b08a492
commit
a969a5e721
@ -134,6 +134,16 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
-- Portable Tank
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:portable_tank",
|
||||
recipe = {
|
||||
{"group:glass", "elepower_dynamics:fluid_duct", "group:glass"},
|
||||
{"group:glass", "group:glass", "group:glass"},
|
||||
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
-----------
|
||||
-- Items --
|
||||
-----------
|
||||
|
@ -11,6 +11,7 @@ dofile(modpath.."/craftitems.lua")
|
||||
dofile(modpath.."/plastic.lua")
|
||||
dofile(modpath.."/tools.lua")
|
||||
dofile(modpath.."/nodes.lua")
|
||||
dofile(modpath.."/tanks.lua")
|
||||
dofile(modpath.."/dusts.lua")
|
||||
dofile(modpath.."/gears.lua")
|
||||
dofile(modpath.."/worldgen.lua")
|
||||
|
@ -1,4 +1,4 @@
|
||||
name = elepower_dynamics
|
||||
description = Elepower Dynamics. Conduits and materials!
|
||||
depends = elepower_papi,elepower_fapi,default
|
||||
depends = elepower_papi,elepower_fapi,default,fluid_tanks
|
||||
optional_depends = moreores,pipeworks,homedecor
|
||||
|
10
elepower_dynamics/tank.lua
Normal file
10
elepower_dynamics/tank.lua
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
fluid_tanks.register_tank("elepower_dynamics:portable_tank", {
|
||||
description = "Portable Tank",
|
||||
capacity = 8000,
|
||||
accepts = true,
|
||||
tiles = {
|
||||
"elepower_tank_base.png", "elepower_tank_base.png", "elepower_tank_side.png",
|
||||
"elepower_tank_side.png", "elepower_tank_side.png", "elepower_tank_side.png"
|
||||
}
|
||||
})
|
9
elepower_dynamics/tanks.lua
Normal file
9
elepower_dynamics/tanks.lua
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
fluid_tanks.register_tank("elepower_dynamics:portable_tank", {
|
||||
description = "Portable Tank",
|
||||
capacity = 8000,
|
||||
accepts = true,
|
||||
tiles = {
|
||||
"elepower_tank_base.png", "elepower_tank_side.png", "elepower_tank_base.png^elepower_power_port.png",
|
||||
}
|
||||
})
|
BIN
elepower_dynamics/textures/elepower_tank_base.png
Normal file
BIN
elepower_dynamics/textures/elepower_tank_base.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 446 B |
BIN
elepower_dynamics/textures/elepower_tank_side.png
Normal file
BIN
elepower_dynamics/textures/elepower_tank_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 520 B |
@ -1,3 +1,3 @@
|
||||
name = elepower_farming
|
||||
description = Electric Farming Automation!
|
||||
depends = elepower_papi, elepower_tools, elepower_fapi, bucket, farming
|
||||
depends = elepower_papi, elepower_tools, elepower_fapi, bucket, farming, fluid_tanks
|
||||
|
@ -252,4 +252,13 @@ if minetest.get_modpath("bucket") ~= nil then
|
||||
|
||||
bucket.register_liquid("elepower_farming:sludge_source", "elepower_farming:sludge_flowing",
|
||||
"elepower_farming:bucket_sludge", "#121212", "Sludge Bucket")
|
||||
|
||||
fluid_tanks.register_tank(":elepower_dynamics:portable_tank", {
|
||||
description = "Portable Tank",
|
||||
capacity = 8000,
|
||||
accepts = true,
|
||||
tiles = {
|
||||
"elepower_tank_base.png", "elepower_tank_side.png", "elepower_tank_base.png^elepower_power_port.png",
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -172,8 +172,6 @@ local function plant(pos, range, stack, inv)
|
||||
soil = "farming:soil"
|
||||
end
|
||||
|
||||
print(dump(base_node), soil,wet_soil)
|
||||
|
||||
if base_node.name ~= soil and base_node.name ~= wet_soil then
|
||||
minetest.set_node(base_pos, {name = soil})
|
||||
end
|
||||
|
@ -27,44 +27,43 @@ minetest.register_node("elepower_farming:tree_extractor", {
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"elepower_farming:tree_extractor"},
|
||||
label = "elefluidSapAccumulator",
|
||||
interval = 8,
|
||||
chance = 1/6,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fluid_c = meta:get_int("tree_fluid_storage")
|
||||
if fluid_c == CAPACITY then return end
|
||||
label = "elefluidSapAccumulator",
|
||||
interval = 8,
|
||||
chance = 1/6,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local buffer = fluid_lib.get_buffer_data(pos, "tree")
|
||||
if not buffer or buffer.amount == buffer.capacity then return end
|
||||
|
||||
local fpos = ele.helpers.face_front(pos, node.param2)
|
||||
local fluid = 0
|
||||
local ftype = meta:get_string("tree_fluid")
|
||||
local fname = "Tree Sap"
|
||||
local fnode = minetest.get_node_or_nil(fpos)
|
||||
local fpos = ele.helpers.face_front(pos, node.param2)
|
||||
local amount = 0
|
||||
local ftype = buffer.fluid
|
||||
local fnode = minetest.get_node_or_nil(fpos)
|
||||
if fnode and ele.helpers.get_item_group(fnode.name, "tree") then
|
||||
local fdata = fluid_table[fnode.name]
|
||||
if fdata and (ftype == "" or ftype == fdata.fluid) then
|
||||
fluid = fdata.fpc
|
||||
amount = fdata.fpc
|
||||
ftype = fdata.fluid
|
||||
fname = minetest.registered_nodes[ftype].description:gsub(" Source", "")
|
||||
end
|
||||
end
|
||||
|
||||
if fluid == 0 then
|
||||
if amount == 0 then
|
||||
meta:set_string("infotext", "Place me in front of a tree!")
|
||||
return
|
||||
end
|
||||
|
||||
local give = 0
|
||||
if fluid_c + fluid > CAPACITY then
|
||||
give = CAPACITY - fluid_c
|
||||
if buffer.amount + amount > buffer.capacity then
|
||||
give = buffer.capacity - buffer.amount
|
||||
else
|
||||
give = fluid
|
||||
give = amount
|
||||
end
|
||||
|
||||
fluid_c = fluid_c + give
|
||||
buffer.amount = buffer.amount + give
|
||||
buffer.fluid = ftype
|
||||
|
||||
meta:set_int("tree_fluid_storage", fluid_c)
|
||||
meta:set_string("tree_fluid", ftype)
|
||||
meta:set_string("infotext", ("%s: %d/%d %s"):format(fname, fluid_c, CAPACITY, fluid_lib.unit))
|
||||
meta:set_int("tree_fluid_storage", buffer.amount)
|
||||
meta:set_string("tree_fluid", buffer.fluid)
|
||||
meta:set_string("infotext", fluid_lib.buffer_to_string(buffer))
|
||||
end
|
||||
})
|
||||
|
@ -21,13 +21,13 @@ minetest.register_node("elepower_machines:accumulator", {
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"elepower_machines:accumulator"},
|
||||
label = "elefluidAccumulator",
|
||||
interval = 2,
|
||||
chance = 1/5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_c = meta:get_int("water_fluid_storage")
|
||||
if water_c == CAPACITY then return end
|
||||
label = "elefluidAccumulator",
|
||||
interval = 2,
|
||||
chance = 1/5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local buffer = fluid_lib.get_buffer_data(pos, "water")
|
||||
if not buffer or buffer.amount == buffer.capacity then return end
|
||||
|
||||
local positions = {
|
||||
{x=pos.x+1,y=pos.y,z=pos.z},
|
||||
@ -36,29 +36,29 @@ minetest.register_abm({
|
||||
{x=pos.x, y=pos.y,z=pos.z-1},
|
||||
}
|
||||
|
||||
local fluid = 0
|
||||
local amount = 0
|
||||
for _,fpos in pairs(positions) do
|
||||
local node = minetest.get_node(fpos)
|
||||
if node.name == "default:water_source" then
|
||||
fluid = fluid + 1000
|
||||
amount = amount + 1000
|
||||
end
|
||||
end
|
||||
|
||||
if fluid == 0 then
|
||||
if amount == 0 then
|
||||
meta:set_string("infotext", "Submerge me in water!")
|
||||
return
|
||||
end
|
||||
|
||||
local give = 0
|
||||
if water_c + fluid > CAPACITY then
|
||||
give = CAPACITY - water_c
|
||||
if buffer.amount + amount > buffer.capacity then
|
||||
give = buffer.capacity - buffer.amount
|
||||
else
|
||||
give = fluid
|
||||
give = amount
|
||||
end
|
||||
|
||||
water_c = water_c + give
|
||||
buffer.amount = buffer.amount + give
|
||||
|
||||
meta:set_int("water_fluid_storage", water_c)
|
||||
meta:set_string("infotext", ("Water: %d/%d %s"):format(water_c, CAPACITY, fluid_lib.unit))
|
||||
meta:set_int("water_fluid_storage", buffer.amount)
|
||||
meta:set_string("infotext", fluid_lib.buffer_to_string(buffer))
|
||||
end
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user