Skip to content

Commit

Permalink
Merge pull request #2 from Jelmergu/develop
Browse files Browse the repository at this point in the history
Update to 1.0
  • Loading branch information
Jelmergu authored Oct 31, 2020
2 parents a588ee7 + afbd1ff commit e0a195e
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 22 deletions.
Binary file modified graphicsProjects/converter-project.xcf
Binary file not shown.
21 changes: 16 additions & 5 deletions upgrade-machines/Jelmergu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Jelmergu:addRecipe(recipe)
recipe.enabled = recipe.enabled and recipe.enabled or false
recipe.icon_size = recipe.icon_size and recipe.icon_size or 32
recipe = self:convertToNormalAndExpensive(recipe)
var_dump({recipe, data.raw.recipe['electric-mining-drill']})
--var_dump({recipe, data.raw.recipe['electric-mining-drill']})
data:extend({ recipe })
end

Expand Down Expand Up @@ -69,7 +69,7 @@ end

function Jelmergu:convertToNormalAndExpensive(recipe)
if recipe.expensive == false then
var_dump(recipe.name)
--var_dump(recipe.name)
return recipe
end

Expand All @@ -79,7 +79,7 @@ function Jelmergu:convertToNormalAndExpensive(recipe)
normal.allow_as_intermediate = recipe.allow_as_intermediate
expensive.allow_as_intermediate = normal.allow_as_intermediate
normal.ingredients = table.deepcopy(recipe.ingredients)
var_dump(normal, recipe.ingredients)
--var_dump(normal, recipe.ingredients)
normal.main_product = recipe.main_product
expensive.ingredients = self:doubleTableExeptFirst(normal.ingredients)

Expand All @@ -100,7 +100,7 @@ function Jelmergu:convertToNormalAndExpensive(recipe)

recipe.normal = normal
recipe.expensive = expensive
var_dump(recipe)
--var_dump(recipe)
return recipe

end
Expand All @@ -109,7 +109,7 @@ function Jelmergu:doubleTableExeptFirst (origin)
local result = {}
local r
local o = table.deepcopy(origin)
var_dump(o)
--var_dump(o)
for k,v in pairs(o) do
if k ~= 1 then -- assume the first ingredient is the machine to upgrade
if v.count ~= nil then
Expand All @@ -126,4 +126,15 @@ function Jelmergu:doubleTableExeptFirst (origin)
end

return result
end

