Mutating vehicle part on activation

I was thinking of making dual purpose parts (ex: a table that can be folded into the floor - real life counterpart folds into the wall, but gamewise it makes more sense) but I’ve been unable to find any example so…

Is there any way to define in the JSON that you can activate a part to change it’s icon and properties in a similar way to what we can do with activable objects? If this part has storage, mutating the part will spill the storage contents to the floor? I am thinking of use_action: {type: transform} but I haven’t seen any example that applies to vehicle parts (that seem to derive actions from flags).

I know that parts can transform terrain but I don’t know if that can be applied to the part itself. Plus the parts that do transform terrain don’t seem to do so if the part stays in place and has to be moving to do so.

You may be going into uncharted territory here.

Well a door changes sprite and function when activated. Lights also sort of transform? Point is, the code to change at least part of the properties is there but I bet it’s not json-ized so unless you can code the best thing you can do is suggest it on github (if it hasn’t been suggested before)

Vehicle parts can’t use item iuse actions. The idea is interesting, but it would need a lot of C++ support behind it.

1 Like

So basically transformation should be implemented via flags, and treat each case individually, right?

No, treating vehicle part transformation as a mass of special cases is not a good idea.

Vehicle part transformations should be done similar to item transformations, with some JSON that describes the transformation and some C++ code that parses that JSON and makes the transformation happen. However, someone needs to write that C++ code before people can start writing the JSON for folding tables and whatnot.

It’s not super complicated C++ code, and I can give some advice and pointers to a programmer who wants to write it. But it’s not code that’s been written and if you add transformation JSON to a vehicle part, it will get ignored.

1 Like