CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
9.73k stars 4.05k forks source link

Recalculate weight when inventory changes due to pet carrier use #73492

Closed RenechCDDA closed 1 week ago

RenechCDDA commented 2 weeks ago

Summary

None

Purpose of change

This problem wasn't apparent before because vanilla's pet carrier is limited to animals of SMALL size or less. Sky island's version lets you capture HUGE.

Describe the solution

Invalidate the using character's cached weight whenever an animal is captured or released

Describe alternatives you've considered

item::set_var() would also be a good place to call this, but it doesn't have knowledge of what character it is or isn't attached to

Testing

Captured a horse, got knocked to the ground immediately. Released the horse, was able to get up without any other inventory changes.

Additional context

Brambor commented 2 weeks ago

If you want, could you look at this? Please and thank you!