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

Overpressure - Add to vehicle/static Missile Launchers and Recoilless Guns #10270

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

mrschick
Copy link
Contributor

@mrschick mrschick commented Aug 28, 2024

When merged this pull request will:

  • Modify firedEHOP for vehicle Overpressure so that is uses the offset config value when determining OP direction.
    A positive value will shift the Overpressure origin point forward along the weapon's direction (just like it does backwards for launchers).
    A negative value will orient the Overpressure direction backwards, as well as shift its origin point further back.
  • Add a backblast config value for vehicle weapons, if set their overpressure will be simulated backwards just like for man-portable launchers. Includes backblast reflection damage to the shooter if in an open vehicle.
  • Add Overpressure to static Titan AT/AA launchers (same backblast as their man-portable variants).
  • Add Overpressure to Vanilla AT guns found on Offroads.
  • Tweak Overpressure configuration of the M47 Dragon, as it previously had almost as much as a tank cannon.
  • For RHS AFRF+USAF Compats:
    • Isolate their Overpressure overrides to subconfigs.
    • Add Overpressure to SPG-9 (static and vehicle-mounted) Recoilless Guns and static Igla/Stinger launchers.
    • Reduce Overpressure of static and vehicle-mounted TOW launchers closer to that of a Titan Compact, since afaik they are soft-launched.
    • Metis/Kornet launchers inherit the default overpressure values of man-portable launchers. I believe this is correct enough due to them appearing hard-launched.

@johnb432
Copy link
Contributor

Why separate the overpressure configs from the regular RHS compats? They don't set dependencies.

@mrschick
Copy link
Contributor Author

mrschick commented Aug 28, 2024

To make the config cleaner, imo, as the overpressure overrides are now more significant and numerous.

@johnb432
Copy link
Contributor

Making a component is, imo, not worth it in this case. Asking for other ACE devs to weigh in on the subject.

@Drofseh
Copy link
Contributor

Drofseh commented Aug 28, 2024

Making a component is, imo, not worth it in this case. Asking for other ACE devs to weigh in on the subject.

I don't think this needs a new component either

@mrschick
Copy link
Contributor Author

Was done as well for the tiny hearing compats and rhs_usf3/hellfire, I don't see the benefit of slapping it all into one big CfgWeapons along with other less related entries.

@johnb432
Copy link
Contributor

Was done as well for the tiny hearing compats and rhs_usf3/hellfire, I don't see the benefit of slapping it all into one big CfgWeapons along with other less related entries.

The hearing subcomponents include a file from hearing, so it has a hard dependency. The hellfire is only loaded if the hellfire component is loaded, so it's necessary to be a in a separate subcomponent.

@mrschick
Copy link
Contributor Author

mrschick commented Aug 28, 2024

Can those components be disabled in a way overpressure can't?

The hearing subcomponents include a file from hearing

Isn't that just an include that is pre-processed either way in the process of determining whether the component has the necessary dependencies loaded?

@johnb432
Copy link
Contributor

Isn't that just an include that is pre-processed either way in the process of determining whether the component has the necessary dependencies loaded?

No, because if didn't load hearing, I imagine it would throw an error, but it doesn't.


This is missing documentation, needs to be added.

Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

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

Unfortunately, this doesn't account for the shooter taking damage. E.g: Use the Jeep Wrangler with an SPG-9, with the rear of the SPG facing a wall. You're in an open vehicle, but you don't take damage, as FUNC(firedEHOP) just isn't meant to handle backblast.

I think you need to change

["ace_firedPlayerVehicle", LINKFUNC(firedEHOP)] call CBA_fnc_addEventHandler;

so that it first checks what sort of damage it's supposed to apply (backblast vs overpressure), then call the respective function.
To differentiate what type of damage to apply, you should introduce a new attribute (something like GVAR(backblast) = 1;). I'm not a fan of changing offset's purpose like this, it's too subtle and should be done in a separate PR imo. It would be clearer in the changelog that ACE now supports the offset attribute for overpressure (i.e. vehicle based weapons).

addons/overpressure/CfgWeapons.hpp Outdated Show resolved Hide resolved
addons/overpressure/CfgWeapons.hpp Outdated Show resolved Hide resolved
addons/overpressure/CfgWeapons.hpp Outdated Show resolved Hide resolved
@mrschick
Copy link
Contributor Author

Unfortunately, this doesn't account for the shooter taking damage. E.g: Use the Jeep Wrangler with an SPG-9, with the rear of the SPG facing a wall. You're in an open vehicle, but you don't take damage, as FUNC(firedEHOP) just isn't meant to handle backblast.

