rendered paste body/* Define grf */
grf {
grfid: "NML\00";
/* GRF name and description strings are defined in the lang files */
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESC);
/* This is the first version, start numbering at 0. */
version: 0;
min_compatible_version: 0;
}
/* Define a rail type table,
* this allows referring to railtypes
* irrespective of the grfs loaded.
*/
railtypetable {
RAIL, ELRL, MONO, MGLV, "3RDR",
}
/* Basic template for 4 vehicle views */
template tmpl_vehicle_basic(x, y) {
// arguments x, y: coordinates of top-left corner of first sprite
[x, y, 8, 24, -3, -12] //xpos ypos xsize ysize xrel yrel
[x + 9, y, 22, 20, -14, -12]
[x + 32, y, 32, 16, -16, -12]
[x + 65, y, 22, 20, -6, -12]
}
/* Template for a vehicle with only 4 views (symmetric) */
template tmpl_vehicle_4_views(num) {
// argument num: Index in the graphics file, assuming vertical ordering of vehicles
tmpl_vehicle_basic(1, 1 + 32 * num)
}
/* Template for a vehicle with 8 views (non-symmetric) */
template tmpl_vehicle_8_views(num, reversed) {
// argument num: Index in the graphics file, assuming vertical ordering of vehicles
// argument reversed: Reverse visible orientation of vehicle, if set to 1
tmpl_vehicle_basic(reversed ? 89 : 1, 1 + 32 * num)
tmpl_vehicle_basic(reversed ? 1 : 89, 1 + 32 * num)
}
/* Template for a single vehicle sprite */
template tmpl_vehicle_single(num, xsize, ysize, xoff, yoff) {
[1, 1 + 32 * num, xsize, ysize, xoff, yoff]
}
/* C1 */
/* Define the spritesets, these allow referring to these sprites later on */
spriteset (set_smetro_c1_front, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(0, 0) }
spriteset (set_smetro_c1_rear, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(1, 1) }
spriteset (set_smetro_c1_middle, "gfx/swedish_metro.png") { tmpl_vehicle_4_views(4) }
spriteset (set_smetro_c1_purchase, "gfx/swedish_metro.png") { tmpl_vehicle_single(5, 32, 16, -16, -10) }
spriteset (set_smetro_c1_invisible, "gfx/swedish_metro.png") { tmpl_vehicle_single(6, 1, 1, 0, 0) }
/* Choose between front, middle and back parts */
switch(FEAT_TRAINS, SELF, sw_smetro_c1_graphics_b, position_in_consist_from_end) {
0: set_smetro_c1_rear;
set_smetro_c1_middle;
}
switch(FEAT_TRAINS, SELF, sw_smetro_c1_graphics, position_in_consist) {
0: set_smetro_c1_front;
sw_smetro_c1_graphics_b;
}
switch(FEAT_TRAINS, SELF, sw_smetro_c1_traction, position_in_consist) {
0: return 0.2;
return 0.0;
}
/* Define the actual train */
item(FEAT_TRAINS, item_smetro_c1) {
/* Define properties first, make sure to set all of them */
property {
name: string(STR_SMETRO_C1_NAME);
// not available in toyland:
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
introduction_date: date(1949, 1, 1);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 30;
reliability_decay: 20;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
// refitting is done via cargo classes only, no cargoes need explicit enabling/disabling:
//refittable_cargo_types: bitmask();
// It's an intercity train, loading is relatively slow:
loading_speed: 5;
cost_factor: 10;
running_cost_factor: 100; // Changed by callback
sprite_id: SPRITE_ID_NEW_TRAIN;
speed: 80 km/h;
misc_flags: bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU);
refit_cost: 0; //refit costs don't apply to subcargo display
// callback flags are not set manually
track_type: railtype("3RDR"); // from rail type table
ai_special_flag: AI_FLAG_PASSENGER;
power: 324 kW; // Changed by CB
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0;
cargo_capacity: 160; // per part, changed by callback
weight: 30 ton; // Total, changed by callback
ai_engine_rank: 0; // not intended to be used by the ai
engine_class: ENGINE_CLASS_ELECTRIC;
extra_power_per_wagon: 0 kW;
// 4/12 of weight on driving wheels, with a default friction coefficient of 0.3:
tractive_effort_coefficient: sw_smetro_c1_traction;
air_drag_coefficient: 0.1;
//shorten_vehicle: SHORTEN_TO_8_8;
length: 8;
// Overridden by callback to disable for non-powered wagons:
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, ENABLE_WAGON_POWER);
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
/* Define graphics and callbacks
* Setting all callbacks is not needed, only define what is used */
graphics {
default: sw_smetro_c1_graphics;
purchase: set_smetro_c1_purchase;
colour_mapping: palette_2cc(COLOUR_GREEN, COLOUR_DARK_GREEN);
}
}
/* C14 */
/* Define the spritesets, these allow referring to these sprites later on */
spriteset (set_smetro_c14_front, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(7, 0) }
spriteset (set_smetro_c14_rear, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(8, 1) }
spriteset (set_smetro_c14_middle, "gfx/swedish_metro.png") { tmpl_vehicle_4_views(11) }
spriteset (set_smetro_c14_purchase, "gfx/swedish_metro.png") { tmpl_vehicle_single(12, 32, 16, -16, -10) }
spriteset (set_smetro_c14_invisible, "gfx/swedish_metro.png") { tmpl_vehicle_single(13, 1, 1, 0, 0) }
/* Choose between front, middle and back parts
switch(FEAT_TRAINS, SELF, sw_smetro_c14_graphics, position_in_consist) {
7: set_smetro_c14_front;
8: set_smetro_c14_rear;
set_smetro_c14_middle;
}
*/
/* Choose between front, middle and back parts */
switch(FEAT_TRAINS, SELF, sw_smetro_c14_graphics_b, position_in_consist_from_end) {
0: set_smetro_c14_rear;
set_smetro_c14_middle;
}
switch(FEAT_TRAINS, SELF, sw_smetro_c14_graphics, position_in_consist) {
0: set_smetro_c14_front;
sw_smetro_c14_graphics_b;
}
/* Define the actual train */
item(FEAT_TRAINS, item_smetro_c14) {
/* Define properties first, make sure to set all of them */
property {
name: string(STR_SMETRO_C14_NAME);
// not available in toyland:
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
introduction_date: date(1985, 1, 1);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 30;
reliability_decay: 20;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
// refitting is done via cargo classes only, no cargoes need explicit enabling/disabling:
//refittable_cargo_types: bitmask();
// It's an intercity train, loading is relatively slow:
loading_speed: 5;
cost_factor: 20;
running_cost_factor: 50; // Changed by callback
sprite_id: SPRITE_ID_NEW_TRAIN;
speed: 80 km/h;
misc_flags: bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU);
refit_cost: 0; //refit costs don't apply to subcargo display
// callback flags are not set manually
track_type: railtype("3RDR"); // from rail type table
ai_special_flag: AI_FLAG_PASSENGER;
power: 440 kW; // Changed by CB
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0;
cargo_capacity: 156; // per part, changed by callback
weight: 25 ton; // Total, changed by callback
ai_engine_rank: 0; // not intended to be used by the ai
engine_class: ENGINE_CLASS_ELECTRIC;
extra_power_per_wagon: 0 kW;
// 4/12 of weight on driving wheels, with a default friction coefficient of 0.3:
tractive_effort_coefficient: 0.3;
air_drag_coefficient: 0.1;
//shorten_vehicle: SHORTEN_TO_8_8;
length: 8;
// Overridden by callback to disable for non-powered wagons:
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, ENABLE_WAGON_POWER);
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
/* Define graphics and callbacks
* Setting all callbacks is not needed, only define what is used */
graphics {
default: sw_smetro_c14_graphics;
purchase: set_smetro_c14_purchase;
colour_mapping: palette_2cc(COLOUR_BLUE, COLOUR_DARK_BLUE);
}
}
/* C20 */
/* Define the spritesets, these allow referring to these sprites later on */
spriteset (set_smetro_c20_front, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(14, 0) }
spriteset (set_smetro_c20_rear, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(15, 1) }
spriteset (set_smetro_c20_middle, "gfx/swedish_metro.png") { tmpl_vehicle_4_views(18) }
spriteset (set_smetro_c20_purchase, "gfx/swedish_metro.png") { tmpl_vehicle_single(19, 32, 16, -16, -10) }
spriteset (set_smetro_c20_invisible, "gfx/swedish_metro.png") { tmpl_vehicle_single(20, 1, 1, 0, 0) }
/* Choose between front, middle and back parts
switch(FEAT_TRAINS, SELF, sw_smetro_c20_graphics, position_in_consist) {
7: set_smetro_c20_front;
8: set_smetro_c20_rear;
set_smetro_c20_middle;
}
*/
switch(FEAT_TRAINS, SELF, sw_smetro_c20_graphics, position_in_consist % 3) {
0: set_smetro_c20_front;
2: set_smetro_c20_rear;
set_smetro_c20_middle;
}
switch (FEAT_TRAINS, SELF, sw_smetro_c20_articulated, extra_callback_info1) {
1..2: return item_smetro_c20;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS; //stop adding vehicle parts
}
/* Define the actual train */
item(FEAT_TRAINS, item_smetro_c20) {
/* Define properties first, make sure to set all of them */
property {
name: string(STR_SMETRO_C20_NAME);
// not available in toyland:
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
introduction_date: date(1999, 1, 1);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 30;
reliability_decay: 20;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
// refitting is done via cargo classes only, no cargoes need explicit enabling/disabling:
//refittable_cargo_types: bitmask();
// It's an intercity train, loading is relatively slow:
loading_speed: 8;
cost_factor: 50;
running_cost_factor: 30; // Changed by callback
sprite_id: SPRITE_ID_NEW_TRAIN;
speed: 90 km/h;
misc_flags: bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU);
refit_cost: 0; //refit costs don't apply to subcargo display
// callback flags are not set manually
track_type: railtype("3RDR"); // from rail type table
ai_special_flag: AI_FLAG_PASSENGER;
power: 1000 kW; // Changed by CB
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0;
cargo_capacity: 330; // per part, changed by callback
weight: 22 ton; // Total, changed by callback
ai_engine_rank: 0; // not intended to be used by the ai
engine_class: ENGINE_CLASS_ELECTRIC;
extra_power_per_wagon: 0 kW;
// 4/12 of weight on driving wheels, with a default friction coefficient of 0.3:
tractive_effort_coefficient: 2 / 3;
air_drag_coefficient: 0.05;
//shorten_vehicle: SHORTEN_TO_8_8;
length: 6;
// Overridden by callback to disable for non-powered wagons:
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, ENABLE_WAGON_POWER);
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
/* Define graphics and callbacks
* Setting all callbacks is not needed, only define what is used */
graphics {
default: sw_smetro_c20_graphics;
purchase: set_smetro_c20_purchase;
colour_mapping: palette_2cc(COLOUR_GREY, COLOUR_DARK_BLUE);
articulated_part: sw_smetro_c20_articulated;
}
}