View Issue Details

IDProjectCategoryView StatusLast Update
0006323The Dark ModPhysicspublic05.12.2023 01:25
ReporterFrost_Salamander Assigned To 
PrioritynormalSeveritynormalReproducibilityalways
Status newResolutionopen 
PlatformPCOSWindowsOS Version11
Product VersionTDM 2.11 
Target VersionTDM 2.13 
Summary0006323: Drowned AI not marked as 'player responsible' if shallow water
DescriptionIn the FM High Expectations (version 3), it was meant to be possible to complete an assassination objective by drowning an AI in a baptismal font that contains very shallow water. Indeed you can place the AI so that his head is under water and he drowns. However, the 'kill' objective is not marked as complete.

I think the reason for this is as follows:

- The objective has the 'player responsible' attribute ticked. This is correct as it will ensure that accidental death of the AI does not complete the objective.
- While the AI is drowning, a check occurs every few seconds to see if the AI is underwater and applies damage.
- The check determines who is responsible for the AI being in the water. This check occurs in UpdateAir() and is located here: https://github.com/stgatilov/darkmod_src/blob/0a7a601e7264f6be7bca6f875e49e0bc56362cde/game/ai/AI.cpp#L12568
- The variable that determines who pushed the AI into the water is called 'm_SetInMotionByActor'. This variable is cleared when the AI stops moving. This happens here: https://github.com/stgatilov/darkmod_src/blob/0a7a601e7264f6be7bca6f875e49e0bc56362cde/game/physics/Physics_AF.cpp#L6301
- The entity that determines who pushed the AI into the water is passed through to the damage check, and ultimately to the 'Killed()' function when the AI dies. Here an event is passed to the objectives system to indicate if the player was responsible for the death or not. This happens here: https://github.com/stgatilov/darkmod_src/blob/0a7a601e7264f6be7bca6f875e49e0bc56362cde/game/ai/AI.cpp#L7111
- Because the water is so shallow in the baptismal font, the ragdoll stops moving immediately and m_SetInMotionByActor is cleared before the check in UpdateAir() happens, so the 'player responsible' flag isn't set. This means the objective doesn't fire because the player 'isn't responsible'.

I think this problem doesn't occur in deeper water because the body is still moving as it's sinking and m_SetInMotionByActor isn't cleared before the first UpdateAir() check.

Oddly, while testing this theory out I managed to place the AI into the font face up (instead of face down as normal). In this case the objective fired as expected. However it's not easy to orient the body that way so I have been unable to reproduce it again.

I think for a workaround for High Expectations I will just remove the 'player responsible' attribute from the objective, as the chances of the AI dying accidentally are very rare.
Steps To ReproduceThe issue is discussed in this forum post, along with steps to reproduce: https://forums.thedarkmod.com/index.php?/topic/21837-fan-mission-the-lieutenant-2-high-expectations-by-frost_salamander-20230424/&do=findComment&comment=487316

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
23.09.2023 10:05 Frost_Salamander New Issue
08.10.2023 16:22 Daft Mugi Target Version => TDM 2.12
05.12.2023 01:25 nbohr1more Target Version TDM 2.12 => TDM 2.13