Skip to content
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

Rework monster equipment #36377

Merged
merged 27 commits into from
Jan 12, 2020
Merged

Rework monster equipment #36377

merged 27 commits into from
Jan 12, 2020

Conversation

ymber
Copy link
Member

@ymber ymber commented Dec 23, 2019

Summary

SUMMARY: Infrastructure "Rework monster equipment handling"

Purpose of change

Fixes #36312
The code for monster inventories needs cleaning up and some of the interaction menus feel janky. Weight and volume checks are inconsistent. Animal equipment stats are not properly communicated to the player.

Describe the solution

Use cata::value_ptr<item>s for specific use items that a monster can only have one of at once so we don't have to do weird stuff tracking item positions in its inventory.

  • Use cata::value_ptr<item> for armor, tack, and storage items
  • Use flags for tack rather than checking for an item id
  • Fix weight and volume checks
  • Display monster armor values to player
  • Update monster interaction menu behavior
  • Allow checking current volume and weight of stored items on animal
  • Allow removing selected items from animal's pack

Testing

Game compiles, menus and item interactions behave as intended. Correct items are dropped when the horse dies.

src/monster.cpp Outdated Show resolved Hide resolved
@ymber ymber marked this pull request as ready for review December 24, 2019 08:28
@ymber
Copy link
Member Author

ymber commented Dec 24, 2019

This should be ready now. I'm postponing the monster inventory menu objectives for another PR because that one will probably be a few hundred lines on its own.

@ymber ymber added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Monsters Monsters both friendly and unfriendly. labels Dec 24, 2019
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.h Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monster.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/monster.h Outdated Show resolved Hide resolved
src/creature.cpp Outdated Show resolved Hide resolved
@kevingranade kevingranade merged commit e97941a into CleverRaven:master Jan 12, 2020
@ymber ymber deleted the drop_saddle branch January 12, 2020 08:38
@@ -685,7 +685,8 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack
if( z ) {
if( !proj.get_drop().is_null() ) {
z->add_effect( effect_tied, 1_turns, num_bp, true );
z->tied_item = proj.get_drop();
item drop_item = proj.get_drop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop_item is not used at all (see #37053)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably got lost in the refactor for value pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saddle evaporates when horse dies
5 participants