From 74f80351a5464af4b44554ebe7c7d77529aee5d2 Mon Sep 17 00:00:00 2001 From: Darxo Date: Sun, 6 Oct 2024 20:33:49 +0200 Subject: [PATCH] feat: add new onHired and onOtherPlayerHired events for skills --- msu/hooks/entity/tactical/player.nut | 15 +++++++++++++++ msu/hooks/skills/skill.nut | 11 +++++++++++ msu/hooks/skills/skill_container.nut | 15 +++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/msu/hooks/entity/tactical/player.nut b/msu/hooks/entity/tactical/player.nut index 4525f8b70..8490f3744 100644 --- a/msu/hooks/entity/tactical/player.nut +++ b/msu/hooks/entity/tactical/player.nut @@ -27,6 +27,21 @@ this.m.LevelUpsSpent++; } + q.onHired = @(__original) function() + { + __original(); + this.getSkills().onHired(); + + foreach (bro in ::World.getPlayerRoster().getAll()) + { + if (bro.getID() != this.getID()) + { + bro.getSkills().onOtherPlayerHired(this); + } + } + + } + q.onSerialize = @(__original) function( _out ) { this.getFlags().set("LevelUpsSpent", this.m.LevelUpsSpent); diff --git a/msu/hooks/skills/skill.nut b/msu/hooks/skills/skill.nut index 08293817d..a1822e200 100644 --- a/msu/hooks/skills/skill.nut +++ b/msu/hooks/skills/skill.nut @@ -437,6 +437,17 @@ return _tooltip; } + +// New Events + // This event is triggered once for every skill of a player character directly after the onHired event of that player class is triggered + q.onHired <- function() + { + } + + // This event is triggered once for every skill of every other character in the player roster after the onHired event of a player class is triggered + q.onOtherPlayerHired <- function( _otherCharacter ) + { + } }); ::MSU.QueueBucket.VeryLate.push(function() { diff --git a/msu/hooks/skills/skill_container.nut b/msu/hooks/skills/skill_container.nut index 138dba667..b72e6624f 100644 --- a/msu/hooks/skills/skill_container.nut +++ b/msu/hooks/skills/skill_container.nut @@ -538,4 +538,19 @@ return ret; } + +// New Events + // This event is triggered once for a player directly after the onHired event of that characters player class is triggered + q.onHired <- function() + { + this.callSkillsFunction("onHired", []); + } + + // This event is triggered once for every other character in the player roster after the onHired event of a player class is triggered + q.onOtherPlayerHired <- function( _otherCharacter ) + { + this.callSkillsFunction("onOtherPlayerHired", [ + _otherCharacter + ]); + } });