function Jelmergu:removeUnlockFromTechnology(tech, recipe)
for i = 1, #data.raw["technology"][tech].effects do
var_dump(data.raw["technology"][tech].effects[i], tech, recipe, i)
local effect = data.raw["technology"][tech].effects[i]
if effect.type == "unlock-recipe" and effect.recipe == recipe then
table.remove(data.raw["technology"][tech].effects, i)
return
end
end
end
22 changes: 18 additions & 4 deletions upgrade-machines/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---------------------------------------------------------------------------------------------------
Version: 1.0.0
Date: 31. 10. 2020
General:
- Update for 1.0
New Recipes:
- Burner assembling machine to Assembling machine 1 (Bob's mods)
---------------------------------------------------------------------------------------------------
Version: 0.18.1
Date: 24. 01. 2020
Bug fix:
- Fix that Pistol to Combat shotgun never got unlocked
New Recipes:
- Filter inserter to Stack filter inserter
---------------------------------------------------------------------------------------------------
Version: 0.18.0
Date: 21. 01. 2020
General:
Expand Down Expand Up @@ -99,10 +113,10 @@ Date: 28. 10. 2017
Extramod support:
- Add Bobs Plates support with new recipes
New recipes:
- Mixing to Steel Mixing furnace
- Steel Mixing to Electric Mixing furnace
- Chemical to Steel Chemical furnace
- Steel Chemical to Electric Chemical furnace
- Mixing to Steel Mixing furnace (Bob's mods)
- Steel Mixing to Electric Mixing furnace (Bob's mods)
- Chemical to Steel Chemical furnace (Bob's mods)
- Steel Chemical to Electric Chemical furnace (Bob's mods)
---------------------------------------------------------------------------------------------------
Version: 0.1.0
Date: 08. 10. 2017
Expand Down
5 changes: 4 additions & 1 deletion upgrade-machines/data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ if data.raw.recipe["basic-circuit-board"] then
{ "iron-plate", 7 },
{ "basic-circuit-board", 3},
}

data.raw.recipe["burner-assembling-to-assembling-machine-1"].ingredients = {
{ "burner-assembling-machine", 1 },
{ "basic-circuit-board", 3 },
}
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions upgrade-machines/info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "upgrade-machines",
"version": "0.18.0",
"version": "1.0.0",
"title": "Upgrade Machines",
"author": "Jelmergu",
"contact": "",
"homepage": "",
"factorio_version": "0.18",
"factorio_version": "1.0",
"dependencies": ["base >= 0.16.22", "? bobelectronics >= 0.15.2", "? bobplates >= 0.15.12"],
"description": "This mod adds recipes to upgrade all burner stage machines to their next tier machine"
}
6 changes: 3 additions & 3 deletions upgrade-machines/lib/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ end


function var_dump(table)
if settings.startup.upgrade_machines_debug == nil or settings.startup.upgrade_machines_debug.value ~= true then
return
end
--if settings.startup.upgrade_machines_debug == nil or settings.startup.upgrade_machines_debug.value ~= true then
-- return
--end

if game ~= nil then -- during control stage
game.print(serpent.block(table))
Expand Down
6 changes: 4 additions & 2 deletions upgrade-machines/locale/en/recipe-name.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ stone-chemical-to-steel-furnace=Chemical to Steel Chemical furnace
steel-chemical-to-electric-furnace=Steel Chemical to Electric Chemical furnace
pistol-to-submachine=Pistol to Submachine
pistol-to-shotgun=Pistol to Shotgun
pistol-to-combat-shotgun=Pistol to Combat shotgun
shotgun-to-combat-shotgun=Shotgun to Combat shotgun
light-to-heavy-armor=Light to Heavy armor
heavy-to-modular-armor=Heavy to Modular armor
modular-to-power-armor=Modular to Power armor
power-to-power-armor-mk2=Power to Power armor MK2
boiler-to-heat-exchanger=Boiler to Heat exchanger
steam-engine-to-steam-turbine=Steam engine to Steam turbine
steam-engine-to-steam-turbine=Steam engine to Steam turbine
filter-inserter-to-stack-filter-inserter=Filter inserter to Stack filter inserter
burner-assembling-to-assembling-machine-1= Burner assembler to Assembling machine 1
10 changes: 10 additions & 0 deletions upgrade-machines/migrations/2020-01-24_upgrade-machines_0.18.1.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for index, force in pairs(game.forces) do
if force.technologies["military-3"].researched == true then
force.recipes["pistol-to-combat-shotgun"].enabled = true
force.recipes["pistol-to-combat-shotgun"].reload()
end
if force.technologies["stack-inserter"].researched == true then
force.recipes["filter-inserter-to-stack-filter-inserter"].enabled = true
force.recipes["filter-inserter-to-stack-filter-inserter"].reload()
end
end
5 changes: 5 additions & 0 deletions upgrade-machines/migrations/2020-10-31.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recipe" : [
["pistol-to-combat-shotgun", "shotgun-to-combat-shotgun"]
]
}
14 changes: 14 additions & 0 deletions upgrade-machines/migrations/2020-10-31_upgrade_machines_1.0.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
for _, force in pairs(game.forces) do
if force.technologies["bob-steam-turbine-1"].researched == true then
force.recipes["steam-engine-to-steam-turbine"].enabled = false
force.recipes["steam-engine-to-steam-turbine"].reload()
end
if force.technologies["bob-heat-exchanger-1"].researched == true then
force.recipes["boiler-to-heat-exchanger"].enabled = false
force.recipes["boiler-to-heat-exchanger"].reload()
end
if force.technologies["automation"].researched == true then
force.recipes["burner-assembling-to-assembling-machine-1"].enabled = true
force.recipes["burner-assembling-to-assembling-machine-1"].reload()
end
end
4 changes: 4 additions & 0 deletions upgrade-machines/prototypes/recipe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ require ("recipes.vanilla")
if mods.bobplates then
log("detected bob plates")
require ("recipes.bobplates")
end

if mods.bobassembly then
require("recipes.bobassembly")
end
15 changes: 15 additions & 0 deletions upgrade-machines/prototypes/recipes/bobassembly.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Jelmergu:addConditionalRecipe({ "burner-assembling-machine", "assembling-machine-1" },
{
name = "burner-assembling-to-assembling-machine-1",
order = "b[burner-to-electric-drill]",
expensive = false,
icon_size = 64,
ingredients = {
{ "burner-assembling-machine", 1 },
{ "electronic-circuit", 3 },
},
main_product = "assembling-machine-1",
energy_required = 0.5,
}
)

58 changes: 53 additions & 5 deletions upgrade-machines/prototypes/recipes/vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,10 @@ Jelmergu:addRecipe(

Jelmergu:addRecipe(
{
name = "pistol-to-combat-shotgun",
name = "shotgun-to-combat-shotgun",
ingredients = {
{ "pistol", 1 },
{ "iron-plate", 5 },
{ "copper-plate", 5 },
{ "steel-plate", 15 },
{ "wood", 10 },
{ "steel-plate", 14 },
},
result = "combat-shotgun",
energy_required = 10,
Expand Down Expand Up @@ -189,6 +186,57 @@ Jelmergu:addRecipe(
}
)

Jelmergu:addRecipe(
{
name = "light-to-heavy-armor",
ingredients = {
{"light-armor", 1},
{"copper-plate", 100},
{"steel-plate", 50}
},
results = {
{"heavy-armor", 1},
{"iron-plate", 40},
},
expensive = false,
energy_required = 8

}
)

Jelmergu:addRecipe(
{
name = "heavy-to-modular-armor",
ingredients = {
{"heavy-armor", 1},
{"advanced-circuit", 30},
},
results = {
{"modular-armor", 1},
{"copper-plate", 100},
},
expensive = false,
energy_required = 15
}
)

Jelmergu:addRecipe(
{
name = "filter-inserter-to-stack-filter-inserter",
ingredients = {
{"filter-inserter", 1},
{"advanced-circuit", 1},
{"electronic-circuit", 16},
{"iron-gear-wheel", 15}

},
icon_size = 64,
result = "stack-filter-inserter",
expensive = false,
energy_required = 3
}
)

Jelmergu:addRecipe(
{
name = "boiler-to-heat-exchanger",
Expand Down
9 changes: 9 additions & 0 deletions upgrade-machines/prototypes/technology.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ require("technology.vanilla")
if mods.bobplates then
require("technology.bobplates")
end

if mods.bobpower then
require("technology.bobpower")
end

if mods.bobassembly then
require("technology.bobassembly")
end

1 change: 1 addition & 0 deletions upgrade-machines/prototypes/technology/bobassembly.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jelmergu:addConditionalTechnology("basic-automation", "burner-assembling-to-assembling-machine-1", "automation")
2 changes: 2 additions & 0 deletions upgrade-machines/prototypes/technology/bobpower.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Jelmergu:removeUnlockFromTechnology("nuclear-power", "boiler-to-heat-exchanger")
Jelmergu:removeUnlockFromTechnology("nuclear-power", "steam-engine-to-steam-turbine")
10 changes: 10 additions & 0 deletions upgrade-machines/prototypes/technology/vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ table.insert(data.raw["technology"]["military"].effects, {
recipe = "pistol-to-shotgun"
})

table.insert(data.raw["technology"]["military-3"].effects, {
type = "unlock-recipe",
recipe = "shotgun-to-combat-shotgun"
})


table.insert(data.raw["technology"]["advanced-material-processing"].effects, {
type = "unlock-recipe",
recipe = "stone-to-steel-furnace"
Expand Down Expand Up @@ -45,3 +51,7 @@ table.insert(data.raw["technology"]["nuclear-power"].effects, {
type = "unlock-recipe",
recipe = "steam-engine-to-steam-turbine"
})
table.insert(data.raw["technology"]["stack-inserter"].effects, {
type = "unlock-recipe",
recipe = "filter-inserter-to-stack-filter-inserter"
})

0 comments on commit e0a195e

Please sign in to comment.