1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +00:00
kawari/resources/scripts/common/GenericAetheryte.lua
The Dax feb0ffb869 Implement the aethernet for aetherytes and ensure both aetherytes and aethernet shards
do better about not yeeting you into invalid zones, crashing the client, or softlocking
2025-06-24 19:17:18 -04:00

52 lines
2.3 KiB
Lua

-- generic aetheryte, use this for all of the big aetherytes
--- scene 00000 - display main menu ("Welcome to <location>.")
--- scene 00001 - softlocks, unknown purpose
--- scene 00002 - aethernet menu (used only by aethernet shards? scene 00 for big aetherytes display the aethernet submenu without needing an additional play_scene)
--- scene 00003 - "you have aethernet access" message and vfx
--- scene 00100 - "According to the message engraved in the base, special permission is required to use this aetheryte." (Eulmore-specific)
--- scene 00200 - "The aetheryte has ceased functioning." (Eulmore-specific)
SCENE_SHOW_MENU = 00000
SCENE_HAVE_AETHERNET_ACCESS = 00003
function onTalk(target, player)
--- param has to be 1 for the menu to even show up
player:play_scene(target, EVENT_ID, SCENE_SHOW_MENU, 8192, 1)
end
function onReturn(scene, results, player)
local AETHERNET_SUBMENU = 4
local AETHERNET_SUBMENU_CANCEL = 0
local SET_HOME_POINT = 1
local HOME_PNT_YES = 1
local HOME_PNT_NO = 0
-- local REGISTER_FAVORITE_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless
-- local REGISTER_SECURITY_TOKEN_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless
local resultc = table.getn(results) -- TODO: Do we need to check this still? Can the favorite/security menus return more than 2, once they work?
local menu_option = results[1]
local decision = results[2]
if scene == SCENE_SHOW_MENU then -- main aetheryte prompt scene
if menu_option == SET_HOME_POINT then
-- TODO: logic for setting home point
--[[ if decision == HOME_PNT_YES then
else
end ]]
elseif menu_option == AETHERNET_SUBMENU then
if decision ~= AETHERNET_SUBMENU_CANCEL then
player:finish_event(EVENT_ID) -- Need to finish the event here, because warping does not return to this callback (the game will crash or softlock otherwise)
player:warp_aetheryte(decision)
return
end
--[[elseif menu_option == REGISTER_FAVORITE_DSTN then
-- TODO: Favorite Destination logic
else -- REGISTER_SECURITY_TOKEN_DSTN
-- TODO: Security Token Free Destination logic ]]
end
end
player:finish_event(EVENT_ID)
end