I'm currently working on a massive new set, which builds on my old Generic European Set. I have coded four new railtypes, each representing a different voltage system used in Europe:
1500V DC (DC15)
3000V DC (DC30)
15KV AC (ELAC)
25KV AC (ELRL) - regular electric rail; default electrics run on this
This is working fine so far - until I tried to code a multi-system locomotive.
Code: Select all
track_type: bitmask(ELRL, ELAC, DC15, DC30);
I then tried several other things, the one that seemed to work best out of them was creating another railtype that was compatible with all four electrified tracktypes. However, it clutters up the railtypes menu, and it doesn't appear to be possible for a locomotive to run on only ELAC and ELRL, but not the DC ones, for example.
Here is the code for the railtypes:
Code: Select all
item(FEAT_RAILTYPES) {
property {
label: "ELAC";
name: string(STR_AC15);
menu_text: string(STR_AC15);
build_window_caption: string(STR_AC15_BUILD);
autoreplace_text: string(STR_AC15_AUTOREPLACE);
new_engine_text: string(STR_AC15_NEW_ENGINE);
// introduction_date: date(1950,1,1);
compatible_railtype_list: ["RAIL","ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["ELAC"];
railtype_flags: bitmask(RAILTYPE_FLAG_CATENARY);
curve_speed_multiplier: 1;
// station_graphics: RAILTYPE_STATION_RAIL;
construction_cost: 2;
// speed_limit: 230 km/h;
acceleration_model: ACC_MODEL_RAIL;
sort_order: 18;
}
graphics {
CATENARY_PYLONS: elac_pylons_group;
}
}
item(FEAT_RAILTYPES) {
property {
label: "DC15";
name: string(STR_DC15);
menu_text: string(STR_DC15);
build_window_caption: string(STR_DC15_BUILD);
autoreplace_text: string(STR_DC15_AUTOREPLACE);
new_engine_text: string(STR_DC15_NEW_ENGINE);
// introduction_date: date(1950,1,1);
compatible_railtype_list: ["RAIL","ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["DC15"];
railtype_flags: bitmask(RAILTYPE_FLAG_CATENARY);
curve_speed_multiplier: 1;
// station_graphics: RAILTYPE_STATION_RAIL;
construction_cost: 2;
// speed_limit: 160 km/h;
acceleration_model: ACC_MODEL_RAIL;
sort_order: 16;
}
graphics {
CATENARY_PYLONS: dc15_pylons_group;
CATENARY_WIRE: dc_wire_group;
}
}
item(FEAT_RAILTYPES) {
property {
label: "DC30";
name: string(STR_DC30);
menu_text: string(STR_DC30);
build_window_caption: string(STR_DC30_BUILD);
autoreplace_text: string(STR_DC30_AUTOREPLACE);
new_engine_text: string(STR_DC30_NEW_ENGINE);
// introduction_date: date(1950,1,1);
compatible_railtype_list: ["RAIL","ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["DC30"];
railtype_flags: bitmask(RAILTYPE_FLAG_CATENARY);
curve_speed_multiplier: 1;
// station_graphics: RAILTYPE_STATION_RAIL;
construction_cost: 2;
// speed_limit: 160 km/h;
acceleration_model: ACC_MODEL_RAIL;
sort_order: 17;
}
graphics {
CATENARY_PYLONS: dc30_pylons_group;
CATENARY_WIRE: dc_wire_group;
}
}
item(FEAT_RAILTYPES) {
property {
label: "RAIL";
compatible_railtype_list: ["TRIF","RAIL","ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["TRIF","ELRL","ELAC","DC15","DC30"];
}
}
item(FEAT_RAILTYPES) {
property {
label: "ELRL";
name: string(STR_AC25);
menu_text: string(STR_AC25);
build_window_caption: string(STR_AC25_BUILD);
autoreplace_text: string(STR_AC25_AUTOREPLACE);
new_engine_text: string(STR_AC25_NEW_ENGINE);
compatible_railtype_list: ["RAIL","ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["ELRL"];
}
}
/*
item(FEAT_RAILTYPES) {
property {
label: "MULT";
name: string(N_A);
menu_text: string(N_A);
build_window_caption: string(N_A);
autoreplace_text: string(N_A);
new_engine_text: string(N_A);
compatible_railtype_list: ["ELRL","ELAC","DC15","DC30"];
powered_railtype_list: ["ELRL","ELAC","DC15","DC30"];
introduction_date: date(9999,1,1);
speed_limit: 1;
construction_cost: 65525;
}
}
*/
Code: Select all
switch (FEAT_TRAINS, SELF, ms_train_power_switch, current_railtype) {
ELRL: return 2000;
ELAC: return 2000;
DC30: return 1500;
DC15: return 1500;
// RAIL: return 0; //train just coasts to a halt on unpowered track
CB_FAILED;
}
switch (FEAT_TRAINS, SELF, ms_train_speed_switch, current_railtype) {
ELRL: return 230;
ELAC: return 200;
DC30: return 160;
DC15: return 160;
// RAIL: return 1; //makes game crash when engine enters RAIL
// RAIL: return 0; //game says max speed is 65,535 km/h
CB_FAILED;
}
switch (FEAT_TRAINS, SELF, ms_railtype_switch, extra_callback_info1) {
PROP_TRAINS_POWER: ms_train_power_switch;
PROP_TRAINS_SPEED: ms_train_speed_switch;
CB_FAILED;
}
switch (FEAT_TRAINS, SELF, ms_train_switch, current_callback) {
VEH_CB_VEHICLE_PROPERTIES: ms_railtype_switch;
test_train_group;
}
//Testing Multi-System Train
item(FEAT_TRAINS, ms_train) {
property {
sprite_id: SPRITE_ID_NEW_TRAIN;
misc_flags: bitmask(TRAIN_FLAG_2CC);
name: string(STR_NAME_TEST_TRAIN_4);
climates_available: ALL_CLIMATES;
track_type: bitmask(ELRL, ELAC, DC15, DC30);
introduction_date: date(1950,1,1);
speed: 230 km/h;
tractive_effort_coefficient: 0.5;
power: 2000 hp;
weight: 100;
dual_headed: 0;
engine_class: ENGINE_CLASS_ELECTRIC;
}
graphics {
ms_train_switch;
}
}

Thanks,
Jake