Make me optional
This commit is contained in:
parent
fe85b07625
commit
0945cb9773
1 changed files with 16 additions and 12 deletions
|
|
@ -124,13 +124,13 @@ end
|
||||||
|
|
||||||
allbypass = {}
|
allbypass = {}
|
||||||
if get_setting("bz-recipe-bypass") then
|
if get_setting("bz-recipe-bypass") then
|
||||||
for recipe in string.gmatch(me.get_setting("bz-recipe-bypass"), '[^",%s]+') do
|
for recipe in string.gmatch(util.get_setting("bz-recipe-bypass"), '[^",%s]+') do
|
||||||
allbypass[recipe] = true
|
allbypass[recipe] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.is_foundry()
|
function util.is_foundry()
|
||||||
return util.bz.foundry and not me.get_setting("bzfoundry-minimal")
|
return util.bz.foundry and not util.get_setting("bzfoundry-minimal")
|
||||||
end
|
end
|
||||||
|
|
||||||
function should_force(options)
|
function should_force(options)
|
||||||
|
|
@ -138,7 +138,7 @@ function should_force(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bypass(recipe_name)
|
function bypass(recipe_name)
|
||||||
if me.bypass[recipe_name] then
|
if me and me.bypass[recipe_name] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if allbypass[recipe_name] then
|
if allbypass[recipe_name] then
|
||||||
|
|
@ -423,7 +423,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max)
|
||||||
})
|
})
|
||||||
local probability = data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression
|
local probability = data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression
|
||||||
-- A lot more common near starting point when aps gleba
|
-- A lot more common near starting point when aps gleba
|
||||||
local factor = (mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 20) or 1
|
local factor = (mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 20) or 1
|
||||||
data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression = probability .. [[*
|
data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression = probability .. [[*
|
||||||
if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 200, ]] .. factor .. [[,
|
if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 200, ]] .. factor .. [[,
|
||||||
if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 700,
|
if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 700,
|
||||||
|
|
@ -432,8 +432,8 @@ function util.add_gleba_rock(resource, amount_min, amount_max)
|
||||||
|
|
||||||
end
|
end
|
||||||
if data.raw.item[resource] then
|
if data.raw.item[resource] then
|
||||||
amount_min = (amount_min or 10) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1)
|
amount_min = (amount_min or 10) * ((mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 4) or 1)
|
||||||
amount_max = (amount_max or 20) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1)
|
amount_max = (amount_max or 20) * ((mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 4) or 1)
|
||||||
util.add_minable_result(
|
util.add_minable_result(
|
||||||
"simple-entity", "gleba-rock",
|
"simple-entity", "gleba-rock",
|
||||||
{ type = "item", name = resource, amount_min = amount_min, amount_max = amount_max })
|
{ type = "item", name = resource, amount_min = amount_min, amount_max = amount_max })
|
||||||
|
|
@ -536,7 +536,7 @@ function util.se_landfill(params)
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
icons = {
|
icons = {
|
||||||
{ icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 },
|
{ icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 },
|
||||||
{ icon = "__" .. me.name .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size },
|
{ icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size },
|
||||||
},
|
},
|
||||||
energy_required = 1,
|
energy_required = 1,
|
||||||
enabled = false,
|
enabled = false,
|
||||||
|
|
@ -644,7 +644,7 @@ function util.se_matter(params)
|
||||||
icon_size = 64, scale = 0.5 },
|
icon_size = 64, scale = 0.5 },
|
||||||
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
|
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
|
||||||
icon_size = 64, scale = 0.33, shift = { 8, -8 } },
|
icon_size = 64, scale = 0.33, shift = { 8, -8 } },
|
||||||
{ icon = "__" .. util.me.name .. "__/graphics/icons/" .. params.ore .. ".png",
|
{ icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png",
|
||||||
icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { -8, 8 } },
|
icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { -8, 8 } },
|
||||||
{ icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
|
{ icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
|
||||||
icon_size = 64, scale = 0.5 },
|
icon_size = 64, scale = 0.5 },
|
||||||
|
|
@ -683,7 +683,7 @@ function util.se_matter(params)
|
||||||
icon_size = 64, scale = 0.5 },
|
icon_size = 64, scale = 0.5 },
|
||||||
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
|
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
|
||||||
icon_size = 64, scale = 0.33, shift = { -8, 8 } },
|
icon_size = 64, scale = 0.33, shift = { -8, 8 } },
|
||||||
{ icon = "__" .. util.me.name .. "__/graphics/icons/" .. params.ore .. ".png",
|
{ icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png",
|
||||||
icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { 8, -8 } },
|
icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { 8, -8 } },
|
||||||
{ icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
|
{ icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
|
||||||
icon_size = 64, scale = 0.5 },
|
icon_size = 64, scale = 0.5 },
|
||||||
|
|
@ -967,7 +967,7 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options)
|
||||||
end
|
end
|
||||||
local is_fluid = not not data.raw.fluid[ingredient]
|
local is_fluid = not not data.raw.fluid[ingredient]
|
||||||
if data.raw.recipe[recipe_name] and (util.get_item(ingredient) or is_fluid) then
|
if data.raw.recipe[recipe_name] and (util.get_item(ingredient) or is_fluid) then
|
||||||
me.add_modified(recipe_name)
|
if me then me.add_modified(recipe_name) end
|
||||||
prepare_redo_recycling(recipe_name)
|
prepare_redo_recycling(recipe_name)
|
||||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
||||||
end
|
end
|
||||||
|
|
@ -1130,7 +1130,7 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) and (data.raw.item[old] or data.raw.fluid[old]) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) and (data.raw.item[old] or data.raw.fluid[old]) then
|
||||||
me.add_modified(recipe_name)
|
if me then me.add_modified(recipe_name) end
|
||||||
prepare_redo_recycling(recipe_name)
|
prepare_redo_recycling(recipe_name)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
||||||
end
|
end
|
||||||
|
|
@ -1164,7 +1164,7 @@ function util.remove_ingredient(recipe_name, old, options)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
me.add_modified(recipe_name)
|
if me then me.add_modified(recipe_name) end
|
||||||
prepare_redo_recycling(recipe_name)
|
prepare_redo_recycling(recipe_name)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||||
end
|
end
|
||||||
|
|
@ -1967,6 +1967,10 @@ function util.sum_products(recipe_name)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function util.add_productivity(recipe)
|
||||||
|
data.raw.recipe[recipe].allow_productivity = true
|
||||||
|
end
|
||||||
|
|
||||||
function util.set_vtk_dcm_ingredients()
|
function util.set_vtk_dcm_ingredients()
|
||||||
if mods["vtk-deep-core-mining"] then
|
if mods["vtk-deep-core-mining"] then
|
||||||
local sum = util.sum_products("vtk-deepcore-mining-ore-chunk-refining")
|
local sum = util.sum_products("vtk-deepcore-mining-ore-chunk-refining")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue