OpenXcom Forum

OpenXcom Forks => OXCE Bugs => OpenXcom Extended (OXCE) => OXCE Bugs FIXED => Topic started by: zRrr on October 31, 2023, 08:03:45 pm

Title: [FIXED] Crew don't get to eject if craft was retreating when destroyed by HK
Post by: zRrr on October 31, 2023, 08:03:45 pm
When XCom craft is destroyed by Hunter-Killer ufo, pilots and passangers usually get a chance to survive and end up transferred to home base. But when "Disengage" button is pressed, they never escape.

I believe this happens because "Disengage" button sets _end field to true, and then check at DogfightState.cpp:1444 skips call to evacuateCrew (sorry, forum does not allow me to post github link).

Attached save for Piratez with craft types edited for demonstration. Intercept ufo, get shot to last bits of health, press retreat. There will be no gals in transfer, and no "Vessel lost" message either.
Title: Re: Crew don't get to eject if craft was retreating when destroyed by HK
Post by: Vakrug on November 01, 2023, 10:27:20 am
I knew that something is wrong with "evacuation", but I couldn't figure out what exactly, because problem seems to be very inconsistent. Now I know that  "Disengage" button is the culprit. Thanks!
Title: Re: Crew don't get to eject if craft was retreating when destroyed by HK
Post by: Meridian on November 01, 2023, 11:52:24 am
yeah, the dogfightstate is beyond help
it's not possible to maintain or extend it anymore without a complete rewrite

anyway, I checked where I could move this function to always trigger, but I haven't found a single suitable place
I will move it outside of this class, but it will be at a cost:

a/ it will be called not only for HKs, but for all UFOs
b/ I will change the evac defaults from 100% to 0% (for OG/OXC compatibility), so mods that don't specify them explicitly (including XPiratez) will break... and will have to add the desired values in the next version explicitly
Title: Re: Crew don't get to eject if craft was retreating when destroyed by HK
Post by: zRrr on November 01, 2023, 06:04:54 pm
Wish I could be more helpful.

I think it is safe to pull craft handling part outside of if (!_end) {} block, since crafts are not shared between DogfightState instances, and cleanup code there is called at most once per instance.

Or, to preserve symmetry, fatal damage to craft can do _end = false; like it is done with damage to ufo.

I've did a few tests with both of changes, they fix this issue and do not break anything at first glance, but it is hard to be sure...
Title: Re: Crew don't get to eject if craft was retreating when destroyed by HK
Post by: Dioxine on November 02, 2023, 01:43:57 pm
yeah, the dogfightstate is beyond help
it's not possible to maintain or extend it anymore without a complete rewrite

anyway, I checked where I could move this function to always trigger, but I haven't found a single suitable place
I will move it outside of this class, but it will be at a cost:

a/ it will be called not only for HKs, but for all UFOs
b/ I will change the evac defaults from 100% to 0% (for OG/OXC compatibility), so mods that don't specify them explicitly (including XPiratez) will break... and will have to add the desired values in the next version explicitly

Just please give me a heads-up for this.
Title: Re: Crew don't get to eject if craft was retreating when destroyed by HK
Post by: Meridian on November 04, 2023, 11:28:02 am
Just please give me a heads-up for this.

You can configure the defaults already in the current version:

Code: [Select]
pilotsEmergencyEvacuationSurvivalChance: 100
crewEmergencyEvacuationSurvivalChance: 100
Title: Re: [FIXED] Crew don't get to eject if craft was retreating when destroyed by HK
Post by: Meridian on December 02, 2023, 04:13:14 pm
a/ it will be called not only for HKs, but for all UFOs
b/ I will change the evac defaults from 100% to 0% (for OG/OXC compatibility), so mods that don't specify them explicitly (including XPiratez) will break... and will have to add the desired values in the next version explicitly

a/ done here: https://github.com/MeridianOXC/OpenXcom/commit/57c2ebeef5ec69be9828eeedc03f1694eb871c7a
b/ not done

PS: if somebody wants to attack battleships with skyrangers in vanilla, and wants the soldiers onboard to die, mod the survival odds back to zero... I'm not changing the OXCE default value just for this corner case