File location: ...\Trainz\world\custom\interiors\
Typical Directory Structure for custom Interior should be:
| World | |||||
| Custom | |||||
| Interior | |||||
| Custom_Interior | |||||
| Config.TXT | |||||
| Custom_interior.IM | |||||
| custom_interior.TGA | |||||
| Env_metal.BMP | |||||
| *.tecture.TXT | |||||
This is the interior of a traincar.
Referenced by the interior tag in a traincar config.TXT file.
In
TRS2004, an interior config.TXT file now has the ability to be setup using a mesh-table. This gives greater control over animations and gives the ground work for script implementation.
In the following example, the generic UP DD40 interior has scripted, animated wipers and a fan, both controlled by switches. Also, when these switches are in the ‘on’ position, a mesh is rendered to represent the switch light coming on.
Actually, the DD40 interior is a great example of what can be done using standard levers alone. The sliding windows, the retractable sun visors and the swivel chair are all ‘levers’. Sure they contain no real function... It adds a bit of fun if anything!
Download DD40 Interior source and in-games files here: http://www.auran.com/TRS2004/downloads/contentcreation/TRS2004_dd40_interior.zip
Remember: Interiors created using a mesh-table cannot be used in pre-TRS2004 versions of
Trainz.
Green is UTC additions
Config.TXT File Example for an Interior -- Diesel |
|
kuid <KUID:-3:10085> kind interior rem DD40 script “DD40Cabin” mesh-table description "" |
| This is the DD40 interior script file. This sets up the fan and wiper animations to be switch controlled and controls the visibility of switchlights. |
Cabin.GS Script File Example for an Interior -- Diesel |
|
include “defaultlocomotivecabin.gs”
class DD40CabinData isclass CabinData class DD40Cabin isclass DefaultLocomotiveCabin // Lights thread void SlowFanDown(void); void UpdateFan(void); float fanSpeed; //! Attach this cabin to a game object (i.e. a locomotive). // get cabin data // ANIMATING FAN cabin_fan_switch.SetValue(value); // ANIMATING WIPER window_wipers.SetValue(value); // SWITCH 3 // SWITCH 4 // SWITCH 5 // SWITCH 6 // SWITCH 7 // SWITCH 8 void UserPressKey(string s) float value; cabin_fan_switch.SetValue(value); UpdateFan(); float value; window_wipers.SetValue(value); UpdateWipers(); public void Init(void) cabin_fan_switch = GetNamedControl(“fan_switch”); cabin_fan_light = GetNamedControl(“switchlight0”); RunAnimation(); } void UserSetControl(CabinControl p_control, float p_value) if (p_control == cabin_fan_switch) if (wantFanAnimation) else if (p_control == window_wipers) if (wantWiperAnimation) } else if (p_control == switch3) light3.SetValue(value); light4.SetValue(value); light5.SetValue(value); else if (p_control == switch6) light6.SetValue(value); else if (p_control == switch7) else if (p_control == switch8) light8.SetValue(value); else } thread void SlowFanDown(void) if (isFanSlowingDown) isFanSlowingDown = true; // Slow it down... Sleep(0.5); fanSpeed = 0.0; thread void SpeedFanUp(void) if (isFanSpeedingUp) isFanSpeedingUp = true; // Speed it up... Sleep(0.5); fanSpeed = 1.0; void UpdateFan(void) if (cd.animatingFan) void UpdateWipers(void) // Don’t need to worry about else, as it will be handled when the loop is done. thread void RunAnimation(void) wait() } }; |
Overview
TRS2004 steam cab interiors have been set-up in generally the same way as diesel and electric cabs with a few additional steam specific features.
Many of the levers and fireplates have several moving objects and required mouse controlled animations. This differed from the usual lever types with only one object, set to rotate around an attachment point.
Not only did the levers need reviewing, but the cab firebox itself had to produce fire and glow variations and the coal shoveller needed to be controlled and linked to the coal requirements also.
Dowload PB15 Interior source and in-games files here: http://www.auran.com/TRS2004/downloads/contentcreation/TRS2004_PB15_interior.zip
See PB15 interior Config.TXT on the following page.
Config.TXT File Example for an Interior -- Steam |
|
kuid <KUID:-3:10191> kind interior script “PB15Cabin” camera -0.769, 0.566, 0.617 obsolete-table soundscript mesh-table description "" |
| This is the PB15 steam interior script file. This script is responsible for mapping all the steam-specific controls to the physics system, and for handling PB-15 specific functions such as the coal shoveling dude. |
Cabin.GS Script File Example for an Interior -- Steam |
|
include “train.gs” include “locomotive.gs” include “cabin.gs” class PB15CabinData isclass CabinData class PB15Cabin isclass Cabin CabinControl speedometer; bool shovellingCoal; thread void RunAnimation(void); public void Init(void) waterGlassLeft_dial = GetNamedControl(“waterglass_left”); firebox = GetNamedControl(“firebox”); waterInjector0 = GetNamedControl(“water_injector_0”); fire_plates = GetNamedControl(“fire_plates”); RunAnimation(); //! Attach this cabin to a game object (i.e. a locomotive). // get cabin data // the default locomotive config uses kPa to describe pressure dial ranges public void Update(void) // if (speedometer) if (main_reservoir_needle) value = GetPressureParam(“brake-cylinder-pressure”); if (no3_pipe_needle) if (brake_pipe_needle) if (equaliser_needle) if (flow_needle) value = loco.GetEngineParam(“current-drawn”); // if (reverser_lever) if (train_brake_lever) if (train_lapbrake_lever) if (loco_brake_lever) if (dynamic_brake_lever) if (wheelslip_light) if (horn_rope) if (pantograph_lever) if (light_switch) if (waterGlassLeft_dial) if (waterGlassRight_dial) // update cabin data cd.fireboxDoorOpen = fire_plates.GetValue() > 0.9; if (firebox) if(fire_plates) firebox.SetNamedValue(“fire-life”, loco.GetEngineParam(“fire-temperature”) / 1600.0); if (boiler_needle) if (waterInjector0) if (waterInjector1) void UserSetControl(CabinControl p_control, float p_value) if (p_control == reverser_lever) // else if (p_control == throttle_lever) else if (p_control == train_brake_lever) else if (p_control == train_lapbrake_lever) else if (p_control == loco_brake_lever) else if (p_control == dynamic_brake_lever) else if (p_control == horn_rope) else if (p_control == pantograph_lever) else if (p_control == light_switch) else if (p_control == regulator_lever) else if (p_control == waterInjector0 or p_control == waterInjector1) void UserPressKey(string s) shovellingCoal = true; thread void RunAnimation(void) wait() on “Animation-Event”, “Coalman_loop2_end”: on “Animation-Event”, “Coalman_loop2shovel_end”: on “Animation-Event”, “Coalman_shovel_end”: on “Animation-Event”, “Coalman_wipebrow_end”: on “Animation-Event”, “Coalman_shovel2loop_end”: on “Animation-Event”, “Coalman_wave_end”: } }; |
| TAGS | DESCRIPTIONS | ||
| script | This refers to the name of the script file and the class of asset it is (the class must match that stated within the script file). | ||
| class | |||
| mesh | Mesh model file (*.IM or *.PM) | ||
| camera | Camera position relative to a.cabfront (0,0,0 = left/right, front/back, up/down) | ||
| cameralist |
Multiple in-cab camera positions relative to a.cabfront. This section ignored by SP3. 0,0,0,0,0 =left/right, front/back, up/down, yaw, pitch To determine these variables add -freeintcam to the trainzoptions.TXT. Pan around the interior using arrow keys and mouse. Co-ordinates at bot./left of screen.. |
||
| cameradefault |
The in-cab camera view Trainz defaults to when entering the cab. (Generally should be the same as that of camera). This section ignored by SP3. |
||
| attachment | Start of attachments section. Specifies additional meshes and types inserted at specified attachment points within the main *.IM model. | ||
| Interior Attachment Types: | |||
| pantograph_lever | Pantograph lever/switch. For raising and lowering pantographs on electric locos. | ||
| horn | Locomotive's horn | ||
| independantbrake_lever | Independent (Loco) brake lever | ||
| reverser_lever | Reverser lever (Forward/Neutral/Reverse) | ||
| throttle_lever | Throttle/power handle | ||
| trainbrake_lever | Train brake lever - self lapping | ||
| trainbrakelap_lever | Train brake lever with lap position | ||
| dynamicbrake_lever | For selecting dynamic brake | ||
| bplocomain_needle | Main reservoir pressure needle | ||
| bploco_equalizer | Equalizing reservoir pressure needle | ||
| bptrainbrakepipe_needle | Brake pipe pressure needle | ||
| bptrainbrakecylinder_needle | Brake cylinder pressure needle | ||
| speedo_needle | Speedometer needle | ||
| ampmeter_needle | Power meter needle | ||
| flow_needle | Flow gauge needle | ||
| windows | Textured mesh with low opacity (semi-transparent) to give impression of refection. This mesh has the same 3D origin point as the main *.IM (or *.PM) model, therefore does not require an attachment point | ||
| wheelslip_light | A warning light mesh that is only visible when the locomotive loses traction. This mesh has the same 3D origin point as the main *.PM model, therefore does not require an attachment point | ||
| switch0, switch1 etc. | Switches | ||
| light_switch | Light switch | ||
| You can also attach miscellaneous meshes to attachment points. They have
no current function in Trainz but they look pretty groovy.
|
|||
|
E.g. a swivel chair |
|||
|
swivel_chair |
|||
| Interior Attachment variables: | |||
| Kinds: | lever | Levers, switches, dials, etc. | |
| needle | Gauge needles | ||
| animated-lever | Animated Levers etc E.g. in steam cabs | ||
| collision-proxy | Mouse collisions for animated levers | ||
| pullrope | Pull rope horn as in the F7 | ||
| light | Wheelslip light | ||
| mesh | Mesh file to be inserted | ||
| att | Attachment point where mesh is inserted. If no attachment point is specified the mesh will be inserted at a.cabfront (the same insertion point as main mesh) | ||
| limits | Mathematical boundaries Trainz uses determine the objects function. These values vary as different objects use different mathematical units. Generally use the default values used in the config.TXT files provided. | ||
| angles | Rotational boundaries in radians relative to its attachment point. Refer to the radian/degree circle diagram below to help you out. | ||
| notches | The position of notches within the angle boundaries. These are represented as decimal points between and including 0 and 1. | ||
| notchheight | The size of the notches specified. | ||
| radius | The notch position relative to the attachment point. | ||
| mousespeed | This controls the use of the mouse on screen. Use this to adjust the push/pull functioning of levers and dials. | ||
| 2. | Doubles mouse speed in default direction | ||
| -0.5 | Inverts mouse direction and halves the speed. | ||
|
-1 |
Inverts mouse direction. | ||
| test-collisions | 0 | Mouse cannot be used for this mesh. Collision mesh used instead. E.g. animated-levers | |
| opacity | Used for the window mesh to give transparency (and the impression of reflectivity). | ||
.