Remove overtime warning (will be introduced as part of https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4716), update type annotations, resolve warnings

This commit is contained in:
teknomunk 2025-01-01 12:15:50 -06:00 committed by the-real-herowl
parent 911e203fd7
commit ba631d3af7
4 changed files with 14 additions and 14 deletions

@ -3,6 +3,7 @@
"diagnostics": { "disable": ["lowercase-global"] },
"diagnostics.globals": [
"minetest",
"core",
"dump",
"dump2",
"Raycast",
@ -18,5 +19,6 @@
"AreaStore",
"vector"
],
"workspace.library": ["/usr/share/luanti/luanti-lls-definitions/library", "/usr/share/luanti/builtin"],
"workspace.ignoreDir": [".luacheckrc"]
}

@ -27,7 +27,7 @@ local function load_index(x,y,z)
local idx_str = storage:get_string(idx_key)
if idx_str and idx_str ~= "" then
local idx = minetest.deserialize(idx_str)
return idx
return idx or {}
end
return {}
@ -156,7 +156,7 @@ function mod.index_block(pos)
local idx = {}
-- Setup voxel manipulator
local vm,data,area = read_voxel_area()
local _,data,area = read_voxel_area()
-- Indexes to speed things up
local cid_attractors = {}

@ -5,9 +5,12 @@ local S = minetest.get_translator("mcl_lightning_rods")
mcl_lightning_rods = {}
local mod = mcl_lightning_rods
---@class core.NodeDef
---@field _on_lightning_strike? fun(pos : vector.Vector, node : core.Node)
dofile(modpath.."/api.lua")
---@type nodebox
---@type core.NodeBox
local cbox = {
type = "fixed",
fixed = {
@ -16,7 +19,7 @@ local cbox = {
},
}
---@type node_definition
---@type core.NodeDef
local rod_def = {
description = S("Lightning Rod"),
_doc_items_longdesc = S("A block that attracts lightning"),
@ -66,10 +69,10 @@ local rod_def = {
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
after_place_node = function(pos)
mod.register_lightning_attractor(pos)
end,
after_destruct = function(pos, oldnode)
after_destruct = function(pos)
mod.unregister_lightning_attractor(pos)
end,
_on_lightning_strike = function(pos, node)
@ -97,7 +100,7 @@ rod_def_a.mesecons = {
},
}
rod_def_a.on_timer = function(pos, elapsed)
rod_def_a.on_timer = function(pos)
local node = minetest.get_node(pos)
if node.name == "mcl_lightning_rods:rod_powered" then --has not been dug
@ -110,7 +113,7 @@ end
minetest.register_node("mcl_lightning_rods:rod_powered", rod_def_a)
lightning.register_on_strike(function(pos, pos2, objects)
lightning.register_on_strike(function(pos)
local lr = mod.find_closest_attractor(pos, 64)
if not lr then return end
@ -138,7 +141,7 @@ minetest.register_craft({
minetest.register_lbm({
name = "mcl_lightning_rods:index_rods",
nodenames = {"mcl_lightning_rods:rod","mcl_lightning_rods:rod_powered"},
action = function(pos, node)
action = function(pos)
mod.register_lightning_attractor(pos)
end
})

@ -214,11 +214,6 @@ local player_attached = mcl_player.player_attached
-- Check each player and apply animations
minetest.register_globalstep(function(dtime)
-- Track server lag greater than 110ms
if dtime > 0.11 then
minetest.log("warning", "Timestep greater than 110ms("..tostring(math.floor(dtime*1000)).." ms), server lag detected")
end
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local model_name = player_model[name]