Guide to adding new content to CDDA for first time modders

Hi. On adding new items, I am confused about item weights in the json vs item weights in-game and I was also wondering if it is possible to have an item “look like” a combination of multiple items? For example: I am wanting to make a custom suit for a character class that I am making and I want it to use the tileset of a combination of different existing armor pieces so that the suit will be one item but look the same as if you combined several pre-existing items. Example is if the suit is a combination of if you wore a hood with cat ears or pants with a tail, etc. For now, I am just going to make the item available only when starting with that particular character class, but I am considering actually making it craftable as a combination of a bunch of other armor pieces and able to be disassembled into the individual parts as well. I may also create a new scenario for the class in the future if I can get the hang of this stuff. :slight_smile: Thank you.

The “weight”: line in the json refers to the weight in grams. Kilos are easy, but if you’re like me and use lbs, you’ll have to google the conversion.

So, I want to make an item that’s 1 lb. I google what is 1 lb in grams and get 453 grams. So my line looks like this:

"weight": 453,

Oooohh… Yeah, I use pounds so I was very confused where these numbers were coming from. The difference between “volume” in the json and “volume” in the game was easy and made sense, but the weights… Thanks!

I love you @mlangsdorf and your sexy mustache too. Always helpful.

1 Like

I didn’t write code to recompose multiple sprites/images into a new one for looks_like. I wrote code to tell the function that looks up an image that if it doesn’t find an image, it can look for a different image and use that instead.

No, you can’t specify a combination of items for looks_like.

1 Like

Hey, Can someone point me to the best examples of missions that update maps? I specifically want to change some terrain in a faction map at the end of a mission, getting a litttle confused though. thanks!

data/json/npcs/tacoma_ranch/*, especially NPC_ranch_foreman.json

1 Like

That’s perfect! Cheers mate!

Excuse me, can I translate the content of your post into Chinese?

This guide post is really wonderful. I want to share it with my friends.

Yes, of course you may! Please do. Though use the current version at the development wiki.

Thank you very much.I like this guide post. Cheers!

Hey, I was thinking about writing a mod to add some new, exciting(read: shitty) homemade firearms, and wanted to play around with faults and other general effects, I know that certain ammo types can misfire, and that some guns will fail to eject or get damaged by black powder, but I wanted to know if catastrophic failure could be implemented as either part of the mod, or just in my own personal files, and whether that would need baked-in support or if something in JSON could take care of that.

Any help is appreciated, thanks!

I’m having trouble getting a new engine to use a new fuel. It recognizes it needs the fuel, doesn’t start without it, but once it has the fuel it doesn’t actually consume any of it.

Is there something specific to my case here that i have to increase or add? I followed the guides but I only got the engine to run an eternity once it has enough fuel to start, never consuming it.

You need a "fuel_type" and an "energy_consumption", as well as not having the "PERPETUAL" flag, for an engine to consume fuel. Could you post the vehicle part definition JSON?

Some clarrification: It’s not meant to be an engine to run a vehicle with, more like a device to turn a resource into an effect. It does do its job perfectly, except for the not consuming fuel part.

{
“id”: “aft”,
“type”: “vehicle_part”,
“name”: “Anti-fungal tower”,
“fuel_type”: “conc_fungicidal”,
“item”: “v_aft_item”,
“location”: “central”,
“symbol”: “T”,
“broken_symbol”: “t”,
“color”: “grey”,
“difficulty”: 8,
“durability”: 100,
“noise_factor”: 15,
“description”: “A metal tower designed to spray a fine fungicidal mist over a large area. Needs a tank from which to pump the sprayable fungicide and electricity to power the pumps.”,
“cold_affects_start”: false,
“backfire_threshold”: 0.25,
“backfire_freq”: 20,
“damaged_power_factor”: 0.25,
“m2c”: 65,
“epower”: -2000,
“power”: 1,
“energy_consumption”: 15000,
“flags”: [ “CTRL_ELECTRONIC”, “EMITTER”, “ENABLED_DRAINS_EPOWER”, “ENGINE”, “OBSTACLE”, “USE_TANKS”, “E_HEATER”, “E_COMBUSTION” ],
“emissions”: [ “emit_fungicidal_cloud” ],
“requirements”: {
“install”: { “skills”: [ [ “mechanics”, 6 ] ], “time”: 120000, “using”: [ [ “welding_standard”, 10 ] ] },
“removal”: { “skills”: [ [ “mechanics”, 5 ] ], “using”: “vehicle_weld_removal” },
“repair”: { “skills”: [ [ “mechanics”, 6 ] ], “time”: 30000, “using”: [ [ “welding_standard”, 5 ] ] }
},
“breaks_into”: [ { “item”: “steel_lump” }, { “item”: “steel_chunk”, “count”: [ 1, 3 ] }, { “item”: “scrap”, “count”: [ 1, 3 ] } ],
“damage_reduction”: { “all”: 15 }
}

Here’s the fuel too, if you need it:

{
“id”: “conc_fungicidal”,
“type”: “AMMO”,
“name”: “concentrated fungicide”,
“description”: “FUNGICIDE DESCRIPTION HERE”,
“weight”: “3 g”,
“volume”: “250 ml”,
“count”: 250,
“stack_size”: 200,
“price”: 600,
“price_postapoc”: 3500,
“category”: “chems”,
“symbol”: “=”,
“color”: “yellow”,
“container”: “bottle_plastic”,
“phase”: “liquid”,
“ammo_type”: “chemical_spray”,
“fuel”: {
“energy”: 30.0,
“explosion_data”: { “chance_hot”: 5, “chance_cold”: 10, “factor”: 0.25, “fiery”: false, “size_factor”: 1 },
“range”: 4,
“effects”: [ “GAS_FUNGICIDAL”, “STREAM_GAS_FUNGICIDAL”, “NEVER_MISFIRES”, “JET” ]
}
}

I still need to make recipies for everything, but I want to get the “engine” working before getting to that stuff.

1 Like

Well, that’s probably not going to work. You can’t willy-nilly repurpose JSON entries like you’re trying to do here. The C++ code for vehicles does certain things with engines, and all of the fuel consumption code works in the context of providing motive power.

I’m not even sure that "ENABLED_DRAINS_EPOWER" makes sense in context of engines.

All that said, I don’t see any particular reason why this shouldn’t work if you idle in one place long enough, or drive fast enough. You’re claiming a 15 kW nominal draw from a fuel that produces 30 MJ/L, so at 100% load you would 1 liter of fuel every 2000 seconds (roughly 30 minutes). If you’re just idling the vehicle’s engine while testing, that would lengthen to 1 liter of fuel every 2 days, so it’s possible that fuel is being consumed but you’re not noticing.

1 Like

The OP should be updated to add faction camps and expansions!

On that topic, say I throw together some more advanced expansion buildings like a foundry (mass produces simple metal things cuz I want metal bases (o yeah, plural!) and I’m tired of taking a modified flatbed to the recycling center 2 hours of driving away :stuck_out_tongue: ), a logging facility (cuz I’m tired of cutting logs into planks and break long sticks by hand), things like that, but make them require a certain level of another “solar array” expansion that does nothing on it own. So here’s the questions: Will blueprint_requires honor other expansions (I see no example of it right now), and would such “advanced” buildings be welcomed into the main game, provided properly balanced recipes?

1 Like

Thank you. I was just being impatient with my testing. Everything’s working more or less how I want it now after some tweaking.

One last thing before I call it done-and-dusted. Is there a way for a recipe to use a specific corpse? Currently it does accept corpses but the problem is that it’ll currently take any corpse it can find in the crafting range. I know the type of corpse isn’t specific in the item jsons due to it being generated at run time but if there is a way for a recipe to use a specific corpse I’d like to know.

No, there is not. Corpses, even though they have different names and stuff, are all the same item.

Thanks on the quick response. Guess I’ll just increase the corpse amount required to make up for the loss in biomass.