aboutsummaryrefslogtreecommitdiff
path: root/init.lua
blob: 466abf8838a53e23b9bfda2f1783a7d9f314d17c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)

mesecons_debug = {
    -- is mesecons_debug enabled?
    enabled = true,

    -- is mescons enabled?
    mesecons_enabled = true,

    -- blockpos-hash => context
    context_store = {},
    context_store_size = 0,

    -- persistent storage for whitelist
    storage = minetest.get_mod_storage(),

    -- total amount of time used by mesecons in the last period
    total_micros = 0,

    -- running average of how much mesecons is doing
    avg_total_micros_per_second = 0,

    -- average lag
    avg_lag = 1,
    lag_level = "none",
    load_level = "none",

    -- playername => true
    hud_enabled_by_playername = {},

    -- which optional dependencies are installed?
    has = {
        monitoring = minetest.get_modpath("monitoring"),
        digilines = minetest.get_modpath("digilines"),
    },

    log = function(level, message_fmt, ...)
        minetest.log(level, ("[%s] "):format(modname) .. message_fmt:format(...))
    end,
}

dofile(modpath .. "/settings.lua")
dofile(modpath .. "/util.lua")
dofile(modpath .. "/privs.lua")
dofile(modpath .. "/context.lua")
dofile(modpath .. "/penalty.lua")
dofile(modpath .. "/cleanup.lua")
dofile(modpath .. "/hud.lua")
dofile(modpath .. "/overrides/mesecons_queue.lua")
dofile(modpath .. "/overrides/node_timers.lua")
dofile(modpath .. "/commands/user_commands.lua")
dofile(modpath .. "/commands/admin_commands.lua")
dofile(modpath .. "/commands/create_lag.lua")
dofile(modpath .. "/commands/clear_penalty.lua")
dofile(modpath .. "/commands/flush.lua")

dofile(modpath .. "/nodes/mesecons_lagger.lua")
if mesecons_debug.has.digilines then
    dofile(modpath .. "/nodes/penalty_controller.lua")
end

dofile(modpath .. "/compat/convert_old_whitelist.lua")