---- vanilla NML ---- switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_0, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 5; bitmask(CC_ARMOURED): return 5; return 3; } switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_1, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 7; bitmask(CC_ARMOURED): return 7; return 4; } switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_2, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 9; bitmask(CC_ARMOURED): return 9; return 5; } switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed, param_adjust_vehicle_capacity) { 0: acton_switch_loading_speed_by_cargo_0; 1: acton_switch_loading_speed_by_cargo_1; 2: acton_switch_loading_speed_by_cargo_2; } switch (FEAT_ROADVEHS, SELF, acton_create_visual_effect, 0) { return 0; } item(FEAT_ROADVEHS, acton, 600) { property { name: string(STR_NAME_ACTON, string(STR_NAME_SUFFIX_COACH)); cargo_capacity: 27; sprite_id: SPRITE_ID_NEW_ROADVEH; //enable new graphics - nml constant introduction_date: date(1990,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway power: 360hp; speed: 90mph; weight: 8.0ton; tractive_effort_coefficient: 0.7; cost_factor: 44.3; running_cost_base: RUNNING_COST_ROADVEH; running_cost_factor: 88.6; model_life: VEHICLE_NEVER_EXPIRES; vehicle_life: 40; reliability_decay: 20; // default value retire_early: -10; sound_effect: SOUND_BUS_START_PULL_AWAY; refit_cost: 0; // this needs to be 0 if we want autorefit without using cb refittable_cargo_classes: bitmask(CC_PASSENGERS); non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support cargo_allow_refit: []; cargo_disallow_refit: []; default_cargo_type: PASS; cargo_age_period: 370; misc_flags: bitmask(ROADVEH_FLAG_2CC,ROADVEH_FLAG_AUTOREFIT); // nml constants length: 7; effect_spawn_model: EFFECT_SPAWN_MODEL_DIESEL; } graphics { cargo_capacity: acton_switch_cargo_capacity; purchase_cargo_capacity: acton_switch_cargo_capacity; loading_speed: acton_switch_loading_speed; default: acton_switch_graphics; purchase: acton_sg_purchase; create_effect: acton_create_visual_effect; } } if (param[1]==0) { item(FEAT_ROADVEHS, acton, 600) { property { climates_available: ALL_CLIMATES; } } } ---- some form of scoping ---- scope(FEAT_ROADVEHS, acton, 600) { switch (SELF, switch_loading_speed_by_cargo_0, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 5; bitmask(CC_ARMOURED): return 5; return 3; } switch (SELF, switch_loading_speed_by_cargo_1, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 7; bitmask(CC_ARMOURED): return 7; return 4; } switch (SELF, switch_loading_speed_by_cargo_2, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) { bitmask(CC_MAIL): return 9; bitmask(CC_ARMOURED): return 9; return 5; } switch (SELF, switch_loading_speed, param_adjust_vehicle_capacity) { 0: switch_loading_speed_by_cargo_0; 1: switch_loading_speed_by_cargo_1; 2: switch_loading_speed_by_cargo_2; } switch (SELF, create_visual_effect, 0) { return 0; } property { name: string(STR_NAME_ACTON, string(STR_NAME_SUFFIX_COACH)); cargo_capacity: 27; sprite_id: SPRITE_ID_NEW_ROADVEH; //enable new graphics - nml constant introduction_date: date(1990,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway power: 360hp; speed: 90mph; weight: 8.0ton; tractive_effort_coefficient: 0.7; cost_factor: 44.3; running_cost_base: RUNNING_COST_ROADVEH; running_cost_factor: 88.6; model_life: VEHICLE_NEVER_EXPIRES; vehicle_life: 40; reliability_decay: 20; // default value retire_early: -10; sound_effect: SOUND_BUS_START_PULL_AWAY; refit_cost: 0; // this needs to be 0 if we want autorefit without using cb refittable_cargo_classes: bitmask(CC_PASSENGERS); non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support cargo_allow_refit: []; cargo_disallow_refit: []; default_cargo_type: PASS; cargo_age_period: 370; misc_flags: bitmask(ROADVEH_FLAG_2CC,ROADVEH_FLAG_AUTOREFIT); // nml constants length: 7; effect_spawn_model: EFFECT_SPAWN_MODEL_DIESEL; } if (param[1]==0) { property { climates_available: ALL_CLIMATES; } } graphics { cargo_capacity: switch_cargo_capacity; purchase_cargo_capacity: switch_cargo_capacity; loading_speed: switch_loading_speed; default: switch_graphics; purchase: sg_purchase; create_effect: create_visual_effect; } } // end scope