1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +00:00
kawari/resources/scripts/events/common/GenericAetheryte.lua
thedax 6d99bef66c
Refactor and reorganize numerous Lua systems: (#63)
-Global.lua is no longer a catch-all dumping ground for registering actions and events
Instead, Global.lua will actually contain useful global constants and functions

-Init.lua will take over the role of being the initial script run when doing reloads or booting the servers
-Actions.lua will take over registering all actions
-Items.lua will take over registering all items
-Commands.lua will take over registering all text commands

-Events.lua will take over registering all warps, openings/quests, aetherytes, etc.
To this end, event ids now live in organized tables to reduce error-prone copy paste clutter

If we get enough actions, items or commands, we can move those to tables too.
2025-06-25 13:25:48 -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