Skip to content

Fixed dead characters respawning at the site would retain inventory items#28

Open
yahvk-cuna wants to merge 2 commits into
oiltanker:masterfrom
yahvk-cuna:master
Open

Fixed dead characters respawning at the site would retain inventory items#28
yahvk-cuna wants to merge 2 commits into
oiltanker:masterfrom
yahvk-cuna:master

Conversation

@yahvk-cuna
Copy link
Copy Markdown

When respawn is on, dead characters who respawn at the site will retain inventory items, causing the character's inventory to be copied.

@yahvk-cuna yahvk-cuna changed the title Master Fixed dead characters respawning at the site would retain inventory items Nov 29, 2023
@Akronyhm
Copy link
Copy Markdown
Collaborator

Akronyhm commented Dec 4, 2023

Does this properly fix the problem? By looking into the documentation it appears like StartItemsGiven is more or less a flag that is set whenever a character has properly spawned in; and is retained in the xml.

I would feel abit more secure if inventory-/ and hpData were null-checked before assigned (or at the very least set to some default) to the character (which is mainly what the original code-block was attempting to do)

The proper fix might be to grab a default-spawn item-package and assign it if the loaded inventory and hp information are null

@Akronyhm Akronyhm added the need more info Need more info to reproduce issue label Dec 4, 2023
@yahvk-cuna
Copy link
Copy Markdown
Author

Sorry that I forgot about this PR.

In

charInfo.StartItemsGiven = false;
, it flags dead people with StartItemsGiven false, so the if condition is met when the character is respawning. Setting the inventory to null and StartItemsGiven to false is the correct way to indicate this character is respawning and will lead the game to give job items in https://github.com/FakeFishGames/Barotrauma/blob/47badaf760c216d5bb807fd26de87b7e284683bb/Barotrauma/BarotraumaShared/SharedSource/GameSession/CrewManager.cs#L291-L301.

I have been running my campaigns with this change. I haven't had any problems related to this in the past few months.

AntoineDijoux added a commit to AntoineDijoux/multiplayer-crew-manager that referenced this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need more info Need more info to reproduce issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants