Modding:Lua/onInteraction
From Starbounder - Starbound Wiki
Contents
onInteraction code examples
All examples taken from vanilla at July, 10, 2017
/objects/crafting/upgradeablecraftingobjects/upgradeablecraftingobject.lua
return { "OpenCraftingInterface", currentStageData().interactData}
/interface/scripted/sbvn/sbvnobject.lua
self.interactData = config.getParameter("interactData") . . return {"ScriptPane", self.interactData}
/npcs/vaultkeytrader.lua
return { "ScriptPane", "/interface/scripted/keytrader/keytradergui.config" }
/objects/ancient/ancientconsole/a/objects/ancient/challengedoor/challengedoor.lua
if config.getParameter("returnDoor") then return { "OpenTeleportDialog", { canBookmark = false, includePlayerBookmarks = false, destinations = { { name = "Exit Portal", planetName = "Return to World... Hopefully!", icon = "return", warpAction = "Return" } } } } else return { "OpenTeleportDialog", { canBookmark = false, includePlayerBookmarks = false, destinations = { { name = "Challenge Portal", planetName = "Unstable Pocket Dimension", icon = "default", warpAction = string.format( "InstanceWorld:challengerooms:%s:%s", storage.uuid, world.threatLevel()) } } } } end
/objects/playerstation/expansionslot/expansionslot.lua
-- don't allow interaction from the expand direction if vec2.dot(args.source, self.expandDirection) < 0 then return {config.getParameter("interactAction"), config.getParameter("interactData")} else animator.playSound("interactError") end