Skip to content

Commit

Permalink
Compatibility with Rampant
Browse files Browse the repository at this point in the history
  • Loading branch information
heinwessels committed Dec 26, 2023
1 parent e08e96c commit ab325af
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 18 deletions.
7 changes: 6 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---------------------------------------------------------------------------------------------------
Version: 0.5.2
Date: 26.12.2023
Features:
- Compatibility with Rampant.
---------------------------------------------------------------------------------------------------
Version: 0.5.1
Date: 01.12.2023
Changes:
- Biters now consistently attack the Egg Extractor, Incubator, Treadmills, Revitalizer and Cage Cannon.
- Player can no longer incubate or revitalize biters in their mere hands.
- Player can no longer incubate or revitalize biters in their bare hands.
- (Internal) Big refactor of control stage to use event-handler and Sumneko Language Server.
- (Internal) Added rudemental integration test to verify escape periods.
---------------------------------------------------------------------------------------------------
Expand Down
63 changes: 55 additions & 8 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ config.biter.tiers = {
density_modifier = 7,
escape_period = 60 * 60 * 15,
},
[9] = {
energy_modifer = 8,
density_modifier = 8,
escape_period = 60 * 60 * 10,
},
[10] = {
energy_modifer = 8,
density_modifier = 8,
escape_period = 60 * 60 * 7,
},
}

-- Here we define the different biter types. All stats
Expand Down Expand Up @@ -220,7 +230,7 @@ config.biter.types = {
},
["behemoth-spitter"] = {
copy = "behemoth-biter",
tint = {r = 0.7, g = 0.95, b = 0.4, a = 1.000},
tint = {r = 0.7, g = 0.95, b = 0.4, a = 1.000},
},
}

Expand All @@ -238,13 +248,18 @@ if enabled_mods["bobenemies"] then
leviathan_tier = 8
end

if enabled_mods["Rampant"] then
-- Oof. Rampant is rough
leviathan_tier = 10
end

if enabled_mods["Explosive_biters"] then
config.biter.types["small-explosive-biter"] = {copy = "small-biter", scale = 0.48}
config.biter.types["medium-explosive-biter"] = {copy = "medium-biter", scale = 0.49}
config.biter.types["big-explosive-biter"] = {copy = "big-biter", scale = 0.50}
config.biter.types["behemoth-explosive-biter"] = {copy = "behemoth-biter", scale = 0.51}
config.biter.types["explosive-leviathan-biter"] = {tier = leviathan_tier, scale = 0.30}

config.biter.types["small-explosive-spitter"] = {copy = "small-spitter"}
config.biter.types["medium-explosive-spitter"] = {copy = "medium-spitter"}
config.biter.types["big-explosive-spitter"] = {copy = "big-spitter"}
Expand All @@ -258,7 +273,7 @@ if enabled_mods["Cold_biters"] then
config.biter.types["big-cold-biter"] = {copy = "big-biter"}
config.biter.types["behemoth-cold-biter"] = {copy = "behemoth-biter"}
config.biter.types["leviathan-cold-biter"] = {tier = leviathan_tier}

config.biter.types["small-cold-spitter"] = {copy = "small-spitter"}
config.biter.types["medium-cold-spitter"] = {copy = "medium-spitter"}
config.biter.types["big-cold-spitter"] = {copy = "big-spitter"}
Expand All @@ -273,7 +288,7 @@ if enabled_mods["Toxic_biters"] then
config.biter.types["big-toxic-biter"] = {copy = "big-biter", scale = 0.50}
config.biter.types["behemoth-toxic-biter"] = {copy = "behemoth-biter", scale = 0.51}
config.biter.types["leviathan-toxic-biter"] = {tier = leviathan_tier, scale = 0.30}

config.biter.types["small-toxic-spitter"] = {copy = "small-spitter"}
config.biter.types["medium-toxic-spitter"] = {copy = "medium-spitter"}
config.biter.types["big-toxic-spitter"] = {copy = "big-spitter"}
Expand All @@ -300,7 +315,7 @@ if enabled_mods["bobenemies"] then
config.biter.types["bob-titan-biter"] = {tier = 6}
config.biter.types["bob-behemoth-biter"] = {tier = 7}
config.biter.types["bob-leviathan-biter"] = {tier = leviathan_tier}

config.biter.types["bob-big-electric-spitter"] = {tier = 3}
config.biter.types["bob-huge-acid-spitter"] = {tier = 4}
config.biter.types["bob-huge-explosive-spitter"] = {tier = 4}
Expand All @@ -321,10 +336,41 @@ if enabled_mods["ArachnidsFaction"] then
config.biter.types["arachnid-spitter-mediumspitter-unit"] = {tier = 2, scale = 0.39}
config.biter.types["arachnid-spitter-bigspitter-unit"] = {tier = 3, scale = 0.40}
config.biter.types["arachnid-spitter-behemothspitter-unit"]= {tier = 4, scale = 0.41}
if enabled_mods["Arachnids_enemy"] then

