Khaligufzel / Dimensionfall

A survival game inspired by Cataclysm: Dark Days Ahead and Bright Nights.
MIT License
12 stars 5 forks source link

equipment alters Inventory space #394

Closed snipercup closed 1 week ago

snipercup commented 2 weeks ago

Fixes #349 Requires #391

Equipment now alters the inventory size in the following way:

This PR also adds 3 bags. All three can be found in a wardrobe in a house. The player starts with a medium sized messanger bag. The player still gets a "free" 500 inventory space when all equipment is taken off. We'll probably get rid of this in the future so the entire inventory space is made up of equipped item's inventory capacity.

I updated the PlayerAttribute to have two modes. Default mode and Fixed mode. The default mode shows up on screen and may deplete over time Fixed mode is not visible but will fulfill the role of a number in the background that alters mechanics like the inventory.

You can drop any playerattribute in the wearable item editor, but only playerattributes marked as fixed mode will have any effect. We could also implement it for default mode but I'm not sure about that yet.

The fixed mode in the playerattribute has a base amount, a temp amount that does not get saved and a permanent amount that is saved and loaded. I came up with this because equipment is equipped at the start of the game, so when the game is loaded it will buff the max inventory twice since the old value of the inventory was also saved. In my implementation, the equipment will add to the temporary amount of the playerattribute, which does not get saved. When the game is loaded, the buff is re-applied from the equipment that is worn. The permanent amount will be for something like an item being consumed, or maybe we can have something like currency that increases permanently when you sell something.

The implementation is perhaps more then we need for this specific case but I try to think forward into the future, especially when it comes to modability.