From 5a961cb73259c2771f0f2a77040f358fc5218106 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Tue, 14 Jan 2025 19:52:58 +0100 Subject: [PATCH] Mtn: fix teleport bug for physical character --- maps/mountain_fortress_v3/functions.lua | 8 ++++++-- modules/rpg/functions.lua | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index ec877637..452b8d18 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -2649,7 +2649,9 @@ function Public.on_player_changed_position(event) if adjusted_zones.reversed then if position.y < -74 then - player.teleport({ position.x, position.y + 1 }, surface) + if player.character ~= nil then + player.character.teleport({ position.x, position.y + 1 }, surface) + end player.print(({ 'main.forcefield' }), { r = 0.98, g = 0.66, b = 0.22 }) if player.character then player.character.health = player.character.health - 5 @@ -2661,7 +2663,9 @@ function Public.on_player_changed_position(event) end else if position.y >= 74 then - player.teleport({ position.x, position.y - 1 }, surface) + if player.character ~= nil then + player.character.teleport({ position.x, position.y - 1 }, surface) + end player.print(({ 'main.forcefield' }), { r = 0.98, g = 0.66, b = 0.22 }) if player.character then player.character.health = player.character.health - 5 diff --git a/modules/rpg/functions.lua b/modules/rpg/functions.lua index d949b919..010ccf72 100644 --- a/modules/rpg/functions.lua +++ b/modules/rpg/functions.lua @@ -1298,8 +1298,14 @@ show_cooldown_progressbar = end local rpg_t = Public.get_value_from_player(player.index) + if not rpg_t then + return + end local active_spell = Public.get_spell_by_name(rpg_t, rpg_t.dropdown_select_name) + if not active_spell then + return + end if event.name ~= active_spell.entityName then Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event) return