No more warnings

This commit is contained in:
Cooldude2606
2024-09-28 03:46:14 +01:00
parent 32a8ba8f3a
commit 3145f7e904
43 changed files with 215 additions and 177 deletions

View File

@@ -155,7 +155,7 @@ end
--- Raise events for protected entities
Event.add(defines.events.on_pre_player_mined_item, function(event)
local entity = event.entity
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]
-- Check if the player should be ignored
if config.ignore_admins and player.admin then return end
if entity.last_user == nil or entity.last_user.index == player.index then return end

View File

@@ -146,13 +146,13 @@ end
--- Stop selection if the selection tool is removed from the cursor
Event.add(defines.events.on_player_cursor_stack_changed, function(event)
local player = game.get_player(event.player_index) --- @cast player -nil
local player = game.players[event.player_index] --- @cast player -nil
if player.cursor_stack.is_selection_tool then return end
Selection.stop(player)
end)
--- Stop selection after an event such as death or leaving the game
local function stop_after_event(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]
Selection.stop(player)
end

View File

@@ -46,10 +46,10 @@ function Tasks.add_task(force_name, player_name, task_title, task_body)
force_tasks._uid = force_tasks._uid + 1
-- Get the existing tasks for this force
local task_ids = force_tasks[force_name]
local task_ids = force_tasks[force_name] --[[@as table?]]
if not task_ids then
task_ids = {}
force_tasks[force_name] = task_ids
force_tasks[force_name] = task_ids --[[@as any]]
end
-- Insert the task id into the forces tasks