-
Notifications
You must be signed in to change notification settings - Fork 735
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 spectator handling of grenades #6012
Conversation
Bring local up to date
Bring up to date
Yes, XEH should be used, that's the whole reason of us throwing it. |
@jonpas do you have a good starting point for that? It looks like my options in CBA are:
Am I missing something, or is there no way to handle adding / removing object based extended events? |
xeh doesn't really have a clean way to remove EH, |
So stupid that the fired EH doesn't always pass in the projectile to begin with. My initial concern was how well this scales, but since it's only running when the projectile is null I think it's fine. Could do worse than As for the advanced throwing part, I'm not sure that will work because that function is using the {
if (!isNil QGVAR(entitiesToDraw) && {_unit in GVAR(entitiesToDraw)}) then {
if (count GVAR(grenadesToDraw) > MAX_GRENADES) then { GVAR(grenadesToDraw) deleteAt 0; };
GVAR(grenadesToDraw) pushBack _projectile;
};
} Doesn't really add much overhead since advanced throwing isn't happening often, plus it won't do anything unless spectator is active. |
Of course, you could still and and remove the EH if you'd prefer 👍 |
The advanced throwing event handler should get removed before the conditions trigger the fired event removal, with that said having dedicated grenade handling code for advanced throwing might not be the worst thing ever, my only concern is an update to grenade handling code has to be tracked in two areas. (For example if you wanted to separate grenade icons by grenade types, you'd have to update the advanced throwing and the fired event handler code). Not the worst thing in the world.
I'm personally not a fan of adding handlers until they're needed, so I do want to keep the add/remove flow in |
I am not sure about this, but adding/removing a handler might be more expensive overall than adding it on start and then just checking a simple boolean. |
Keep in mind that units could be removed from the viewable list which were previously in it (via public API or even mid-mission settings change). So this is only true for when spectator is closed, I think dedicated code for advanced throwing is needed.
We could make a local event to add projectiles into the system, that way it could also be called independently in other components too. |
@SilentSpike something like that? (also why does circle ci keep failing?) |
Just not setup yet from where you branched off, don't worry about it. |
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.
All looks good 👍
(_this select 0) setVariable [QGVAR(highlightTime), time + FIRE_HIGHLIGHT_TIME]; | ||
|
||
// add grenade to tracking | ||
[QGVAR(addToGrenadeTracking), [_this select 6]] CBA_fnc_localEvent; |
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.
call
is missing
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.
Good catch
* Handle non-local vanilla grenade tosses * handle advanced throwing grenades * Track through events * Add missing calls
When merged this pull request will:
This is needed since grenades and other large/slow projectiles are actually handled globally instead of locally, and the projectile returned to the handler is null.
Note: we can probably drop special handling of advanced throwing grenades if we change the BI's fired event handler to use CBA's (since https://github.com/acemod/ACE3/blob/master/addons/advanced_throwing/functions/fnc_throwFiredXEH.sqf should handle it)