mirror of
https://github.com/sirrobzeroone/elepower.git
synced 2024-08-20 21:04:06 +02:00
Some timers changes
This commit is contained in:
parent
674703f31e
commit
ce47073b69
@ -113,6 +113,8 @@ local function on_timer(pos, elapsed)
|
||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||
local active = "Idle"
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
||||
|
||||
if storage > usage and sludge.amount + SLUDGE_PRODUCED < sludge.capacity and is_enabled then
|
||||
if work == HARVESTER_TICK then
|
||||
local harvested = {}
|
||||
@ -136,6 +138,7 @@ local function on_timer(pos, elapsed)
|
||||
|
||||
active = "Active"
|
||||
refresh = true
|
||||
power.usage = usage
|
||||
ele.helpers.swap_node(pos, "elepower_farming:harvester_active")
|
||||
else
|
||||
if not is_enabled then
|
||||
@ -145,7 +148,6 @@ local function on_timer(pos, elapsed)
|
||||
ele.helpers.swap_node(pos, "elepower_farming:harvester")
|
||||
end
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = usage}
|
||||
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
||||
|
||||
meta:set_string("formspec", get_formspec(work_percent, power, sludge, state))
|
||||
|
@ -234,6 +234,7 @@ local function on_timer(pos, elapsed)
|
||||
|
||||
local state = meta:get_int("state")
|
||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
||||
local active = "Idle"
|
||||
|
||||
if storage > usage and is_enabled then
|
||||
@ -256,11 +257,11 @@ local function on_timer(pos, elapsed)
|
||||
|
||||
active = "Active"
|
||||
refresh = true
|
||||
power.usage = usage
|
||||
elseif not is_enabled then
|
||||
active = "Off"
|
||||
end
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = usage}
|
||||
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
||||
|
||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
||||
|
@ -126,6 +126,8 @@ local function on_timer(pos, elapsed)
|
||||
local mob_desc = "None"
|
||||
local active = "Active"
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
||||
|
||||
if storage > usage and not egg_slot:is_empty() and ele.helpers.get_item_group(egg_name, "spawn_egg") and is_enabled then
|
||||
local mob_name = egg_name:gsub("_set", "")
|
||||
|
||||
@ -147,6 +149,7 @@ local function on_timer(pos, elapsed)
|
||||
|
||||
refresh = true
|
||||
mob_desc = minetest.registered_items[mob_name].description
|
||||
power.usage = usage
|
||||
elseif not is_enabled then
|
||||
active = "Off"
|
||||
else
|
||||
@ -157,7 +160,6 @@ local function on_timer(pos, elapsed)
|
||||
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
||||
active, mob_desc, ele.capacity_text(capacity, storage)))
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = usage}
|
||||
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
||||
|
||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
||||
|
@ -65,6 +65,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
||||
|
||||
storage = storage + generation
|
||||
pow_buffer.storage = storage
|
||||
pow_buffer.usage = generation
|
||||
meta:set_int("storage", storage)
|
||||
|
||||
burn_time = burn_time - 1
|
||||
|
@ -72,6 +72,8 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
local state = meta:get_int("state")
|
||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||
|
||||
local power = {capacity = capacity, storage = storage, usage = 0}
|
||||
|
||||
if storage > usage and is_enabled then
|
||||
if coolant_buffer.amount >= 1000 and hot_buffer.amount >= 1000 then
|
||||
if time >= TIME then
|
||||
@ -98,6 +100,7 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
else
|
||||
time = time + 1
|
||||
storage = storage - usage
|
||||
power.usage = usage
|
||||
refresh = true
|
||||
end
|
||||
else
|
||||
@ -110,7 +113,6 @@ local function lava_cooler_timer(pos, elapsed)
|
||||
active = "Idle"
|
||||
end
|
||||
|
||||
local power = {capacity = capacity, storage = storage}
|
||||
local timer = math.floor(100 * time / TIME)
|
||||
|
||||
meta:set_int("src_time", time)
|
||||
|
@ -4,8 +4,8 @@ ele.formspec = {}
|
||||
ele.formspec.gui_switcher_icons = {
|
||||
[0] = "elepower_gui_check.png",
|
||||
"elepower_gui_cancel.png",
|
||||
"mesecons_wire_on.png",
|
||||
"mesecons_wire_off.png",
|
||||
"mesecons_wire_on.png^elepower_gui_mese_mask.png^\\[makealpha\\:255,0,0",
|
||||
"mesecons_wire_off.png^elepower_gui_mese_mask.png^\\[makealpha\\:255,0,0",
|
||||
}
|
||||
|
||||
function ele.formspec.state_switcher(x, y, state)
|
||||
|
@ -173,9 +173,7 @@ local tubelib_tube = {
|
||||
end,
|
||||
}
|
||||
|
||||
local mesecons_def = {}
|
||||
if mc then
|
||||
mesecons_def = {
|
||||
local mesecons_def = {
|
||||
effector = {
|
||||
action_on = function (pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -192,8 +190,7 @@ if mc then
|
||||
end
|
||||
end,
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Functions
|
||||
|
||||
|
BIN
elepower_papi/textures/elepower_gui_mese_mask.png
Normal file
BIN
elepower_papi/textures/elepower_gui_mese_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
Loading…
Reference in New Issue
Block a user