Skip to content

Commit

Permalink
Bobs equipment (#989)
Browse files Browse the repository at this point in the history
* Add check before replacing tech

By default, electric engine is blue science. However a couple of Bob's mods move it to green science. In this case, angels-components-mechanical-4 is too high a tier prerequisite.

* Adjust equipment/armor tech tiers

* Adjust equipment/armor tech tiers

* Adjust equipment/armor tech tiers

Low density structures are are a higher tech tier

* Reverting previous change

* Burner Phase setting can be enabled without Burner Assemblers

* Unit test: mod settings change

Removed duplicate setting
Moved setting to correct heading

* Unit test update: Bob modules

Modules can be considered same tier as when they are unlocked. No need for them to be after

* Armor ingredients and prerequisites
  • Loading branch information
KiwiHawk authored Jun 2, 2024
1 parent 0e189bc commit 946fcbe
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 23 deletions.
3 changes: 1 addition & 2 deletions angelsdev-unit-test/python/unit_test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def addConfiguration(cls:UnitTestConfiguration, configName:str, modList:list[str
UnitTestConfiguration.addDefaultSetting("startup", "angels-enable-tech", False)

# BobPower
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-burnerphase", False) # TODO: add testing cases if we want to support this
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-revamp-rtg", True)
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-power-poles", True)
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-power-steam", True)
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-power-fluid-generator", True)
Expand Down Expand Up @@ -78,6 +76,7 @@ def addConfiguration(cls:UnitTestConfiguration, configName:str, modList:list[str
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-revamp-hardmode", True)

# BobOther
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-burnerphase", False) # TODO: add testing cases if we want to support this
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-mining-miningaxes", True)
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-plates-purewater", True)
UnitTestConfiguration.addDefaultSetting("startup", "bobmods-ores-unsortedgems", True)
Expand Down
21 changes: 7 additions & 14 deletions angelsdev-unit-test/unit-tests/unit-test-006.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,13 @@ local function calculate_science_pack_level()
if game.active_mods["bobmodules"] and settings.startup["bobmods-modules-enable-modules-lab"].value then
for pack_name, pack_level in pairs({
-- bobs module science packs
["speed-processor"] = 50
+ (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["effectivity-processor"] = 50
+ (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["productivity-processor"] = 50
+ (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["pollution-clean-processor"] = 50
+ (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["pollution-create-processor"] = 50
+ (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["module-circuit-board"] = science_pack_level["angels-science-pack-blue"]
or science_pack_level["chemical-science-pack"],
["module-case"] = science_pack_level["angels-science-pack-yellow"]
or science_pack_level["production-science-pack"],
["speed-processor"] = (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["effectivity-processor"] = (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["productivity-processor"] = (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["pollution-clean-processor"] = (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["pollution-create-processor"] = (science_pack_level["angels-science-pack-orange"] or science_pack_level["logistic-science-pack"]),
["module-circuit-board"] = (science_pack_level["angels-science-pack-blue"] or science_pack_level["chemical-science-pack"]),
["module-case"] = (science_pack_level["angels-science-pack-yellow"] or science_pack_level["production-science-pack"]),
}) do
science_pack_level[pack_name] = pack_level
end
Expand Down
1 change: 1 addition & 0 deletions angelsindustries/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Date: ???
- Added item description to Gravitational analyzer (984)
- Adjusted the recipes and science packs for Bob's Assembling Machines when Components or Technology Overhauls are enabled (985)
- Tech Overhaul: Hid Steam science pack from Bob's Technology mod (986)
- Adjust ingredients and tech prerequisites for Power armor and equipment when using Bob's mods (989)
Bugfixes:
- Fixed potential softlock with Tech Overhaul and Bob's Technology mod (986)
---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion angelsindustries/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"homepage": "https://forums.factorio.com/viewforum.php?f=185",
"description": "Adds industrial equipment as well as the tools you need to expand and grow your base. Adds extra components [BETA] and a tech [ALPHA] overhaul.",
"dependencies": [
"angelsrefining >= 0.12.1",
"angelsrefining >= 0.12.8",
"angelspetrochem >= 0.9.25",
"angelssmelting >= 0.6.17",
"angelsbioprocessing >= 0.7.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if angelsmods.industries.components then
})
OV.remove_prereq("exoskeleton-equipment", "electric-engine")
OV.add_prereq("exoskeleton-equipment", "angels-components-mechanical-3")
OV.add_prereq("exoskeleton-equipment", "tech-orange-circuit")
OV.remove_science_pack("exoskeleton-equipment", "chemical-science-pack")
end

-----------------------------------------------------------------------------
Expand Down Expand Up @@ -219,5 +219,23 @@ if angelsmods.industries.components then
OV.add_prereq("bob-boiler-2", "angels-components-construction-2")
end

-----------------------------------------------------------------------------
-- BOB WARFARE --------------------------------------------------------------
-----------------------------------------------------------------------------
if mods["bobwarfare"] then
OV.patch_recipes({
{
name = "power-armor",
ingredients = {
{ type = "item", name = "circuit-green-loaded", amount = "circuit-orange-loaded" },
},
},
})
if angelsmods.industries.tech then
OV.remove_prereq("power-armor-mk2", "low-density-structure")
OV.remove_input("power-armor-mk2", "low-density-structure")
end
end

OV.execute()
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ if angelsmods.industries.components then
OV.global_replace_item("engine-unit", "motor-2")
OV.global_replace_technology("engine", "angels-components-mechanical-2")
OV.global_replace_item("electric-engine-unit", "motor-4")
OV.global_replace_technology("electric-engine", "angels-components-mechanical-4")
if angelsmods.functions.tech_uses_science_pack("electric-engine", "chemical-science-pack") then
OV.global_replace_technology("electric-engine", "angels-components-mechanical-4")
else
OV.global_replace_technology("electric-engine", "angels-components-mechanical-3")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@ if angelsmods.industries.tech then
end

if settings.startup["bobmods-burnerphase"].value then
AI.core_replace("automation", "basic", "processing")
AI.core_replace("steam-power", "energy", "basic")
AI.core_replace("steam-automation", "processing", "basic")
if data.raw.technology["basic-automation"] then
AI.core_replace("automation", "basic", "processing")
AI.core_replace("steam-automation", "processing", "basic")
end
end
end

Expand Down
13 changes: 11 additions & 2 deletions angelsindustries/prototypes/overrides/global-tech-bobs-packs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ if angelsmods.industries.tech then
AI.pack_replace("follower-robot-count-1", "green", "orange")
AI.pack_replace("follower-robot-count-2", "green", "orange")
OV.remove_prereq("walking-vehicle", "production-science-pack")
--Modular/Power Armor
AI.pack_replace("modular-armor", "orange", "green")
AI.pack_replace("power-armor-mk2", "blue", "orange")
OV.remove_prereq("power-armor-mk2", "military-3")
end

-------------------------------------------------------------------------------
Expand Down Expand Up @@ -356,13 +360,18 @@ if angelsmods.industries.tech then
--adds bob personal equipment stuffs
AI.pack_replace("personal-roboport-equipment", "green", "orange")
AI.pack_replace("personal-roboport-modular-equipment-1", "green", "orange")
AI.pack_replace("exoskeleton-equipment", "green", "orange")
AI.pack_replace("solar-panel-equipment-2", "green", "orange")
AI.pack_replace("exoskeleton-equipment", "blue", "green")
AI.pack_replace("exoskeleton-equipment-2", "blue", "orange")
OV.remove_prereq("exoskeleton-equipment-2", "advanced-electronics-2")
OV.remove_prereq("exoskeleton-equipment-3", "production-science-pack")
AI.pack_replace("solar-panel-equipment", "orange", "green")
AI.pack_replace("solar-panel-equipment-2", "blue", "orange")
AI.pack_replace("solar-panel-equipment-4", "blue", "yellow")
OV.remove_prereq("bob-energy-shield-equipment-3", "production-science-pack")
OV.remove_prereq("bob-battery-equipment-4", "production-science-pack")
OV.remove_prereq("bob-battery-equipment-6", "tech-yellow-packs")
OV.remove_prereq("personal-laser-defense-equipment-3", "production-science-pack")
OV.remove_prereq("night-vision-3", "production-science-pack")
end

-------------------------------------------------------------------------------
Expand Down
22 changes: 22 additions & 0 deletions angelsrefining/prototypes/angels-functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2068,3 +2068,25 @@ function angelsmods.functions.set_next_upgrade(crafting_machine_type, crafting_m
--check upgrade_category
angelsmods.functions.set_fast_replace_category(crafting_machine_type, crafting_machine_name, next_upgrade)
end

-------------------------------------------------------------------------------
-- CHECK IF TECH USES SCIENCE PACK --------------------------------------------
-------------------------------------------------------------------------------
function angelsmods.functions.tech_uses_science_pack(tech_name, pack)
if type(tech_name) == "string" then
local technology = data.raw.technology[tech_name]
if technology then
technology = technology.normal or technology.expensive or technology
if technology.unit and technology.unit.ingredients then
local addit = true
for i, ingredient in pairs(technology.unit.ingredients) do
if ingredient[1] == pack or ingredient.name == pack then
return true
end
end
end
end
end

return false
end

0 comments on commit 946fcbe

Please sign in to comment.