Cataclysm-dda: Many professions fail to spawn nested contents

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

Describe the bug

many professions specify nested contents in the form of

          { "item": "medium_plus_battery_cell", "ammo-item": "battery", "charges": 600, "container-item": "mil_mess_kit" },

and

          {
            "item": "m2010",
            "ammo-item": "300_winmag",
            "charges": 5,
            "contents-item": [ "shoulder_strap", "rifle_scope", "bipod" ]
          },

which apparently fails to insert into those items due to pocket type mismatches?

Steps To Reproduce

  1. apply wapcaplet's small patch here for debug data: https://gist.github.com/wapcaplet/7ca7dccdd97d28d75b3462859d8750d8
  2. start character creation
  3. cycle through professions
  4. watch the terminal output show put_in failed messages
  5. notice how the containers (weapons, tools, clothing) spawn but not what goes in them (weapon mods, battery cells, etc)

Expected behavior

stuff specified in professions should get their contents.

presumably item group json should either be more permissive when inserting things, or updated to use the correct pocket type, or something?

Screenshots

image
image

Versions and configuration

  • OS: Linux

    • OS Version: Distributor ID: Ubuntu; Description: Ubuntu 19.10; Release: 19.10; Codename: eoan;

  • Game Version: 0.E-3911-g312db57cf0c0d-dirty [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Magiclysm [magiclysm]
    ]

Additional context

since this seems to be an item groups issue, it very likely affects actual loot items out in the wild instead of just being limited professions, i'm just not in a position to verify that

other things also fail to go into containers, but not for the above reasons; for instance, M24 fails to insert in back holster on the police sniper weapon, but that's because the M24 is too long for the back holster to hold. so not all profession put_in errors are this problem.

<Bug> Character / World Generation Containers Mutations / Traits / Professions

All 5 comments

I currently have issues spawning ammo or mags in spawned guns of downed zeds (or even ground-spawned guns) so I think you're right. Latest tests seem to spawn ammo drops within guns that take ammo directly (shotguns), but guns that take ammo in mags (like M4) spawn empty. :(
Zeds that drop holsters with handguns also ALWAYS spawn without ammo in the gun or even a magazine.

Note, the patch mentioned in the issue description is no longer necessary since #41677 added an explicit debugmsg to report put_in failures here.

I have checked the full list of professions in current master 963edfda and none of them are reporting failures when scrolling through the starting profession list. I checked a few professions by spawning new characters into a world, and verifying items were loaded up correctly:

  • Bionic Soldier: HK416 A5+2 (with ACOG scope and shoulder strap), 2 STANAG 30-round magazines (30/30), two-way radio (300/300)
  • Chain Smoker: Cellphone (150/150), lighter (100/100 butane), pack with cigarette (20)
  • Camper: Cellphone (150/150), gasoline lantern (500/500), mess kit (500/500), refillable lighter (50/50)
  • Police Sniper: Worn M24+1 (5/5 .308 with shoulder strap), USP .45 (12/12 .45) in holster, 2 USP magazines (12/12 .45) in leg ammo pouch, 7.62.51mm M80 (20), two-way radio (300/300)

There is still a discrepancy, that can_contain in fact returns different results than insert_item for gunmods. For example item( "m4a1" ).contents.can_contain( item( "shoulder_strap" ) ) will fail, while insert_item with the same gun/gunmod succeeds. I will submit a PR with test cases for this, but it does not appear to have an adverse effect on starting profession spawns.

TL;DR This issue should be resolved now, but having additional confirmations would be great.

Police sniper starting inventory screenshot:

image

@esotericist You have mentioned this being one of your preferred professions. It looks like everything is here now, please confirm.

image
Confirmed with Military Recruit on 11003.

_Note_, the patch mentioned in the issue description is no longer necessary since #41677 added an explicit debugmsg to report put_in failures here.

Note to the note: I kind of want to revert (or rework) that in #44155 because it fires even when not appropriate. This is not the place to discuss it, I just wanted to mention it here in case things change because of that.

This issue was fixed in #41677 which the person above wants to revert (LOL).

Bionic Sniper with 300_winmag ammo and "shoulder_strap", "rifle_scope", "bipod" mods:
assasin

You can close this issue.

Was this page helpful?
0 / 5 - 0 ratings