Khaligufzel / Dimensionfall

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

Moveable furniture can be container #225

Closed snipercup closed 3 months ago

snipercup commented 3 months ago

You could already mark moveable furniture as a container in the content editor, but it wouldn't take effect in-game.

Now the moveable furniture also creates a container as a child if it is marked as a container. This is useful for shopping carts and trash bins.

This pr doesn't actually apply the new functionality but it will be useful after #223

I tested it on the office chair, and the container sprite blocks most of the furniture sprite. I decided to hide the container sprite. This does mean that the player can't know if it's a container and if it contains items until the player opens the inventory when he is in proximity of the furniture. Maybe we will find a better sprite that doesn't hide the furniture sprite, or we can visualize the container with a shader.

When you move the furniture, the container moves with it. When the furniture is destroyed, the items inside it will be added to the wreck that spawns. The container items are also saved and loaded.