Skip to content

Modder's Guide to Livery Tools

zekew11 edited this page Jan 20, 2023 · 2 revisions

An active livery component is a named livery component in the json file. Most of the information about how the component modifies the aircraft is contained in the title of the component. This is broken into sections. These are described in the order they will appear. We'll keep a work in progress title line as we go in order to show the progression.

"name":


config

To be recognized as an active component, the name of the component must contain "config". Individual "words" in the title are separated by underscores...

"name":"config_

Anything preceding "config" will be ignored by the mod. It is safe for example to write:

"name":"mytexture_config_...


nouns

Next we need to know what objects we'll be modifying. There are some keywords built in for common objects/groups of objects.

  • "wings": the wings. Includes flaps.
  • "tail": the tail
  • "lights": the blinky lights. also the lights that cast light in front of the plane
  • "effects": things like jet exhaust
  • "flaps": the animated flaps
  • "windows": the group of windows lit at nighttime
  • "frontdoors"): doors with "front" in the name
  • "reardoors": doors with "rear" in the name
  • "towbar": The point that towbar attaches for pushback. also includes the point that the aircraft turns around
  • "audio": All the audio emitters
  • "groundequipment": APU/GPU
  • "livery": the entire livery (not the entire aircraft: all the elements loaded as part of this specific livery)
  • "self" : this object (example: make this sprite render as a shadow)

In our example we've shortened a fuselage and want to move the back service vehicles forward. we'll use "reardoors" for this.

"name":"config_reardoors

But wait! there's a problem here. The waste access door, for cabin cleaning, is labeled simply "wasteaccessdoor". Because it doesn't have "rear" in the name, it didn't get included in the reardoors keyword...

exactly

We can find components by name by using the term "exactly" in our config. Every word after an "exactly" will be considered a name of a component to try to find, until the parser sees a second "exactly"

  • You can use "xact" as shorthand for "exactly" to reduce the length of the names.

It is possible to string together multiple nouns, both by keyword and by "exactly" in a single config (as long as you're going to apply the same operation to all of them). This means we can do this:

"name":"config_reardoors_exactly_WasteAccessDoor_exactly_

The above will fetch all the doors with rear in the name by keyword, and then also fetch the WasteAccessDoor by name.

If we wanted, we could continue... "name":"config_reardoors_someotherkeyword_anoutherkeyword_exactly_WasteAccessDoor_someotherexactname_exactly_


verbs

Now we need to actually do something with these objects...

  • "disable" : turns the object(s) off
  • "enable" : turns the object(s) back on
  • "moveabs" : moves all object(s) to the position of this livery component. (if you do this with the door groups you'll be putting all the doors in one place...)
  • "moverel": moves all object(s) by the amount that corresponds to the position of this livery component (preferred for working with groups)
  • "makeshadow": puts these object(s) in the shadow layer
  • "makewindow" : move the object(s) to the windows group and put it in the nonlit layer. For window lights.
  • "makenonlit": puts these object(s) in the nonlit layer (think of it as "not affected by light level")
  • "makeshadow": replaces the aircraft's shadow with this object. Max 1 per livery.

In our example, we want to move a bunch of doors in different positions forward by the same amount. This is done by moverel:

"name":"config_reardoors_exactly_WasteAccessDoor_exactly_moverel",

This line will move the doors by the amount specified as the position of the livery object that it is the name for. It is convenient that we can use the object's position for this. The rest of the object parameters are unimportant: I'd recommend setting it to a slice of your livery that is transparent since it isn't actually trying to be a visual object in of itself.

It is in theory possible to chain verbs the same way as with nouns, though I don't see an application for this at the moment.

		{  
            "name":"config_reardoors_exactly_WasteAccessDoor_exactly_moverel",
            "layerOrder":1,
            "slicePosition":{  
                "x":1,
                "y":1
            },
            "sliceSize":{  
                "x":1,
                "y":1
            },
            "position":{  
                "x":2.4,
                "y":0.0,
                "z":0
            },
            "flip":{  
                "x":0,
                "y":0
            },
            "rotation":0
        },

Parameters

In the future there may be settings that need parameters that aren't already part of a livery. These parameters will come after the last verb. A hypothetical example is below: this is not implemented:

"name":"config_someobject_setparent_groundequipment",


Compatibility

I recognize that I may introduce a headache for modders that distribute primarily on the workshop wherein any livery that uses this framework will be dependent on a non-workshop mod to function fully.

A solution is to put any features that would look "wrong" without my mod on Z-level -9999, where they will be invisible (below the "floor")

            "position":{  
                "x":2.4,
                "y":0.0,
                "z":-9999.0

My mod will automatically search for livery components that are hidden in this way and reset them. None of this exercise is necessary for testing or distributing to those that know they need my mod as a dependency.