// add the units to articulated consist switch (FEAT_TRAINS, SELF, peasweep_articulated_cb_switch, extra_callback_info1) { 0: return peasweep; 1: return peasweep_1; return CB_RESULT_NO_MORE_ARTICULATED_PARTS; } // default spriteset templates template spriteset_template_asymmetric_unreversed_peasweep_unflipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, y, 8, 29, -3, -16 ] [73, y, 26, 24, -10, -18 ] [104, y, 33, 16, -8, -12 ] [143, y, 26, 24, -4, -16 ] [180, y, 8, 29, -3, -14 ] [193, y, 26, 24, -14, -16 ] [224, y, 33, 16, -16, -12 ] [263, y, 26, 24, -8, -19 ] } template spriteset_template_asymmetric_reversed_peasweep_unflipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [180, y, 8, 29, -3, -16 ] [193, y, 26, 24, -10, -18 ] [224, y, 33, 16, -8, -12 ] [263, y, 26, 24, -4, -16 ] [60, y, 8, 29, -3, -14 ] [73, y, 26, 24, -14, -16 ] [104, y, 33, 16, -16, -12 ] [143, y, 26, 24, -8, -19 ] } template spriteset_template_asymmetric_unreversed_peasweep_flipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, y, 8, 29, -3, -14 ] [73, y, 26, 24, -14, -16 ] [104, y, 33, 16, -16, -12 ] [143, y, 26, 24, -8, -19 ] [180, y, 8, 29, -3, -16 ] [193, y, 26, 24, -10, -18 ] [224, y, 33, 16, -8, -12 ] [263, y, 26, 24, -4, -16 ] } template spriteset_template_asymmetric_reversed_peasweep_flipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [180, y, 8, 29, -3, -14 ] [193, y, 26, 24, -14, -16 ] [224, y, 33, 16, -16, -12 ] [263, y, 26, 24, -8, -19 ] [60, y, 8, 29, -3, -16 ] [73, y, 26, 24, -10, -18 ] [104, y, 33, 16, -8, -12 ] [143, y, 26, 24, -4, -16 ] } // buy menu spriteset template template spriteset_template_purchase_peasweep(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [107, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] // allow for buffers/couplings being 1px additional to the unit (they overlap in consists, but show in buy menu) [360, y, 49, 16, -24, -11 ] [60, 10, 1, 1, 0, 0] } // default graphics chain spriteset(peasweep_ss_unreversed_unflipped, "generated/graphics/peasweep.png") { spriteset_template_asymmetric_unreversed_peasweep_unflipped(10 + 0) } spriteset(peasweep_ss_pantographs_down_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_unflipped(10 + 0) } spriteset(peasweep_ss_pantographs_up_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_unflipped(40 + 0) } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_pantographs_unreversed_unflipped, current_railtype) { ELRL: return peasweep_ss_pantographs_up_unreversed_unflipped; return peasweep_ss_pantographs_down_unreversed_unflipped; } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_vehicle_layers_unreversed_unflipped, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_ss_unreversed_unflipped; 1: return peasweep_switch_graphics_pantographs_unreversed_unflipped; } spriteset(peasweep_ss_unreversed_flipped, "generated/graphics/peasweep.png") { spriteset_template_asymmetric_unreversed_peasweep_flipped(10 + 0) } spriteset(peasweep_ss_pantographs_down_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_flipped(10 + 0) } spriteset(peasweep_ss_pantographs_up_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_flipped(40 + 0) } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_pantographs_unreversed_flipped, current_railtype) { ELRL: return peasweep_ss_pantographs_up_unreversed_flipped; return peasweep_ss_pantographs_down_unreversed_flipped; } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_vehicle_layers_unreversed_flipped, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_ss_unreversed_flipped; 1: return peasweep_switch_graphics_pantographs_unreversed_flipped; } // handle user flipped state switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_unreversed, vehicle_is_flipped) { 1: return peasweep_switch_graphics_vehicle_layers_unreversed_flipped; return peasweep_switch_graphics_vehicle_layers_unreversed_unflipped; } random_switch (FEAT_TRAINS, FORWARD_SELF(0), peasweep_switch_graphics_vehicle) { 1: return peasweep_switch_graphics_unreversed; } // buy menu graphics chain spriteset(peasweep_ss_purchase, "generated/graphics/peasweep.png") { spriteset_template_purchase_peasweep(10) } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_purchase, 0) { return peasweep_ss_purchase; } switch (FEAT_TRAINS, SELF, peasweep_switch_set_layers_register_more_sprites, STORE_TEMP(CB_FLAG_MORE_SPRITES | PALETTE_USE_DEFAULT, 0x100)) { return peasweep_switch_graphics_vehicle; } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_rear_light, position_in_consist_from_end) { 0: return ss_rear_light_24px; return ss_rear_light_empty; } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_layer_rear_light, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) { return peasweep_switch_graphics_rear_light; } switch (FEAT_TRAINS, SELF, peasweep_switch_graphics, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_switch_set_layers_register_more_sprites; 1: return peasweep_switch_set_layers_register_more_sprites; return peasweep_switch_graphics_layer_rear_light; } // -- smoke etc -- // switch (FEAT_TRAINS, SELF, peasweep_switch_visual_effect_and_powered_by_variant_unreversed, current_railtype) { return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER); } item(FEAT_TRAINS, peasweep, 1750) { property { name: string(STR_NAME_CONSIST_PARENTHESES, string(STR_NAME_peasweep), string(STR_NAME_SUFFIX_ELECTRIC)); climates_available: NO_CLIMATE; // nml constant engine_class: ENGINE_CLASS_ELECTRIC; visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER); introduction_date: date(1947,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway cargo_capacity: 0; sprite_id: SPRITE_ID_NEW_TRAIN; //enable new graphics - nml constant power: 3600hp; speed: 75mph; weight: 150ton; tractive_effort_coefficient: 0.3; cost_factor: 0; // use the CB to set this, the prop is capped to max 255, cb is 32k running_cost_base: RUNNING_COST_ELECTRIC; running_cost_factor: 0; // use the CB to set this, the prop is capped to max 255, cb is 32k refit_cost: 0; // btw this needs to be 0 if we want autorefit without using cb refittable_cargo_classes: bitmask(); non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support cargo_allow_refit: []; cargo_disallow_refit: []; cargo_age_period: 185; misc_flags: bitmask(TRAIN_FLAG_2CC,TRAIN_FLAG_SPRITE_STACK,TRAIN_FLAG_AUTOREFIT); // nml constants dual_headed: 0; model_life: 48; retire_early: -10; reliability_decay: 20; // default value vehicle_life: 40; length: 6; track_type: ELRL; } graphics { default: peasweep_switch_graphics; purchase: peasweep_switch_graphics_purchase; cost_factor: 121; // CB used as it is capped to max 32k, prop is only 255 running_cost_factor: 87; // CB used as it is capped to max 32k, prop is only 255 visual_effect_and_powered: peasweep_switch_visual_effect_and_powered_by_variant_unreversed; articulated_part: peasweep_articulated_cb_switch; } } if (param[1]==0) { item(FEAT_TRAINS, peasweep, 1750) { property { climates_available: ALL_CLIMATES; } } } // -- end 1750 -- // default spriteset templates template spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, y, 8, 29, -3, -16 ] [73, y, 26, 24, -10, -18 ] [104, y, 33, 16, -8, -12 ] [143, y, 26, 24, -4, -16 ] [180, y, 8, 29, -3, -14 ] [193, y, 26, 24, -14, -16 ] [224, y, 33, 16, -16, -12 ] [263, y, 26, 24, -8, -19 ] } template spriteset_template_asymmetric_reversed_peasweep_1_unflipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [180, y, 8, 29, -3, -16 ] [193, y, 26, 24, -10, -18 ] [224, y, 33, 16, -8, -12 ] [263, y, 26, 24, -4, -16 ] [60, y, 8, 29, -3, -14 ] [73, y, 26, 24, -14, -16 ] [104, y, 33, 16, -16, -12 ] [143, y, 26, 24, -8, -19 ] } template spriteset_template_asymmetric_unreversed_peasweep_1_flipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, y, 8, 29, -3, -14 ] [73, y, 26, 24, -14, -16 ] [104, y, 33, 16, -16, -12 ] [143, y, 26, 24, -8, -19 ] [180, y, 8, 29, -3, -16 ] [193, y, 26, 24, -10, -18 ] [224, y, 33, 16, -8, -12 ] [263, y, 26, 24, -4, -16 ] } template spriteset_template_asymmetric_reversed_peasweep_1_flipped(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [180, y, 8, 29, -3, -14 ] [193, y, 26, 24, -14, -16 ] [224, y, 33, 16, -16, -12 ] [263, y, 26, 24, -8, -19 ] [60, y, 8, 29, -3, -16 ] [73, y, 26, 24, -10, -18 ] [104, y, 33, 16, -8, -12 ] [143, y, 26, 24, -4, -16 ] } // buy menu spriteset template template spriteset_template_purchase_peasweep_1(y) { //[left_x, upper_y, width, height, offset_x, offset_y] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [107, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] [60, 10, 1, 1, 0, 0] // allow for buffers/couplings being 1px additional to the unit (they overlap in consists, but show in buy menu) [360, y, 49, 16, -24, -11 ] [60, 10, 1, 1, 0, 0] } // default graphics chain spriteset(peasweep_1_ss_unreversed_unflipped, "generated/graphics/peasweep.png") { spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(10 + 0) } spriteset(peasweep_1_ss_pantographs_down_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(10 + 0) } spriteset(peasweep_1_ss_pantographs_up_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(40 + 0) } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_pantographs_unreversed_unflipped, current_railtype) { ELRL: return peasweep_1_ss_pantographs_up_unreversed_unflipped; return peasweep_1_ss_pantographs_down_unreversed_unflipped; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_vehicle_layers_unreversed_unflipped, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_1_ss_unreversed_unflipped; 1: return peasweep_1_switch_graphics_pantographs_unreversed_unflipped; } spriteset(peasweep_1_ss_unreversed_flipped, "generated/graphics/peasweep.png") { spriteset_template_asymmetric_unreversed_peasweep_1_flipped(10 + 0) } spriteset(peasweep_1_ss_pantographs_down_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_1_flipped(10 + 0) } spriteset(peasweep_1_ss_pantographs_up_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") { spriteset_template_asymmetric_unreversed_peasweep_1_flipped(40 + 0) } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_pantographs_unreversed_flipped, current_railtype) { ELRL: return peasweep_1_ss_pantographs_up_unreversed_flipped; return peasweep_1_ss_pantographs_down_unreversed_flipped; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_vehicle_layers_unreversed_flipped, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_1_ss_unreversed_flipped; 1: return peasweep_1_switch_graphics_pantographs_unreversed_flipped; } // handle user flipped state switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_unreversed, vehicle_is_flipped) { 1: return peasweep_1_switch_graphics_vehicle_layers_unreversed_flipped; return peasweep_1_switch_graphics_vehicle_layers_unreversed_unflipped; } random_switch (FEAT_TRAINS, FORWARD_SELF(1), peasweep_1_switch_graphics_vehicle) { 1: return peasweep_1_switch_graphics_unreversed; } // buy menu graphics chain spriteset(peasweep_1_ss_purchase, "generated/graphics/peasweep.png") { spriteset_template_purchase_peasweep_1(10) } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_purchase, 0) { return peasweep_1_ss_purchase; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_set_layers_register_more_sprites, STORE_TEMP(CB_FLAG_MORE_SPRITES | PALETTE_USE_DEFAULT, 0x100)) { return peasweep_1_switch_graphics_vehicle; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_rear_light, position_in_consist_from_end) { 0: return ss_rear_light_24px; return ss_rear_light_empty; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_layer_rear_light, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) { return peasweep_1_switch_graphics_rear_light; } switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics, getbits(extra_callback_info1, 8, 8)) { 0: return peasweep_1_switch_set_layers_register_more_sprites; 1: return peasweep_1_switch_set_layers_register_more_sprites; return peasweep_1_switch_graphics_layer_rear_light; } // -- smoke etc -- // switch (FEAT_TRAINS, SELF, peasweep_1_switch_visual_effect_and_powered_by_variant_unreversed, current_railtype) { return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER); } item(FEAT_TRAINS, peasweep_1, 1751) { property { name: string(STR_NAME_CONSIST_PARENTHESES, string(STR_NAME_peasweep), string(STR_NAME_SUFFIX_ELECTRIC)); climates_available: NO_CLIMATE; // nml constant engine_class: ENGINE_CLASS_ELECTRIC; visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER); introduction_date: date(1947,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway cargo_capacity: 0; sprite_id: SPRITE_ID_NEW_TRAIN; //enable new graphics - nml constant power: 3600hp; speed: 75mph; weight: 150ton; tractive_effort_coefficient: 0.3; cost_factor: 0; // use the CB to set this, the prop is capped to max 255, cb is 32k running_cost_base: RUNNING_COST_ELECTRIC; running_cost_factor: 0; // use the CB to set this, the prop is capped to max 255, cb is 32k refit_cost: 0; // btw this needs to be 0 if we want autorefit without using cb refittable_cargo_classes: bitmask(); non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support cargo_allow_refit: []; cargo_disallow_refit: []; cargo_age_period: 185; misc_flags: bitmask(TRAIN_FLAG_2CC,TRAIN_FLAG_SPRITE_STACK,TRAIN_FLAG_AUTOREFIT); // nml constants dual_headed: 0; model_life: 48; retire_early: -10; reliability_decay: 20; // default value vehicle_life: 40; length: 6; track_type: ELRL; } graphics { default: peasweep_1_switch_graphics; purchase: peasweep_1_switch_graphics_purchase; cost_factor: 121; // CB used as it is capped to max 32k, prop is only 255 running_cost_factor: 87; // CB used as it is capped to max 32k, prop is only 255 visual_effect_and_powered: peasweep_1_switch_visual_effect_and_powered_by_variant_unreversed; } } // -- end 1751 --