Skip to content
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

Merged
merged 5 commits into from
Nov 9, 2019
Merged

Add Toggle Lamps module #241

merged 5 commits into from
Nov 9, 2019

Conversation

mharis001
Copy link
Member

When merged this pull request will:

  • title

@mharis001 mharis001 added the feature Adds a new feature label Nov 5, 2019
@mharis001 mharis001 added this to the 1.6.0 milestone Nov 5, 2019
addons/common/XEH_PREP.hpp Outdated Show resolved Hide resolved
* None
*
* Example:
* [_lamp, false] call zen_common_fnc_setLampState
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

@mharis001 mharis001 merged commit a9073e4 into master Nov 9, 2019
@mharis001 mharis001 deleted the toggle-lamps-module branch November 9, 2019 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants