up
This commit is contained in:
parent
26e29a6c21
commit
9be9a1e545
2 changed files with 63 additions and 10 deletions
|
@ -147,8 +147,10 @@ function regenerate_ore(event)
|
|||
for w in event.parameters:gmatch("%S+") do table.insert(params, w) end
|
||||
if #params == 1 and params[1] == "all" then
|
||||
for _, resource in pairs(me.resources) do
|
||||
game.print("Regenerating "..resource)
|
||||
game.regenerate_entity(resource)
|
||||
if prototypes.entity[resource] then
|
||||
game.print("Regenerating "..resource)
|
||||
game.regenerate_entity(resource)
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
|
|
@ -118,6 +118,15 @@ function util.contains(table, sought)
|
|||
return false
|
||||
end
|
||||
|
||||
-- copies a recipe, giving the copy a new name
|
||||
function util.copy_recipe(recipe_name, new_recipe_name)
|
||||
if data.raw.recipe[recipe_name] then
|
||||
new_recipe = futil.table.deepcopy(data.raw.recipe[recipe_name])
|
||||
new_recipe.name = new_recipe_name
|
||||
data:extend({new_recipe})
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the gleba rock. If it exists, still add resource to mine from it
|
||||
function util.add_gleba_rock(resource, amount_min, amount_max)
|
||||
if (not data.raw.planet.gleba or
|
||||
|
@ -369,6 +378,30 @@ function util.use_fluid_mining_final()
|
|||
util.remove_raw("technology", "uranium-mining")
|
||||
end
|
||||
|
||||
|
||||
-- Add vacuum if it hasn't been added yet
|
||||
function util.add_vacuum()
|
||||
if not data.raw.fluid.vacuum then
|
||||
data:extend({
|
||||
{
|
||||
type = "fluid",
|
||||
name = "vacuum",
|
||||
icons = { util.vacuum_icon, },
|
||||
visualization_color = util.vacuum_vis,
|
||||
subgroup = "fluid",
|
||||
order = "d[vacuum]",
|
||||
default_temperature = 1500,
|
||||
max_temperature = 2000,
|
||||
gas_temperature = 0,
|
||||
heat_capacity = "0.01kJ",
|
||||
base_color = {0.9, 0.9, 0.9},
|
||||
flow_color = {0.8, 0.8, 0.9},
|
||||
auto_barrel = false,
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- If Hot metals mod is enabled, mark these metals as hot
|
||||
function util.add_hot_metals(metals)
|
||||
if HotMetals and HotMetals.items then
|
||||
|
@ -1094,9 +1127,6 @@ function multiply_recipe(recipe, multiple)
|
|||
else
|
||||
recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default
|
||||
end
|
||||
if recipe.result_count then
|
||||
recipe.result_count = recipe.result_count * multiple
|
||||
end
|
||||
if recipe.results then
|
||||
for i, result in pairs(recipe.results) do
|
||||
if result.name then
|
||||
|
@ -1113,10 +1143,22 @@ function multiply_recipe(recipe, multiple)
|
|||
end
|
||||
end
|
||||
end
|
||||
if not recipe.results and not recipe.result_count then
|
||||
-- implicit one item result
|
||||
recipe.result_count = multiple
|
||||
end
|
||||
multiply_ingredients(recipe, multiple)
|
||||
end
|
||||
end
|
||||
|
||||
-- multiply the ingredient cost of a recipe
|
||||
function util.multiply_ingredients(recipe_name, multiple, options)
|
||||
if not should_force(options) and bypass(recipe_name) then return end
|
||||
if data.raw.recipe[recipe_name] then
|
||||
me.add_modified(recipe_name)
|
||||
prepare_redo_recycling(recipe_name)
|
||||
multiply_ingredients(data.raw.recipe[recipe_name], multiple)
|
||||
end
|
||||
end
|
||||
|
||||
function multiply_ingredients(recipe, multiple)
|
||||
if recipe then
|
||||
if recipe.ingredients then
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
if ingredient.name then
|
||||
|
@ -1277,6 +1319,13 @@ function add_time(recipe, amount)
|
|||
end
|
||||
end
|
||||
|
||||
-- Set localised name
|
||||
function util.set_localised_name(recipe_name, localised_name)
|
||||
if data.raw.recipe[recipe_name] then
|
||||
data.raw.recipe[recipe_name].localised_name = localised_name
|
||||
end
|
||||
end
|
||||
|
||||
-- Set recipe category
|
||||
function util.set_category(recipe_name, category, options)
|
||||
if not should_force(options) and bypass(recipe_name) then return end
|
||||
|
@ -1467,12 +1516,14 @@ function util.add_minable_result(t, name, result)
|
|||
if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable then
|
||||
if data.raw[t][name].minable.result and not data.raw[t][name].minable.results then
|
||||
data.raw[t][name].minable.results = {
|
||||
{data.raw[t][name].minable.result ,data.raw[t][name].minable.count}}
|
||||
util.item(data.raw[t][name].minable.result ,data.raw[t][name].minable.count)}
|
||||
data.raw[t][name].minable.result = nil
|
||||
data.raw[t][name].minable.result_count = nil
|
||||
end
|
||||
if data.raw[t][name].minable.results then
|
||||
table.insert(data.raw[t][name].minable.results, result)
|
||||
else
|
||||
data.raw[t][name].minable.results = {result}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue