diff --git a/changelog.txt b/changelog.txt index 6d98066..70c716e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,7 +13,7 @@ Date: 23. 11. 2021 - Optimized adding new chunks to the Rampant in-memory state map - Added minimum building cost upgrade check before base upgrade performs scanning - Added max number of wander commands in a row for squads that aren't going anywhere before disbanding squad - - Optimized energy thief faction + - Optimized energy thief faction by switch to electric AOE projectile - Factorissimo, Space Exploration Orbits, asteroid belts, secret maps, starmap, AAI-signal, NiceFill, Blueprint lab surfaces are no longer processed - Map processing around player now changes to the surface the player is standing on - Squads now get processed regardless of the current active map being processed diff --git a/control.lua b/control.lua index e84bc2b..0ee329d 100644 --- a/control.lua +++ b/control.lua @@ -599,7 +599,7 @@ end local function onTriggerEntityCreated(event) if (event.effect_id == "rampant-drain-trigger") then local entity = event.target_entity - if (entity.valid) then + if (entity and entity.valid) then local map = universe.maps[event.surface_index] if not map then return @@ -608,6 +608,15 @@ local function onTriggerEntityCreated(event) if (chunk ~= -1) then setDrainedTick(map, chunk, event.tick) end + elseif (event.target_position) then + local map = universe.maps[event.surface_index] + if not map then + return + end + local chunk = getChunkByPosition(map, event.target_position) + if (chunk ~= -1) then + setDrainedTick(map, chunk, event.tick) + end end end end diff --git a/libs/Constants.lua b/libs/Constants.lua index 6387277..9a6e560 100644 --- a/libs/Constants.lua +++ b/libs/Constants.lua @@ -1390,7 +1390,7 @@ if settings.startup["rampant--energyThiefEnemy"].value then units = { { type = "biter", - attackAttributes = {"beam", "electric", "drainCrystal"}, + attackAttributes = {"spit", "electric", "drainCrystal"}, name = "biter", majorResistances = {"electric", "laser"}, minorResistances = {}, diff --git a/prototypes/SwarmUtils.lua b/prototypes/SwarmUtils.lua index de45393..808ba39 100644 --- a/prototypes/SwarmUtils.lua +++ b/prototypes/SwarmUtils.lua @@ -149,6 +149,13 @@ local clusterAttackNumeric = { ["startingSpeed"] = { 0.25, 0.25, 0.27, 0.27, 0.29, 0.29, 0.31, 0.31, 0.33, 0.33 } } +local liteClusterAttackNumeric = { + ["clusterDistance"] = { 2, 2, 3, 3, 3, 4, 4, 4, 5, 5 }, + ["clusters"] = { 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 }, + ["startingSpeed"] = { 0.25, 0.25, 0.27, 0.27, 0.29, 0.29, 0.31, 0.31, 0.33, 0.33 }, + ["damage"] = { 4, 7.5, 11.25, 15, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5 } +} + local biterAttributeNumeric = { ["range"] = { 0.5, 0.5, 0.75, 0.75, 1.0, 1.0, 1.25, 1.50, 1.75, 2.0 }, ["radius"] = { 0.5, 0.65, 0.75, 0.85, 0.95, 1.1, 1.2, 1.3, 1.4, 1.5 }, @@ -914,21 +921,39 @@ local function buildAttack(faction, template) attack.tint2)) or nil) end elseif (attack == "drainCrystal") then - template.actions = function(attributes, electricBeam) + template.range = { 6, 6, 7, 7, 8, 8, 9, 9, 10, 10 } + template.addon[#template.addon+1] = liteClusterAttackNumeric + template.attackPointEffects = function(attributes) return { { - type = "instant", - target_effects = - { - type = "script", - effect_id = "rampant-drain-trigger" - } + type = "script", + effect_id = "rampant-drain-trigger" }, { - type = "beam", - beam = electricBeam or "electric-beam", - duration = attributes.duration * 2 + type = "damage", + damage = { type="laser", amount = attributes.damage } + }, + { + type="nested-result", + action = { + { + type = "cluster", + cluster_count = attributes.clusters, + distance = attributes.clusterDistance, + distance_deviation = 1, + action_delivery = + { + type = "projectile", + projectile = makeLaser(attributes), + duration = 20, + direction_deviation = 0.6, + starting_speed = attributes.startingSpeed, + starting_speed_deviation = 0.3 + }, + repeat_count = 2 + } + } } } end