Loading

Paste #pgzr2xfsv

  1. ---- vanilla NML ----
  2.  
  3. switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_0, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  4.     bitmask(CC_MAIL): return 5;
  5.     bitmask(CC_ARMOURED): return 5;
  6.     return 3;
  7. }
  8.  
  9. switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_1, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  10.     bitmask(CC_MAIL): return 7;
  11.     bitmask(CC_ARMOURED): return 7;
  12.     return 4;
  13. }
  14.  
  15. switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed_by_cargo_2, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  16.     bitmask(CC_MAIL): return 9;
  17.     bitmask(CC_ARMOURED): return 9;
  18.     return 5;
  19. }
  20.  
  21. switch (FEAT_ROADVEHS, SELF, acton_switch_loading_speed, param_adjust_vehicle_capacity) {
  22.     0: acton_switch_loading_speed_by_cargo_0;
  23.     1: acton_switch_loading_speed_by_cargo_1;
  24.     2: acton_switch_loading_speed_by_cargo_2;
  25. }
  26.  
  27. switch (FEAT_ROADVEHS, SELF, acton_create_visual_effect, 0) {
  28.     return 0;
  29. }
  30.  
  31. item(FEAT_ROADVEHS, acton, 600) {
  32.     property {
  33.         name:                           string(STR_NAME_ACTON, string(STR_NAME_SUFFIX_COACH));
  34.         cargo_capacity:                 27;
  35.         sprite_id:                      SPRITE_ID_NEW_ROADVEH; //enable new graphics - nml constant
  36.         introduction_date:              date(1990,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway
  37.         power:                          360hp;
  38.         speed:                          90mph;
  39.         weight:                         8.0ton;
  40.         tractive_effort_coefficient:    0.7;
  41.         cost_factor:                    44.3;
  42.         running_cost_base:              RUNNING_COST_ROADVEH;
  43.         running_cost_factor:            88.6;
  44.         model_life:                     VEHICLE_NEVER_EXPIRES;
  45.         vehicle_life:                   40;
  46.         reliability_decay:              20; // default value
  47.         retire_early:                   -10;
  48.         sound_effect:                   SOUND_BUS_START_PULL_AWAY;
  49.         refit_cost:                     0; // this needs to be 0 if we want autorefit without using cb
  50.         refittable_cargo_classes:       bitmask(CC_PASSENGERS);
  51.         non_refittable_cargo_classes:   bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
  52.         cargo_allow_refit:              [];
  53.         cargo_disallow_refit:           [];
  54.         default_cargo_type:             PASS;
  55.         cargo_age_period:               370;
  56.         misc_flags:                     bitmask(ROADVEH_FLAG_2CC,ROADVEH_FLAG_AUTOREFIT); // nml constants
  57.         length:                         7;
  58.         effect_spawn_model:             EFFECT_SPAWN_MODEL_DIESEL;
  59.     }
  60.     graphics {
  61.         cargo_capacity:                 acton_switch_cargo_capacity;
  62.         purchase_cargo_capacity:        acton_switch_cargo_capacity;
  63.         loading_speed:                  acton_switch_loading_speed;
  64.         default:                        acton_switch_graphics;
  65.         purchase:                       acton_sg_purchase;
  66.         create_effect:                  acton_create_visual_effect;
  67.     }
  68. }
  69.  
  70. if (param[1]==0) {
  71.     item(FEAT_ROADVEHS, acton, 600) {
  72.         property {
  73.             climates_available:             ALL_CLIMATES;
  74.         }
  75.     }
  76. }
  77.  
  78.  
  79. ---- some form of scoping ----
  80.  
  81. scope(FEAT_ROADVEHS, acton, 600) {
  82.     switch (SELF, switch_loading_speed_by_cargo_0, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  83.         bitmask(CC_MAIL): return 5;
  84.         bitmask(CC_ARMOURED): return 5;
  85.         return 3;
  86.     }
  87.  
  88.     switch (SELF, switch_loading_speed_by_cargo_1, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  89.         bitmask(CC_MAIL): return 7;
  90.         bitmask(CC_ARMOURED): return 7;
  91.         return 4;
  92.     }
  93.  
  94.     switch (SELF, switch_loading_speed_by_cargo_2, cargo_classes & bitmask(CC_MAIL, CC_ARMOURED)) {
  95.         bitmask(CC_MAIL): return 9;
  96.         bitmask(CC_ARMOURED): return 9;
  97.         return 5;
  98.     }
  99.  
  100.     switch (SELF, switch_loading_speed, param_adjust_vehicle_capacity) {
  101.         0: switch_loading_speed_by_cargo_0;
  102.         1: switch_loading_speed_by_cargo_1;
  103.         2: switch_loading_speed_by_cargo_2;
  104.     }
  105.  
  106.     switch (SELF, create_visual_effect, 0) {
  107.         return 0;
  108.     }
  109.  
  110.     property {
  111.         name:                           string(STR_NAME_ACTON, string(STR_NAME_SUFFIX_COACH));
  112.         cargo_capacity:                 27;
  113.         sprite_id:                      SPRITE_ID_NEW_ROADVEH; //enable new graphics - nml constant
  114.         introduction_date:              date(1990,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway
  115.         power:                          360hp;
  116.         speed:                          90mph;
  117.         weight:                         8.0ton;
  118.         tractive_effort_coefficient:    0.7;
  119.         cost_factor:                    44.3;
  120.         running_cost_base:              RUNNING_COST_ROADVEH;
  121.         running_cost_factor:            88.6;
  122.         model_life:                     VEHICLE_NEVER_EXPIRES;
  123.         vehicle_life:                   40;
  124.         reliability_decay:              20; // default value
  125.         retire_early:                   -10;
  126.         sound_effect:                   SOUND_BUS_START_PULL_AWAY;
  127.         refit_cost:                     0; // this needs to be 0 if we want autorefit without using cb
  128.         refittable_cargo_classes:       bitmask(CC_PASSENGERS);
  129.         non_refittable_cargo_classes:   bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
  130.         cargo_allow_refit:              [];
  131.         cargo_disallow_refit:           [];
  132.         default_cargo_type:             PASS;
  133.         cargo_age_period:               370;
  134.         misc_flags:                     bitmask(ROADVEH_FLAG_2CC,ROADVEH_FLAG_AUTOREFIT); // nml constants
  135.         length:                         7;
  136.         effect_spawn_model:             EFFECT_SPAWN_MODEL_DIESEL;
  137.     }
  138.     if (param[1]==0) {
  139.         property {
  140.             climates_available:             ALL_CLIMATES;
  141.         }
  142.     }
  143.     graphics {
  144.         cargo_capacity:                 switch_cargo_capacity;
  145.         purchase_cargo_capacity:        switch_cargo_capacity;
  146.         loading_speed:                  switch_loading_speed;
  147.         default:                        switch_graphics;
  148.         purchase:                       sg_purchase;
  149.         create_effect:                  create_visual_effect;
  150.     }
  151.  
  152. } // end scope

Comments