From 6e6864fd7c78b4c0f103b83cdb01d56fa18c38ec Mon Sep 17 00:00:00 2001 From: Vantha Date: Thu, 26 Feb 2026 17:04:10 +0100 Subject: [PATCH] Improve internal naming of tutorial triggers Make the naming consistent with e.g. the Triggers Demo map Remove the "On" at the start, since it's otherwise used for message handlers, and replace "Trigger" at the end with "Action", since that more accurately describes what it is. --- binaries/data/mods/public/maps/scripts/Tutorial.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/binaries/data/mods/public/maps/scripts/Tutorial.js b/binaries/data/mods/public/maps/scripts/Tutorial.js index fa75077110..406aa4668c 100644 --- a/binaries/data/mods/public/maps/scripts/Tutorial.js +++ b/binaries/data/mods/public/maps/scripts/Tutorial.js @@ -11,8 +11,8 @@ Trigger.prototype.InitTutorial = function(data) this.tutorialEvents = []; // Register needed triggers - this.RegisterTrigger("OnDeserialized", "OnDeserializedTrigger", { "enabled": true }); - this.RegisterTrigger("OnPlayerCommand", "OnPlayerCommandTrigger", { "enabled": false }); + this.RegisterTrigger("OnDeserialized", "DeserializedAction", { "enabled": true }); + this.RegisterTrigger("OnPlayerCommand", "PlayerCommandAction", { "enabled": false }); this.tutorialEvents.push("OnPlayerCommand"); for (const step of this.tutorialSteps) @@ -25,7 +25,7 @@ Trigger.prototype.InitTutorial = function(data) continue; if (key == "IsDone") continue; - const action = key + "Trigger"; + const action = key.substring(2) + "Action"; this.RegisterTrigger(key, action, { "enabled": false }); this.tutorialEvents.push(key); } @@ -46,7 +46,7 @@ Trigger.prototype.NextStep = function(deserializing = false) for (const event of this.tutorialEvents) { - const action = event + "Trigger"; + const action = event.substring(2) + "Action"; if (step[event]) { Trigger.prototype[action] = step[event]; @@ -64,8 +64,8 @@ Trigger.prototype.NextStep = function(deserializing = false) if (showContinueButton) { - this.EnableTrigger("OnPlayerCommand", "OnPlayerCommandTrigger"); - Trigger.prototype.OnPlayerCommandTrigger = function(msg) + this.EnableTrigger("OnPlayerCommand", "PlayerCommandAction"); + Trigger.prototype.PlayerCommandAction = function(msg) { if (msg.cmd.type == "dialog-answer" && msg.cmd.tutorial && msg.cmd.tutorial == "continue") this.NextStep(); @@ -102,7 +102,7 @@ Trigger.prototype.DisplayWarning = function(warning) }); }; -Trigger.prototype.OnDeserializedTrigger = function() +Trigger.prototype.DeserializedAction = function() { this.index = Math.max(0, this.index - 1);