-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Toggle Lamps module #241
Conversation
* None | ||
* | ||
* Example: | ||
* [_lamp, false] call zen_common_fnc_setLampState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is already a BI function for this. Any reason for adding our own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do a comparison of them. General rule of thumb for ACEifying anything is to not rely on BI functions, they may be written in a worse way, without the given framework for debugging, or have additional checks that slow it down and are not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BI's
params [
["_lamp",objnull,[objnull]],
["_state",true,[true]]
];
_lamp switchlight (["off","on"] select _state);
It uses switchLight
instead of setHit
but it seems that in the latest A3 updates switchLight
has been extended to allow it to be used on street lamps too. Don't see the point of using ZEN's implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Own function is better here, it will handle destroyed lights.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not trying to advocate for BI's code, but handling destroyed lights might not be what the user intends. A player might shoot out lights and then using this module would repair them all back to normal. A choice would be good.
When merged this pull request will: