/* 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, } /* 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] } /* Define the spritesets, these allow referring to these sprites later on */ spriteset (set_smetro_front, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(0, 0) } spriteset (set_smetro_rear, "gfx/swedish_metro.png") { tmpl_vehicle_8_views(1, 1) } spriteset (set_smetro_middle, "gfx/swedish_metro.png") { tmpl_vehicle_4_views(4) } spriteset (set_smetro_purchase, "gfx/swedish_metro.png") { tmpl_vehicle_single(5, 32, 16, -16, -10) } spriteset (set_smetro_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_graphics, position_in_consist % 4) { 0: set_smetro_front; 3: set_smetro_rear; set_smetro_middle; } /* Define the actual train */ item(FEAT_TRAINS, item_smetro) { /* Define properties first, make sure to set all of them */ property { name: string(STR_SMETRO_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: 8; cost_factor: 10; running_cost_factor: 10; // 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: ELRL; // 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: 52; // 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: 0.3 / 3; // changed by callback air_drag_coefficient: 0.06; //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_ELECTRIC, 2, DISABLE_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_graphics; purchase: set_smetro_purchase; colour_mapping: palette_2cc(COLOUR_GREEN, COLOUR_DARK_GREEN); } }