MSUTeam / MSU

Modding Standards and Utilities for Battle Brothers
22 stars 4 forks source link

[REQUEST] introduce new 'interrupt' framework #327

Open Darxo opened 1 year ago

Darxo commented 1 year ago

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

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

Darxo commented 8 months ago

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