Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ suspend fun Player.kidnap(destination: Tile) {
*/
fun Player.onExitInterrupt(block: suspend Player.() -> Unit) {
val event: String = get("random_event") ?: return
walkTrigger = {
walkTrigger {
queue("random_event_exit") {
if (get<String>("random_event") == event) {
block()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class RandomEventTrigger : Script {

adminCommand("random_event", stringArg("event", optional = true, autofill = RandomEvents.keys), desc = "Start a random event") { args ->
val event = args.getOrNull(0) ?: RandomEvents.pick()
clear("random_event_origin")
if (event == null || !RandomEvents.start(this, event)) {
message("No random event found${if (args.isEmpty()) "" else " for '${args[0]}'"}.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ object RandomEvents : AutoCloseable {
}

private fun exit(player: Player): Tile {
player.walkTrigger = null
val origin = Tile(player["random_event_origin", player.tile.id])
player.clearInstance()
player.clear("random_event")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ class KissTheFrog : Script {
// The cave is enclosed, so the player must not be able to strand themselves by walking off. If
// they click off the dialogue (which cancels this handler), the walk fires this trigger and they
// fade out and teleport home anyway; reading the dialogue through does the same at the end.
walkTrigger = { queue("ktf_escape_cave") { escapeCave() } }
walkTrigger {
queue("ktf_escape_cave") {
escapeCave()
}
}
npc<Sad>("Oh, another poor soul hexed into a frog for their bad manners.")
npc<Neutral>("Here, I'll send you on your way. Do be more polite next time.")
escapeCave()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,23 @@ class Mime : Script {
set("mime_correct", 0)
}
mysteriousOldMan()
trigger()
kidnap(SPAWN)
// The old man stays behind at the kidnap origin, so he narrates by id rather than talkWith.
npc<Neutral>("mysterious_old_man", "Here's a little challenge for you:<br>Copy the Mime's performance, then you'll be released.")
start()
}

private fun Player.trigger() {
walkTrigger {
strongQueue("start") {
start()
}
}
kidnap(SPAWN)
// The old man stays behind at the kidnap origin, so he narrates by id rather than talkWith.
npc<Neutral>("mysterious_old_man", "Here's a little challenge for you:<br>Copy the Mime's performance, then you'll be released.")
start()
}

private suspend fun Player.start() {
trigger()
walkOverDelay(WATCH)
val mime = NPCs.firstOrNull(MIME_TILE) { it.id == "mime" } ?: NPCs.add("mime", MIME_TILE, ticks = -1, owner = this)
runMime(mime)
Expand Down Expand Up @@ -136,6 +141,7 @@ class Mime : Script {
for (unlock in MIME_EMOTES) {
set("unlocked_emote_$unlock", true)
}
walkTrigger = null
addOrDrop("random_event_gift")
rewardCostumePoint("mime")
clear("mime_emote")
Expand Down
2 changes: 1 addition & 1 deletion game/src/main/kotlin/content/quest/Cutscene.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Cutscene(
}

fun onEnd(destroyInstance: Boolean = true, block: suspend () -> Unit) {
player.walkTrigger = {
player.walkTrigger {
player.queue.clear("${name}_cutscene_end")
player.queue("${name}_cutscene_end") {
end(destroyInstance)
Expand Down
Loading