mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-09 01:57:29 +01:00
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:
parent
911e203fd7
commit
ba631d3af7
@ -3,6 +3,7 @@
|
|||||||
"diagnostics": { "disable": ["lowercase-global"] },
|
"diagnostics": { "disable": ["lowercase-global"] },
|
||||||
"diagnostics.globals": [
|
"diagnostics.globals": [
|
||||||
"minetest",
|
"minetest",
|
||||||
|
"core",
|
||||||
"dump",
|
"dump",
|
||||||
"dump2",
|
"dump2",
|
||||||
"Raycast",
|
"Raycast",
|
||||||
@ -18,5 +19,6 @@
|
|||||||
"AreaStore",
|
"AreaStore",
|
||||||
"vector"
|
"vector"
|
||||||
],
|
],
|
||||||
|
"workspace.library": ["/usr/share/luanti/luanti-lls-definitions/library", "/usr/share/luanti/builtin"],
|
||||||
"workspace.ignoreDir": [".luacheckrc"]
|
"workspace.ignoreDir": [".luacheckrc"]
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ local function load_index(x,y,z)
|
|||||||
local idx_str = storage:get_string(idx_key)
|
local idx_str = storage:get_string(idx_key)
|
||||||
if idx_str and idx_str ~= "" then
|
if idx_str and idx_str ~= "" then
|
||||||
local idx = minetest.deserialize(idx_str)
|
local idx = minetest.deserialize(idx_str)
|
||||||
return idx
|
return idx or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
@ -156,7 +156,7 @@ function mod.index_block(pos)
|
|||||||
local idx = {}
|
local idx = {}
|
||||||
|
|
||||||
-- Setup voxel manipulator
|
-- Setup voxel manipulator
|
||||||
local vm,data,area = read_voxel_area()
|
local _,data,area = read_voxel_area()
|
||||||
|
|
||||||
-- Indexes to speed things up
|
-- Indexes to speed things up
|
||||||
local cid_attractors = {}
|
local cid_attractors = {}
|
||||||
|
@ -5,9 +5,12 @@ local S = minetest.get_translator("mcl_lightning_rods")
|
|||||||
mcl_lightning_rods = {}
|
mcl_lightning_rods = {}
|
||||||
local mod = 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")
|
dofile(modpath.."/api.lua")
|
||||||
|
|
||||||
---@type nodebox
|
---@type core.NodeBox
|
||||||
local cbox = {
|
local cbox = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -16,7 +19,7 @@ local cbox = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---@type node_definition
|
---@type core.NodeDef
|
||||||
local rod_def = {
|
local rod_def = {
|
||||||
description = S("Lightning Rod"),
|
description = S("Lightning Rod"),
|
||||||
_doc_items_longdesc = S("A block that attracts lightning"),
|
_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)
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos)
|
||||||
mod.register_lightning_attractor(pos)
|
mod.register_lightning_attractor(pos)
|
||||||
end,
|
end,
|
||||||
after_destruct = function(pos, oldnode)
|
after_destruct = function(pos)
|
||||||
mod.unregister_lightning_attractor(pos)
|
mod.unregister_lightning_attractor(pos)
|
||||||
end,
|
end,
|
||||||
_on_lightning_strike = function(pos, node)
|
_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)
|
local node = minetest.get_node(pos)
|
||||||
|
|
||||||
if node.name == "mcl_lightning_rods:rod_powered" then --has not been dug
|
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)
|
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)
|
local lr = mod.find_closest_attractor(pos, 64)
|
||||||
if not lr then return end
|
if not lr then return end
|
||||||
|
|
||||||
@ -138,7 +141,7 @@ minetest.register_craft({
|
|||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = "mcl_lightning_rods:index_rods",
|
name = "mcl_lightning_rods:index_rods",
|
||||||
nodenames = {"mcl_lightning_rods:rod","mcl_lightning_rods:rod_powered"},
|
nodenames = {"mcl_lightning_rods:rod","mcl_lightning_rods:rod_powered"},
|
||||||
action = function(pos, node)
|
action = function(pos)
|
||||||
mod.register_lightning_attractor(pos)
|
mod.register_lightning_attractor(pos)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -214,11 +214,6 @@ local player_attached = mcl_player.player_attached
|
|||||||
|
|
||||||
-- Check each player and apply animations
|
-- Check each player and apply animations
|
||||||
minetest.register_globalstep(function(dtime)
|
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
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local model_name = player_model[name]
|
local model_name = player_model[name]
|
||||||
|
Loading…
Reference in New Issue
Block a user