Foamcrete modding

I would like to create a tool that works on the same principle as a spraying gun for foamcrete. But it should build a different type of wall and floor, not made of foamcrete. As far as I understand this action is hardcoded into the game. But what if I’m wrong and there are some simple ways to do it without digging into the coding?

You’re correct that you couldn’t use the same principle as the Aftershock foamcrete sprayer, because that relies on hardcoded functions found here. But that doesn’t mean you can’t do it another way, arguably a better way that doesn’t rely on hardcoded functions.

I can think of two ways to do it: either make duplicate construction recipes that use the foamcrete spraygun, or give the foamcrete spraygun an activation menu that lets it spawn a construction at a charge-cost in foamcrete. Either should be doable through json alone, but the former would probably be easier. It might look like this:

“type”: “construction”,
“id”: “constr_scrap_wall_foamcrete”,
“group”: “build_metal_wall_foamcrete”,
“category”: “CONSTRUCT”,
“required_skills”: [ [ “fabrication”, 4 ] ],
“time”: “9 m”,
“tools”: [ [ [ “foam_sprayer”, 10 ] ] ],
“pre_terrain”: “t_pit_shallow”,
“post_terrain”: “t_scrap_wall”

Whereas the use-action implementation might look something like:

“type”: “ter_furn_transform”,
“id”: “scrap_wall_foamcrete”,
“furniture”: [
“result”: “t_scrap_wall”,
“valid_furniture”: [ “f_null” ],
“message”: “You spray a foamcrete into the shape of a wall and it quickly hardens until it’s indistinguishable from steel”

(My construction recipe example is based on the construction recipe for a scrap wall, my ter_furn_transform example is based on the Magiclysm Earthshaper’s spell Pillar of Stone, both are just rough draft examples that would probably need further alterations)

And then you would just put a use-action in the sprayer’s json entry giving it a use action that requires however many units of foamcrete ammo in order to call that function. I’m not 100% sure on how all of that works, and there are limits to what you can do with use_actions without relying on hardcoded functionality, but it should be possible to make it work. It’s just a bit more complicated than just using a construction recipe.

Causing the result to not be made out of foamcrete is trivial, the result will be whatever you put in the recipe as the result. It’s not like crafting recipes where there’s some level of automatic inheritance. At least I don’t think there is.