Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CR] Bugfix/cannot reload charged items #40382

Closed

Conversation

mft-dev
Copy link
Contributor

@mft-dev mft-dev commented May 9, 2020

Summary Bugfixes "Fix tools without magazines load/unload issue"

Purpose of change

Tries to fix the issue where the new nested container system assumes all items with contents/charge have a magazine or internal container.

Describe the solution

Most of the methods that deal with checking whether something can fit/hold something else have been changed to reflect the assumption that anything with fuel/charge must also have a container or magazine to hold this charge.

This is a quick-fix to work around this assumption for magazine-less tools, such as the jackhammer, sewing kits etc. The work around simply handles the case where a tool has no appropriate container for a type of ammo or fuel.

Describe alternatives you've considered

Adding a pseudo-magazine to all tools to be more in line with the nested container vision. Adding pocket_data to the jackhammer json definition will make siphoning work, but will not assign the approrirate charge to the tool.

Testing

Start a new game.

Spawn in a tailor's kit.

Unload the tailor's kit. Observe that no error is produced and that you now have a 400 thread stack.

Reload the tailor's kit. Observe that the tailor's kit now has 400 charge and you now have no thread stack.

Additional context

@ifreund ifreund added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things labels May 9, 2020
@ifreund ifreund requested a review from KorGgenT May 9, 2020 11:06
return true;
}
}
if (is_fuel_for(it)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just adjust the json to contain things properly, instead of writing code to re-add the old charge behavior?

@KorGgenT
Copy link
Member

KorGgenT commented May 9, 2020

i know it's possible to fix it correctly instead of adding a work-around

@mft-dev
Copy link
Contributor Author

mft-dev commented May 10, 2020

i know it's possible to fix it correctly instead of adding a work-around

I think you're right. I will close this PR since I mainly did the work to get a working game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants