Skip to content

Commit

Permalink
Rename Jaw-Crusher
Browse files Browse the repository at this point in the history
Add subgroup if missing main_product, Fixes #43
Add Migration File


Former-commit-id: 293a459 [formerly 25ce2ef]
Former-commit-id: 293a459
Former-commit-id: f7b2101
  • Loading branch information
Nexela committed Aug 8, 2017
1 parent 51f99d8 commit 8050602
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 52 deletions.
2 changes: 1 addition & 1 deletion data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ require("prototypes.buildings.ulric-corral")
require("prototypes.buildings.borax-mine")
require("prototypes.buildings.ralesia-plantation")
require("prototypes.buildings.niobium-mine")
require("prototypes.buildings.ore-crusher")
require("prototypes.buildings.jaw-crusher")
require("prototypes.buildings.ball-mill")
require("prototypes.buildings.mukmoux-pasture")
require("prototypes.buildings.py-tank-1500")
Expand Down
6 changes: 6 additions & 0 deletions migrations/PyCoalProcessing_0.3.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"entity":
[
["ore-crusher", "jaw-crusher"]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local recipe1={
local item1={
type = "item",
name = "jaw-crusher",
icon = "__pycoalprocessing__/graphics/icons/ore-crusher.png",
icon = "__pycoalprocessing__/graphics/icons/jaw-crusher.png",
flags = {"goes-to-quickbar"},
subgroup = "coal-processing",
order = "s",
Expand All @@ -32,7 +32,7 @@ local item1={
local entity1={
type = "assembling-machine",
name = "jaw-crusher",
icon = "__pycoalprocessing__/graphics/icons/ore-crusher.png",
icon = "__pycoalprocessing__/graphics/icons/jaw-crusher.png",
flags = {"placeable-neutral","player-creation"},
minable = {mining_time = 1, result = "jaw-crusher"},
fast_replaceable_group = "jaw-crusher",
Expand Down Expand Up @@ -60,7 +60,7 @@ local entity1={
animation ={
layers={
{
filename = "__pycoalprocessing__/graphics/entity/ore-crusher/sprite-left.png",
filename = "__pycoalprocessing__/graphics/entity/jaw-crusher/sprite-left.png",
width = 96,
height = 256,
line_length = 21,
Expand All @@ -69,7 +69,7 @@ local entity1={
animation_speed = 0.85,
},
{
filename = "__pycoalprocessing__/graphics/entity/ore-crusher/sprite-mid.png",
filename = "__pycoalprocessing__/graphics/entity/jaw-crusher/sprite-mid.png",
width = 96,
height = 256,
line_length = 21,
Expand All @@ -78,7 +78,7 @@ local entity1={
animation_speed = 0.85,
},
{
filename = "__pycoalprocessing__/graphics/entity/ore-crusher/sprite-right.png",
filename = "__pycoalprocessing__/graphics/entity/jaw-crusher/sprite-right.png",
width = 32,
height = 256,
line_length = 64,
Expand Down
6 changes: 6 additions & 0 deletions prototypes/item-groups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,10 @@ data:extend{
group = "coal-processing",
order = "z",
},
{
type = "item-subgroup",
name = "py-unsorted",
group = "coal-processing",
order = "zzzz",
},
}
92 changes: 48 additions & 44 deletions prototypes/recipes/advanced-foundry-recipes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ local nexelit_plate ={
},
main_product= "nexelit-plate",
icon = "__pycoalprocessing__/graphics/icons/nexelit-plate.png",
subgroup = "py-items",
order = "a1",
subgroup = "py-items",
order = "a1",
}
-------------------------------------------------------------------------------
--STEEL PLATE - cant change the base one,so i did that.
Expand All @@ -32,7 +32,7 @@ local steel_plate2 ={
ingredients ={
{type="item", name="crushed-iron", amount=2},
{type="item", name="coke", amount=2},
{type="item", name="fuelrod-mk01", amount=1},
{type="item", name="fuelrod-mk01", amount=1},
{type="item", name="limestone", amount=2},
{type="item", name="sand-casting", amount=1},
},
Expand All @@ -42,57 +42,61 @@ local steel_plate2 ={
},
main_product= "steel-plate",
icon = "__base__/graphics/icons/steel-plate.png",
subgroup = "py-items",
order = "a2",
subgroup = "py-items",
order = "a2",
}

data:extend{nexelit_plate,steel_plate2}
-------------------------------------------------------------------------------

--Make foundry recipes from smelting recipes with 1 ingredient.
local list = {}
log("Creating additional foundry recipes")
local _filter_ing = function(v)
return v.category == "smelting" and (v.ingredients and #v.ingredients == 1) or (v.normal and v.normal.ingredients and #v.normal.ingredients == 1) end

for _, recipe in pairs(table.filter(data.raw.recipe, _filter_ing)) do

local ing1 = (recipe.ingredients and recipe.ingredients[1].name and recipe.ingredients[1])
or (recipe.ingredients and {type="item", name=recipe.ingredients[1][1], amount=recipe.ingredients[1][2] * 5})
ing1 = ing1 or (recipe.normal and recipe.normal.ingredients and recipe.normal.ingredients[1].name and recipe.normal.ingredients[1])
or (recipe.normal and {type="item", name=recipe.normal.ingredients[1][1], amount=recipe.normal.ingredients[1][2] * 5})
local _filter_ing = function(v)
return v.category == "smelting" and (v.ingredients and #v.ingredients == 1) or (v.normal and v.normal.ingredients and #v.normal.ingredients == 1)
end

local res
if recipe.result then
res = {{type = "item", name = recipe.result or recipe.result[1], amount = 8}}
elseif recipe.results then
res = table.deepcopy(recipe.results)
elseif recipe.normal.result then
res = {{type = "item", name = recipe.normal.result or recipe.normal.result[1], amount = 8}}
elseif recipe.normal.results then
res = table.deepcopy(recipe.normal.results)
end
for _, recipe in pairs(table.filter(data.raw.recipe, _filter_ing)) do

local ing1 = (recipe.ingredients and recipe.ingredients[1].name and recipe.ingredients[1])
or (recipe.ingredients and {type="item", name=recipe.ingredients[1][1], amount=recipe.ingredients[1][2] * 5})
ing1 = ing1 or (recipe.normal and recipe.normal.ingredients and recipe.normal.ingredients[1].name and recipe.normal.ingredients[1])
or (recipe.normal and {type="item", name=recipe.normal.ingredients[1][1], amount=recipe.normal.ingredients[1][2] * 5})

local new = {
type = "recipe",
name = "advanced-foundry-"..recipe.name,
category = "advanced-foundry",
enabled = true,
energy_required = 3,
ingredients = {
ing1,
{type="item", name="fuelrod-mk01", amount=1},
{type="item", name="limestone", amount=2},
{type="item", name="sand-casting", amount=1},
},
results = res,
icon = recipe.icon,
icons = recipe.icons,
main_product = data.raw.item[res[1].name] and res[1].name or nil
}
log(new.name)
list[#list+1] = new
local res
if recipe.result then
res = {{type = "item", name = recipe.result or recipe.result[1], amount = 8}}
elseif recipe.results then
res = table.deepcopy(recipe.results)
elseif recipe.normal.result then
res = {{type = "item", name = recipe.normal.result or recipe.normal.result[1], amount = 8}}
elseif recipe.normal.results then
res = table.deepcopy(recipe.normal.results)
end
data:extend(list)

data:extend{nexelit_plate,steel_plate2}
local new = {
type = "recipe",
name = "advanced-foundry-"..recipe.name,
category = "advanced-foundry",
enabled = true,
energy_required = 3,
ingredients = {
ing1,
{type="item", name="fuelrod-mk01", amount=1},
{type="item", name="limestone", amount=2},
{type="item", name="sand-casting", amount=1},
},
results = res,
icon = recipe.icon,
icons = recipe.icons,
main_product = data.raw.item[res[1].name] and res[1].name or nil
}
log(new.name)
if not new.main_product then
new.subgroup = "py-unsorted"
new.order = "a"
end
list[#list+1] = new
end
data:extend(list)
4 changes: 2 additions & 2 deletions prototypes/updates/bob-updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ replace_ing("ralesia-plantation", "stone", "glass")
replace_ing("ulric-corral", "iron-gear-wheel", "steel-bearing")
replace_ing("ulric-corral", "electronic-circuit", "basic-circuit-board")

replace_ing("ore-crusher", "steel-plate", "invar-alloy")
replace_ing("jaw-crusher", "steel-plate", "invar-alloy")
replace_ing("ore-chusher", "electronic-circuit", "basic-electronic-circuit-board")
add_ing("ore-crusher", {name="rubber", amount=10})
add_ing("jaw-crusher", {name="rubber", amount=10})

add_ing("ball-mill", {name="steel-bearing-ball", amount=1000})

Expand Down

0 comments on commit 8050602

Please sign in to comment.