Yeah, I noticed that limitation but didn't think much more about it.
FUNC(getDistance) works from a vehicle, checkVisibility appears to work to check if the vehicle is open or not.

I think you need to change [the EH] so that it first checks what sort of damage it's supposed to apply (backblast vs overpressure), then call the respective function.

Thinking about this, it seems it could create too much duplicated code. The most efficient option might be merging the 2 firedEHs into one, which then determines with a few checks whether to handle backblast or overpressure.

To differentiate what type of damage to apply, you should introduce a new attribute (something like GVAR(backblast) = 1;).

Thought that would add needless complexity at first, but given the other necessary changes, this is the best solution.
I guess it should be made explicit on MANP-launchers as well, can be inherited anyway.

@mrschick
Copy link
Contributor Author

I am having doubts on the feasibility of backblast damage to the vehicle gunner, neither checkVisibility nor lineIntersects appear to be a reliable way of telling whether the vehicle/static turret is open or not.
Static Titan and TOW launchers for example appear to always be counted as closed.

@johnb432
Copy link
Contributor

I am having doubts on the feasibility of backblast damage to the vehicle gunner, neither checkVisibility nor lineIntersects appear to be a reliable way of telling whether the vehicle/static turret is open or not. Static Titan and TOW launchers for example appear to always be counted as closed.

I've managed to get backblast to work the existing functions in the static titan launcher. I'll make the required suggestions.

Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

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

In XEH_postInit.sqf:

["ace_firedPlayerVehicle", {
    if (getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(backblast)) == 1) then {
        _this call FUNC(firedEHBB);
    } else {
        _this call FUNC(firedEHOP);
    };
}] call CBA_fnc_addEventHandler;

In fnc_firedEHBB.sqf, change all instances of _unit to _gunner except in lines 18 & 19.


This is only a rough working version. Ideally we'd want to cache GVAR(backblast) with the other overpressure values, let's get a working version first, then worry about optimising.

addons/overpressure/CfgWeapons.hpp Outdated Show resolved Hide resolved
addons/overpressure/functions/fnc_firedEHOP.sqf Outdated Show resolved Hide resolved
@mrschick
Copy link
Contributor Author

Sure, but how can the BB EH reliably tell whether the vehicle is "open" and damage from backblast reflection should be applied to the gunner? Or do you intend applying it either way, to simulate some sort of overpressure even on armored vehicles like a BRDM with ATGMs?

@PabstMirror
Copy link
Contributor

ace_hearing (and also acre) have some code to detect how open a turret seat is: https://github.com/acemod/ACE3/blob/master/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf

@mrschick
Copy link
Contributor Author

Current implementation works well.
Backblast reflection damage while in a vehicle looks good, except for edge cases like the RHSAFRF BRDM2, which counts as an open vehicle.

@mrschick
Copy link
Contributor Author

mrschick commented Sep 5, 2024

Overpressure on mortars works pretty well.
Backblast to MLRSs does too. The NATO tracked MLRS and AAF wheeled MLRS use the same Weapon but need different offsets, though I found a reasonable middle ground.

A bigger issue is that truck-mounted MLRS backblast reflection can easily cause unrealistic injury to the gunner at higher launcher elevations, due to the vehicle counting as open.
Maybe a fix could be a GVAR(noReflection) = 1 flag for the Weapon, though that might eliminate wanted reflection for more open vehicles reusing the same weapon. A better option might be a similar flag on the vehicle class itself 🤔

Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

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

Merge master into PR, so it's easier to test.

addons/overpressure/functions/fnc_firedEHBB.sqf Outdated Show resolved Hide resolved
addons/overpressure/functions/fnc_firedEHBB.sqf Outdated Show resolved Hide resolved
addons/overpressure/functions/fnc_getDistance.sqf Outdated Show resolved Hide resolved
@@ -37,7 +37,7 @@ TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage);
private _distance = vectorMagnitude _relativePosition;
private _angle = acos (_axisDistance / _distance);

private _line = [_posASL, _targetPositionASL, _firer, _x];
private _line = [_posASL, _targetPositionASL, vehicle _firer, _x];
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 33 might also have to be changed, to accommodate gunners being able to be injured from overpressure/backblast from other sources. I'm not sure about this though, so hold off on any changes to that just yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, should work by just allowing the loop to run on entities in vehicles and then putting the same "closed vehicle" condition on it as run by firedEHBB.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checking line intersection between the BB origin and a player on a vehicle seems a bit tricky though, it keeps registering an intersection with 2 guys on a quad right behind an SPG-9 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants