1
0
mirror of https://github.com/Wyrrrd/bbr-fix.git synced 2026-07-06 21:16:50 +02:00

3 Commits

Author SHA1 Message Date
Wyrrrd 69bf3cac33 Add vscode to gitignore 2023-12-21 10:37:42 +01:00
Wyrrrd 5936a9acc7 Forgot credits (sorry) 2023-03-22 13:50:37 +01:00
Wyrrrd 86b98f8bc9 Rewrite against bugs and for performance 2023-03-22 13:38:44 +01:00
7 changed files with 84 additions and 24 deletions
+1
View File
@@ -1 +1,2 @@
*.zip *.zip
.vscode/*
+3 -3
View File
@@ -8,13 +8,13 @@
"type": "factoriomod", "type": "factoriomod",
"request": "launch", "request": "launch",
"name": "Factorio Mod Debug", "name": "Factorio Mod Debug",
"factorioPath": "D:/Modding/Factorio/bin/x64/factorio.exe" "factorioVersion": "D:/Modding/Factorio/bin/x64/factorio.exe"
}, },
{ {
"type": "factoriomod", "type": "factoriomod",
"request": "launch", "request": "launch",
"name": "Factorio Mod Debug (Settings & Data)", "name": "Factorio Mod Debug (Settings & Data)",
"factorioPath": "D:/Modding/Factorio/bin/x64/factorio.exe", "factorioPath": "D:/Factorio/latest/bin/x64/factorio.exe",
"hookSettings": true, "hookSettings": true,
"hookData": true "hookData": true
}, },
@@ -22,7 +22,7 @@
"type": "factoriomod", "type": "factoriomod",
"request": "launch", "request": "launch",
"name": "Factorio Mod Debug (Profile)", "name": "Factorio Mod Debug (Profile)",
"factorioPath": "D:/Modding/Factorio/bin/x64/factorio.exe", "factorioPath": "D:/Factorio/latest/bin/x64/factorio.exe",
"hookMode": "profile" "hookMode": "profile"
} }
] ]
+9
View File
@@ -0,0 +1,9 @@
{
"factorio.versions": [
{
"name": "Main",
"factorioPath": "d:\\Modding\\Factorio\\bin\\x64\\factorio.exe",
"active": true
}
]
}
+2 -1
View File
@@ -10,4 +10,5 @@ The stone in the rail recipe gets replaced by the bridge material (wood, iron pl
So if your modded rail costs 1x stone, 1x steel and 1x turret (don't ask why), with a cost multiplier of **1**, wooden bridge rail will cost **1x** wood, 1x steel and 1x turret. With a cost multiplier of **5**, wooden bridge rail will cost **5x** wood, 1x steel and 1x turret. So if your modded rail costs 1x stone, 1x steel and 1x turret (don't ask why), with a cost multiplier of **1**, wooden bridge rail will cost **1x** wood, 1x steel and 1x turret. With a cost multiplier of **5**, wooden bridge rail will cost **5x** wood, 1x steel and 1x turret.
### Credits ### Credits
Thanks to [kapaer](https://mods.factorio.com/user/kapaer) for the [mod](https://mods.factorio.com/mod/beautiful_bridge_railway) this depends on. Thanks to [kapaer](https://mods.factorio.com/user/kapaer) for the [mod](https://mods.factorio.com/mod/beautiful_bridge_railway) this depends on.
Thanks to [Eldrinn-Elantey](https://github.com/Eldrinn-Elantey) for the Russian translation.7
+7
View File
@@ -1,4 +1,11 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 1.1.3
Date: 2023-03-22
Changes:
- Complete rewrite to enable copying rail recipe result amount, and for performance
Features:
- Added "gravel" from IR3 to overwritten materials
---------------------------------------------------------------------------------------------------
Version: 1.1.2 Version: 1.1.2
Date: 2021-09-06 Date: 2021-09-06
Changes: Changes:
+59 -18
View File
@@ -1,25 +1,66 @@
local base_recipe = {} -- setup id helper maps
-- grab rail recipe ingredients except stone ingredients_id_map = {old = false}
for _,component in pairs(data.raw["recipe"]["rail"].ingredients) do for id, item in pairs(data.raw["recipe"]["rail"].ingredients) do
cname = component[1] or component["name"] ingredients_id_map[item[1] or item["name"]] = id
camount = component[2] or component["amount"] if item[1] then
if cname ~= "stone" then ingredients_id_map["old"] = true
table.insert(base_recipe,{cname,camount})
end end
end end
data.raw["recipe"]["bbr-rail-wood"].ingredients = table.deepcopy(base_recipe) if data.raw["recipe"]["rail"].products then
data.raw["recipe"]["bbr-rail-iron"].ingredients = table.deepcopy(base_recipe) products_id_map = {}
data.raw["recipe"]["bbr-rail-brick"].ingredients = table.deepcopy(base_recipe) print(tprint(data.raw["recipe"]["rail"]))
for id, item in pairs(data.raw["recipe"]["rail"].products) do products_id_map[item[1] or item["name"]] = id end
end
-- mod integrations
if mods["IndustrialRevolution3"] then
replace_item = "gravel"
else
replace_item = "stone"
end
-- get multiplier
multiplier = settings.startup["bbr-fix-cost"].value multiplier = settings.startup["bbr-fix-cost"].value
if multiplier>0 then
table.insert(data.raw["recipe"]["bbr-rail-wood"].ingredients,{"wood",multiplier}) -- setup bridge material list
table.insert(data.raw["recipe"]["bbr-rail-iron"].ingredients,{"iron-plate",multiplier}) bridges = {
table.insert(data.raw["recipe"]["bbr-rail-brick"].ingredients,{"stone-brick",multiplier}) {name = "wood", item = "wood"},
else {name = "iron", item = "iron-plate"},
table.insert(data.raw["recipe"]["bbr-rail-wood"].ingredients,{"wood",1}) {name = "brick", item = "stone-brick"}
table.insert(data.raw["recipe"]["bbr-rail-iron"].ingredients,{"iron-plate",1}) }
table.insert(data.raw["recipe"]["bbr-rail-brick"].ingredients,{"stone-brick",1})
for _, bridge in pairs(bridges) do
-- copy rail recipe to bridge
data.raw["recipe"]["bbr-rail-"..bridge.name] = table.deepcopy(data.raw["recipe"]["rail"])
-- fix recipe name
data.raw["recipe"]["bbr-rail-"..bridge.name].name = "bbr-rail-"..bridge.name
-- replace stone with multiplied bridge material
if ingredients_id_map.old then
data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]][1] = bridge.item
-- apply multiplier
if multiplier > 1 then
data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]][2] = multiplier * data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]][2]
end
else
data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]].name = bridge.item
-- apply multiplier
if multiplier > 1 then
data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]].amount = multiplier * data.raw["recipe"]["bbr-rail-"..bridge.name].ingredients[ingredients_id_map[replace_item]].amount
end
end
-- replace rails with bridges
if products_id_map then
data.raw["recipe"]["bbr-rail-"..bridge.name].products[products_id_map["rail"]].name = "bbr-rail-"..bridge.name
else
data.raw["recipe"]["bbr-rail-"..bridge.name].result = "bbr-rail-"..bridge.name
end
end end
+3 -2
View File
@@ -1,12 +1,13 @@
{ {
"name": "bbr-fix", "name": "bbr-fix",
"version": "1.1.2", "version": "1.1.3",
"title": "Beautiful Bridge Railway - Recipe Fix", "title": "Beautiful Bridge Railway - Recipe Fix",
"author": "Wyrrrd", "author": "Wyrrrd",
"factorio_version": "1.1", "factorio_version": "1.1",
"dependencies": [ "dependencies": [
"base >= 1.1.0", "base >= 1.1.0",
"beautiful_bridge_railway >= 1.1.1" "beautiful_bridge_railway >= 1.1.1",
"(?) IndustrialRevolution3 >= 3.0.1"
], ],
"description": "Adds rails to recipes." "description": "Adds rails to recipes."
} }