Open RoyalFox2140 opened 13 hours ago
These are my thoughts on the implementation while only considering items:
Like Royalfox writes, instead of having a "steel knife" and a "gold knife", there is just a "knife" made from "steel" or "gold". One of those will be the "primary material". The primary material will change properties like weight and damage.
There are different aspects to consider:
Here is what I think we should do to implement it:
This allows both simplification and flexibility. For example, a knife may be created from any "metallic" material. A spear may be created from a "long handle" and 4 "metallic" or alternatively, 4 "rocky", but excluding "limestone" variant.
Here is the json I came up with:
Item definition of a craftable item. It has the made_from
property, which whitelists all materials and variants it can be made from, even if there is no recipe. It can still spawn as a variant of that material. The crafting recipe allows for an alternative
entry, which allows the user to craft using alternative materials. In this case, we can use a long_stick
or 20 metallic
. The final material of the item needs to be selected based on the primay ingredient
, which will be one from the recipe that the user has to select.
"description": "A long stick with a sharpened stone tip, ideal for hunting or defense.",
"id": "stone_spear",
"Craft": [
{
"craft_amount": 1,
"craft_time": 10,
"derive_material_from": {"item": "long_stick"},
"flags": {
"requires_light": false
},
"required_resources": [
{
"alternative": [
{
"type": "item",
"amount": 1,
"id": "long_stick"
},
{
"type": "material",
"amount": 20,
"from_material": {
"material": ["metallic"],
"material_categories": ["rare","sturdy"],
"materials": ["steel","gold"]
}
}
]
},
{
"amount": 1,
"id": "sharp_stone"
}
],
"skill_progression": {
"id": "fabrication",
"xp": 25
}
}
],
"Melee": {
"damage": 17,
"reach": 2,
"used_skill": {
"skill_id": "cutting",
"xp": 10
}
},
"made_from": {
"material": ["metallic", "wood"],
"material_categories": ["rare","sturdy"],
"materials": ["steel","gold","hardwood"]
},
"image": "./Mods/Core/Items/spear_stone_32.png",
"max_stack_size": 1,
"name": "Stone Spear",
"sprite": "spear_stone_32.png",
"stack_size": 1,
"two_handed": true,
"volume": 200,
"weight": 4
},
material item definition. This might result in steel scrap
or gold scrap
. Or any variant of the "rare" or "sturdy" category. I put all three options in the made_from
property, but we will most likely use one or two of them. For example, you can pick the metallic
material, but only the rare
category for this item. This would result in gold
or advanced steel
scrap only.
{
"id": "scrap",
"name": "scrap",
"description": "Some metal bits and pieces. Useful for something, right?",
"image": "./Mods/Core/Items/steel_scrap.png",
"max_stack_size": 100,
"sprite": "steel_scrap.png",
"material_amount": {
"metallic": 5
},
"made_from": {
"material": ["metallic"],
"material_categories": ["rare","sturdy"],
"materials": ["steel","gold"]
},
"stack_size": 2,
"two_handed": false,
"volume": 15,
"weight": 0.25
}
Material definition. This lists properties of items and the modifiers. The modifiers are listed as a percentage of the base value. So a knife's base damage may be 20, but if it's made from steel, it will be 22 damage (120% of 20).
{
"id": "metallic",
"description": "Any metal that can substitute eachother"
"variants": [
"steel": {
"item_modifications": {
"weight": 120,
"damage": 100
},
"furniture_modifications": {
"durability": 120
},
"categories": ["rare","durable"]
},
"iron": {
"item_modifications": {
"weight": 140,
"damage": 100
},
"furniture_modifications": {
"durability": 110
},
"categories": ["common","mediocre"]
},
"pig iron": {
"item_modifications": {
"weight": 140,
"damage": 85
},
"furniture_modifications": {
"durability": 85
},
"categories": ["very common","poor"]
}
]
}
Itemgroup definition. It will spawn scrap
, but only of the variants listed in the material
property. You wouldn't use all three material options at once, but only one. For example the material_categories
property to limit the scrap to common
variants only.
{
"id": "mob_loot",
"name": "Mob loot",
"description": "Loot that's dropped by a mob",
"items": [
{
"type":
"id": "bullet_9mm",
"max": 20,
"min": 10,
"probability": 20
},
{
"id": "pistol_magazine",
"max": 1,
"min": 1,
"probability": 20
},
{
"id": "scrap",
"max": 1,
"min": 1,
"probability": 20,
"material": {
"material": ["metallic", "wood"],
"material_categories": ["rare","sturdy"],
"materials": ["steel","gold","hardwood"]
}
}
],
"mode": "Collection",
"sprite": "machete_32.png",
"use_sprite": false
},
Yes it's a Rimworld reference. That means this is MOSTLY based on that, but better.
What is Stuffables:
My knife is made of stuff. What stuff? I DONT KNOW! That's for me to decide when I craft it! Rather than the game having a Steel Knife, Copper Knife, Bronze Knife, Wood Knife, Aluminum knife, Tungsteen Knife, and Titanium Knife, it has Knife.
How is this useful:
Every material-accepting item has a variant based on every material, but with stuffables the material determines the properties, either most or all of them. We should have support for it determining not just the usual suspects like damage and weight but modifiers for tool qualities or hit chance and so on.
Clothes will be about 90% of this.
Examples:
A wood chopping axe has a 50% penalty on tool quality if made from copper, and a 50% bonus if made from steel.
A knife does 10% more damage if it's made of titanium and 20% lighter than when it's made of Steel.
My shirt can be wool, leather, cotton, linen, kevlar, or fur. All of them are different armors, weights, and value. Kevlar is going to stop a round while leather would reasonably protect against scratches.