Loading

Pyrite/Mineral Mine Code

  1. from industry import IndustryPrimaryExtractive, TileLocationChecks
  2.  
  3. industry = IndustryPrimaryExtractive(id='pyrite_mine',
  4.                                     accept_cargo_types=['ENSP'],
  5.                                     prod_cargo_types=['PORE'],
  6.                                      prob_in_game='4',
  7.                                      prob_random='7',
  8.                                      prod_multiplier='[20, 0]',
  9.                                      map_colour='181',
  10.                                      location_checks=dict(cluster=[70, 3]),
  11.                                      prospect_chance='0.75',
  12.                                      name='string(STR_IND_PYRITE_MINE)',
  13.                                      nearby_station_name='string(STR_STATION_PYRITES)',
  14.                                      fund_cost_multiplier='252')
  15.  
  16. industry.economy_variations['NORTH_AMERICA'].enabled = True
  17.  
  18. industry.add_tile(id='pyrite_mine_tile_1',
  19.                   animation_length=81,
  20.                   animation_looping=True,
  21.                   animation_speed=1,
  22.                   custom_animation_next_frame='((animation_frame == 80) ? CB_RESULT_STOP_ANIMATION : CB_RESULT_NEXT_FRAME)',
  23.                   custom_animation_control={'macro': 'first_frame_is_0',
  24.                                             'animation_triggers': 'bitmask(ANIM_TRIGGER_INDTILE_TILE_LOOP)'},
  25.                   location_checks=TileLocationChecks(require_effectively_flat=True,
  26.                                                      disallow_industry_adjacent=True))
  27.  
  28. industry.add_tile(id='pyrite_mine_tile_2',
  29.                   animation_length=71,
  30.                   animation_looping=True,
  31.                   animation_speed=2,
  32.                   custom_animation_control={'macro': 'random_first_frame',
  33.                                             'animation_triggers': 'bitmask(ANIM_TRIGGER_INDTILE_CONSTRUCTION_STATE)'},
  34.                   location_checks=TileLocationChecks(require_effectively_flat=True,
  35.                                                      disallow_industry_adjacent=True))
  36.  
  37. industry.add_tile(id='pyrite_mine_tile_3',
  38.                   animation_length=200,
  39.                   animation_looping=True,
  40.                   animation_speed=3,
  41.                   custom_animation_next_frame='((animation_frame == 18) ? CB_RESULT_STOP_ANIMATION : CB_RESULT_NEXT_FRAME)',
  42.                   custom_animation_control={'macro': 'first_frame_is_0',
  43.                                             'animation_triggers': 'bitmask(ANIM_TRIGGER_INDTILE_TILE_LOOP)'},
  44.                   location_checks=TileLocationChecks(require_effectively_flat=True,
  45.                                                      disallow_industry_adjacent=True))
  46.  
  47. sprite_ground = industry.add_sprite(
  48.     sprite_number='GROUNDTILE_MUD_TRACKS'
  49. )
  50. sprite_ground_overlay = industry.add_sprite(
  51.     sprite_number='GROUNDTILE_MUD_TRACKS'
  52. )
  53.  
  54. spriteset_headgear_animated = industry.add_spriteset(
  55.     sprites=[(10, 310, 64, 122, -31, -88), (80, 310, 64, 122, -31, -88), (150, 310, 64, 122, -31, -88)],
  56.     animation_rate=1,
  57.     custom_sprite_selector='(animation_frame % 3)',
  58. )
  59. spriteset_exit_trestle_animated = industry.add_spriteset(
  60.     sprites=[(10, 160, 64, 122, -31, -88), (80, 160, 64, 122, -31, -88), (150, 160, 64, 122, -31, -88),
  61.              (220, 160, 64, 122, -31, -88), (290, 160, 64, 122, -31, -88), (360, 160, 64, 122, -31, -88),
  62.              (430, 160, 64, 122, -31, -88), (500, 160, 64, 122, -31, -88), (500, 160, 64, 122, -31, -88),
  63.              (570, 160, 64, 122, -31, -88), (570, 160, 64, 122, -31, -88), (640, 160, 64, 122, -31, -88),
  64.              (640, 160, 64, 122, -31, -88), (710, 160, 64, 122, -31, -88), (780, 160, 64, 122, -31, -88),
  65.              (850, 160, 64, 122, -31, -88), (920, 160, 64, 122, -31, -88), (990, 160, 64, 122, -31, -88),
  66.              (1060, 160, 64, 122, -31, -88)],
  67.     animation_rate=1,
  68. )
  69. spriteset_crusher_front_part = industry.add_spriteset(
  70.     sprites=[(10, 10, 64, 122, -31, -90)],
  71. )
  72. spriteset_crusher_rear_part = industry.add_spriteset(
  73.     sprites=[(80, 10, 64, 122, -31, -74)],
  74. )
  75. spriteset_hut_vents = industry.add_spriteset(
  76.     sprites=[(150, 10, 64, 122, -31, -90)],
  77. )
  78. spriteset_ore_1 = industry.add_spriteset(
  79.     sprites=[(220, 10, 64, 122, -31, -90)],
  80. )
  81. spriteset_ore_2 = industry.add_spriteset(
  82.     sprites=[(290, 10, 64, 122, -31, -90)],
  83. )
  84. spriteset_winding_house = industry.add_spriteset(
  85.     sprites=[(360, 10, 64, 122, -31, -90)],
  86. )
  87. spriteset_exit_shed_rear = industry.add_spriteset(
  88.     sprites=[(430, 10, 64, 122, -31, -90)],
  89. )
  90. sprite_smoke_1 = industry.add_smoke_sprite(
  91.     smoke_type='dark_smoke_small',
  92.     xoffset=-1,
  93.     yoffset=2,
  94.     zoffset=38,
  95. )
  96. sprite_smoke_2 = industry.add_smoke_sprite(
  97.     smoke_type='dark_smoke_small',
  98.     xoffset=-1,
  99.     yoffset=6,
  100.     zoffset=38,
  101. )
  102.  
  103. industry.add_spritelayout(
  104.     id='pyrite_mine_spritelayout_tile_empty',
  105.     ground_sprite=sprite_ground,
  106.     ground_overlay=sprite_ground_overlay,
  107.     building_sprites=[],
  108. )
  109. industry.add_spritelayout(
  110.     id='pyrite_mine_spritelayout_headgear_animated',
  111.     ground_sprite=sprite_ground,
  112.     ground_overlay=sprite_ground_overlay,
  113.     building_sprites=[spriteset_headgear_animated],
  114. )
  115. industry.add_spritelayout(
  116.     id='pyrite_mine_spritelayout_exit_trestle_animated',
  117.     ground_sprite=sprite_ground,
  118.     ground_overlay=sprite_ground_overlay,
  119.     building_sprites=[spriteset_exit_trestle_animated],
  120. )
  121. industry.add_spritelayout(
  122.     id='pyrite_mine_spritelayout_crusher_front_part',
  123.     ground_sprite=sprite_ground,
  124.     ground_overlay=sprite_ground_overlay,
  125.     building_sprites=[spriteset_crusher_front_part],
  126. )
  127. industry.add_spritelayout(
  128.     id='pyrite_mine_spritelayout_crusher_rear_part',
  129.     ground_sprite=sprite_ground,
  130.     ground_overlay=sprite_ground_overlay,
  131.     building_sprites=[spriteset_crusher_rear_part],
  132. )
  133. industry.add_spritelayout(
  134.     id='pyrite_mine_spritelayout_hut_vents',
  135.     ground_sprite=sprite_ground,
  136.     ground_overlay=sprite_ground_overlay,
  137.     building_sprites=[spriteset_hut_vents],
  138. )
  139. industry.add_spritelayout(
  140.     id='pyrite_mine_spritelayout_ore_1',
  141.     ground_sprite=sprite_ground,
  142.     ground_overlay=sprite_ground_overlay,
  143.     building_sprites=[spriteset_ore_1],
  144. )
  145. industry.add_spritelayout(
  146.     id='pyrite_mine_spritelayout_ore_2',
  147.     ground_sprite=sprite_ground,
  148.     ground_overlay=sprite_ground_overlay,
  149.     building_sprites=[spriteset_ore_2],
  150. )
  151. industry.add_spritelayout(
  152.     id='pyrite_mine_spritelayout_winding_house',
  153.     ground_sprite=sprite_ground,
  154.     ground_overlay=sprite_ground_overlay,
  155.     building_sprites=[spriteset_winding_house],
  156.     smoke_sprites=[sprite_smoke_1, sprite_smoke_2],
  157. )
  158. industry.add_spritelayout(
  159.     id='pyrite_mine_spritelayout_exit_shed_rear',
  160.     ground_sprite=sprite_ground,
  161.     ground_overlay=sprite_ground_overlay,
  162.     building_sprites=[spriteset_exit_shed_rear],
  163. )
  164.  
  165. industry.add_industry_layout(
  166.     id='pyrite_mine_industry_layout_1',
  167.     layout=[(0, 1, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  168.             (0, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  169.             (1, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_rear_part'),
  170.             (1, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  171.             (1, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_hut_vents'),
  172.             (2, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  173.             (2, 1, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  174.             (2, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  175.             (3, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_front_part'),
  176.             (3, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_1'),
  177.             (3, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_2')
  178.             ]
  179. )
  180.  
  181. industry.add_industry_layout(
  182.     id='pyrite_mine_industry_layout_2',
  183.     layout=[(0, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_rear_part'),
  184.             (0, 1, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  185.             (0, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  186.             (0, 3, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  187.             (0, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  188.             (1, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  189.             (1, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  190.             (1, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  191.             (1, 3, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  192.             (1, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_hut_vents'),
  193.             (2, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_front_part'),
  194.             (2, 1, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  195.             (2, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_1'),
  196.             (2, 3, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  197.             (2, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_2')
  198.             ]
  199. )
  200.  
  201. industry.add_industry_layout(
  202.     id='pyrite_mine_industry_layout_3',
  203.     layout=[(0, 0, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  204.             (0, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  205.             (1, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  206.             (1, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_2'),
  207.             (1, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  208.             (2, 0, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  209.             (2, 1, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  210.             (2, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  211.             (3, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_hut_vents'),
  212.             (3, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  213.             (3, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_rear_part'),
  214.             (4, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  215.             (4, 1, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  216.             (4, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_2'),
  217.             (5, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_front_part'),
  218.             (5, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_1')
  219.             ]
  220. )
  221.  
  222. industry.add_industry_layout(
  223.     id='pyrite_mine_industry_layout_4',
  224.     layout=[(0, 0, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  225.             (0, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  226.             (0, 2, 'pyrite_mine_tile_1', 'pyrite_mine_spritelayout_headgear_animated'),
  227.             (0, 3, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_winding_house'),
  228.             (0, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_rear_part'),
  229.             (1, 0, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  230.             (1, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_2'),
  231.             (1, 2, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_exit_shed_rear'),
  232.             (1, 3, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  233.             (1, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_tile_empty'),
  234.             (2, 0, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  235.             (2, 1, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_hut_vents'),
  236.             (2, 2, 'pyrite_mine_tile_3', 'pyrite_mine_spritelayout_exit_trestle_animated'),
  237.             (2, 3, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_ore_1'),
  238.             (2, 4, 'pyrite_mine_tile_2', 'pyrite_mine_spritelayout_crusher_front_part')
  239.             ]
  240. )

Comments