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.
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
Monster item aware behaviour #38303
Monster item aware behaviour #38303
Changes from 10 commits
3e79946
daf2131
44b4e3d
8e23218
5dc7825
1b13147
adf22ca
c14cf06
3c55b60
f310cb5
0ec93e8
b696f34
a396a54
e632c7f
7382731
b9eba2c
c852f42
03c177e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Probably better to JSONize the list of stealable materials, with monster's entry having an array of materials that it'd consider stealing (if any), listing both food and non-food materials. This would also be useful, for instance, to make carnivore food stealers steal only meat-based foods they'd actually want to eat; monsters that actually eat items they stole (if they're edible at all) would have a flag noting this, so you don't have to make two mostly-separate checks for food stealing and "shinies" stealing.
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.
All these variables are used only in the cycle below, so they should be placed inside it.
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.
Probably should consider that most monsters that could be interested in food (wolves?) would just start eating food right after moving close to it, rather than picking it up and eating some time later.
Also I'm not sure how food stealing and eating would work with food in sealed tin cans (or other sealed containers); an animal very likely wouldn't be interested at all in such an item (it doesn't smell like food) and certainly shouldn't be able to eat the food inside unless it can chew through the container.
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.
I was going to add the option for animals to eat the item rather than pick it up, but felt may be out of scope. I’ll add this and the checking of containers
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.
Please make sure
capacity
doesn't equal to zero, otherwise we'll get a division by zero here.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.
Are you sure about this calculation?
/ capacity
means the stronger the monster is (= higher weight capacity), so less charges it will pick up.Also: why are you adding this value to the existing charges of the item. The result can only be larger than the number of existing charges, so the code will try to pick up more than there is.
The
std::min
is so it selects the smaller value of the amount of existing charges or the amount of charges that can be picked.