-
Notifications
You must be signed in to change notification settings - Fork 737
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 destroyed boat ejecting #6330
Conversation
addons/vehicles/XEH_postInit.sqf
Outdated
[QGVAR(ejectDestroyed), _vehicle] call CBA_fnc_globalEvent; | ||
}; | ||
}]; | ||
_vehicle setVariable [QGVAR(ejectDestroyedHDEH), _eh]; |
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.
You don't need to store this variable, just use _thisEventHandler
in the event to remove itself
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 need it because HandleDamage
is local and doesn't hit on all machines, so I don't have _thisEventHandler
value everywhere
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.
🤔 Huh? Of course you have _thisEventHandler
everywhere, it's a block of code used in an event handler added with addEventHandler
.
Personally I would much rather have some leftover event handlers on some machines which will remove themselves if a dead vehicle ever changes locality and takes a single hit of damage again (which, let's be honest, isn't likely). It will make the code more elegant and remove unnecessary network traffic.
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.
But why do you need it? https://github.com/acemod/ACE3/pull/6330/files#diff-71d8e1c52a77144d92094e89a77b7a55R6
That?
The eventhandler and variables are removed anyway when the vehicle is destroyed aren't they?
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 have _thisEventHandler
only where vehicle is local. EH is fired only on one machine so I have to clean up EHs on all other machines. I always thought cleanup is necessary. If you insist I can get rid of it, no problem.
The eventhandler and variables are removed anyway when the vehicle is destroyed aren't they?
No, they aren't removed.
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.
They will clean themselves up in the event that a dead vehicle switches locality and receives more damage (again, not likely). It's totally harmless to leave them sitting there doing nothing.
Regarding the defect you mention, we could surely have it check for explosives (etc.) and let the units be killed in those cases. Also not sure whether this belong here or in cookoff (as it has damage handling for other vehicles which don't actually cook off) |
But we don't know how big explosion is, if it's small grenade or big satchel. Also distance is important. ATM I don't think it's worth it to check all of these parameters. |
HandleDamage get's the amount of damage though. Wouldn't that be enough? |
Here is HDEH
Note AP damage is more than HE damage. So looks like out of luck. |
I guessss...... One could look into the ammo config to look for explosiveness and damage |
We already do this in cook off so it's nothing new 😛 |
OK it works. |
Good point, I'm happy to leave it in vehicles 👍 Can see what other maintainers say |
If in vehicles then maybe change https://github.com/Dystopian/ACE3/blame/master/addons/vehicles/README.md#L4
Cookoff seems a little out of place. This thing is more like fixing a vanilla bug. Though mods couldn't integrate into it that well or they would need to check if ACE is present in the XEH code. So not sure if worth it. Probably not Aand another also: https://github.com/acemod/ACE3/pull/6330/files#diff-71d8e1c52a77144d92094e89a77b7a55R15 Eventhandler recompilation. Please don't give me fps drops when getting shot ._. |
addons/vehicles/XEH_postInit.sqf
Outdated
if (0.5 >= getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive")) then { | ||
{ | ||
if (alive _x) then { | ||
moveOut _x; |
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.
wasn't there a problem that moveOut didn't work with dead bodies? Or was that fixed recently?
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.
but I don't move out them ^^ if (alive _x)
.
Or you want to move out them also? I don't think it's logical.
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.
lol duh... Must read. Read good for thinking. 🤕
I was thinking about unconscious units but this already handles that fine. Then my brain moved from unconscious to dead.
addons/vehicles/XEH_postInit.sqf
Outdated
TRACE_2("init ejectDestroyed vehicle",_vehicle,typeOf _vehicle); | ||
_vehicle addEventHandler ["HandleDamage", { | ||
params ["_vehicle", "", "", "", "_ammo"]; | ||
if (!alive _vehicle) then { |
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.
if (alive _vehicle) exitWith
?
get's rid of indentation (readability)
and get's rid of the !
(performance)
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.
Isn't exitWith
slower than then
?
Instead of the config number, scanning and adding xeh |
addons/vehicles/XEH_postInit.sqf
Outdated
private _ejectDestroyedClasses = []; | ||
{ | ||
private _ejectDestroyedClass = configName _x; | ||
if (-1 == _ejectDestroyedClasses findIf {_ejectDestroyedClass isKindOf _x}) then { |
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.
Same here. if (-1 !=... ) exitWith
to have less indentation.
I'd also add a comment like //Only want to add the EH once.
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.
no, it would exit forEach loop
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.
Also.. doesn't his add a problem?
I don't know if the configClasses output is properly ordered.
But if you add it to the child class first. And after that get to the parent class you might add twice?
Can only happen if configClasses can return child before parent. Which it shouldn't be able to if it linearly traverses the config.
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.
well ACE uses some of such config loops and there were no problems yet AFAIK.
@PabstMirror #6330 (comment) :D |
But it would prevent us to use it in 3rd-party addons, no? See the 1st post. Or we'll have to add it to compats which is not so good. |
Current method doesn't check inheritance, e.g. it still runs on this child:
I think adding like this will be cleaner and faster.
We could even add RHS vehicles directly in here as there is no load order/inheritance problems with xeh. |
Do RHS vehicles still have the same issue? Also please stop recompiling the whole eventhandler code on every shot that hits the boat. |
It's intended because I didn't find suitable classes to exclude. I didn't want to add unnecessary logic.
I agree with
RHS don't have suitable boats.
will do 👌 |
Found a solution for the config scan problem. |
@dedmen really good solution. Could be used if it's needed. |
hmm working on static weapons - they should be handled another way |
Static weapons don't fire HDEH when become dead and can be alive if |
Needs testing if this still happens with medical, specifically on boats. |
I don't completely understand why you link unit HD and vehicle HD. This PR is about vehicle HD only. It was made with disabled ACE Medical at all. The purpose was just to eject unit from shot rubber boat.
then I can add somewhat like |
Merging now, will keep this in mind while working on #7305 |
When merged this pull request will:
add destroyed boat ejecting framework;Rubber Boat
,Water Scooter
,RHIB
eject crew if destroyed.Some boats like rubber boat or scooter are very easy to destroy even with 1-2 bullets or if they are just collided with other object (especially by engine). It's OK except it kills its crew (Arma feature) even if it's not really possible. This PR adds
HandleDamage
event handler which ejects crew when boat is destroyed.This way has at least one defect: ejected crew is not damaged with any projectile type. You can destroy boat with grenade, HE rocket or even explosive charge but crew will survive when eject. From my point of view it's not a big deal in comparison with dying from stone collision but maybe you think otherwise.Config values are safe for 3rd-party mods and can be easily added to them. E.g. CUP has suitable Zodiac and RHIB boats.Suitable CUP boats inherit vanilla boats and are fixed automatically.I also tested solution with
allowDamage
command but it has more bugs without any advantages.