From ab325afe6ba3eb42ee6cf61a34b2476e69d413cd Mon Sep 17 00:00:00 2001 From: Hein Wessels Date: Tue, 26 Dec 2023 18:18:41 +0100 Subject: [PATCH] Compatibility with Rampant --- changelog.txt | 7 ++++- config.lua | 63 +++++++++++++++++++++++++++++++++----- info.json | 5 +-- locale/en/en.cfg | 4 +-- prototypes/incubator.lua | 5 +-- prototypes/revitalizer.lua | 4 ++- scripts/escapables.lua | 2 +- scripts/trapping.lua | 2 +- 8 files changed, 74 insertions(+), 18 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9981119..e32f9a2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. --------------------------------------------------------------------------------------------------- diff --git a/config.lua b/config.lua index d716fba..1952511 100644 --- a/config.lua +++ b/config.lua @@ -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 @@ -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}, }, } @@ -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"} @@ -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"} @@ -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"} @@ -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} @@ -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 ----------------------------------------------- @@ -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 \ No newline at end of file diff --git a/info.json b/info.json index b34410c..c20970b 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "biter-power", - "version": "0.5.1", + "version": "0.5.2", "title": "Biter Power", "author": "stringweasel", "factorio_version": "1.1", @@ -13,6 +13,7 @@ "? Toxic_biters", "? bobenemies", "? Arachnids_enemy", - "? ArachnidsFaction" + "? ArachnidsFaction", + "? Rampant" ] } \ No newline at end of file diff --git a/locale/en/en.cfg b/locale/en/en.cfg index 10eec32..aa9eeef 100644 --- a/locale/en/en.cfg +++ b/locale/en/en.cfg @@ -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! diff --git a/prototypes/incubator.lua b/prototypes/incubator.lua index 4246372..cc625d8 100644 --- a/prototypes/incubator.lua +++ b/prototypes/incubator.lua @@ -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", @@ -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, diff --git a/prototypes/revitalizer.lua b/prototypes/revitalizer.lua index 607ba0f..003a287 100644 --- a/prototypes/revitalizer.lua +++ b/prototypes/revitalizer.lua @@ -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", @@ -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, diff --git a/scripts/escapables.lua b/scripts/escapables.lua index fe378d0..5b3215c 100644 --- a/scripts/escapables.lua +++ b/scripts/escapables.lua @@ -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 diff --git a/scripts/trapping.lua b/scripts/trapping.lua index f0f660f..1ccd248 100644 --- a/scripts/trapping.lua +++ b/scripts/trapping.lua @@ -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