Skip to content

Commit b1e661f

Browse files
committed
196 added Chiltern livery and tidied up sprite switches
1 parent a59e74d commit b1e661f

File tree

5 files changed

+46
-16
lines changed

5 files changed

+46
-16
lines changed

build.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ def handle_folder(directory: Path, auto=False):
7575
if (directory / "sprites").exists():
7676
file_list.update(handle_folder(directory / "sprites", auto))
7777
file_list.update(find_files_in_directory(directory / "sprites"))
78-
79-
# Grab the vehicles
78+
8079
file_list.update(find_files_in_directory(directory))
8180

82-
# Automatically look at subdirectories
8381
if auto:
84-
# Don't automatically walk subdirectories, only when auto is set
8582
exclude_dirs = {"append", "prepend", "sprites"}
8683
subdirectories = [p for p in directory.iterdir() if p.is_dir() and p.name not in exclude_dirs]
8784
for subdir in subdirectories:

gfx/DMU/196.png

328 Bytes
Loading

src/trains/diesel_mu/Civity/196-0.pnml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// Choose sprites depending on car position
2-
switch(FEAT_TRAINS, SELF, switch_br_196_0_spriteset, position_in_articulated_veh % 2) {
3-
0: spriteset_BR196_front_WestMidlands;
4-
spriteset_BR196_middle_WestMidlands;
2+
switch(FEAT_TRAINS, SELF, switch_br_196_0_spriteset, cargo_subtype) {
3+
0: sw_BR196_WMR;
4+
1: sw_BR196_Chiltern;
55
}
66

7+
switch(FEAT_TRAINS, SELF, switch_br_196_0_liveries, cargo_subtype) {
8+
0: return string(str_WMR);
9+
1: return string(str_Chiltern);
10+
}
11+
12+
713
// Define articulations
814
switch(FEAT_TRAINS, SELF, switch_br_196_0_articulated, extra_callback_info1) {
915
// extra_callback_info1 returns the car number, so 1 is the second car, .. so on
@@ -66,6 +72,7 @@ item(FEAT_TRAINS, item_br_196_0, 432) {
6672
graphics {
6773
default: switch_br_196_0_spriteset;
6874
purchase: spriteset_BR196_Purchase;
75+
cargo_subtype_text: switch_br_196_0_liveries;
6976

7077
articulated_part: switch_br_196_0_articulated;
7178
start_stop: switch_br_196_0_start_stop;

src/trains/diesel_mu/Civity/196-1.pnml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Choose sprites depending on car position
2-
switch(FEAT_TRAINS, SELF, switch_br_196_1_spriteset, position_in_articulated_veh % 4) {
3-
0: spriteset_BR196_front_WestMidlands;
4-
3: spriteset_BR196_middle_WestMidlands;
5-
spriteset_BR196_rear_WestMidlands;
2+
switch(FEAT_TRAINS, SELF, switch_br_196_1_spriteset, cargo_subtype) {
3+
sw_BR196_WMR;
64
}
75

86
// Define articulations

src/trains/diesel_mu/sprites/196.pnml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,42 @@ spriteset(spriteset_BR196_Purchase, "gfx/DMU/196.png") {
22
template_purchase(0, 0)
33
}
44

5-
spriteset(spriteset_BR196_front_WestMidlands, "gfx/DMU/196.png") {
5+
spriteset(spriteset_BR196_front_WMR, "gfx/DMU/196.png") {
66
template_train32px(0, 13)
77
}
8-
9-
spriteset(spriteset_BR196_middle_WestMidlands, "gfx/DMU/196.png") {
8+
spriteset(spriteset_BR196_rear_WMR, "gfx/DMU/196.png") {
109
template_train32px(0, 39)
1110
}
12-
13-
spriteset(spriteset_BR196_rear_WestMidlands, "gfx/DMU/196.png") {
11+
spriteset(spriteset_BR196_middle_WMR, "gfx/DMU/196.png") {
1412
template_train32px(0, 65)
13+
}
14+
switch(FEAT_TRAINS, SELF, sw_BR196_WMR_sw2, position_in_articulated_veh)
15+
{
16+
0: spriteset_BR196_front_WMR;
17+
spriteset_BR196_middle_WMR;
18+
}
19+
switch(FEAT_TRAINS, SELF, sw_BR196_WMR, position_in_articulated_veh_from_end)
20+
{
21+
0: spriteset_BR196_rear_WMR;
22+
sw_BR196_WMR_sw2;
23+
}
24+
25+
spriteset(spriteset_BR196_front_Chiltern, "gfx/DMU/196.png") {
26+
template_train32px(0, 91)
27+
}
28+
spriteset(spriteset_BR196_rear_Chiltern, "gfx/DMU/196.png") {
29+
template_train32px(0, 117)
30+
}
31+
spriteset(spriteset_BR196_middle_Chiltern, "gfx/DMU/196.png") {
32+
template_train32px(0, 113)
33+
}
34+
switch(FEAT_TRAINS, SELF, sw_BR196_Chiltern_sw2, position_in_articulated_veh)
35+
{
36+
0: spriteset_BR196_front_Chiltern;
37+
spriteset_BR196_middle_Chiltern;
38+
}
39+
switch(FEAT_TRAINS, SELF, sw_BR196_Chiltern, position_in_articulated_veh_from_end)
40+
{
41+
0: spriteset_BR196_rear_Chiltern;
42+
sw_BR196_Chiltern_sw2;
1543
}

0 commit comments

Comments
 (0)