Advertisement
Guest User

Untitled

a guest
Sep 28th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.76 KB | None | 0 0
  1. local FUN = require("__pycoalprocessing__/prototypes/functions/functions")
  2.  
  3. --------------------------------------------------------------------------------
  4.  
  5. local function ends_with(str, ending)
  6.     return ending == "" or str:sub(-#ending) == ending;
  7. end
  8.  
  9. local function withoutLast(str, count)
  10.     return string.sub(str, 1, string.len (str) - count);
  11. end
  12.  
  13.  
  14. local function getBaseAssemblerTryDif (baseAssemblerName, withDif)
  15.  
  16.      local baseAssembler = data.raw["assembling-machine"][baseAssemblerName];
  17.              
  18.      if baseAssembler == nil then
  19.        
  20.          local nameWithMK;
  21.  
  22.          if withDif then
  23.              nameWithMK = baseAssemblerName .. "-mk01"
  24.          else
  25.              nameWithMK = baseAssemblerName .. "mk01"
  26.          end
  27.        
  28.          return data.raw["assembling-machine"][nameWithMK];
  29.      else
  30.          return baseAssembler;
  31.      end
  32.  
  33. end
  34.  
  35. local function getBaseAssembler(baseAssemblerName)
  36.  
  37.     log ("--------------------------: " .. baseAssemblerName);
  38.  
  39.     local withDif = ends_with(baseAssemblerName, "-");
  40.    
  41.     local realBaseAssemblerName;
  42.  
  43.     if withDif then      
  44.         realBaseAssemblerName = withoutLast(baseAssemblerName, 1)
  45.     else    
  46.         realBaseAssemblerName = baseAssemblerName        
  47.     end
  48.                                              
  49.     return getBaseAssemblerTryDif (realBaseAssemblerName, withDif);
  50.  
  51. end
  52.  
  53. for _, asm in pairs(data.raw["assembling-machine"]) do
  54.    
  55.     -- Check Only Py Assemblers?
  56.    
  57.     if ends_with(asm.name, "mk02") or ends_with(asm.name, "mk03") or ends_with(asm.name, "mk04") then
  58.        
  59.         local baseAssemblerName = withoutLast (asm.name, 4);
  60.        
  61.         local baseAssembler = getBaseAssembler(baseAssemblerName);
  62.  
  63.         if baseAssembler ~= nil then
  64.  
  65.             asm.module_specification.module_slots = math.max (asm.module_specification.module_slots, baseAssembler.module_specification.module_slots);
  66.  
  67.         else
  68.  
  69.             log ("base assembler for " .. asm.name .. " not found");
  70.  
  71.         end
  72.     end    
  73. end
  74.  
  75. --------------------------------------------------------------------------------
  76.  
  77. data.raw["recipe"]["nichrome-2"].category = "casting";
  78.  
  79. --------------------------------------------------------------------------------
  80.  
  81. data.raw["assembling-machine"]["advanced-foundry-mk01"].module_specification.module_slots = 2;
  82. data.raw["assembling-machine"]["advanced-foundry-mk02"].module_specification.module_slots = 2;
  83. data.raw["assembling-machine"]["advanced-foundry-mk03"].module_specification.module_slots = 2;
  84. data.raw["assembling-machine"]["advanced-foundry-mk04"].module_specification.module_slots = 2;
  85.  
  86. data.raw["assembling-machine"]["automated-factory-mk01"].module_specification.module_slots = 1;
  87. data.raw["assembling-machine"]["automated-factory-mk02"].module_specification.module_slots = 2;
  88. data.raw["assembling-machine"]["automated-factory-mk03"].module_specification.module_slots = 4;
  89. data.raw["assembling-machine"]["automated-factory-mk04"].module_specification.module_slots = 4;
  90.  
  91. --------------------------------------------------------------------------------
  92.  
  93. local restoreProducts =
  94. {
  95. "tar-processing-unit",
  96. "tar-processing-unit-mk02",
  97. "tar-processing-unit-mk03",
  98. "tar-processing-unit-mk04",
  99. "washer",
  100. "washer-mk02",
  101. "washer-mk03",
  102. "washer-mk04"
  103. };
  104.  
  105.  
  106. for index, asmName in pairs(restoreProducts) do
  107.  
  108.     local assembler = data.raw["assembling-machine"][asmName];
  109.      
  110.     assembler.allowed_effects = {"consumption", "speed", "productivity", "pollution"};
  111.  
  112. end
  113.  
  114. --------------------------------------------------------------------------------
  115.  
  116. FUN.productivity({
  117.  
  118. "proton-donor",
  119. "proton-receiver",
  120. "crystallographic-substrate",
  121.  
  122. "pa-sulfur",
  123. "pa-aromatics",
  124. "pa-benzene",
  125. "pa-propene",
  126. "pa-silicon",
  127. "pa-coal",
  128. "pa-niobium",
  129. "pa-chromium",
  130. "pa-molybdenum",
  131. "pa-vanadium",
  132. "pa-uranium",
  133. "pa-uranium-235",
  134. "pa-diamond",
  135. "pa-proton",
  136. "pa-oxygen",
  137. "pa-helium",
  138. "pa-hydrogen",
  139. "pa-boron",
  140. "pa-coal2",
  141. "pa-aluminium",
  142. "pa-nickel",
  143. "pa-zinc",
  144. "pa-silver",
  145. "pa-gold",
  146. "pa-vanadium2",
  147.  
  148.  
  149.  
  150. "clean-nexelit",
  151. "nexelit-ore-1",
  152. "aramid-2",
  153. "biofilm-pyht",
  154. "ceramic",
  155. "ceramic-2",
  156. "sodium-sulfate",
  157. "sodium-bisulfate",
  158. "sand-classification2",
  159. "kerosene",
  160. "filtration-media",
  161. "carbon-filter",
  162. "carbon-filter-mk02",
  163. "carbon-filter-mk03",
  164. "carbon-filter-mk04",
  165. "bolts",
  166. "small-parts-01",
  167. "small-parts-02",
  168. "small-parts-03",
  169. "rubber-01",
  170. "rubber-02",
  171. "rubber-03",
  172. "rubber-04",
  173. "styrene",
  174. "btx-to-styrene",
  175. "carbon-black",
  176. "carbon-black-2",
  177. "belt",
  178. "guar-01",
  179. "guar-02",
  180. "guar-03",
  181. "guar-04",
  182. "guar-05",
  183. "guar-separation",
  184. "guar-gum",
  185. "drilling-fluid-1",
  186. "drilling-fluid-2",
  187. "drilling-fluid-3"})
  188.  
  189. --------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement