In my mod I have access to a LuaEntity from an event in the control stage, which for this example let's say is a spider-vehicle. I'm trying to somehow access all the information about this entity, which can be found in the the runtime-api.json file in the docs.
I've written a small script to extract all the methods and attributes from each entity and sort them into a lua-file which I can then use to look up all attributes and methods of an entity in my mod. The problem is that in the JSON file the data is related to "subclasses", for instance SpiderVehicle (example below). The LuaEntity provided is just that, a LuaEntity. So entity.object_name is LuaEntity, while entity.name is spider-vehicle. So how do I connect a "class name"/SpiderVehicle with a "dash delimited name"/spider-vehicle?
I've found that the prototype in prototype-api.json has a "typename" field which contains a dash delimited name, but I've got no prototype name available (I think?) for my LuaEntity. I guess I could do some converting to camelcase and add Prototype as a suffix but that seems like a solution that could break easily, not sure how ridgid that would be. Any suggestions?
Example of attribute autopilot_destinations for SpiderVehicle in runtime-api.json:
Code: Select all
{
"name": "autopilot_destinations",
"order": 161,
"description": "The queued destination positions of spidertron's autopilot.",
"subclasses": [
"SpiderVehicle"
],
"read_type": {
"complex_type": "array",
"value": "MapPosition"
},
"optional": false
},