Skip to content

Commit

Permalink
Re-added 720/1 to avoid compatibility breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
audigex committed Jul 13, 2024
1 parent 50b1aa5 commit f21f2f5
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lang/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ STR_BR_710_1 :BR Class 710/1 "Aventra" (4-Car)
STR_BR_710_2_4CAR :BR Class 710/2 "Aventra" (4-Car)
STR_BR_710_2_5CAR :BR Class 710/2 "Aventra" (5-Car)

STR_BR_720 :BR Class 720 "Aventra" (5-Car)
STR_BR_720 :BR Class 720 "Aventra" (5-Car)
STR_BR_720_1 :BR Class 720/1 "Aventra" (10-Car)

STR_BR730_0 :BR Class 730/0 "Aventra" (3-Car)
STR_BR730_2 :BR Class 730/2 "Aventra" (5-Car)
Expand Down
2 changes: 1 addition & 1 deletion src/grf.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ grf {
desc: string(STR_PARAM_DESC_TRAM);
min_value: 0;
max_value: 5;
def_value: 1;
def_value: 0;
names: {
0: string(STR_TRAM_DEFAULT);
1: string(STR_TRAM_TRAINONLY);
Expand Down
1 change: 1 addition & 0 deletions src/sortpurchase.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ sort(FEAT_TRAINS, [
item_br_710_2_5car,
item_BR717,
item_br_720,
item_br_720_1,
item_br730_0,
item_br730_2,
item_br_745,
Expand Down
106 changes: 106 additions & 0 deletions src/trains/emu/720-1.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Choose sprites depending on car position
switch(FEAT_TRAINS, SELF, switch_br_720_1_spriteset_GA, position_in_articulated_veh % 10) {
0: spriteset_br_720_front_GA;
6: spriteset_br_720_middle_panto_GA;
9: spriteset_br_720_rear_GA;
spriteset_br_720_middle_GA;
}

switch(FEAT_TRAINS, SELF, switch_br_720_1_spriteset_C2C, position_in_articulated_veh % 10) {
0: spriteset_br_720_front_C2C;
6: spriteset_br_720_middle_panto_C2C;
9: spriteset_br_720_rear_C2C;
spriteset_br_720_middle_C2C;
}

switch(FEAT_TRAINS, SELF, switch_br_720_1_spriteset, cargo_subtype) {
0: switch_br_720_1_spriteset_GA;
1: switch_br_720_1_spriteset_C2C;
}

switch(FEAT_TRAINS, SELF, switch_br_720_1_subtype_text, cargo_subtype) {
0: return string(str_GreaterAnglia);
1: return string(str_C2C);
return CB_RESULT_NO_TEXT;
}

// Define articulations
switch(FEAT_TRAINS, SELF, switch_br_720_1_articulated, extra_callback_info1) {
// extra_callback_info1 returns the car number, so 1 is the second car, 2 the third, .. so on
// The callback runs this switch until it returns NO_MORE_ARTICULATED_PARTS, which ends the growth
1..9: return item_br_720_1;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS; // Stop adding more cars
}

// Only give particle effects to front/rear cars
switch(FEAT_TRAINS, SELF, switch_br_720_1_particles, position_in_articulated_veh % 10) {
6: visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC , 2, DISABLE_WAGON_POWER);
visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER);
}

// Start/stop switch, used to limit maximum length
switch(FEAT_TRAINS, SELF, switch_br_720_1_start_stop, num_vehs_in_consist) {
return CB_RESULT_NO_TEXT; // Allow any length
}

// Only allow the same train type to be added to itself
switch(FEAT_TRAINS, SELF, switch_br_720_1_can_attach_wagon, vehicle_type_id) {
item_br_720_1: return CB_RESULT_ATTACH_ALLOW;
item_br_720: return CB_RESULT_ATTACH_ALLOW;
return string(STR_CANNOT_ATTACH);
}


item(FEAT_TRAINS, item_br_720_1, 447) {
property {
name: string(STR_BR_720_1);
climates_available: NO_CLIMATE; // available in all climates
introduction_date: date(2020, 03, 17);
model_life: VEHICLE_NEVER_EXPIRES; // keep available forever
vehicle_life: 30; // years after vehicle is deemed "old" and should be replaced
reliability_decay: 0; // dont reduce reliabilty, (will grow from 75% upwards over the years)
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
cost_factor: 170;
loading_speed: 25;
running_cost_factor: 100;
cargo_allow_refit: [];
cargo_disallow_refit: [];

speed: 100 mph;
power: 4200 hp;
cargo_capacity: (1390/10);
weight: 330 ton;

sprite_id: SPRITE_ID_NEW_TRAIN; // required
misc_flags: bitmask(TRAIN_FLAG_MU); // acts as multiple-unit
refit_cost: 0;
track_type: railtype("ELRL");
ai_special_flag: AI_FLAG_PASSENGER; // tell ai that this is a passenger train
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0; // set to 0 otherwise limited to 2 cars only
engine_class: ENGINE_CLASS_ELECTRIC; // even if its 3rd rail, ELECTRIC would give overhead wire effects
extra_power_per_wagon: 0 kW;
tractive_effort_coefficient: 0.3;
air_drag_coefficient: 0.06;
length: 8; // full tile length vehicle
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 2, DISABLE_WAGON_POWER); // visual fx
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}

graphics {
default: switch_br_720_1_spriteset;
purchase: spriteset_br_720_purchase;
cargo_subtype_text: switch_br_720_1_subtype_text;

articulated_part: switch_br_720_1_articulated;
start_stop: switch_br_720_1_start_stop;
can_attach_wagon: switch_br_720_1_can_attach_wagon;
visual_effect_and_powered: switch_br_720_1_particles;
additional_text: string(STR_DSC_BR_720);
cargo_capacity: return(1390/10 * param_pax);
cost_factor: return(GetAdjustedCost(170));
running_cost_factor: return(GetAdjustedCost(100));
}
}

0 comments on commit f21f2f5

Please sign in to comment.