Skip to content

Instantly share code, notes, and snippets.

@cam72cam
Last active January 23, 2024 14:15
Show Gist options
  • Save cam72cam/132c47ff46a3ef942d09991af286ce52 to your computer and use it in GitHub Desktop.
Save cam72cam/132c47ff46a3ef942d09991af286ce52 to your computer and use it in GitHub Desktop.
IR Controls.md

Interactable Controls:

  • Types: https://github.com/TeamOpenIndustry/ImmersiveRailroading/blob/c5c40278a/src/main/java/cam72cam/immersiverailroading/library/ModelComponentType.java#L82-L92
    • Door/Window/Widget available everywhere
    • Everything else is locomotive specific
    • ENGINE_START requires all controls to be in the "ON" position.
    • All other locomotive controls are linked (THROTTLE_1's position is linked to THROTTLE_N's position)
  • Movement
    • Translation:
      • TL_distance_axis (DOOR_1_TL_0.58_X)
      • Can have a TL_ for each axis
    • Scale:
      • SCALE_amount_axis (GAUGE_LIQUID_1_TL_0.15_Y_SCALE_1_Y)
      • Can have a SCALE_ for each axis
    • Rotation:
      • Looks for a group in the part which matches partname_number_ROT_degrees
      • ex: DOOR_1_ROT_-70.5
      • Calculates the "vector" represented by that group (think pin / linkage axis)
      • Rotates the whole part around that group
    • Hide:
      • Looks for a group in the part which contains "HIDE"
  • Modifiers
    • Control Group:
      • Each part stores it's position in a "Control Group"
      • Sometimes these are overridden by locomotive controls (like throttle)
      • Defaults to a unique identifier per part
      • Can be configured using _CG_name (can be any characters other than underscore)
      • Multiple parts can share the same CG (multi part doors for example)
    • Global:
      • Any groups which contain GLOBAL will set the CG on all linked pieces of stock
      • So you could have a WIDGET_1_CG_LEFTDOORS_GLOBAL in the cab that would set all coupled stock with CG_LEFTDOOR to the cab's value
    • Toggle:
      • Any groups which contain TOGGLE will invert the groups value ON/OFF with a single click
      • Useful for breakers / buttons
    • Press:
      • Any groups which contain PRESS will set the value to ON/1 when clicked and back to OFF/0 when released
    • Label:
      • By default text tooltips are turned on (config setting) to help you learn about the new control systems
      • These can be set by using _LABEL_some name
      • Spaces are supported, but blender does not like them
      • Any ^ chars are replaced with so you can define the spaces in blender
  • Doors:
    • Doors have some additional modifiers / functions
    • Any door containing EXTERNAL will allow you to walk off of of on to the side of the stock when open most of the way
    • Any door containing CONNECTING will prevent you from moving to the next car in the train when closed
    • All other doors are cosmetic
  • Sounds:
    • There are some default sounds added to IR locomotives for actuating controls
    • You can define custom control sounds by adding a "controls" block to the "sounds" block in the stock definition.
    • Inside the "controls" block you can add a block for TYPE_ID (DOOR_1, WIDGET_20, THROTTLE_7...)
    • Inside that control block you can specify a "engage", "disengage" and "move" sound (same format as other sounds)
    • You can also specify a "movePercent": number.
      • If this is omitted the move sound is looped. If it is present the move sound is played every time the control moves the give percent (0.1 = 10%)
  • Control Modifiers:
    • properties -> linear_brake_control (brake is a linear drag instead of a increase/decrease drag)
    • properties -> linked_brake_throttle (throttle/brake are the same setting)

Readouts/Gauges:

Lighting:

  • Headlight Flares:
    • HEADLIGHT_NUMBER or HEADLIGHT_FRONT/REAR_NUMBER if it's on an articulated base
    • Defaults to pure white and a standard flare image
    • Looks for 0xFFFFFF (where the F's are a hex color value) and overrides the flare color
    • Can be configured in rolling stock json:
      • Add a "lights" block
      • Add a "HEADLIGHT_number" block to the lights block
      • In this block you can now set
        • "texture" to "immersiverailroading:models/......png"
        • "castsLight": true/false for optifine integration / performance with a lot of lights
        • "reverseColor": "0xFFFFFF" for what color to change to when in reverse
        • "blinkIntervalSeconds": number, for how often to turn the light on and off
        • "blinkoffsetSeconds": number, how long to wait before starting to blink (think ditch lights)
        • "blinkFullBright: true/false, if you should enable/disable the emissive textures in the part when blinking
  • Emissive Features:
    • Any group with FULLBRIGHT in the name will be rendered as "emissive" if the loco/car has power
    • Think fireboxes, lamps, etc...
  • Interior lighting
    • Any groups that have INTERIOR will be softly lit at night to simulate interior lighting
    • Hint: You can make multiple groups for the same DOOR_number and have some interior and others not
    • If older models are used that don't have INTERIOR, IR guesses at what parts should be lit up
  • Controls
    • LCG_somename allows you to have lights turn on when a control group is enabled
    • LINVERT allows you to invert the above control
    • "properties" -> "interior_light_level": 0.0 through 1.0 to specify interior brightness

Reference Models:

  • BR01 (headlights, gauges, doors, widgets, controls)
  • K4 Pacific (headlights, controls, reverser is backwards)
  • Big Boy (headlight on articulated front locomotive)
  • p70 Passenger (doors, interior lighting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment