CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.68k stars 4.19k forks source link

npc_prefers_guns and npc_uses_guns are failing #74081

Open osuphobia opened 6 months ago

osuphobia commented 6 months ago

Describe the bug

I have encountered these CI bugs for several times.

https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/9233824079/job/25406711898?pr=74065 https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/9003333447/job/24735032542

-------------------------------------------------------------------------------
npc_prefers_guns
-------------------------------------------------------------------------------
D:\a\Cataclysm-DDA\Cataclysm-DDA\tests\npc_test.cpp(616)
...............................................................................

D:\a\Cataclysm-DDA\Cataclysm-DDA\tests\npc_test.cpp(645): FAILED:
  CHECK( !hostile.get_wielded_item().get_item()->is_gun() )
with expansion:
  false

Log messages during failed test:
12:00:03PM: Enemy NPC dies!
12:00:03PM: 
12:00:03PM: You eat your holy SPAM of debugging (fresh).
12:00:03PM: You start walking.
12:00:00PM: Male Family, Thug gets angry!
12:00:00PM: Enemy NPC puts on their <color_c_green>++</color> debug pocket universe.
12:00:00PM: You wield your M24 rifle+2.
12:00:00PM: Enemy NPC puts away the wood crossbow.
12:00:00PM: Enemy NPC wields a M4 carbine+2.

https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/8962437008/job/24611311991

Mods-(~[slow] ~[.],starting_items)=> -------------------------------------------------------------------------------
Mods-(~[slow] ~[.],starting_items)=> npc_uses_guns
Mods-(~[slow] ~[.],starting_items)=> -------------------------------------------------------------------------------
Mods-(~[slow] ~[.],starting_items)=> ../tests/npc_test.cpp:583
Mods-(~[slow] ~[.],starting_items)=> ...............................................................................
Mods-(~[slow] ~[.],starting_items)=> 
Mods-(~[slow] ~[.],starting_items)=> ../tests/npc_test.cpp:602: FAILED:
Mods-(~[slow] ~[.],starting_items)=>   CHECK( danger_around > 1.0f )
Mods-(~[slow] ~[.],starting_items)=> with expansion:
Error: Mods-(~[slow] ~[.],starting_items)=>   0.0f > 1.0f
Mods-(~[slow] ~[.],starting_items)=> 
Mods-(~[slow] ~[.],starting_items)=> Log messages during failed test:
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: Enemy NPC dies!
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: 
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: You eat your holy SPAM of debugging (fresh).
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: You start walking.
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: Female Family, Thug gets angry!
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: Enemy NPC puts on their <color_c_green>++</color> debug pocket universe.
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: Enemy NPC wields a M24 rifle+2.
Mods-(~[slow] ~[.],starting_items)=> 12:00:00PM: You wield your M24 rifle+2.

The npc_prefers_guns and npc_prefers_guns test cases are failing, looks like the enemy NPC were already wielding the gun properly before CHECK( danger_around > 1.0f ), CHECK( !hostile.get_wielded_item().get_item()->is_gun() ), or hostile.wield_better_weapon().

https://github.com/CleverRaven/Cataclysm-DDA/blob/929b6f6625a03df3ce542679d428ca3d0726de47/tests/npc_test.cpp#L583-L614

https://github.com/CleverRaven/Cataclysm-DDA/blob/929b6f6625a03df3ce542679d428ca3d0726de47/tests/npc_test.cpp#L616-L656

Attach save file

N/A

Steps to reproduce

No idea, asked Renech for help, but they didn't reproduce this bug locally.

Expected behavior

No failure.

Screenshots

No response

Versions and configuration

5227b93da607f85ab1165a49eb3f2d7caf3d7bff

Additional context

No response

TealcOneill commented 5 months ago

Some people in the discord are having the age old issue of NPCs using anything but ranged weapons. Is it likely that this test failing and their issue have the same cause?

osuphobia commented 5 months ago

Some people in the discord are having the age old issue of NPCs using anything but ranged weapons. Is it likely that this test failing and their issue have the same cause?

I dunno what the old issue actually is, but not likely to be the same one. In this case, enemy NPCs are wielding crossbow (or something less lethal) first, and change to M4 carbine before the time point they are expected to do so. The problem is not that they don't wield guns, but they wield them too early, before the TEST CASE wants them to.

TealcOneill commented 5 months ago

Ah, my bad I misread the issue. Thanks anyway 👍

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

osuphobia commented 5 days ago

Still an existing issue: https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/11936471549/job/33270194209?pr=78035