Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new onHired and onOtherPlayerHired events for skills #434

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
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
]);
}
});