-
Notifications
You must be signed in to change notification settings - Fork 288
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
Auto-eat sorts by spoilage #2402
Auto-eat sorts by spoilage #2402
Conversation
if the message is to be deleted before merging, why is it still in? for BFN testing? |
BFN asked for it on the discord for some reason. |
I meant, it was supposed to be there to help you debug and only for that. |
Deleted the message since it's served its purpose. I don't see any way to pretty up the added function though, not without losing the use of |
@chaosvolt I have reports that player drink vinegar on auto eat. |
@chaosvolt Can't reproduce the bug. Maybe mod case |
Vinegar has zero quench value (https://github.com/cataclysmbnteam/Cataclysm-BN/blob/upload/data/json/items/comestibles/drink_other.json#L167) so it should be excluded by this: if( !food && comest.get_comestible()->quench < 15 ) {
// not quenching enough
continue;
} |
is it considered food or drink? |
It should be telling it that the |
From what I can tell, it will only sort items in a randomly picked pile, not out of all of them. The PR should say so. It would be possible to sort ALL piles and pick the most rotten item out of them, but that would be more expensive. Not a lot of work to implement, but potentially expensive to run, with cost scaling with nearby item count. |
Ah, hmm. Yeah I'm not sure how to ensure it does that, I'd assumed it would already do that from how it seemed to be sorting things. |
It has a |
Ah, that'd explain it. I'll have to look at this when I get home later today. |
228f796
to
e2f5aa2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, rebased to latest upload. been reading the code, and i think i could refactor based on BFN's comment.
@joveeater, would it be possible to improve the performance for batch-sorting? i think they could be parallelized or cached.
Good luck, I can still look at it when I get time but for now still a bit in over my head. ^^" |
|
e2f5aa2
to
5f63c16
Compare
48a5fc2
to
d04e62d
Compare
Code looks good. |
haven't measured it but should be faster since there's no vector copying. |
wrote first ever test file, can't figure out how to make it work. TEST_CASE( "auto_consume_priority", "[auto_consume][food][zone]" )
{
clear_all_state();
map &here = get_map();
constexpr auto auto_eat_zone_origin = tripoint{ 60, 60, 0 };
tripoint auto_eat_zone_origin_abs = here.getabs( auto_eat_zone_origin );
constexpr auto three_steps_rd = tripoint{ 3, 3, 0 };
auto &zmgr = zone_manager::get_manager();
zmgr.add( "Auto eat zone", zone_type_id( "AUTO_EAT" ),
faction_id( "your_followers" ), false, true,
auto_eat_zone_origin_abs - three_steps_rd,
auto_eat_zone_origin_abs + three_steps_rd );
avatar &you = get_avatar();
you.setpos( auto_eat_zone_origin );
you.set_stored_kcal( 1000 );
// Place food in the auto-eat zone
item hardtack( "hardtack", calendar::turn, 20 );
item cooked_meat( "meat_cooked", calendar::turn, 20 );
item pine_nuts( "pine_nuts", calendar::turn, 20 );
tripoint hardtack_pos = auto_eat_zone_origin + tripoint( 0, 0, 0 );
tripoint cooked_meat_pos = auto_eat_zone_origin + tripoint( 1, 0, 0 );
tripoint pine_nuts_pos = auto_eat_zone_origin + tripoint( 2, 0, 0 );
here.add_item_or_charges( hardtack_pos, hardtack );
here.add_item_or_charges( cooked_meat_pos, cooked_meat );
here.add_item_or_charges( pine_nuts_pos, pine_nuts );
for( const item &it : here.i_at( hardtack_pos ) ) {
INFO( it.tname() );
CHECK( it.typeId() == itype_id( "hardtack" ) );
}
// Player should auto-consume food
for( int i = 0; i < 10; i++ ) {
find_auto_consume( you, consume_type::FOOD );
}
// check that the player has consumed the food
CHECK( you.get_stored_kcal() > 1000 );
CHECK( here.i_at( hardtack_pos ).size() == 20 );
CHECK( here.i_at( cooked_meat_pos ).size() == 10 );
CHECK( here.i_at( pine_nuts_pos ).size() == 10 );
}
|
also conform to astyle
/home/scarf/repo/cata/Cataclysm/tests/auto_eat_zone_test.cpp:63: FAILED:
CHECK( here.i_at( hardtack_pos ).size() == 20 )
with expansion:
1 == 20
As for the eating failed, it would be best if you split it into "find the item" and "actually eat the item", so that you can test them separately. |
4c0c308
to
ba6db08
Compare
ba6db08
to
bb77112
Compare
What is the state of the PR right now? |
it's waiting for review. |
So this should be ready given Scarf's improvements on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test for drink is wonky to say at least, but this PR's been sitting for uncomfortably long. as for now it works without visible issues, i'll merge then fix if it breaks afterwards.
Das bueno! Das very bueno! Next step: #2573 |
commit ac1e6d0 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jul 20 18:41:31 2023 -0500 Simplify and sanity-check digging action (cataclysmbnteam#2755) * Simplify and sanity-check digging action * Update iuse.cpp * Update iuse.cpp commit b312caa Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jul 20 18:40:13 2023 -0500 Convert water dispenser into furniture holding a limited amount (cataclysmbnteam#2899) * Convert water dispenser into furniture holding a limited amount * Also mods, derp commit e806674 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jul 20 18:39:53 2023 -0500 Add use action for bringing up gun cleaning mend menu (cataclysmbnteam#2954) * Add use action for brining up gun cleaning mend menu * Update iuse.cpp commit af6183e Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jul 20 18:39:22 2023 -0500 Set safe speed for wagons to hidden animal speed limit (cataclysmbnteam#2938) commit ac173db Author: Coolthulhu <Coolthulhu@gmail.com> Date: Fri Jul 21 01:39:03 2023 +0200 Cone AoE attack improvements - msg, npcs, armor wrecking (cataclysmbnteam#2986) * Fix NPCs not using cone AoE weapons * Fix appendix hitting * Limit armor wrecking from low dmg multiplier attacks commit e9b9b20 Author: AniDemi <60388907+AniDemi@users.noreply.github.com> Date: Fri Jul 21 00:45:05 2023 +0200 Adjust calorie values and fix crafting display (cataclysmbnteam#2764) * Fix electric cs lajatang * Fixed predicted calories display * This fix has already been merged * Revert Change * Update test * bread.json * carnivore.json * dairy.json * drink_other.json * drink.json * junkfood.json * med.json * protein.json * veggy_dishes.json * Quick fix * drink.json * carnivore.json * dairy.json * drink.json 2 * drink_other.json * junkfood.json * med.json * raw_veggy.json * other.json * protein.json * veggy_dishes.json * unneeded * fix tests again * untouch protein * Unneeded flag * Fixed wrong file path * Fix crafting and display values * Remove old test commit 72e717e Author: Krwak <72284934+Krwak@users.noreply.github.com> Date: Mon Jul 17 10:22:05 2023 +0200 Scenario locations balancing (cataclysmbnteam#3022) * Update scenarios.json Removing some locations which logically don't make sense for scenarios involved and in some cases don't fulfill the requirements even. * Update scenarios.json correction commit 0d6af7b Author: Krwak <72284934+Krwak@users.noreply.github.com> Date: Mon Jul 17 05:01:18 2023 +0200 Update scenarios.json (cataclysmbnteam#3020) Removed golfcourse location from Really Bad Day commit 78572b4 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jul 16 08:13:56 2023 -0500 Mech updates part 3: grabbing furniture and wielding items (cataclysmbnteam#2833) * Mech Update part 3 * Almost forgot the stylin' * Update grab.cpp commit 588ea97 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jul 16 07:42:38 2023 -0500 The Mech Update (cataclysmbnteam#2829) * The Mech Update * Finish the JSON bits * Updates to open and close behavior * Fixes * Update turret.json * Update game.cpp * Update data/json/items/generic.json Co-authored-by: scarf <greenscarf005@gmail.com> * Make the salvaged lasers still at least lighter than the rebuilt ones --------- Co-authored-by: scarf <greenscarf005@gmail.com> commit 15a099f Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jul 15 04:57:05 2023 +0200 Routine i18n updates on 2023-07-15 (cataclysmbnteam#3018) commit 88ea38d Author: joveeater <joveasarus@gmail.com> Date: Fri Jul 14 23:22:49 2023 +0100 Fix the tests (cataclysmbnteam#3017) commit 522002b Author: joveeater <joveasarus@gmail.com> Date: Fri Jul 14 10:12:05 2023 +0100 Fix a crash when using chop tree zones (cataclysmbnteam#3016) commit f9effce Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jul 11 09:43:01 2023 -0500 Rework usage of anvil quality (cataclysmbnteam#3008) * Rework usage of anvil quality * Resume conversions, fix some bork * Moar stuff * Update parts.json * Fix a whoops, update mods commit fab906e Author: Chorus System <ohinchy@gmail.com> Date: Sun Jul 9 03:37:18 2023 -0400 balance: nerf and rename baselard and dagger (cataclysmbnteam#3013) * Updated baselard and dagger Someone pointed out a few weeks ago that the baselard and dagger items are smaller than the combat knife, despite medieval daggers being larger than modern combat knives. The baselard and dagger are now a bit bigger than the combat knife. * Renamed baselard to crude dagger, matched crude dagger and dagger damage and to-hit to combat knife commit 8dd8229 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jul 8 04:54:25 2023 +0200 Routine i18n updates on 2023-07-08 (cataclysmbnteam#3012) commit a9106f0 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jul 7 00:01:57 2023 -0500 Use more divisible amounts of flour for certain recipes (cataclysmbnteam#3001) commit 4e7ec53 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Mon Jul 3 00:53:55 2023 -0500 Delete scenario blacklist from obsolete Dark Skies Above mod (cataclysmbnteam#3007) commit 22f190c Author: scarf <greenscarf005@gmail.com> Date: Sat Jul 1 13:42:52 2023 +0900 feat: do not prompt when it's safe to climb down (cataclysmbnteam#2879) * refactor: use enum * feat: do not prompt if it's safe to climb down * fix: typo for `trait_WEB_BRIDGE` * refactor: use optional for `map_funcs::climbing_cost` game - remove unnecessary cost <= 0 check (climbing_cost cannot be < 0) iexamine - being hard to climb is now considered both_way - prevent redundant rope message when climbing down by hand commit a603f2e Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jul 1 06:00:23 2023 +0200 Routine i18n updates on 2023-07-01 (cataclysmbnteam#3005) commit f101739 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jun 30 01:40:32 2023 -0500 Updates to axe, hammer, and anvil qualities (cataclysmbnteam#2999) commit ddf5abb Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Fri Jun 30 02:08:42 2023 +0100 Weapon Categories for gunmods. (cataclysmbnteam#2541) * First go round Tearing out gun_type_type Some kind of missing function? Hash<weapon_category_id> maybe??? * JS lint * Fix * Update rail.json * Mod updates * Update data/mods/Generic_Guns/gunmods/gunmods.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Swap to appropriate XBOW categories * Update target weapon category Update rifle mods to apply to gatling gun and machine gun Why would you put a bayonet on a gatling gun? Dunno, but if you want... * Category add Revolver's don't get brass catchers or silencers normally. * Update item_factory.cpp * Mod fix * Update display for target category --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit 0428332 Author: Zlorthishen <79779913+Zlorthishen@users.noreply.github.com> Date: Wed Jun 28 21:31:54 2023 -0500 docs: state what exactly does C.R.I.T. stand for (cataclysmbnteam#3003) * Update modinfo.json adds C.R.I.T. acronym meaning * Update crt_classes.json expands descriptions * Update modinfo.json commit 1ef0c4f Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Wed Jun 28 18:59:21 2023 +0100 Fix segfault when NPC is set to use silent weapons (cataclysmbnteam#3002) * Fix considerations * Update considerations for weapon switching * Styling commit 3e0683e Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 28 06:01:29 2023 -0500 Update schizophrenia.json (cataclysmbnteam#3000) commit 7616783 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 28 02:44:03 2023 -0500 Rework woodcutting exertion to not use once-in-x-minutes (cataclysmbnteam#2617) * Rework woodcutting exertion to not use once-in-x-minutes * Update activity_handlers.cpp * Update activity_handlers.cpp * Update activity_handlers.cpp * Typofix * Update activity_handlers.cpp commit ba67ffa Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 28 00:17:37 2023 -0500 Make primer recipe more granular, add to component options (cataclysmbnteam#2995) commit 4cc6314 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 28 00:17:28 2023 -0500 Make net and bolas recipes reversible (cataclysmbnteam#2996) commit 79c2d56 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 28 00:17:11 2023 -0500 Port over change making elephant gun a double rifle (cataclysmbnteam#2997) Co-authored-by: Terrorforge <terrorforge@gmail.com> commit 5e79785 Author: Empyrean-Heaven <134475898+Empyrean-Heaven@users.noreply.github.com> Date: Wed Jun 28 12:33:04 2023 +0900 New Schizo Snippets (cataclysmbnteam#2998) * Update schizophrenia.json * Update schizophrenia.json * Update schizophrenia.json * Update data/json/snippets/schizophrenia.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update data/json/snippets/schizophrenia.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> --------- Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> commit 6e177d1 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 27 02:47:37 2023 -0500 Fix paper recipe making wrong amount (cataclysmbnteam#2993) commit 77d8266 Author: Cyantime <Cyantime@users.noreply.github.com> Date: Tue Jun 27 02:30:37 2023 -0400 Spawns manhole cover when manhole is pried (cataclysmbnteam#2994) * Spawns manhole cover when manhole is pried * Suggested style change Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit 97c160b Author: AniDemi <60388907+AniDemi@users.noreply.github.com> Date: Sat Jun 24 19:20:29 2023 +0200 Fix display saying food is still cold after reheating (cataclysmbnteam#2988) * Fix reheating temp * Reapply flag to rest of stack * Heretic bot * No patience commit aca7e80 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jun 24 04:56:42 2023 +0200 Routine i18n updates on 2023-06-24 (cataclysmbnteam#2987) commit 68b3152 Author: AniDemi <60388907+AniDemi@users.noreply.github.com> Date: Fri Jun 23 11:53:40 2023 +0200 Updated crafting menu example with existing item (cataclysmbnteam#2985) commit 321411e Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jun 23 01:31:18 2023 -0500 Use bismuth in recipes, related ammo fixes (cataclysmbnteam#2952) commit a84bac1 Author: joveeater <joveasarus@gmail.com> Date: Fri Jun 23 06:21:11 2023 +0100 Fixes some active item cache problems (cataclysmbnteam#2984) Fix! commit 652b20b Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jun 22 00:32:54 2023 -0500 Fix monsters noclipping through underground climbable terrain (cataclysmbnteam#2982) commit d4f6513 Author: Cyantime <Cyantime@users.noreply.github.com> Date: Thu Jun 22 00:18:44 2023 -0400 Allows NPC morale to decay (cataclysmbnteam#2983) commit 94df22d Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 21 23:18:09 2023 -0500 Fix load error from undefined VERY_COLD flag (cataclysmbnteam#2980) commit b476232 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 21 01:53:47 2023 -0500 Temperature for food that can rot is displayed in tagtext (cataclysmbnteam#2850) * Temperature for food that can rot is displayed in tagtext * refactor: use variable and celsius * Update item.cpp --------- Co-authored-by: scarf <greenscarf005@gmail.com> commit 217e633 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 21 01:51:53 2023 -0500 Fix pickup key spoiling presence of loot in crates (cataclysmbnteam#2869) commit e40303a Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 20 18:51:30 2023 -0500 Allow cured hides/pelts for clay containers (cataclysmbnteam#2974) * Allow cured hides/pelts for clay containers * Do the thing commit 8836073 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 20 11:46:22 2023 -0500 Fix fire weapon messages failing to print (cataclysmbnteam#2953) * Fix fire weapon messages failing to print * Apply suggestions from code review Co-authored-by: scarf <greenscarf005@gmail.com> --------- Co-authored-by: scarf <greenscarf005@gmail.com> commit 469f9f3 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 20 11:46:10 2023 -0500 Fix cooked items counting as raw (cataclysmbnteam#2976) commit a95523b Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 20 11:45:59 2023 -0500 Port over anthill fixes (cataclysmbnteam#2977) Co-authored-by: Anton Burmistrov <11132525+Night-Pryanik@users.noreply.github.com> commit 271c247 Author: scarf <greenscarf005@gmail.com> Date: Tue Jun 20 21:03:35 2023 +0900 fix(L10n): make extracting bodypart fields optional (cataclysmbnteam#2979) accounts to changes made in cataclysmbnteam#2775 commit 701016c Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Mon Jun 19 07:38:01 2023 -0500 Recipes make more use of other fabric and leather options for handle or backing components (cataclysmbnteam#2138) * Commit for remote * Continue work on it, fix name override * Fix load error, continue adding up to other folder * And weapon folder * Update materials.json * Revert back to rags only for lsurv items * Update head.json commit 21df39d Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jun 18 07:42:30 2023 -0500 Fix grid constructions calling for solder twice (cataclysmbnteam#2973) commit 910b218 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sun Jun 18 14:01:37 2023 +0200 Move wielded item data to body part (cataclysmbnteam#2864) * Move wielded item to body part * Remove unused commit 5f2414f Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jun 18 06:48:31 2023 -0500 Sanity-checking construction components yet again (cataclysmbnteam#2969) * Sanity-checking construction components yet again * Update construction.json * Glorious, delicious fixes With thanks to @olanti-p and @KheirFerrum for putting up with my lack of knowledge of how to python. * Finish up stick usage * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * And now standardize log usage * Thatch and mortar stuff * Adobe adjustments * Also fix more basecamps * And finally update rammed earth --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit ef15050 Author: Empyrean-Heaven <134475898+Empyrean-Heaven@users.noreply.github.com> Date: Sat Jun 17 15:26:29 2023 +0900 Update workshop.json (cataclysmbnteam#2971) commit 15b240f Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Fri Jun 16 10:08:19 2023 +0100 Add warning for smashing with glass item (cataclysmbnteam#2934) commit 94ad32e Author: Empyrean-Heaven <134475898+Empyrean-Heaven@users.noreply.github.com> Date: Wed Jun 14 12:16:04 2023 +0900 Some updates to obsolete mods just in case anybody uses them (like yours truly) (cataclysmbnteam#2964) * Update construction.json * Update terrain.json * Update scenarios.json commit 4b39752 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 13 16:03:11 2023 -0500 Give Deft an attackcost bonus in exchange for costing 2 points (cataclysmbnteam#2916) commit 63ece78 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Tue Jun 13 13:23:29 2023 -0500 Update suffer.cpp (cataclysmbnteam#2963) commit a9f22f7 Author: Relgar <84274761+Relgar@users.noreply.github.com> Date: Wed Jun 14 03:51:47 2023 +1000 Update seeds.json (cataclysmbnteam#2961) Allow creation of cabbage seeds from cabbages commit 14bbac8 Author: Empyrean-Heaven <134475898+Empyrean-Heaven@users.noreply.github.com> Date: Wed Jun 14 02:27:08 2023 +0900 Update suffer.cpp (cataclysmbnteam#2962) commit 8497ae6 Author: Cyantime <Cyantime@users.noreply.github.com> Date: Tue Jun 13 13:24:30 2023 -0400 Solar panel CBM no longer provides power at all times (cataclysmbnteam#2958) commit 72edde9 Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Mon Jun 12 23:54:29 2023 +0100 Construction recipes use soldering standard (cataclysmbnteam#2957) Instead of soldering_iron which excludes the Integrated Toolset commit 85a32d8 Author: RoyalFox <112293514+RoyalFox2140@users.noreply.github.com> Date: Sat Jun 10 20:35:28 2023 -0400 correct harvest products (cataclysmbnteam#2955) human products fixed, black dragons tainted meat moved to dragon meat, lemure drops tainted meat commit 1a43795 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jun 10 05:43:14 2023 +0200 Routine i18n updates on 2023-06-10 (cataclysmbnteam#2950) commit 586a7b9 Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Fri Jun 9 18:36:37 2023 +0100 Make "covers" be overwritten properly. (cataclysmbnteam#2949) commit e912f4a Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jun 9 03:06:20 2023 -0500 Fix open safe spawning on indoor shrub in house variant (cataclysmbnteam#2944) Co-authored-by: Anton Burmistrov <11132525+Night-Pryanik@users.noreply.github.com> commit 92a8aac Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jun 9 00:23:18 2023 -0500 Fix forgotten monster flag (cataclysmbnteam#2931) commit dd7e640 Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Thu Jun 8 20:00:26 2023 +0100 Fix how NPCs handle loose sheath/holsters (cataclysmbnteam#2948) * Fix how NPCs handle loose sheath/holsters No reason for all the checks, remove_item is a solution that applies to all. NPCs also cannot invoke holsters properly so... Also fix debug monsters so their danger level becomes "only" 100 instead of 2000+ which causes almost all npcs to piss their pants in fear and refuse to fight. * Fix holster iuse NPCs can invoke it now, but I still don't want them to. commit 450e35f Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Thu Jun 8 18:09:08 2023 +0100 Rework `wield_better_weapon` considerations (cataclysmbnteam#2930) * Rework wield_better_weapon considerations NPCs stop wielding non weapons they have worn (likely armor/accessories) They will now wield non-weapons if they have nothing better and it's not worn. So we now return to the glorious days of whacking people with helmets (assuming it's better as a weapon than anything they have equipped) * npc_throw now clears the compare weapon cache After you throw your weapon you'll logically look for a new one. commit 00e0fc2 Author: Empyrean-Heaven <134475898+Empyrean-Heaven@users.noreply.github.com> Date: Thu Jun 8 17:35:17 2023 +0900 style: typo in `Lost To The Cataclysm` profession (cataclysmbnteam#2946) From though to through commit 4dab0a1 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Wed Jun 7 06:14:26 2023 -0500 Update 10mm auto to use large pistol primers (cataclysmbnteam#2945) commit f6506dc Author: Zlorthishen <79779913+Zlorthishen@users.noreply.github.com> Date: Wed Jun 7 05:20:28 2023 -0500 Assassination mission (cataclysmbnteam#2908) * Update missiondef.json * Update professions.json * Update scenarios.json * Update data/json/npcs/missiondef.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/scenarios.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update scenarios.json * Update data/json/professions.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update missiondef.json * Update data/json/professions.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update data/json/scenarios.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update data/json/professions.json Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> * Update modinfo.json * Update modinfo.json * Update modinfo.json * Update data/mods/No_Feral_Humans/modinfo.json --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chaosvolt <chaosvolt@users.noreply.github.com> commit 49d4051 Author: RoyalFox <112293514+RoyalFox2140@users.noreply.github.com> Date: Tue Jun 6 07:52:44 2023 -0400 Cots can be crafted & uncrafted (cataclysmbnteam#2943) * cot recipe and uncraft as it says * Update data/json/recipes/other/other.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit 1479a17 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Tue Jun 6 09:56:05 2023 +0200 [Rdy?]Redo random NPC spawn chance (cataclysmbnteam#2748) * Redo random NPC spawn chance * Add debug log info commit 6585139 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Mon Jun 5 01:49:06 2023 -0500 Auto-eat sorts by spoilage (cataclysmbnteam#2402) * Auto-eat sorts by spoilage * Update activity_item_handling.cpp * Auto-eat sorts by spoilage * Update activity_item_handling.cpp * refactor: extract to `ok_to_consume` * perf: find shortest shelf life item without allocating vectors * docs: add docstring for `find_auto_consume` * refactor: use enum class as option for clarity also conform to astyle * test: find_auto_consume --------- Co-authored-by: scarf <greenscarf005@gmail.com> commit cfd2c06 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Mon Jun 5 01:04:44 2023 -0500 Convert buckler to not inherit hand coverage from banded shield (cataclysmbnteam#2940) commit 7710dc4 Author: joveeater <joveasarus@gmail.com> Date: Mon Jun 5 00:31:48 2023 +0100 Shuffle overmap specials (cataclysmbnteam#2932) commit dbf37d3 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jun 4 18:24:17 2023 -0500 Fix cows being only a liter in volume (cataclysmbnteam#2937) commit f25e3e1 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sun Jun 4 12:30:28 2023 -0500 Fix mutant scenarios adding an obsoleted trait (cataclysmbnteam#2929) commit 8291035 Author: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Sun Jun 4 00:09:40 2023 +0100 Fix RAS weapon range in target_ui (cataclysmbnteam#2933) Spawn temp weapon for RAS weapons that is used to generate range. commit 1ac2536 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Sat Jun 3 05:45:35 2023 -0500 Fix vehicles turning bushes into pits (cataclysmbnteam#2927) * Fix vehicles turning bushes into pits * Fix my fuckin' bork commit 50e8cc1 Author: Coolthulhu <Coolthulhu@gmail.com> Date: Sat Jun 3 06:00:11 2023 +0200 Routine i18n updates on 2023-06-03 (cataclysmbnteam#2928) commit e82791d Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Fri Jun 2 05:37:39 2023 -0500 More feral-related changes (cataclysmbnteam#2926) * More feral-related changes * The other stuff * Suggestion per feedback * Update suffer.cpp commit 9e8a806 Author: Chaosvolt <chaosvolt@users.noreply.github.com> Date: Thu Jun 1 14:31:26 2023 -0500 Improvements to feral survivor and Mycus experience (cataclysmbnteam#2922)
Summary
SUMMARY: Balance "Auto-eat now prioritizes items based on shelf life instead of first-dropped unsorted order"
Purpose of change
And this is the other half of the adjustments to auto-eat zones that Viss requested, they asked that someone look into seeing if auto-eat/drink can be reordered to favor whatever will spoil first, much like how the
E
at menu orders things by spoilage.Describe the solution
previous solution by chaosvolt
stable_sort
tofind_auto_consume
in activity_item_handling.cpp, that sorts the items found bystd::vector<item *> items_here;
so that the item closest to going bad gets favored. That way it behaves more like the sorting used by theE
at menu instead of a plain unsorted order, which just takes whather was placed in that tile first.add_msg
that was used to test and confirm that one of the behaviors observed while testing was due to one of the filtrationif
statements excluding items that're too filling to currently eat. This is to be deleted (or converted to debug-only if one really wants it) prior to merging.ok_to_consume
lambda.Describe alternatives you've considered
Screaming.
Testing
Cooked meat being the first choice in this instance confirms it's working as expected, as under the previous unsorted logic the hardtack would normally be chosen first.
It choosing pine nuts also indicates it's favoring them because they spoil sooner than hardtack, and are still being picked despite being lower on the list according to unsorted order.
Additional context
Showing initial drop order and cooked meat being prioritized instead:

Same but with skip-over messages added:

Showing the above items in unsorted order, where hardtack would normally take precedence due to being the first item added:

Showing the results of the other test where vegetable aspic was added:
