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 is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
local active = "Idle"
|
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 storage > usage and sludge.amount + SLUDGE_PRODUCED < sludge.capacity and is_enabled then
|
||||||
if work == HARVESTER_TICK then
|
if work == HARVESTER_TICK then
|
||||||
local harvested = {}
|
local harvested = {}
|
||||||
@ -136,6 +138,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
active = "Active"
|
active = "Active"
|
||||||
refresh = true
|
refresh = true
|
||||||
|
power.usage = usage
|
||||||
ele.helpers.swap_node(pos, "elepower_farming:harvester_active")
|
ele.helpers.swap_node(pos, "elepower_farming:harvester_active")
|
||||||
else
|
else
|
||||||
if not is_enabled then
|
if not is_enabled then
|
||||||
@ -145,7 +148,6 @@ local function on_timer(pos, elapsed)
|
|||||||
ele.helpers.swap_node(pos, "elepower_farming:harvester")
|
ele.helpers.swap_node(pos, "elepower_farming:harvester")
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage, usage = usage}
|
|
||||||
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, sludge, state))
|
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 state = meta:get_int("state")
|
||||||
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
|
local power = {capacity = capacity, storage = storage, usage = 0}
|
||||||
local active = "Idle"
|
local active = "Idle"
|
||||||
|
|
||||||
if storage > usage and is_enabled then
|
if storage > usage and is_enabled then
|
||||||
@ -256,11 +257,11 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
active = "Active"
|
active = "Active"
|
||||||
refresh = true
|
refresh = true
|
||||||
|
power.usage = usage
|
||||||
elseif not is_enabled then
|
elseif not is_enabled then
|
||||||
active = "Off"
|
active = "Off"
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage, usage = usage}
|
|
||||||
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
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 mob_desc = "None"
|
||||||
local active = "Active"
|
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
|
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", "")
|
local mob_name = egg_name:gsub("_set", "")
|
||||||
|
|
||||||
@ -147,6 +149,7 @@ local function on_timer(pos, elapsed)
|
|||||||
|
|
||||||
refresh = true
|
refresh = true
|
||||||
mob_desc = minetest.registered_items[mob_name].description
|
mob_desc = minetest.registered_items[mob_name].description
|
||||||
|
power.usage = usage
|
||||||
elseif not is_enabled then
|
elseif not is_enabled then
|
||||||
active = "Off"
|
active = "Off"
|
||||||
else
|
else
|
||||||
@ -157,7 +160,6 @@ local function on_timer(pos, elapsed)
|
|||||||
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
||||||
active, mob_desc, ele.capacity_text(capacity, storage)))
|
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)
|
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
meta:set_string("formspec", get_formspec(work_percent, power, state))
|
||||||
|
@ -65,6 +65,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
|||||||
|
|
||||||
storage = storage + generation
|
storage = storage + generation
|
||||||
pow_buffer.storage = storage
|
pow_buffer.storage = storage
|
||||||
|
pow_buffer.usage = generation
|
||||||
meta:set_int("storage", storage)
|
meta:set_int("storage", storage)
|
||||||
|
|
||||||
burn_time = burn_time - 1
|
burn_time = burn_time - 1
|
||||||
|
@ -72,6 +72,8 @@ local function lava_cooler_timer(pos, elapsed)
|
|||||||
local state = meta:get_int("state")
|
local state = meta:get_int("state")
|
||||||
local is_enabled = ele.helpers.state_enabled(meta, pos, 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 storage > usage and is_enabled then
|
||||||
if coolant_buffer.amount >= 1000 and hot_buffer.amount >= 1000 then
|
if coolant_buffer.amount >= 1000 and hot_buffer.amount >= 1000 then
|
||||||
if time >= TIME then
|
if time >= TIME then
|
||||||
@ -98,6 +100,7 @@ local function lava_cooler_timer(pos, elapsed)
|
|||||||
else
|
else
|
||||||
time = time + 1
|
time = time + 1
|
||||||
storage = storage - usage
|
storage = storage - usage
|
||||||
|
power.usage = usage
|
||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -110,7 +113,6 @@ local function lava_cooler_timer(pos, elapsed)
|
|||||||
active = "Idle"
|
active = "Idle"
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage}
|
|
||||||
local timer = math.floor(100 * time / TIME)
|
local timer = math.floor(100 * time / TIME)
|
||||||
|
|
||||||
meta:set_int("src_time", time)
|
meta:set_int("src_time", time)
|
||||||
|
@ -4,8 +4,8 @@ ele.formspec = {}
|
|||||||
ele.formspec.gui_switcher_icons = {
|
ele.formspec.gui_switcher_icons = {
|
||||||
[0] = "elepower_gui_check.png",
|
[0] = "elepower_gui_check.png",
|
||||||
"elepower_gui_cancel.png",
|
"elepower_gui_cancel.png",
|
||||||
"mesecons_wire_on.png",
|
"mesecons_wire_on.png^elepower_gui_mese_mask.png^\\[makealpha\\:255,0,0",
|
||||||
"mesecons_wire_off.png",
|
"mesecons_wire_off.png^elepower_gui_mese_mask.png^\\[makealpha\\:255,0,0",
|
||||||
}
|
}
|
||||||
|
|
||||||
function ele.formspec.state_switcher(x, y, state)
|
function ele.formspec.state_switcher(x, y, state)
|
||||||
|
@ -173,9 +173,7 @@ local tubelib_tube = {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local mesecons_def = {}
|
local mesecons_def = {
|
||||||
if mc then
|
|
||||||
mesecons_def = {
|
|
||||||
effector = {
|
effector = {
|
||||||
action_on = function (pos, node)
|
action_on = function (pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -192,8 +190,7 @@ if mc then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
-- Functions
|
-- 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