FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.76k stars 406 forks source link

Game not checks autofill tags on crates within crate shelves #13226

Closed Xardion495 closed 7 months ago

Xardion495 commented 11 months ago

Disclaimers

What happened?

If crates placed inside the shelves, the game not checks autofill tags on them. Please change this behavior.

Reproduction steps

-

Bug prevalence

Happens every time I play

Single player or multiplayer?

Other

-

Submarine spawner

Version

v1.2.7.0 (Winter Update hotfix)

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

Regalis11 commented 10 months ago

Thank you for the report!

I'm not entirely sure I understand the issue. I tested adding the tag "engcab" to a metal crate and placing it in a crate shelf, and it seems to get filled with engineering supplies as expected. Do you mean something else by "autofill tags"?

Xardion495 commented 10 months ago

Filling work as expected but the game still spawn a support crates at the beginning of campaign which must not be happens if autofill is enabled on corresponding containers.

For example.

Regalis11 commented 10 months ago

What do you mean by a support crate? The extra crates that spawn if there's not enough space for the supplies in cabinets or other containers?

To me it doesn't seem like there's necessarily a bug here. If there's not enough space for the initial supplies in that crate tagged as "engcab", the rest of the items should spawn in a new crate.

Xardion495 commented 10 months ago

Well, the truth is even there is enough space in crates the game will spawns extra ones if crates placed in shelves. I'll show in the pictures.

  1. Cargo spawnpoint where initial crates spawns 20240103173955_1
  2. For example add manually two crates. One with 'secarmcab' tag and another one with 'toxcab'+'toxcontainer' tags. Both are empty. Both have an autofill properties enabled. Leave them just on the floor. 20240103170513_1 20240103170521_1 20240103174019_1 20240103170530_1
  3. Press 'test' button and check cargo hull. We will see that no initial crates spawned. 20240103170557_1
  4. Check manually added crates. Both are filled corresponding to their tags. 20240103174212_1 20240103174216_1
  5. Now make another test. Place crates within the shelf and launch the test again. 20240103180930_1
  6. Check crates within the shelf. Both filled as expected. 20240103181059_1
  7. Check cargo hull. We will see that initial crates has been spawned, despite the fact that there are such "initial" crates on the boat 20240103181110_1 20240103181118_1

Thus we can conclude that the game when creating initial crates considering the tags on lockers and crates but not considering tags on crates if they within the shelves.

Regalis11 commented 10 months ago

In those screenshots, the weapon crate seems to be already full, so the game needs to spawn an extra one to have enough space for all the supplies. In the last pic, you're holding a medical crate, not a chemical crate - again, the game needs to spawn a medical crate because there's no other place to put the medical items in.

There does seem to be something off here though, I'm not sure why the extra crates aren't spawning when you leave the manually placed crates on the floor.

Regalis11 commented 10 months ago

Hmm, I unfortunately still couldn't reproduce this. :/

I'm getting the exact same number of crates, and the contents are also identical, regardless if the manually placed crates are in a crate shelf or not. So I suspect this requires some more specific conditions to occur. image

Xardion495 commented 10 months ago

To see the difference just add 'medfabcab' tag to one of the custom crates. 20240106031110_1 20240106114744_1

I checked a code block responsible for initial crates. The bottom line is that the game does not spawn the initial crates exactly, but looks for suitable containers for "start item set" spawning. And if there is no such one or there is not enough space in container, it spawns a new container (crate) and place the item there.

Default start item set is "normal" (Barotrauma/BarotraumaShared/SharedSource/GameSession /AutoItemPlacer.cs:70) Set composition can be viewed in the file of the installed distribution ("...\SteamLibrary\steamapps\common\Barotrauma\Content\Items\StartItems.xml") When the new item list is formed (Barotrauma/BarotraumaShared/SharedSource/GameSession /AutoItemPlacer.cs:104-123) the next code block starts searching for the container for each item from that list (Barotrauma/BarotraumaShared/SharedSource/GameSession/AutoItemPlacer.cs:124-141)

Possible solution may be to modificate FindContainerFor() method in Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs:2120 to add collection parsing for items with 'crateshelf' identifier or 'cargocontainer' tag