Alpha #2
This commit is contained in:
parent
93ed7eeeaa
commit
cc909b2f51
@ -47,6 +47,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
},
|
},
|
||||||
tube = false,
|
tube = false,
|
||||||
on_timer = function (pos, elapsed)
|
on_timer = function (pos, elapsed)
|
||||||
|
local refresh = false
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local nodename = nodename
|
local nodename = nodename
|
||||||
|
|
||||||
@ -59,44 +60,49 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
|
|
||||||
-- Fluid buffer
|
-- Fluid buffer
|
||||||
local flbuffer = fluid_lib.get_buffer_data(pos, buffer_name)
|
local flbuffer = fluid_lib.get_buffer_data(pos, buffer_name)
|
||||||
|
local pow_percent
|
||||||
if not flbuffer or flbuffer.fluid == "" then return false end
|
if not flbuffer or flbuffer.fluid == "" then return false end
|
||||||
|
|
||||||
-- If more to burn and the energy produced was used: produce some more
|
while true do
|
||||||
if burn_time > 0 then
|
-- If more to burn and the energy produced was used: produce some more
|
||||||
if storage + generation > capacity then
|
if burn_time > 0 then
|
||||||
return false
|
if storage + generation > capacity then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
meta:set_int("storage", storage + generation)
|
||||||
|
|
||||||
|
burn_time = burn_time - 1
|
||||||
|
meta:set_int("burn_time", burn_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_int("storage", storage + generation)
|
pow_percent = math.floor((storage / capacity) * 100)
|
||||||
|
|
||||||
burn_time = burn_time - 1
|
-- Burn another bucket of lava
|
||||||
meta:set_int("burn_time", burn_time)
|
if burn_time == 0 then
|
||||||
end
|
local inv = meta:get_inventory()
|
||||||
|
if flbuffer.amount >= 1000 then
|
||||||
|
meta:set_int("burn_time", btime)
|
||||||
|
meta:set_int("burn_totaltime", btime)
|
||||||
|
|
||||||
local pow_percent = math.floor((storage / capacity) * 100)
|
-- Take lava
|
||||||
|
flbuffer.amount = flbuffer.amount - 1000
|
||||||
|
|
||||||
-- Burn another bucket of lava
|
local active_node = nodename.."_active"
|
||||||
if burn_time == 0 then
|
ele.helpers.swap_node(pos, active_node)
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if flbuffer.amount >= 1000 then
|
|
||||||
meta:set_int("burn_time", btime)
|
|
||||||
meta:set_int("burn_totaltime", btime)
|
|
||||||
|
|
||||||
-- Take lava
|
refresh = true
|
||||||
flbuffer.amount = flbuffer.amount - 1000
|
else
|
||||||
|
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)))
|
||||||
|
|
||||||
local active_node = nodename.."_active"
|
ele.helpers.swap_node(pos, nodename)
|
||||||
ele.helpers.swap_node(pos, active_node)
|
end
|
||||||
else
|
|
||||||
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)))
|
|
||||||
|
|
||||||
ele.helpers.swap_node(pos, nodename)
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||||
|
break
|
||||||
end
|
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", get_formspec(pow_percent, percent, flbuffer))
|
meta:set_string("formspec", get_formspec(pow_percent, percent, flbuffer))
|
||||||
@ -105,7 +111,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
|
|
||||||
meta:set_int(buffer_name .. "_fluid_storage", flbuffer.amount)
|
meta:set_int(buffer_name .. "_fluid_storage", flbuffer.amount)
|
||||||
|
|
||||||
return true
|
return refresh
|
||||||
end,
|
end,
|
||||||
on_construct = function (pos)
|
on_construct = function (pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -470,6 +470,7 @@ ele.register_base_device("elepower_nuclear:fission_core", {
|
|||||||
|
|
||||||
meta:set_string("formspec", get_core_formspec(0,0,false))
|
meta:set_string("formspec", get_core_formspec(0,0,false))
|
||||||
end,
|
end,
|
||||||
|
can_dig = can_dig,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_take = ele.default.allow_metadata_inventory_take,
|
allow_metadata_inventory_take = ele.default.allow_metadata_inventory_take,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
ele.tools = {}
|
ele.tools = {}
|
||||||
|
|
||||||
|
local creative = minetest.settings:get_bool("creative_mode")
|
||||||
|
|
||||||
-- Get a tool property
|
-- Get a tool property
|
||||||
function ele.tools.get_tool_property(itemstack, param)
|
function ele.tools.get_tool_property(itemstack, param)
|
||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
@ -23,7 +25,7 @@ function ele.tools.groupcaps(itemstack)
|
|||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
local itemdef = minetest.registered_items[itemstack:get_name()]
|
local itemdef = minetest.registered_items[itemstack:get_name()]
|
||||||
|
|
||||||
if wear == 65535 and meta:get_int("disable") ~= 1 then
|
if wear == 65535 and meta:get_int("disable") ~= 1 and not creative then
|
||||||
local prvcaps = itemstack:get_tool_capabilities()
|
local prvcaps = itemstack:get_tool_capabilities()
|
||||||
meta:set_string("toolcaps", minetest.serialize(prvcaps))
|
meta:set_string("toolcaps", minetest.serialize(prvcaps))
|
||||||
meta:set_tool_capabilities({})
|
meta:set_tool_capabilities({})
|
||||||
@ -121,7 +123,7 @@ function ele.register_tool(toolname, tooldef)
|
|||||||
local usage = ele.tools.get_tool_property(itemstack, "usage")
|
local usage = ele.tools.get_tool_property(itemstack, "usage")
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
if not pos or storage < usage then
|
if not pos or (storage < usage and not creative) then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 946 KiB After Width: | Height: | Size: 889 KiB |
Loading…
Reference in New Issue
Block a user