Skip to content

XEH - Add more events#1588

Merged
jonpas merged 5 commits intoCBATeam:masterfrom
LinkIsGrim:xeh-events
Sep 3, 2023
Merged

XEH - Add more events#1588
jonpas merged 5 commits intoCBATeam:masterfrom
LinkIsGrim:xeh-events

Conversation

@LinkIsGrim
Copy link
Copy Markdown
Contributor

When merged this pull request will:

  • Add CargoLoaded, CargoUnloaded, HandleDamage, OpticsModeChanged, OpticsSwitch, RopeAttach, RopeBreak, SlotItemChanged (2.14), VisionModeChanged events support to XEH.
  • Change event lists to alphabetical/wiki order.

Comment thread addons/xeh/CfgEventHandlers.hpp Outdated
//class Extended_HandleDamage_EventHandlers {}; // Not implemented yet
//class Extended_HandleHeal_EventHandlers {}; // Not implemented yet
class Extended_HandleDamage_EventHandlers {};
class Extended_HandleHeal_EventHandlers {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last time I checked, they ignored the return value. It was better to add handleDamage via init class event.

Does it work now? If not, don't enable these. It will only cause anger and confusion.

Copy link
Copy Markdown
Contributor Author

@LinkIsGrim LinkIsGrim Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should HandleHeal be kept in script_component.hpp and script_xeh.hpp, or removed there as well? It was previously enabled there, just not enabled in config.

Copy link
Copy Markdown
Contributor

@commy2 commy2 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it.

If you want support for HandleDamage and HandleHeal in addClassEventHandler:

  • make sure the RV is still ignored in current version
  • if yes, make addClassEventHandler add a retroactive flag set init event handler that uses the addEventHandler command

Those would be removable by removeAllEventHandlers and removeEventHandler with hard-coded ehids, but anyone who uses the former is a terrorist and the latter goes against best practices (hard-coded or not), so is on their own.

This is a lesson in writing good comments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about adding HandleDamage now
it's going to take a ton of testing to make sure it doesn't cause problems with old mods that may have used this
and to make sure that the return value doesn't override existing code

@LinkIsGrim
Copy link
Copy Markdown
Contributor Author

I've commented out/removed all instances of HandleHeal/HandleDamage, though note that HandleHeal was previously available in some places.

@PabstMirror PabstMirror added this to the 3.16.0 milestone Sep 2, 2023
@jonpas jonpas merged commit 846b173 into CBATeam:master Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants