How to program a new item into the game?

I’m trying to make a Steam machine that’ll gentrate power for your car’s battery by burning wood and using up water.

Right now, I’m stuck on one part…Finding the ID list. I need to go to the Minireactor’s ID and a engine’s ID to chop them up and build a proper steampunk machine ID that’ll make power from logs and draw from your supply of clean water like gas.

The power it makes is 1/3 of the power the truck alternator makes due to the energy density of wood compared to gas. I still need to polish that bit a little, do some more math based on the weight of each logs in the game. How much do one unit of gas weights?

I might also need to take a look at the location list to be sure that I don’t have to add logs to that list or something. Make it so one unit of log burns for x time, etc.

(Old, see edit at end of this post)
“type” : “vehicle_part”,
“id” : “minireactor”,
“name” : “Steam Furnace Rig”,
“symbol” : “F”,
“color” : “light_green”,
“broken_symbol” : “#”,
“broken_color” : “red”,
“damage_modifier” : 80,
“durability” : 580,
“size” : 10000,
“epower” : 746,
“fuel_type” : “log”,
“item” : “minireactor”,
“difficulty” : 5,
“location” : “fuel_source”,
“flags” : [“FUEL_TANK”],
“breaks_into” : [
{“item”: “steel_lump”, “min”: 6, “max”: 11},
{“item”: “steel_chunk”, “min”: 6, “max”: 11},
{“item”: “scrap”, “min”: 6, “max”: 11}

Once that wall’s overcame, I’ll edit this thing a bit more, spit and polish then throw it back here for feedbacks.

Edit: My process so far.

[spoiler]
In the main data folder, Vehicle_Parts.Json, I added this.

{
“type” : “vehicle_part”,
“id” : “steampunkrig”,
“name” : “Steam Furnace Rig”,
“symbol” : “F”,
“color” : “light_green”,
“broken_symbol” : “#”,
“broken_color” : “red”,
“damage_modifier” : 80,
“durability” : 580,
“size” : 10000,
“epower” : 746,
“fuel_type” : “log”,
“item” : “steampunkrig”,
“difficulty” : 5,
“location” : “fuel_source”,
“flags” : [“FUEL_TANK”],
“breaks_into” : [
{“item”: “steel_lump”, “min”: 12, “max”: 30},
{“item”: “steel_chunk”, “min”: 12, “max”: 30},
{“item”: “scrap”, “min”: 12, “max”: 30}
},

And in the data/item/Vehicle_parts.json, I added this.

{
“type”:“GENERIC”,
“id” : “steampunkrig”,
“name” : “Steam Furnace Rig”,
“description” : “A Steam Furnace that boils water into steam to turn fans to generate power. Uses clean water and logs.”,
“weight” : 58215,
“to_hit” : -4,
“color” : “light_green”,
“symbol” : “f”,
“material” : [“steel”],
“volume” : 6,
“bashing” : 7,
“cutting” : 0,
“category” : “veh_parts”,
“price” : 40000
},

And in Data/Recipes/Recipe_electronics, I added this.

{
“type” : “recipe”,
“result”: “steampunkrig”, (This is right? Put the ID of the item here?)
“category”: “CC_ELECTRONIC”,
“subcategory”: “CSC_ELECTRONIC_PARTS”,
“skill_used”: “mechanics”,
“skills_required”: [“electronics”,7],
“difficulty”: 4,
“time”: 60000, Need to edit this to ten hours. What’s the units here?
“reversible”: false,
“decomp_learn”: 4,
“autolearn”: false,
“book_learn”: [[“textbook_mechanics”, 6] , [“textbook_electronics”, 8] , [“textbook_fabrication”, 8] , [“welding_book”, 5]],
“qualities”:[
{“id”:“HAMMER”,“level”:2,“amount”:1},
{“id”:“SAW_M”,“level”:1,“amount”:1},
{“id”:“WRENCH”,“level”:1,“amount”:1}
], “tools”: [
[
[ “goggles_welding”, -1 ]
],
[
[ “welder”, 100 ],
[ “welder_crude”, 150 ],
[ “toolset”, 150 ]
]
],
“components”: [
[
[ “frame”, 1 ]
],
[
[“soldering_iron”, 1]
],
[
[“steel_lump”, 12],
[ “steel_chunk”, 50 ],
[ “scrap”, 150 ]
[ “copper_wire”, 300]
],
[
[“cable”, 5]
]
]
},

I still can’t find the .json that controls how much fuel engines draws on, etc. I need help! Seems that I’m more than halfway finished here.[/spoiler]

Fairly sure that you can just type “habfhubfkhuabkfb” into the ID list and it’ll work because IDs define the item itself, nothing else.

“id” can be anything you want (preferably all lowercase and with underscores instead of spaces).

As I understand it the “item” field is the “id” value of the item that you “install” to make the defined vehicle part (which has it’s own definition in the items folder).

Oh yeah, don’t forget that. I learned that the hard way…

[quote=“i2amroy, post:3, topic:8156”]“id” can be anything you want (preferably all lowercase and with underscores instead of spaces).

As I understand it the “item” field is the “id” value of the item that you “install” to make the defined vehicle part (which has it’s own definition in the items folder).[/quote]

Ooh, here we go. Thanks!

I’ll be wanting to ask how to turn this into a add-on, a mod for the game after I make the new “item”.

Okay.

In the main data folder, Vehicle_Parts.Json, I added this.

{
“type” : “vehicle_part”,
“id” : “steampunkrig”,
“name” : “Steam Furnace Rig”,
“symbol” : “F”,
“color” : “light_green”,
“broken_symbol” : “#”,
“broken_color” : “red”,
“damage_modifier” : 80,
“durability” : 580,
“size” : 10000,
“epower” : 746,
“fuel_type” : “log”,
“item” : “steampunkrig”,
“difficulty” : 5,
“location” : “fuel_source”,
“flags” : [“FUEL_TANK”],
“breaks_into” : [
{“item”: “steel_lump”, “min”: 12, “max”: 30},
{“item”: “steel_chunk”, “min”: 12, “max”: 30},
{“item”: “scrap”, “min”: 12, “max”: 30}
},

And in the data/item/Vehicle_parts.json, I added this.

{
“type”:“GENERIC”,
“id” : “steampunkrig”,
“name” : “Steam Furnace Rig”,
“description” : “A Steam Furnace that boils water into steam to turn fans to generate power. Uses clean water and logs.”,
“weight” : 58215,
“to_hit” : -4,
“color” : “light_green”,
“symbol” : “f”,
“material” : [“steel”],
“volume” : 6,
“bashing” : 7,
“cutting” : 0,
“category” : “veh_parts”,
“price” : 40000
},

And in Data/Recipes/Recipe_electronics, I added this.

{
“type” : “recipe”,
“result”: “steampunkrig”, (This is right? Put the ID of the item here?)
“category”: “CC_ELECTRONIC”,
“subcategory”: “CSC_ELECTRONIC_PARTS”,
“skill_used”: “mechanics”,
“skills_required”: [“electronics”,7],
“difficulty”: 4,
“time”: 60000, Need to edit this to ten hours. What’s the units here?
“reversible”: false,
“decomp_learn”: 4,
“autolearn”: false,
“book_learn”: [[“textbook_mechanics”, 6] , [“textbook_electronics”, 8] , [“textbook_fabrication”, 8] , [“welding_book”, 5]],
“qualities”:[
{“id”:“HAMMER”,“level”:2,“amount”:1},
{“id”:“SAW_M”,“level”:1,“amount”:1},
{“id”:“WRENCH”,“level”:1,“amount”:1}
], “tools”: [
[
[ “goggles_welding”, -1 ]
],
[
[ “welder”, 100 ],
[ “welder_crude”, 150 ],
[ “toolset”, 150 ]
]
],
“components”: [
[
[ “frame”, 1 ]
],
[
[“soldering_iron”, 1]
],
[
[“steel_lump”, 12],
[ “steel_chunk”, 50 ],
[ “scrap”, 150 ]
[ “copper_wire”, 300]
],
[
[“cable”, 5]
]
]
},

I still can’t find the .json that controls how much fuel engines draws on, etc. I need help! Seems that I’m more than halfway finished here.

It’s a bit more complicated.

You need to mess with src/vehicle.cpp.

Fuel consumption multipliers are hardcoded at the moment, you can’t edit them from json level.

But this is a bit more complex than that, because your engine should also consume water. It might be as easy as adding appropriate "if"s in consume_fuel and fuel_left functions (if fuel_type == wood) or it may require a bit more.