From 614cc668d7f1618ea9788cfb03a3cb502cae4c96 Mon Sep 17 00:00:00 2001 From: WinterSolstice8 <60417494+wintersolstice8@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:29:25 -0600 Subject: [PATCH] [lua] Enforce unlocks on homepoint teleports --- scripts/globals/homepoint.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/globals/homepoint.lua b/scripts/globals/homepoint.lua index 5cc19f77c32..9c35ce6bf65 100644 --- a/scripts/globals/homepoint.lua +++ b/scripts/globals/homepoint.lua @@ -201,7 +201,6 @@ xi.homepoint.onEventUpdate = function(player, csid, option, npc) if xi.settings.main.HOMEPOINT_TELEPORT == 1 then if choice >= selection.SET_LAYOUT and choice <= selection.REP_FAVORITE then - local index = bit.rshift(bit.lshift(option, 8), 24) -- Ret HP # if choice == selection.ADD_FAVORITE then @@ -230,6 +229,14 @@ xi.homepoint.onEventUpdate = function(player, csid, option, npc) end player:setTeleportMenu(xi.teleport.type.HOMEPOINT, favs) + elseif choice == selection.TELEPORT then + local hpIndex = bit.rshift(option, 16) + local origin = player:getLocalVar('originIndex') + + if not player:hasTeleport(xi.teleport.type.HOMEPOINT, hpIndex, math.floor(origin / 32)) then + print(string.format("Player %s tried to teleport to an HP without it's destination being unlocked", player:getName())) + player:release() + end end for x = 1, 3 do -- Condense arrays for event params