Consumption now checks for JSON Flags instead of trait ID
Summary
Bugfixes "Consumption code now checks for JSON Flag instead of ID"
Purpose of change
Fixes #63558
Describe the solution
Switched from has_trait to has_flag. This also makes the Mutation flags distinct for readability instead of them being under the 'CANNIBAL' umbrella.
Describe alternatives you've considered
Leaving it up to @Venera3 to finish.
Testing
I ran a quick build with Visual studio as a once-over.
Additional context
This change also opens up opportunities for modders who may desire to add their own mutation trees.
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/JSON_FLAGS.md#character also needs to be updated if you change character flags
There seems to be some incorrect deletions that sneaked in.
There seems to be some incorrect deletions that sneaked in.
Hey, thanks for telling me; I must've missed them in my haste. I tried to revert them.
Though, please do tell me which ones they are; and why the style tests are failing even though I installed the Astyle extension for visual studio 2022.
OK so I reverted all the styling things; now the most recent commit should be "add new flags to item.cpp"
I think that should be all, unless I missed something.
I guess that's all that needs to be done, except for the last of the styling. Currently trying to get the extension to work
Hey, I'm in class rn so can;t do much. What still needs to be done?
Just wanting to move this along, anything else that needs to be done?
Looks good to me, and the failures seem to be unrelated. It won't hurt to rebase it and rerun the checks though.
Looks good to me, and the failures seem to be unrelated. It won't hurt to rebase it and rerun the checks though.
Thanks for the response, didn't want the author to be left hanging any longer 😁
Yeah, I thought someone would merge it and then completely forgot about it... I also notice that @irwiss 's comment is not addressed though, so the json flags documentation needs to be updated too.
Crap, sorry about this. University got in the way. Rebasing? Hrm, how do I do that?
There is no need to rebase currently because @Maleclypse's commits triggered new checks which seem to be failing for unrelated reasons again. In the mean time could you update doc/JSON_FLAGS.md with the new flags?
tests/npc_talk_test.cpp:116: FAILED:
(~[slow] ~[.],starting_items)=> REQUIRE( d.responses.size() == expected_count )
(~[slow] ~[.],starting_items)=> with expansion:
Error: (~[slow] ~[.],starting_items)=> 2 == 4
(~[slow] ~[.],starting_items)=> with message:
(~[slow] ~[.],starting_items)=> d.responses := { talk_response( text="This is a basic test response." ),
(~[slow] ~[.],starting_items)=> talk_response( text="This is a wearing test response." ) }
Error result before I kicked the tests
@Maleclypse may I ask why is the numb flag reverted?
@Maleclypse may I ask why is the numb flag reverted?
Clang was saying it was called but never used so I was trying to get this to a minimum viable state. That was probably the wrong path to take but when Clang showed me that NUMB was a problem I thought, I can remove it.
On discord Renech saw a different error.
Renech — Today at 9:15 PM The test error seems to be due to changing the flags on both the psychopath and sapiovore mutations.
So I'm open to anything that gets this into a mergeable state where it's passing basic build. Looking at the test history it's never gotten a basic build passed flag.
The clang-tidy error was saying that trait_NUMB (not json_flag_NUMB) was unused, so I think you should remove the definition of trait_NUMB rather than reverting the json_flag_NUMB changes.
The clang-tidy error was saying that
trait_NUMB(notjson_flag_NUMB) was unused, so I think you should remove the definition oftrait_NUMBrather than reverting thejson_flag_NUMBchanges.
Oops, thanks! I'll try to work on this today/tonight when I can pull it locally.
Hi Qrox, I'm not sure how to fix the error. Do I just change the below
talker_npc.toggle_trait( trait_SAPIOVORE );
gen_response_lines( d, 4 );
CHECK( d.responses[0].text == "This is a basic test response." );
CHECK( d.responses[1].text == "This is a wearing test response." );
CHECK( d.responses[2].text == "This is a trait flags test response." );
CHECK( d.responses[3].text == "This is a npc trait flags test response." );
player_character.toggle_trait( trait_PSYCHOPATH );
talker_npc.toggle_trait( trait_SAPIOVORE );
To toggle json_flag_Sapiovore?
It's in TALK_TEST_WEARING_AND_TRAIT
I think you should change the following lines to use the new flags of the respective traits:
https://github.com/CleverRaven/Cataclysm-DDA/blob/f2dedcb01f952a9f004e10ef9f0f051821e2a0a5/data/json/npcs/TALK_TEST.json#L97-L106
I.e. change the lines to
{
"text": "This is a trait flags test response.",
"topic": "TALK_DONE",
"condition": { "u_has_flag": "PSYCHOPATH" }
},
{
"text": "This is a npc trait flags test response.",
"topic": "TALK_DONE",
"condition": { "npc_has_flag": "SAPIOVORE" }
}