Alpha #2
This commit is contained in:
parent
93ed7eeeaa
commit
cc909b2f51
@ -47,6 +47,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
||||
},
|
||||
tube = false,
|
||||
on_timer = function (pos, elapsed)
|
||||
local refresh = false
|
||||
local meta = minetest.get_meta(pos)
|
||||
local nodename = nodename
|
||||
|
||||
@ -59,44 +60,49 @@ function ele.register_fluid_generator(nodename, nodedef)
|
||||
|
||||
-- Fluid buffer
|
||||
local flbuffer = fluid_lib.get_buffer_data(pos, buffer_name)
|
||||
local pow_percent
|
||||
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
|
||||
while true do
|
||||
-- If more to burn and the energy produced was used: produce some more
|
||||
if burn_time > 0 then
|
||||
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
|
||||
|
||||
meta:set_int("storage", storage + generation)
|
||||
pow_percent = math.floor((storage / capacity) * 100)
|
||||
|
||||
burn_time = burn_time - 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
end
|
||||
-- Burn another bucket of lava
|
||||
if burn_time == 0 then
|
||||
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
|
||||
if burn_time == 0 then
|
||||
local inv = meta:get_inventory()
|
||||
if flbuffer.amount >= 1000 then
|
||||
meta:set_int("burn_time", btime)
|
||||
meta:set_int("burn_totaltime", btime)
|
||||
local active_node = nodename.."_active"
|
||||
ele.helpers.swap_node(pos, active_node)
|
||||
|
||||
-- Take lava
|
||||
flbuffer.amount = flbuffer.amount - 1000
|
||||
refresh = true
|
||||
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, active_node)
|
||||
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
|
||||
ele.helpers.swap_node(pos, nodename)
|
||||
end
|
||||
end
|
||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||
break
|
||||
end
|
||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||
|
||||
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
||||
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)
|
||||
|
||||
return true
|
||||
return refresh
|
||||
end,
|
||||
on_construct = function (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))
|
||||
end,
|
||||
can_dig = can_dig,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = ele.default.allow_metadata_inventory_take,
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
ele.tools = {}
|
||||
|
||||
local creative = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
-- Get a tool property
|
||||
function ele.tools.get_tool_property(itemstack, param)
|
||||
local meta = itemstack:get_meta()
|
||||
@ -23,7 +25,7 @@ function ele.tools.groupcaps(itemstack)
|
||||
local meta = itemstack:get_meta()
|
||||
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()
|
||||
meta:set_string("toolcaps", minetest.serialize(prvcaps))
|
||||
meta:set_tool_capabilities({})
|
||||
@ -121,7 +123,7 @@ function ele.register_tool(toolname, tooldef)
|
||||
local usage = ele.tools.get_tool_property(itemstack, "usage")
|
||||
local pos = pointed_thing.under
|
||||
|
||||
if not pos or storage < usage then
|
||||
if not pos or (storage < usage and not creative) then
|
||||
return nil
|
||||
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