[Mod Request]Multi-stuff

Started by Razzoriel, August 19, 2017, 01:59:34 PM

Previous topic - Next topic

Razzoriel

Let's say I want to make a spear that uses both metal and wood, and coding would look like this:
    <costStuffCount1>50</costStuffCount1>
    <costStuffCount2>20</costStuffCount2>
    <stuffCategories1>
    <li>Metallic</li>
    </stuffCategories1>
    <stuffCategories2>
      <li>Woody</li>
    </stuffCategories2>

For labelling sake, only the category1 (the first) will be taken, so such a spear made out of steel and oak wood, for instance, would be labelled "Steel spear".

Is that possible?

CannibarRechter

You can have both Metalic and Woody in stufff categories, like this:

<stuffCategories>
   <li>Metallic</li>
      <li>Woody</li>
</stuffCategories>

You can see that sort of thing in various items in the core (e.g., look at MeleeWeapon_Club in Weapons_Melee.xml).

However, what you cannot do inside a ThingDef is have multiple stuffs in <costStuffCount>. You need a RecipeDef for that. Just look in Core/Defs/RecipeDefs to learn how to do that.

If I recall correctly, if you use a RecipeDef, you should remove the costStuffCount from the ThingDef, and use the RecipeDef instead. I suggest you compare a ThingDef that uses costStuffCount (and therefore doesn't use a recipe) to a ThingDef that uses a Recipe, and you should be able to figure it out.

I.e., what you are asking for is already a game feature.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

dburgdorf

#2
Quote from: CannibarRechter on August 24, 2017, 09:23:19 AMI.e., what you are asking for is already a game feature.

Actually, unless I'm missing something, what he's asking for is *not* a feature, and could only be modded in with (possibly extensive) changes to the code that handles recipes.

It's possible to have an item that can be made from any of several different types of "stuff," or that requires both "stuff" and set ingredients.  But it isn't possible to have an item require multiple different types of "stuff."

To go back to his example, it's possible to create a spear recipe that requires steel plus "any sort of wood," or a spear recipe that requires vanilla wood plus "any sort of metallic stuff." And of course it's possible (as with the vanilla club you referenced) to create a recipe that requires "any sort of metallic stuff" OR "any sort of wood." 

But what he wants to do, which can't be done, is create a recipe that requires "any sort of metallic stuff" AND "any sort of wood."
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

CannibarRechter

Looks like you are right. ThingCategoryDefs has a lot of categories, but wood and metal don't look like they are there.  Hmmm, bummer.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

dburgdorf

Quote from: CannibarRechter on August 24, 2017, 09:57:13 AMLooks like you are right. ThingCategoryDefs has a lot of categories, but wood and metal don't look like they are there.  Hmmm, bummer.

I think you're missing my point. Both "woody" and "metallic" are valid types of stuff. The problem is that a recipe the lists both "woody" and "metallic" under "StuffCategories" can be made from *either* wood or metal, but doesn't require *both* wood and metal, which is what the original poster wanted to be able to do.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

Canute

Ok, i am not realy a modder, but i looked at some xml so far.
There are alot of recipes they juse 2 or more ingredents for the recipe.
Can't you just say instead of 25 plasteel   25 metalic for one of the ingredents and leave the other at 40 wood at example ?

jamaicancastle

Quote from: dburgdorf on August 24, 2017, 09:46:13 AM
To go back to his example, it's possible to create a spear recipe that requires steel plus "any sort of wood," or a spear recipe that requires vanilla wood plus "any sort of metallic stuff." And of course it's possible (as with the vanilla club you referenced) to create a recipe that requires "any sort of metallic stuff" OR "any sort of wood." 
Is it possible for a recipe to use a stuff category and a thing category? So it would need X units of a type of metal, say, and Y units of any combination of different woods. Obviously only the stuff would apply stat modifiers, but it might still be useful for what the OP wants.

Quote from: Canute on August 24, 2017, 10:56:45 AM
Can't you just say instead of 25 plasteel   25 metalic for one of the ingredents and leave the other at 40 wood at example ?
You can, but it won't do what the OP wants.

If a recipe calls for specific things ("steel", "wood") or categories of things ("metals") the creation does not inherit stats or appearance from the material. Inheritance only happens if the recipe calls for a stuff category. As it stands, it can only make sense of one stuff category per recipe. It is possible to have an object with some stuff and some specific things as ingredients (for instance, many production benches require some structural materials - stone, wood, or metal - and some steel) but again, the things will not have any effect on the final stats or look of the object.

dburgdorf

Quote from: jamaicancastle on August 24, 2017, 11:04:58 AMIs it possible for a recipe to use a stuff category and a thing category? So it would need X units of a type of metal, say, and Y units of any combination of different woods. Obviously only the stuff would apply stat modifiers, but it might still be useful for what the OP wants.

Interesting idea. I'm at work, so I can't check into it right now, but it might be the best bet to get close to what Razzoriel wanted without messing with actual coding.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

kaptain_kavern

Yes you can do that. I used this in my ASAR mod

Razzoriel

Quote from: dburgdorf on August 24, 2017, 12:05:13 PM
Quote from: jamaicancastle on August 24, 2017, 11:04:58 AMIs it possible for a recipe to use a stuff category and a thing category? So it would need X units of a type of metal, say, and Y units of any combination of different woods. Obviously only the stuff would apply stat modifiers, but it might still be useful for what the OP wants.

Interesting idea. I'm at work, so I can't check into it right now, but it might be the best bet to get close to what Razzoriel wanted without messing with actual coding.
Yes, what I'm looking for is something that would take two types of "stuff", and can be made as such. Another example: a padded leather cloak, which would take say 40 leather and 30 fabric stuff, but only leather, as the "primary stuff" would apply the stat modifiers. So a padded leather cloak made of chichilla fur+devilstrand would be less effective than say a thrumbofur+cloth cloak.

Quote from: kaptain_kavern on August 24, 2017, 05:02:05 PM
Yes you can do that. I used this in my ASAR mod
I took a look at that. No, what you're using is coding which specifies one "stuff", then other SPECIFIC items together with that. I'm not looking for specific items, but rather two or more distinct stuff categories in one recipe, of which only the "primary stuff" is the one which will inherit the statbases.


vengeanceaurelith

I'm new to modding, here, myself, and I recognize that some people that have already answered above have far more experience that I do, but I wanted to share my two cents, as well.

I haven't looked at the code for food, but let's take Kibble, for example. Doesn't it require multiple stuffs to make? Vegetable/Hay and Meat? Wonder if that could be used as a reference to see if this might actually be something in-game, but possibly overlooked?

Razzoriel

Quote from: vengeanceaurelith on September 14, 2017, 08:15:17 PM
I'm new to modding, here, myself, and I recognize that some people that have already answered above have far more experience that I do, but I wanted to share my two cents, as well.

I haven't looked at the code for food, but let's take Kibble, for example. Doesn't it require multiple stuffs to make? Vegetable/Hay and Meat? Wonder if that could be used as a reference to see if this might actually be something in-game, but possibly overlooked?
It is different. Kibble does not inherit anything from both 'stuffs', but yes, this is what I'm using for the moment.

CannibarRechter

I believe this would need to be custom coded. Fluffy's AI manager makes use of custom overlays in Graphic_Multi to cause the AI manager to flash, so it could, in theory, be possible to create items that draw with multiple stuffs with custom drawing code. With that licked, one would have to make sure the game was keeping a record of the stuffs.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects