mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
Merge e37b6b6e9d
into cffbc33e6d
This commit is contained in:
commit
f88faed3d8
|
@ -77,9 +77,16 @@ minetest.register_on_placenode(mesecon.on_placenode)
|
||||||
minetest.register_on_dignode(mesecon.on_dignode)
|
minetest.register_on_dignode(mesecon.on_dignode)
|
||||||
|
|
||||||
-- Overheating service for fast circuits
|
-- Overheating service for fast circuits
|
||||||
local OVERHEAT_MAX = mesecon.setting("overheat_max", 20)
|
local OVERHEAT_MAX = math.max(1.0, mesecon.setting("overheat_max", 20.0))
|
||||||
local COOLDOWN_TIME = mesecon.setting("cooldown_time", 2.0)
|
local COOLDOWN_MODE = mesecon.setting("cooldown_mode", "steps")
|
||||||
local COOLDOWN_STEP = mesecon.setting("cooldown_granularity", 0.5)
|
local COOLDOWN_IN_STEPS = COOLDOWN_MODE == "steps"
|
||||||
|
-- default for steps assumes a dtime of 0.016 seconds
|
||||||
|
local COOLDOWN_TIME = math.max(0.0, COOLDOWN_IN_STEPS and
|
||||||
|
mesecon.setting("cooldown_time_steps", 125.0) or
|
||||||
|
mesecon.setting("cooldown_time", 2.0))
|
||||||
|
local COOLDOWN_STEP = math.max(0.0, COOLDOWN_IN_STEPS and
|
||||||
|
mesecon.setting("cooldown_granularity_steps", 20) or
|
||||||
|
mesecon.setting("cooldown_granularity", 0.5))
|
||||||
local COOLDOWN_MULTIPLIER = OVERHEAT_MAX / COOLDOWN_TIME
|
local COOLDOWN_MULTIPLIER = OVERHEAT_MAX / COOLDOWN_TIME
|
||||||
local cooldown_timer = 0.0
|
local cooldown_timer = 0.0
|
||||||
local object_heat = {}
|
local object_heat = {}
|
||||||
|
@ -121,7 +128,7 @@ function mesecon.move_hot_nodes(moved_nodes)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function global_cooldown(dtime)
|
local function global_cooldown(dtime)
|
||||||
cooldown_timer = cooldown_timer + dtime
|
cooldown_timer = cooldown_timer + (COOLDOWN_IN_STEPS and 1 or dtime)
|
||||||
if cooldown_timer < COOLDOWN_STEP then
|
if cooldown_timer < COOLDOWN_STEP then
|
||||||
return -- don't overload the CPU
|
return -- don't overload the CPU
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,37 @@
|
||||||
[mesecons]
|
[mesecons]
|
||||||
|
|
||||||
|
# Number of seconds to wait after server start before starting to execute actions
|
||||||
|
# from the actionqueue.
|
||||||
mesecon.resumetime (Startup delay) int 4 1 10
|
mesecon.resumetime (Startup delay) int 4 1 10
|
||||||
mesecon.overheat_max (Device heat limit) int 20 1 100
|
|
||||||
mesecon.cooldown_time (Device cooldown time) float 2.0 0.1 10.0
|
# Heat at which a device overheats.
|
||||||
mesecon.cooldown_granularity (Cooldown step length) float 0.5 0.0 1.0
|
# As a rule of thumb, a device gets 1 additional heat each time when it toggles.
|
||||||
|
mesecon.overheat_max (Device heat limit) float 20.0 1.0
|
||||||
|
|
||||||
|
# The method used to cooldown devices over time:
|
||||||
|
# - seconds: The cooldown will happen per seconds.
|
||||||
|
# Use mesecon.cooldown_time and mesecon.cooldown_granularity for further configuration.
|
||||||
|
# - steps: The cooldown will happen per server steps.
|
||||||
|
# Use mesecon.cooldown_time_steps and mesecon.cooldown_granularity_steps for further configuration.
|
||||||
|
mesecon.cooldown_mode (Device cooldown mode) enum steps seconds,steps
|
||||||
|
|
||||||
|
# The time in seconds it takes for a device to fully cool down from max heat.
|
||||||
|
# Only used if mesecon.cooldown_mode is seconds.
|
||||||
|
mesecon.cooldown_time (Device cooldown time in seconds) float 2.0 0.0
|
||||||
|
|
||||||
|
# Length in seconds of the interval in which devices are cooled down over time.
|
||||||
|
# This does not affect the cooldown speed.
|
||||||
|
# Only used if mesecon.cooldown_mode is seconds.
|
||||||
|
mesecon.cooldown_granularity (Cooldown step length in seconds) float 0.5 0.0
|
||||||
|
|
||||||
|
# The time in server steps it takes for a device to fully cool down from max heat.
|
||||||
|
# Only used if mesecon.cooldown_mode is steps.
|
||||||
|
mesecon.cooldown_time_steps (Device cooldown time in server steps) float 125.0 0.0
|
||||||
|
|
||||||
|
# Length in server steps of the interval in which devices are cooled down over time.
|
||||||
|
# This does not affect the cooldown speed.
|
||||||
|
# Only used if mesecon.cooldown_mode is steps.
|
||||||
|
mesecon.cooldown_granularity_steps (Cooldown step length in server steps) int 20 0
|
||||||
|
|
||||||
|
|
||||||
[mesecons_blinkyplant]
|
[mesecons_blinkyplant]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user