* cash card empty, no money
remove money from cash cards in vanilla
* remove unused flags
* preserve cash card stacking test
* obsoletion and migration of cash cards
* Preserve money ammo type for aftershock
* no free threads sorry
* put money in the test data
* don't duplicate money ammo in aftershock
* fix unloading non empty components test
* fix for clang
---------
Co-authored-by: Fris0uman <fris0uman@users.noreply.github.com>
* Put ammonia_hydroxide in bottles
* add "display_type": "BY_VOLUME", remove from bad density list
* Remove ammonia_hydroxide from default container test
* Please clang tidy
* Update supplies.json to fix powder loot generation. Create item groups
Similar to GuardianDLL's fix for graphite, we've just created item groups for the affected chemical powders ingame to be called instead of items
* Created Glass flask itemgroups for Zinc used in MoM spawning
* Change chemical powder items to groups outlined in supplies
Changed any instances of any item groups made in supplies to reference the item group and not the item that spawns as charges, using the method GuardianDLL used to correct the weird graphite spawning issue
* Replaced zincpowder item to zinc powder glass flask item group
* Update items to itemgroup that were changed in supplies
* Updated items to item groups in supplies
* Fixed Magnesium probability from 10 to 12
* Update Detergent Item to itemgroup
* Update Detergent Item to itemGroup
* Update Detergent from Item to itemgroup
* Update Detergent to ItemGroup
* Update supplies.json
* Corrected detergent box to have detergent in it
* Update items to item groups
* Changed comments on zinc powder glass flask
* Fixed missing comma
* Removed default containers
* Removed container from magnesium
* Fixed stray commas breaking things
* Fixed missing whitephosphorous
* Fixed amounts to conform to volume and weight restrictions
* Apply space between probability factor and end of line
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Lint
* Remove offensive line in test
* Remove Tests with Detergent
* Correct Spelling Mistakes in Item-Group names
Unfortunately cannot touch the item-ID as of right now as that would break too many recipes that are currently dependent on the current misspelling of phosphorous.
* Correct spelling of red/white phosphorus
* Correct spelling errors in Red/White Phosphorus Item-Group Names
* Update nests_itemgroups.json with updated Manganese_Dioxide spawn to correct spawning multiple containers with 1 unit in each
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anton Simakov <67688115+GuardianDll@users.noreply.github.com>
- Write EIPC_RECIPES_count alongside EIPC_RECIPES in set_saved_recipes
- Read cached count in ememory_size with lazy refill on miss
- Short-circuit ememory_size to zero when broken_on_active
- Exclude EIPC_RECIPES_count from stacks_with VARS comparison
- Add regression tests including malformed CSV dedupe and broken-write
- Write CAMERA_*_PHOTOS_count alongside JSON in write_extended_photos
- Read cached count in total_photos with lazy refill on miss
- Exclude photo count vars from stacks_with VARS comparison
- Add regression tests for cache, mixed state, and aggregated EMEMORY
This is a bit odd, but as far as I can tell volume was never initialized
(UB), but had a non-zero value and so did not trigger any issues with
the test.
Now that optional always initializes it (to 0), it produced issues. Just
assign it to 100 L.
* start fighting the container field
* part 2
* return accidentally removed field
* use cardboard roll for medical tape, resolve test errors
* please clang
* equalize medical_tape stats same as duct_tape
* correctly sanify tape stats
* please tests
* fix itemgroup
* I went too far
* do not remove hydrocarbons
* Cleanup what i fixed, but forgot to cleanup
* use new values for test_mp3 wetness
* Move test material to core to prevent order dependency errors
* EOL
* move test_material again, now to vanilla
* revert material back to test_data file since ehughsbaird fixed the order dependancy issues
* Updates containers so that more are categorized by their contents.
* Make rotting items stack with each other, regardless of how rotten they are.
For example: a paper wrapper contains butter of varying degrees of rotting.
* Before: it would be categorized as "container"
* After: it is now categorized as "food"
Containers were already categorized by their contents even before this commit,
but only if all contained items were of the **same type** and could be stacked.
With this commit, the condition "all contained items are of the same type" is
instead changed to "all contained items are of the same category".
Another example: a canvas bag contains a screwdriver and a hammer.
* Before: the canvas bag would be categorized as "container"
* After: the canvas bag will be categorized as "tools"
More advanced example: `plastic_bag { wrapper { butter }, wrapper { butter } }`
* Before: plastic_bag would be categorized as "container"
* After: plastic_bag is now categorized as "food"
Situations where "categorized by their contents" does not apply:
* Only applies to "containers". So for example, a pair of jeans that has butter
in its pockets will still be categorized as "clothing" and not "food".
* Containers that contain items from more than one category will be
categorized as "container". For example, a canvas bag that has both a
watermelon and a glock - will be categorized as "container".
This commit makes rotting food stack with each other if possible regardless of
how far in the rotting process the item has come. Specifically,
`item::stacks_with` calculates `get_shelf_life() - rot`, which will be negative
if the item is rotten. And doing `clipped_time()` does not work well on
negative values: it clips to seconds and therefore only partitions into
"buckets" of 1s each. This commit therefore clamps all rotten freshness-values
to the 0-bucket for `item::stacks_with`.
In effect, food that has just started to rot will now be stacked with food that
has been rotting for quite a while. Before, they would be different stacks.
* Cache results of `has_item_with_flag` and `all_items_with_flag`
Adds new functions `add_to_flagged_item_cache` and `remove_from_flagged_item_cache`, as well as new overloads in `visitable` to accomplish this
* Replace some `items_with` with `all_items_with_flag`
* Add special handling for the unique LIGHT flag
* Handle flagged item cache in `item::convert`
* Add note to flag_LIGHT that it's not a real flag
* Open the cache up to expansion beyond just `flag_id`s
* Rename "cache" to "caches"
* Add function `all_items_with` for inventory searches. Replaces `all_items_with_flag`.
There are three overloads for this function. One searches for an item flag, as `all_items_with_flag` did. One searches for all items that pass a specified boolean function. The last one does both. All three add the results to the cache.
* Fix cache handling for item contents
* Embed cache clearing into more item removal functions
Replaces `Character.worn.clear()` with `Character.clear_worn()`. `Character` is now a friend of `outfit` to accomplish this
* Use inv search cache for seeds
* Use inv search cache for cash cards
* Use inv search cache for npc food
* Update some implementations of `all_items_with`
* Use inv search cache for relic processing
* Change cache names to use the function name for simplicity
* Use `all_items_with` for relics in `recalculate_enchantment_cache`
* Include `set` in iexamine
* Use `on_item_acquire` in `convert`
* Handle `i_add` with charged items directly in the function itself
This lets us always assume that calls to the `try_add` overload with copies should, in fact, be doing so
* Adjust `try_add` copies to add all added items to the cache
It used to only add the first item. There's a CPU impact of this change when spawning huge amounts of items, but it's very slight
* Use `has_item_with_flag` instead of `all_items_with` in `link_up_actor`
* Use `all_items_with` for bionic cable functions
* Make `get_cable_vehicle` const
* Make `all_items_with` key use a const reference
* Add `clear_inv` for clearing Character's inventory and cache
* astyle invlet test
* Revert "Add `clear_inv` for clearing Character's inventory and cache"
This reverts commit 944d768dd1.
* Make cache use vectors of items instead of sets
* Deduplicate code in `all_items_with` overloads
Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
* Fix iteration in `remove_from_inv_search_caches`
Temporary measure while I rethink how the cache works. Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
* Greatly rework the item search cache and all its functions
The cache now uses safe references rather than direct item pointers. `all_items_with` replaced with `do_on_items_with`, a function that iterates through the cache, applying a given function to the items and removing invalid item pointers as it goes. There's also an overload that gives the function a boolean `abort` parameter that, if ever set to true, exits the loop immediately and returns true. Also adds `get_items_with` for creating a vector of all the cached item pointers.
* Remove `remove_from_inv_search_caches`
Also reverts changes that were made earlier to accomodate manual cache removal
* Replace `has_item_with_flag` with `has_any_item_with`
I went with a unique function name rather than overloading `read_only_visitable::has_item_with` since visitable can't use the caches, so they're worth differentiating
* Consolidate `do_to_items_with_until` and `has_any_item_with`
They basically did the same thing
* Leftover debug line
* Add `do_and_check_func` to `get_items_with`. Adds const versions
* Rename `get_items_with` to `all_items_with`
* Make `has_any_item_with` use const item references.
The const_cast added to radiocontrol is temporary
* Fix returns
* Fix radio control handling
Specifically, fixes the game letting you activate an RC with a bomb in your inventory (it doesn't activate but it also doesn't warn you). Adds a const version of the item pocket chain's `get_item_with`s to accomplish this
* Add additional overload to inv search functions that looks for an item type id
* Only cache flags of the item's type, not the item specifically.
We should only use const flags for caches, not ones that can be set/unset
* Add `can_link_up` for optimizing cable finding
* Implement inv search cache functions
* Temporary fix for item tests
I need to think about how to handle non-type flags
* Change all the item search function names to specifically mention the cache
I grew to dislike the "almost but not quite the same as visitable" names I've been using. These names are clearer
* Make separate const versions of `cache_visit_items_with`
It's better design to do this; `inv_search_caches` being mutable was causing ambiguity
* Bring back `has_item_with_flag`
Now that `cache_visit_items_with` only accepts item type flags, the original functionality to check for non-type flags like WET has been lost. This brings that back.
* Unused lambda captures
* Reference the references
---------
Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
* Convert integer parsing test to use normal TEST_CASEs
* Rename test name too similar to another
* Test to enforce normalized test names
* Normalize TEST_CASE names (scripted)
* first wave
* I sure hope this doesn't explode
* Revert "I sure hope this doesn't explode"
This reverts commit 0a3915fef8.
* wave 1 fixes
* I may be stupid
* children and itemgroups
* I am quite stupid
* item: allow specifying source monster for corpse items
* c++ oooooh boy
* wave 2 and my sanity
* weapon balancing
* moar fixes
* wave 3
* reversion
* bark fixes
* wave 4
* wave 5 and done!
* hope this works
* fixes for the fix god
* please just let it get merged
---------
Co-authored-by: andrei <a12l+git@runbox.com>
* ammo belts weight an volume changes
Changed both weight and volume of the base magazine belt to 0. Changed all child belts to " 'rigid:' false " so that the volume changes depending on how many bullets are in it.
* adjust pouches to fit new ammo belt sizes/weights
* remove belts from list
remove the relevant ammo belts from the known_bad list as described by the comment in the density test.