MSUTeam/MSU

[REQUEST] introduce new 'interrupt' framework

Opened this issue · 1 comments

Darxo commented

Is your feature request related to a problem? Please describe.
There is a group of vanilla effects

  • Those are Shieldwall, Spearwall, Riposte
    that are removed prematurely if something (usually a skill)
  • For example push, pull, stun/horrified scream
    happened to the character.

It is currently incredibly hard to add effects to the first category without hooking dozens of vanilla effects.
And it is annoying to remember all the effects that need to be removed if designing a new skill that pushes/pulls, etc.

Describe the solution you'd like
Introduce a new virtual function onInterrupted in the skill.nut that is empty
Introduce a new function onInterrupted in the skill_container.nut that calls the onInterrupted on all skills
Introduce a new function interrupt in the actor.nut which will call the onInterrupted in its skill container

Hook the respective functions of every skill that currently causes an interruption and manually call an additional interrupt on the targeting actor.

Hook the shieldwall, spearwall and riposte effects, and overwrite the function onInterrupted in them with one that calls this.removeSelf() and optionally a nice combat log alongside

Additional context
Since we can't edit out the vanilla code lines where they manually remove the mentioned effects, that will now happen twice. But since removeSelf only sets IsGarbage to true that should not be a big issue.

This framework will allow many mods to seamlessly add new interruptable effects aswell as new skills that interrupt a targeted actor

I did a prototypical implementation just now and I realised that one third of the vanilla skills, which cause interruption, will require a very ugly hooking style. They do it as one of three random effects, The function does not return which effect was chosen.

A good way to tackle this seems to be hooking the setCurrentMovementType function

  • as that is always called when an actor is force moved (except in the shoot_stake skill but I believe this is a vanilla bug and unintentional).
  • And an actor is always interrupted when force moved