RanvierMUD / docs

3 stars 4 forks source link

Misleading/Wrong comment: bundle-example-areas ranvier-blade.js #10

Open ProjectStickman opened 5 years ago

ProjectStickman commented 5 years ago

The comment says

// Have to be careful in weapon scripts. If you have a weapon script that causes damage and
// it listens for the 'hit' event you will have to check to make sure that `damage.source
// !== this` otherwise you could create an infinite loop the weapon's own damage triggering
// its script

yet that's not the case in the code for this weapon that does exactly that. Is it still needed or not?

shawncplus commented 5 years ago

It's not needed in ranvier-blade.js because the script isn't dealing damage; it's healing so it won't create an infinite loop with the hit event. If the script was listening to the 'heal' event then the comment would apply mutatis mutandis

shawncplus commented 5 years ago

I think a better place for this comment would be a new weapon and weapon script that actually demonstrated this