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

Outdated Zombie clothing drops function #6907

Closed
SeanMirrsen opened this issue Mar 25, 2014 · 7 comments

Comments

Projects
None yet
5 participants
@SeanMirrsen
Copy link
Contributor

commented Mar 25, 2014

As per http://smf.cataclysmdda.com/index.php?topic=5884.0

There is a function in mondeath.cpp, mdeath::zombie:

// this function generates clothing for zombies
void mdeath::zombie(monster *z) {

It, as helpfully pointed out by the comment, generates clothing for zombies. The problem is that monster drop items, including zombie clothing, are now defined in an external .JSON file, and editing that file to remove the clothing or reduce its chance of appearence - to, say, prevent extensive clutter - does not work as long as that function is used.

I didn't just outright delete this one and all references to it because it seems to do more than just generate clothing - specifically, it seems to generate cash cards - so I thought I'd make it an issue out of it first, so that maybe someone better acquainted with that code than I can take a look and see if that function is safe to remove now.

@i2amroy

This comment has been minimized.

Copy link
Member

commented Mar 25, 2014

I think this function is really tied to our inability to spawn logical clothing groups through the current item spawn system. Because everything defined in the monster drops json is just randomly selected from, you could just as easily end up with a zombie fireman spawning with 10 pairs of underwear and 6 pairs of fireman gauntlets as you could have one spawn with a coherent set. This requires extra logic to get, and thus the reason for the function. Ideally the item drop algorithms would be reworked in a way to allow for easy addition of "one-of" lists, where the game will only select one item form a given list (and thus would allow the creation of coherent clothing sets in the json files).

@SeanMirrsen

This comment has been minimized.

Copy link
Contributor Author

commented Mar 25, 2014

You mean, like it already does with itemgroups? You just need additional itemgroups to choose from, because you already have them, except defined in code except the JSON.

@i2amroy

This comment has been minimized.

Copy link
Member

commented Mar 25, 2014

Ok did a bit more digging into it, and the problem looks like it's the monster item spawning code. Right now said code will only spawn one item. We need to be able to spawn multiple items, and we need to be able to apply a little bit of logic to it as well. Ideally a system would be able to have multiple lists for each monster and allow for multiple copies of the same list. So you could say "spawn 3 things from list A, and 1 thing each from list B, C, D, and E".

This runs into a bit of a problem with how we currently do monster item groups in the JSON, notably that it won't allow for multiple lists for the same monster (if I understand correctly). Here's what I would suggest to do going forward.

  1. Turn monster_drops.json into monster_drop_templates.json
  2. Link spawned items through a list the monster definition, rather then just plugging in the monster_id as the monster_drop list id.
    This would mean if we went to the zombie cop monster json entry it would have something like this:
"drops": [
    { "template" : "clothes_cop"},
    { "group" : "cop_weapons", "chance" : 20, "amount" : 1},
    { "group" : "cop_gear", "chance" : 40, "amount" : 1}
],

and then in monster_drop_templates.json you would have:

        "type": "monitems",
        "id": "clothes_cop",
        "item_groups": [
             { "group" : "cop_shoes", "chance" : 80, "amount" : 1},
             { "group" : "cop_torso", "chance" : 100, "amount" : 1},
             { "group" : "cop_pants", "chance" : 80, "amount" : 1}
        ]

This would then allow for mass use of templates among similar monsters (for example a generic clothes template would work for 90% of zombies) while still allowing for individual monster customization without the creation of new templates for them.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2014

Getting a good documentation on spawnlists (see #5843) would be a good first step. And improving on them, as @i2amroy said already.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2014

I thought we had this for firefighter zeds already, IIRC. I've considered trying to generalize it. @Rivet-the-Zombie, any insight?

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Mar 25, 2014

I gave the firefighter zeds a special function within the clothing drop area of the code that makes them choose from either a full-body costume, or else one each from a set of lists which each contain a section of clothing like tops, pants, boots, etc.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2014

I gave the firefighter zeds a special function within the clothing drop area of the code that makes them choose from either a full-body costume, or else one each from a set of lists which each contain a section of clothing like tops, pants, boots, etc.

Seems like it works well enough. Any reason we couldn't generalize it, maybe extend to fix the corpse-clothing issues as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.