urbanyoung / Phasor

Phasor is a server extension for Halo PC which focuses on giving the end-user the ability to deeply customize gameplay. Phasor does this via its scripting system, which uses the Lua language. Scripters are able to react to and change many different aspects of the game.
MIT License
19 stars 9 forks source link

OnWeaponAssignment should return true for default weapon and false for no weapon #16

Closed twhitcomb closed 11 years ago

twhitcomb commented 11 years ago

All other functions with return values return booleans for allowing/disallowing certain events from occurring. This is the only event function which returns 0 or -1. It should instead return true or false to keep event functions consistent.

urbanyoung commented 11 years ago

OnWeaponAssignment isn't a boolean event though, you cannot say yes or no to the question being asked. OnWeaponAssignment tells you which weapon the player is going to get and it gives you the option to change it. If you don't want to change it, you shouldn't return a value. If you want to change it you should return the weapon id you want them to have, or -1 to specify no weapon. -1 is the id of an invalid object, so it makes sense to return it in this case. The latest build I released broken the -1 return value, but it will be fixed in next one.

twhitcomb commented 11 years ago

Makes sense; it doesn't matter either way, as long as it works :P

RadWolfie commented 10 years ago

I would like to add a comment to this ticket.

OnWeaponAssignment gives every script access either to be edit or not without previous script's edited knowing. That's one of the downside. It would be nice to have one time edit for one script to use whilst other scripts can't (is available on different software for Halo).