if enabled_mods["Arachnids_enemy"] then
config.biter.types["arachnid-biter-leviathan-unit"] ={tier = leviathan_tier, scale = 0.3}
end

end

if enabled_mods["Rampant"] then
for _, mutation in pairs{
"neutral-biter",
"neutral-spitter",
"acid-biter",
"acid-spitter",
"laser-biter",
"laser-spitter",
"fire-biter",
"fire-spitter",
"inferno-spitter",
"wasp-spitter",
"spawner-spawn", --?
"spawner-spitter", --?
"electric-biter",
"physical-biter",
"troll-biter",
"poison-biter",
"suicide-biter",
"nuclear-biter",
"energy-thief-biter",
"fast-biter",
"fast-spitter"
} do
for tier=1,10 do
config.biter.types[mutation .. "-v1-t" .. tier .. "-rampant"] = {tier = tier}
end
end
end

-----------------------------------------------
Expand Down Expand Up @@ -378,11 +424,12 @@ end

-- Calculate the amount of tiers we have defined
config.biter.max_tier = 0
for biter_name, biter_config in pairs(config.biter.types) do
for _, biter_config in pairs(config.biter.types) do
if biter_config.tier > config.biter.max_tier then
config.biter.max_tier = biter_config.tier
end
end
if config.biter.max_tier == 0 then error("No tiers found! This should never happen") end
if not config.biter.tiers[config.biter.max_tier] then error("We do not support "..config.biter.max_tier.." tiers yet") end

return config
5 changes: 3 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "biter-power",
"version": "0.5.1",
"version": "0.5.2",
"title": "Biter Power",
"author": "stringweasel",
"factorio_version": "1.1",
Expand All @@ -13,6 +13,7 @@
"? Toxic_biters",
"? bobenemies",
"? Arachnids_enemy",
"? ArachnidsFaction"
"? ArachnidsFaction",
"? Rampant"
]
}
4 changes: 2 additions & 2 deletions locale/en/en.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ expected-containment=\n[font=default-semibold][color=#ffe6c0]Expected containmen

caged-biter=Caged __1__
tired-caged-biter=Tired Caged __1__
revitalization=__ENTITY____1____ Revitalization
incubation=__ENTITY____1____ Egg Incubation
revitalization=__1__ Revitalization
incubation=__1__ Egg Incubation

capture-complete=__1__ researched after successful [color=cyan]__ENTITY____2____[/color] capture!

Expand Down
5 changes: 3 additions & 2 deletions prototypes/incubator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ for tier = 1, config.biter.max_tier do
end

for biter_name, biter_config in pairs(config.biter.types) do

local unit = data.raw.unit[biter_name] -- Should exist, have checked already

local icons = util.copy(biter_config.icons)
table.insert(icons, 1, {
icon = "__biter-power__/graphics/incubator/biter-egg.png",
Expand All @@ -179,7 +180,7 @@ for biter_name, biter_config in pairs(config.biter.types) do
local recipe = {
type = "recipe",
name = "bp-incubate-egg-"..biter_name,
localised_name = {"bp-text.incubation", biter_name},
localised_name = {"bp-text.incubation", unit.localised_name or {"entity-name."..unit.name}},
icons = icons,
hide_from_player_crafting = true,
category = "incubation-tier-"..biter_config.tier,
Expand Down
4 changes: 3 additions & 1 deletion prototypes/revitalizer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ for tier = 1, config.biter.max_tier do
end

for biter_name, biter_config in pairs(config.biter.types) do
local unit = data.raw.unit[biter_name] -- Should exist, have checked already

local icons = util.copy(biter_config.icons)
table.insert(icons, 1, {
icon = "__biter-power__/graphics/revitalizer/icon.png",
Expand All @@ -279,7 +281,7 @@ for biter_name, biter_config in pairs(config.biter.types) do
local recipe = {
type = "recipe",
name = "bp-revitalization-"..biter_name,
localised_name = {"bp-text.revitalization", biter_name},
localised_name = {"bp-text.revitalization", unit.localised_name or {"entity-name."..unit.name}},
icons = icons,
hide_from_player_crafting = true,
show_amount_in_title = false,
Expand Down
2 changes: 1 addition & 1 deletion scripts/escapables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ end

local function on_constructed(event)
local entity = event.created_entity or event.entity or event.destination
if not entity or not entity.valid then return end
if not entity or not entity.valid then return end
if global.ignore_build_destroy_events == entity.unit_number then return end

if escapables.machines[entity.name] then
Expand Down
2 changes: 1 addition & 1 deletion scripts/trapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local trapping = { }
local biter_configs = config.biter.types

--- @param event EventData.on_script_trigger_effect
function attempt_trapping_biter(event)
local function attempt_trapping_biter(event)
if event.effect_id ~= "bp-cage-trap-trigger" then return end
local trap = event.source_entity -- Could also be the cage cannon
if not trap then return end
Expand Down

0 comments on commit ab325af

Please sign in to comment.