Remove implicit instance flags from wished items #45558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Interface "Remove implicit instance flags from wished items"
Purpose of change
When using the debug "spawn item" menu to wish for an item, the item instance was being assigned all of the flags from the item type, such as
EATEN_COLD
orNO_REPAIR
:Cataclysm-DDA/src/wish.cpp
Lines 483 to 484 in f3a1933
This made debug-spawned items behave differently from their game-world-spawned counterparts, which normally do not have these flags stored in the item instance (
item_tags
).This behavior was added in PR #44675 to support an enhancement to the "Add flags to spawned items" action (
F
), including the ability to add/edit multiple instance flags to an item before spawning it.Describe the solution
This PR changes the
wish_item_callback
behavior so item type flags are not implicitly added to every spawned item's instance flags. Instead, debug-spawned items have no instance flags unless the user explicitly adds them with "Add flags to spawned items" action (F
).The first time using
F
on an item, you'll see the default list of item type flags, which you can edit or append. The spawned item will have all of the designated flags added to itsitem_tags
(instance flags).If you add flags to an item, then switch to another item in the menu before spawning it, the flags will be reset. This is consistent with the "contained" (
f
) behavior, and prevents instance flags from carrying over to another unrelated item that may not support them.Describe alternatives you've considered
Nothing comes to mind
Testing
F
to add flags to an item instance - see item type flags by defaultHOT
,COLD
, orFROZEN
water or other liquids - spawned liquid has correct phase indicatedclean water
,water
,mead
or other liquids without adding any flags - see no explicit instance flags assignedAdditional context
Found this issue while investigating #45471. This is not a fix for that issue, but will make it easier to test reliably.
When wishing for
water
, pressF
to edit or append flags to the item, just like before:Here, the water type has
EATEN_COLD
andNO_REPAIR
- which is where the "This item is not repairable" and "This tastes better while cold" information comes from. PressingF
here is allowing us to add those flags to the water instance, or edit/append to customize the water item that will be spawned.Thus, adding
HOT
:yields a bottle of hot water: