From 21dac2b12ca9897cf5abdcf55e6e5cb9b3e3f554 Mon Sep 17 00:00:00 2001 From: Dylan Lange Date: Sun, 12 Sep 2021 17:29:56 +1200 Subject: [PATCH] Update `lever.plugin.kts` to handle teleporting to Ardougne and back. Also move this to `areas/shared/` since this no longer just applies to the Edgeville lever. --- .../objs/lever.plugin.kts | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) rename game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/{edgeville => shared}/objs/lever.plugin.kts (51%) diff --git a/game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/edgeville/objs/lever.plugin.kts b/game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/shared/objs/lever.plugin.kts similarity index 51% rename from game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/edgeville/objs/lever.plugin.kts rename to game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/shared/objs/lever.plugin.kts index 2d589fa45f..4db543f5f1 100644 --- a/game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/edgeville/objs/lever.plugin.kts +++ b/game/plugins/src/main/kotlin/gg/rsmod/plugins/content/areas/shared/objs/lever.plugin.kts @@ -1,6 +1,25 @@ -package gg.rsmod.plugins.content.areas.edgeville.objs +package gg.rsmod.plugins.content.areas.shared.objs on_obj_option(Objs.LEVER_26761, "pull") { + handleLeverInteraction { + moveTo(3154, 3924) + message("... and teleport into the Wilderness.") + } +} +on_obj_option(Objs.LEVER_1814, "pull") { + handleLeverInteraction { + moveTo(3154, 3924) + message("... and teleport into the Wilderness.") + } +} +on_obj_option(Objs.LEVER_9472, "pull") { + handleLeverInteraction { + moveTo(2561, 3311) + message("... and teleport to Ardougne.") + } +} + +fun Plugin.handleLeverInteraction(onAnimationComplete: Player.() -> Unit) { val obj = player.getInteractingGameObj() player.queue { @@ -26,8 +45,7 @@ on_obj_option(Objs.LEVER_26761, "pull") { wait(4) player.animate(-1) - player.moveTo(3154, 3924) - player.message("... and teleport into the Wilderness.") + onAnimationComplete(player) player.unlock() } -} \ No newline at end of file +}