skyrim-multiplayer / skymp

Multiplayer Mod & TypeScript SDK for Skyrim Special Edition
Other
221 stars 74 forks source link

implement onHit for gamemode api #1338

Closed Pospelove closed 1 year ago

Pospelove commented 1 year ago

there is mp.onActivate. That's how we use this event in gamemode:

https://github.com/skyrim-multiplayer/skymp/blob/1907af820a749b83fc8fb52dfc83a2be07750834/skymp5-functions-lib/src/mpApiInteractor.ts#L65

the task is to add onHit in the same way.

onHit callback should accept hit caster and target ids, damage that would be made.

onHit callback should return modified damage.

So we will be able to change damage in gamemode dynamically.

Pospelove commented 1 year ago

Please make sure that this API will not call JS if no callback is registered

Hits often happen during gameplay. We don't want our server to overload.

Maybe we should introduce smth like vanilla conditions system to only call into javascript when certain conditions are met.

Pospelove commented 1 year ago

won't fix for now