Skip to content

Commit

Permalink
Add compatibility with true Nukes
Browse files Browse the repository at this point in the history
  • Loading branch information
RedRafe committed Mar 11, 2024
1 parent 48eebfd commit c0b8bcc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Version: 1.8.6
Date: xx xxxx 2024
Compatibility:
- Added cpmpatibility with true Nukes mod
- [K2] Balanced 'Advanced Tech Cards' to require 10->1 Lithium Battery Pack
---------------------------------------------------------------------------------------------------
Version: 1.8.5
Expand Down
1 change: 1 addition & 0 deletions compatibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Compatibles (will at least load):
- [x] Train Construction Site
- [x] Train Groups
- [x] Transport Drones
- [x] True Nukes
- [x] Underwater Pipes
- [x] Walkable Water
- [x] Wret's Beacon Rebalance
Expand Down
44 changes: 44 additions & 0 deletions compatibility/true-nukes/data-updates.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if not mods["True-Nukes"] then return end

function startsWith(inputstr, start)
return inputstr:sub(1, #start) == start
end

local util = require "__FreightForwarding__.prototypes.data-util"
local bzutil = require "__bzlead__.data-util"
local restack = util.set_stack_size

restack("tritium-breeder-fuel-cell", 20) -- Was 50
restack("advanced-tritium-breeder-fuel-cell", 20) -- Was 50
restack("plutonium-239", 50)
restack("californium", 50)
restack("TN-thermobaric-1", 20)
restack("TN-warhead-0-1--1", 10)
restack("TN-warhead-0-1--2", 10)
restack("TN-warhead-0-5--2", 10)
restack("TN-warhead-0-5--1", 10)
restack("TN-warhead-0-5--2", 10)
restack("TN-warhead-0-5--3", 10)
restack("TN-warhead-2--1", 10)
restack("TN-warhead-2--2", 10)
restack("TN-warhead-4--1", 10)
restack("TN-warhead-4--2", 10)
restack("TN-warhead-4--3", 10)
restack("TN-warhead-8--1", 10)
restack("TN-warhead-8--2", 10)

bzutil.replace_ingredient("nuclear-test-site", "steel-plate", "ff-titansteel-plate", 0.2, true)
bzutil.replace_ingredient("fusion-test-site", "steel-plate", "ff-titansteel-plate", 0.2, true)

for name, recipe in pairs(data.raw.recipe) do
if startsWith(name, "TN-warhead") then
local steel_count = bzutil.get_ingredient_amount(name, "steel-plate")
if steel_count < 5 then
bzutil.replace_ingredient(name, "steel-plate", "ff-titansteel-plate", 1)
else
bzutil.replace_ingredient(name, "steel-plate", "ff-titansteel-plate", 0.2, true)
end
end
end

util.add_prerequisite("basic-atomic-weapons", "ff-titansteel-processing")
1 change: 1 addition & 0 deletions data-updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ require "__FreightForwarding__.compatibility.planetfall.data-updates"
require "__FreightForwarding__.compatibility.plutonium-energy.data-updates"
require "__FreightForwarding__.compatibility.rocket-silo-construction.data-updates"
require "__FreightForwarding__.compatibility.train-construction-site.data-updates"
require "__FreightForwarding__.compatibility.true-nukes.data-updates"
require "__FreightForwarding__.compatibility.underwater-pipes.data-updates"
3 changes: 3 additions & 0 deletions prototypes/data-util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ end

function data_util.add_prerequisite(tech_name, prerequisite)
local technology = data.raw.technology[tech_name]
if not technology then
return
end
for _, name in pairs(technology.prerequisites) do
if name == prerequisite then
return
Expand Down

0 comments on commit c0b8bcc

Please sign in to comment.