Skip to content

Commit

Permalink
feat: add new onHired and onOtherPlayerHired events for skills
Browse files Browse the repository at this point in the history
  • Loading branch information
Darxo committed Oct 6, 2024
1 parent d485011 commit 74f8035
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
15 changes: 15 additions & 0 deletions msu/hooks/entity/tactical/player.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions msu/hooks/skills/skill.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
15 changes: 15 additions & 0 deletions msu/hooks/skills/skill_container.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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
]);
}
});

0 comments on commit 74f8035

Please sign in to comment.