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

Vehicle Damage - Fix blank hit selections resulting in absurd damage to the driver #9194

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

JonBons
Copy link
Contributor

@JonBons JonBons commented May 5, 2023

When merged this pull request will:

  • Change damage handling get the overall damage from the vehicle if the hit selection is blank

Repro steps

Using CUP_B_BMP2_CZ for testing, some observations:

  • I can drive full-speed into pretty much anything without consequence, very rarely take a wound from a head-on collision with a tree, rock, or building
  • Those collisions will cause track damage usually, but they also damage the front lights (#l svetlo/#p svetlo)
  • At some point after enough collisions I'll start taking damage, sometimes quite catastrophically, sometimes less so

I iterated on all kinds of different damage combinations and eventually discovered what seems to be one cause (I'm sure the logic means it applies in other ways as well):

  • If those front lights mentioned above are at damage state 1 (there are seemingly four selections, I only was able to damage two of them via scripting and did the other two via running into things), there's a very high chance that the driver will take a lot of damage from driving through bushes and similar obstacles

It may not happen on the first bush you go through, but it'll happen soon enough. It's probably just dependent on whatever you hit managing to hit one of those obliterated lights to trigger it.

Go into a mission, create the BMP with the following snippet

private _bmp = "CUP_B_BMP2_CZ" createVehicle (getPos player);
player moveInDriver _bmp;

Damage the lights (this only damages some of the selections, the others need to be damaged by driving into a building)

{(vehicle player) setHitpointDamage [_x, 1]} forEach ["#l svetlo","#p svetlo"];

Now drive into a building a few times to damage the other selections, after doing so drive over a bush or crash through a small wall and watch as the driver recieves a bunch of wounds.

If you need to repair the vehicle after slamming into a building too many times (resulting in disabled tracks/engine)

{(vehicle player) setHitpointDamage [_x, 0]} forEach ["hithull", "hitturret", "hitengine", "hitfuel","hitrtrack","hitltrack"];

Here is a video of repro showing toggling the fix on/off: https://youtu.be/KNprZ4aezRY

@JonBons JonBons changed the title Vehicle Damage - Fix blank hit selections resulting in absurd damage Vehicle Damage - Fix blank hit selections resulting in absurd damage to the driver May 5, 2023
@JonBons
Copy link
Contributor Author

JonBons commented May 5, 2023

After adding debugging, seeing (vehicle player) getHitIndex -1 returning 0.89 while damage (vehicle player) is 0.0411112 is the reason for changing the method here, fixes the huge wounding that can occur from minor damage events after the vehicle is in this state.

@TheCandianVendingMachine

@LinkIsGrim LinkIsGrim added the kind/bug-fix Release Notes: **FIXED:** label Jun 27, 2023
@jonpas jonpas added this to the 3.16.0 milestone Jun 27, 2023
@LinkIsGrim LinkIsGrim merged commit 0555039 into acemod:master Jun 28, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants