Cataclysm-dda: Candles, lighters, and inhalers not spawning with random charges anymore.

Created on 9 Sep 2020  路  5Comments  路  Source: CleverRaven/Cataclysm-DDA

Describe the solution you'd like

Having candles, lighters, inhalers, matchbooks, and other items have random charges again.

Describe alternatives you've considered

Leaving them how they are in a black and white phase of either having a full charge or no charge whatsoever.

Additional context

Seems odd that items are no longer spawning with random charges anymore. Wasn't sure if I should have put this as a bug report because I vaguely remember a PR getting merged (for lighters and candles) that made it so that items are either black and white with their charges (either 0/100 or 100/100). This also had the effect of making an asthmatic character slightly harder to play due to having full inhalers spawn at such a low rate. Seems weird from a realism perspective that there is no variation with charges on some of these items either.

<Bug> Spawn

All 5 comments

Somewhat related, it's probably important to make sure that the solution to this shouldn't effect player's starting inventory, or at least shouldn't effect it as strongly.
I.e. if you start with inhaler (as an asthmatic), you should never randomly start with zero (or next to zero) charges left.

Most items appear to be working correctly in 0.E-5845-g5247a5f3ee. Inhalers and lighters I am not sure about, but all the others you mention (and more) are spawning with random charges in my testing.

Visiting random house kitchens, I find candles, matchbooks, and markers are definitely getting random charges:
image
image

Batteries and electronic devices are as well:
image
image
image

All the lighters I have seen so far were either full or empty, and the same for inhalers (4 empty, 1 full). Possibly I have not looked hard enough yet.
image
image
image
image

I'm trying the most current build and it looks like like random charges started appearing again. I'm not sure if something changed but I'm even seeing candles, lighters, and inhalers with random charges again. In earlier builds most items would either be empty or full. The only exception were guns.

It still looks like lighters/refillable lighters namely that are zombie loot are still spawning with either 0/100 charge or 100/100 charges. Everything else looks to be fixed.

I have also tried checking for items with charges that may do this.

  • Spray cans like lighters are either spawning with empty or full charges
  • Voltmeters are spawning with no batteries

Ill keep a lookout for anymore and add to the list.

I think this is because of item group entries lacking both the "charges-min" and "charges-max" properties. I haven't managed to track down where in the C++ code this is handled, but it's pretty easily verifiable through inhalers. Every possible spawn for them where those properties are not defined results in empty inhalers, but the one spawn where those are defined (inside of house bathrooms) results in inhalers with proper amounts of albuterol. It looks like there are two solutions to this: add those properties to every single appropriate item spawn or adjust the code that checks for those properties.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PlasmaChroma picture PlasmaChroma  路  3Comments

Coolthulhu picture Coolthulhu  路  3Comments

Cyrano7 picture Cyrano7  路  3Comments

ituluwituluwzev picture ituluwituluwzev  路  3Comments

Taberone picture Taberone  路  3Comments