Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //switch to hide the 4th part if a 3part EMU is chosen
- switch(FEAT_TRAINS, SELF, sw_cfl2200_graphics_middle, ((position_in_consist % 4) == 2) && (cargo_subtype == 0)) {
- 1: set_cfl2200_invisible;
- set_cfl2200_middle;
- }
- /* Choose between front, middle and back parts */
- switch(FEAT_TRAINS, SELF, sw_cfl2200_graphics, position_in_consist % 4) {
- 3: set_cfl2200_rear_lighted;
- 0: set_cfl2200_front_lighted;
- sw_cfl2200_graphics_middle;
- }
- //articulated
- switch(FEAT_TRAINS, SELF, sw_cfl2200_articulated_part, extra_callback_info1) {
- 1..3: return item_cfl2200;
- return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_start_stop, num_vehs_in_consist) {
- /* Vehicles may be coupled to a maximum of 4 units (12 cars) */
- 1 .. 12: return CB_RESULT_NO_TEXT;
- return string(STR_CFL2200_CANNOT_START);
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_can_attach_wagon, vehicle_type_id) {
- /* SELF refers to the wagon here, check that it's an ICM */
- item_cfl2200: return CB_RESULT_ATTACH_ALLOW;
- return string(STR_CFL2200_CANNOT_ATTACH_OTHER);
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_cargo_subtype_text, cargo_subtype) {
- 0: return string(STR_CFL2200_SUBTYPE_3_PART);
- 1: return string(STR_CFL2200_SUBTYPE_4_PART);
- return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
- }
- /* --- Shorten vehicle callback --- */
- switch(FEAT_TRAINS, SELF, sw_cfl2200_shorten_3_part_vehicle, position_in_consist % 4) {
- /* In the three part version, shorten the 2nd vehicle to 7/8 and the 3rd to 1/8
- * The rear (1/8) part is then made invisisble */
- 1: return 7;
- 2: return 1;
- return 8;
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_shorten_vehicle, cargo_subtype) {
- 0: sw_cfl2200_shorten_3_part_vehicle;
- return 8; // 4-part vehicle needs no shortening
- }
- // 4parts are heavier than 3
- switch(FEAT_TRAINS, SELF, sw_cfl2200_weight, cargo_subtype) {
- 0: return 193; //ton, 3 part train
- return 252; //ton, 4 part train
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_te, cargo_subtype) {
- /* Base TE coefficient = 0.3
- * 3 parts: 4/12 of weight on driving wheels
- * 4 parts: 6/16 of weight on driving wheels */
- 0: return int(0.3 * 255 / 3);
- return int(0.3 * 255 * 3 / 8);
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_rc, cargo_subtype) {
- return (cargo_subtype == 1) ? 150 : 100;
- }
- switch(FEAT_TRAINS, SELF, sw_cfl2200_capac, cargo_subtype) {
- return (cargo_subtype == 0) && ((position_in_consist % 4) == 2) ? 0 : 110;
- }
- /* Power, weight and TE are all applied to the front vehicle only */
- switch(FEAT_TRAINS, SELF, sw_cfl2200_power, cargo_subtype) {
- 0: return 3160; // kW -> hp
- return 3160; // kW -> hp
- }
- /* Define the actual train */
- item(FEAT_TRAINS, item_cfl2200) {
- /* Define properties first, make sure to set all of them */
- property {
- name: string(STR_CFL2200_NAME);
- climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
- introduction_date: date(2004, 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 cargo types need explicit enabling/disabling
- // It's an intercity train, loading is relatively slow:
- loading_speed: 40;
- cost_factor: 50;
- running_cost_factor: 100; //changed by CB, in gfx
- sprite_id: SPRITE_ID_NEW_TRAIN;
- speed: 160 km/h; // actually 140, but there are rounding errors
- //misc_flags: bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU);
- refit_cost: 0; //refit costs don't apply to subcargo display
- cargo_capacity: 110; //change by CB , change in gfx
- track_type: ELRL; // from rail type table
- ai_special_flag: AI_FLAG_PASSENGER;
- power: 3160 hp; //cb in gfx
- extra_power_per_wagon: 0 kW;
- running_cost_base: RUNNING_COST_ELECTRIC;
- dual_headed: 0;
- ai_engine_rank: 0; // not intended to be used by the ai
- engine_class: ENGINE_CLASS_ELECTRIC;
- weight: 193 ton; // Total, changed by callback in gfx
- extra_weight_per_wagon: 0 ton;
- // 4/12 of weight on driving wheels, with a default friction coefficient of 0.3:
- tractive_effort_coefficient: 0.3/3; // changed by callback in gfx
- air_drag_coefficient: 0.06;
- // Overridden by callback to disable for non-powered wagons:
- visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 2, DISABLE_WAGON_POWER);
- bitmask_vehicle_info: 0;
- }
- /* Define graphics and callbacks
- * Setting all callbacks is not needed, only define what is used */
- graphics {
- default: sw_cfl2200_graphics;
- purchase: set_cfl2200_purchase;
- articulated_part: sw_cfl2200_articulated_part;
- cargo_subtype_text: sw_cfl2200_cargo_subtype_text;
- start_stop: sw_cfl2200_start_stop;
- additional_text: return string(STR_CFL2200_ADDITIONAL_TEXT);
- can_attach_wagon: sw_cfl2200_can_attach_wagon;
- length: sw_cfl2200_shorten_vehicle;
- running_cost_factor: return (cargo_subtype == 1) ? 150 : 100;
- cargo_capacity: return (cargo_subtype == 0) && ((position_in_consist % 4) == 2) ? 0 : 110;
- purchase_cargo_capacity: 110;
- /* Only the front vehicle has power */
- power: sw_cfl2200_power;
- /* Only the front vehicle has weight */
- weight: sw_cfl2200_weight;
- /* Only the front vehicle has TE */
- tractive_effort_coefficient: sw_cfl2200_te;
- /* Only 1/3 of the weight is on the driving weels. */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement