From 90376f11d5d8380f223a98fb323bb39d50361ae2 Mon Sep 17 00:00:00 2001 From: Aaron Veden Date: Sun, 28 Mar 2021 22:00:49 -0700 Subject: [PATCH] see changelog --- changelog.txt | 16 +++++++++ control.lua | 6 ++-- data-final-fixes.lua | 4 +-- data-updates.lua | 2 +- info.json | 2 +- libs/AIPlanning.lua | 58 +++++++++++++++++++++++++-------- libs/Constants.lua | 4 +-- make.rkt | 12 ++++--- prototypes/SwarmUtils.lua | 4 +-- prototypes/utils/BiterUtils.lua | 16 +++++---- 10 files changed, 87 insertions(+), 37 deletions(-) diff --git a/changelog.txt b/changelog.txt index 68cff1d..effe380 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,19 @@ +--------------------------------------------------------------------------------------------------- +Version: 1.0.5 +Date: 28. 03. 2021 + Tweaks: + - Increased max ai points by 24% + - Added chance for normal migration at minimum temperament + - Added raiding at medium-high temperament + - Increased raiding chance at high temperament + - Added a max temperament stage that is all raiding, onslaught, and siege + - Increased active nest contribution to temperament by 38% + Bugfixes: + - Fixed ion cannon event typo in points + - Fixed suicide biters explosions being lots of small explosions to one big explosion + - Fixed unit movement resolution modifer being to low to path effectively + - Fixed range_mode not being set on new enemies for bounding box to bounding box + --------------------------------------------------------------------------------------------------- Version: 1.0.4 Date: 28. 02. 2021 diff --git a/control.lua b/control.lua index 86b5273..4ed47c6 100755 --- a/control.lua +++ b/control.lua @@ -131,7 +131,7 @@ local function onIonCannonFired(event) --]] local map = universe.maps[event.surface.index] map.ionCannonBlasts = map.ionCannonBlasts + 1 - map.points = map.point + 4000 + map.points = map.points + 4000 local chunk = getChunkByPosition(map, event.position) if (chunk ~= -1) then @@ -1017,6 +1017,8 @@ script.on_event(defines.events.on_unit_group_finished_gathering, onGroupFinished script.on_event(defines.events.on_build_base_arrived, onBuilderArrived) +-- testing + remote.add_interface("rampantTests", { pheromoneLevels = tests.pheromoneLevels, @@ -1051,5 +1053,3 @@ remote.add_interface("rampantTests", scanChunkPaths = tests.scanChunkPaths } ) - --- remote.add_interface("rampant", interop) diff --git a/data-final-fixes.lua b/data-final-fixes.lua index d278ab5..84c34af 100755 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -46,9 +46,7 @@ for k, unit in pairs(data.raw["unit"]) do unit.ai_settings = { destroy_when_commands_fail = false, - allow_try_return_to_spawner = true, - path_resolution_modifier = -5, - do_seperation = true + allow_try_return_to_spawner = true } end end diff --git a/data-updates.lua b/data-updates.lua index 8d955c3..cba17a2 100755 --- a/data-updates.lua +++ b/data-updates.lua @@ -65,4 +65,4 @@ mapSettings.unit_group.max_member_slowdown_when_ahead = constants.UNIT_GROUP_MAX mapSettings.unit_group.max_group_slowdown_factor = constants.UNIT_GROUP_SLOWDOWN_FACTOR -data.raw["utility-constants"]["default"].unit_group_pathfinding_resolution = -5 +-- data.raw["utility-constants"]["default"].unit_group_pathfinding_resolution = -5 diff --git a/info.json b/info.json index 6e5b7dc..6563ee1 100755 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name" : "Rampant", "factorio_version" : "1.1", - "version" : "1.0.4", + "version" : "1.0.5", "title" : "Rampant", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", diff --git a/libs/AIPlanning.lua b/libs/AIPlanning.lua index 9f9b045..38cfd5d 100755 --- a/libs/AIPlanning.lua +++ b/libs/AIPlanning.lua @@ -120,7 +120,11 @@ function aiPlanning.planning(map, evolution_factor, tick) local roll = mRandom() if (map.temperament < 0.05) then -- 0 - 0.05 if universe.enabledMigration then - map.state = (universe.siegeAIToggle and AI_STATE_SIEGE) or AI_STATE_MIGRATING + if (roll < 0.7) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE + else + map.state = AI_STATE_MIGRATING + end else if universe.raidAIToggle then if (roll < 0.85) then @@ -134,8 +138,8 @@ function aiPlanning.planning(map, evolution_factor, tick) end elseif (map.temperament < 0.20) then -- 0.05 - 0.2 if (universe.enabledMigration) then - if (roll < 0.4) then - map.state = (universe.siegeAIToggle and AI_STATE_SIEGE) or AI_STATE_MIGRATING + if (roll < 0.4) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE else map.state = AI_STATE_MIGRATING end @@ -173,27 +177,29 @@ function aiPlanning.planning(map, evolution_factor, tick) map.state = AI_STATE_PEACEFUL end elseif (map.temperament < 0.8) then -- 0.6 - 0.8 - if (roll < 0.6) then + if (roll < 0.4) then map.state = AI_STATE_AGGRESSIVE - elseif (roll < 0.8) then + elseif (roll < 0.6) then map.state = AI_STATE_ONSLAUGHT + elseif (roll < 0.8) then + map.state = AI_STATE_RAIDING else map.state = AI_STATE_PEACEFUL end - else -- 0.8 - 1 + elseif (map.temperament < 0.95) then -- 0.8 - 0.95 if (universe.enabledMigration and universe.raidAIToggle) then - if (roll < 0.15) then - map.state = (universe.siegeAIToggle and AI_STATE_SIEGE) or AI_STATE_ONSLAUGHT - elseif (roll < 0.6) then - map.state = AI_STATE_ONSLAUGHT - elseif (roll < 0.8) then + if (roll < 0.15) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE + elseif (roll < 0.4) then map.state = AI_STATE_RAIDING + elseif (roll < 0.8) then + map.state = AI_STATE_ONSLAUGHT else map.state = AI_STATE_AGGRESSIVE end elseif (universe.enabledMigration) then - if (roll < 0.15) then - map.state = (universe.siegeAIToggle and AI_STATE_SIEGE) or AI_STATE_ONSLAUGHT + if (roll < 0.15) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE elseif (roll < 0.7) then map.state = AI_STATE_ONSLAUGHT else @@ -214,6 +220,30 @@ function aiPlanning.planning(map, evolution_factor, tick) map.state = AI_STATE_AGGRESSIVE end end + else + if (universe.enabledMigration and universe.raidAIToggle) then + if (roll < 0.2) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE + elseif (roll < 0.6) then + map.state = AI_STATE_RAIDING + else + map.state = AI_STATE_ONSLAUGHT + end + elseif (universe.enabledMigration) then + if (roll < 0.2) and universe.siegeAIToggle then + map.state = AI_STATE_SIEGE + else + map.state = AI_STATE_ONSLAUGHT + end + elseif (universe.raidAIToggle) then + if (roll < 0.4) then + map.state = AI_STATE_ONSLAUGHT + else + map.state = AI_STATE_RAIDING + end + else + map.state = AI_STATE_ONSLAUGHT + end end -- print("changing state", map.state) @@ -247,7 +277,7 @@ function aiPlanning.temperamentPlanner(map) local delta = 0 if activeNests > 0 then - local val = (0.021695 * activeNests) + local val = (0.03 * activeNests) delta = delta + val else delta = delta - 0.014463 diff --git a/libs/Constants.lua b/libs/Constants.lua index ec0d3fa..7494491 100755 --- a/libs/Constants.lua +++ b/libs/Constants.lua @@ -124,7 +124,7 @@ constants.AI_VENGENCE_SQUAD_COST = 45 constants.AI_SETTLER_COST = 400 constants.AI_BASE_BUILDING_COST = 500 constants.AI_TUNNEL_COST = 100 -constants.AI_MAX_POINTS = 12500 +constants.AI_MAX_POINTS = 15500 constants.AI_MAX_OVERFLOW_POINTS = constants.AI_MAX_POINTS * 3 constants.RAIDING_MINIMUM_BASE_THRESHOLD = 550 @@ -149,7 +149,6 @@ constants.BASE_AI_STATE_ACTIVE = 1 constants.BASE_AI_STATE_OVERDRIVE = 2 constants.BASE_AI_STATE_MUTATE = 3 - constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = 0.5 constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = 3 @@ -164,7 +163,6 @@ constants.BASE_AI_MAX_STATE_DURATION = 10 constants.BASE_AI_MIN_TEMPERAMENT_DURATION = 5 constants.BASE_AI_MAX_TEMPERAMENT_DURATION = 15 - -- ai base constants.BASE_CLEAN_DISTANCE = 13 diff --git a/make.rkt b/make.rkt index 07aa293..d25ca4b 100755 --- a/make.rkt +++ b/make.rkt @@ -2,7 +2,7 @@ (require json) (define modFolder "/mnt/gallery/gameFiles/factorio/mods/") -(define zipModFolder "/data/games/factorio2/mods/") +(define serverModFolder "/home/veden/Downloads/factorio/mods/") (define configuration (call-with-input-file "info.json" (lambda (port) (string->jsexpr (port->string port))))) @@ -14,8 +14,10 @@ (let ((packagePath (string->path (string-append folder packageName ".zip")))) - (delete-directory/files (string->path (string-append folder - packageName))) + (when (file-exists? (string->path (string-append folder + packageName))) + (delete-directory/files (string->path (string-append folder + packageName)))) (when (file-exists? packagePath) (delete-file packagePath))) (zip (string-append folder @@ -91,7 +93,9 @@ (hash-ref configuration 'version))) (print (string-append "copying " (hash-ref configuration 'name) (hash-ref configuration 'version))) - (copyFiles modFolder)) + (copyFiles modFolder) + ;; (copyFiles serverModFolder) + ) (define (zipIt) (set! configuration (call-with-input-file "info.json" diff --git a/prototypes/SwarmUtils.lua b/prototypes/SwarmUtils.lua index 1be4e90..c4106c8 100755 --- a/prototypes/SwarmUtils.lua +++ b/prototypes/SwarmUtils.lua @@ -104,10 +104,10 @@ local nuclearAttackNumeric = { } local bombAttackNumeric = { - ["damage"] = { 25, 25, 25, 25, 30, 30, 40, 40, 50, 50 }, + ["damage"] = { 50, 75, 100, 125, 180, 240, 400, 480, 650, 700 }, ["radius"] = { 1.75, 1.75, 2, 2.5, 3, 3, 3.5, 3.5, 3.75, 4 }, ["explosionDistance"] = { 2, 2, 2, 2, 2, 2.5, 2.5, 2.5, 3, 3 }, - ["explosionCount"] = { 2, 3, 4, 5, 6, 8, 10, 12, 13, 14 } + ["explosionCount"] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } local streamAttackNumeric = { diff --git a/prototypes/utils/BiterUtils.lua b/prototypes/utils/BiterUtils.lua index a2220b0..a9995a6 100755 --- a/prototypes/utils/BiterUtils.lua +++ b/prototypes/utils/BiterUtils.lua @@ -229,7 +229,7 @@ function biterFunctions.makeBiter(attributes) icon = "__base__/graphics/icons/small-biter.png", icon_size = 64, icon_mipmaps = 4, - flags = attributes.flags or {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"}, + flags = attributes.flags or {"placeable-player", "placeable-enemy", "placeable-off-grid", "not-repairable", "breaths-air"}, max_health = attributes.health, order = "b-b-a", subgroup="enemies", @@ -266,7 +266,7 @@ function biterFunctions.makeBiter(attributes) working_sound = sounds.biter_calls(0.2 + (0.05 * attributes.effectiveLevel)), running_sound_animation_positions = {2,}, run_animation = biterrunanimation(attributes.scale, attributes.tint, attributes.tint2 or attributes.tint, attributes.altBiter), - ai_settings = { destroy_when_commands_fail = false, allow_try_return_to_spawner = true, path_resolution_modifier = -5, do_seperation = true } + ai_settings = { destroy_when_commands_fail = false, allow_try_return_to_spawner = true } } if attributes.collisionMask then entity.collision_mask = attributes.collisionMask @@ -287,7 +287,7 @@ function biterFunctions.makeSpitter(attributes) icon = "__base__/graphics/icons/small-spitter.png", icon_size = 64, icon_mipmaps = 4, - flags = attributes.flags or {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"}, + flags = attributes.flags or {"placeable-player", "placeable-enemy", "placeable-off-grid", "not-repairable", "breaths-air"}, max_health = attributes.health, order = "b-b-a", subgroup="enemies", @@ -319,7 +319,7 @@ function biterFunctions.makeSpitter(attributes) damaged_trigger_effect = ((not settings.startup["rampant--removeBloodParticles"].value) and makeDamagedParticle(attributes)) or nil, affected_by_tiles = settings.startup["rampant--unitsAffectedByTiles"].value, run_animation = spitterrunanimation(attributes.scale, attributes.tint, attributes.tint2 or attributes.tint), - ai_settings = { destroy_when_commands_fail = false, allow_try_return_to_spawner = true, path_resolution_modifier = -5, do_seperation = true } + ai_settings = { destroy_when_commands_fail = false, allow_try_return_to_spawner = true } } if attributes.collisionMask then entity.collision_mask = attributes.collisionMask @@ -482,7 +482,7 @@ function biterFunctions.makeWorm(attributes) name = attributes.name .. "-rampant", icon = "__base__/graphics/icons/medium-worm.png", icon_size = 64, icon_mipmaps = 4, - flags = attributes.flags or {"placeable-player", "placeable-enemy", "not-repairable", "breaths-air"}, + flags = attributes.flags or {"placeable-player", "placeable-enemy", "not-repairable", "not-repairable", "breaths-air"}, order="b-b-e", subgroup="enemies", max_health = attributes.health, @@ -582,6 +582,7 @@ function biterFunctions.createSuicideAttack(attributes, blastWave, animation) type = "projectile", range = attributes.range or 0.5, cooldown = attributes.cooldown or 35, + range_mode = "bounding-box-to-bounding-box", ammo_category = "melee", ammo_type = { category = "biological" @@ -1093,6 +1094,7 @@ function biterFunctions.createElectricAttack(attributes, electricBeam, animation { type = "beam", ammo_category = "biological", + range_mode = "bounding-box-to-bounding-box", cooldown = attributes.cooldown or 20, warmup = attributes.warmup, min_attack_distance = (attributes.range and (attributes.range - 2)) or 15, @@ -1121,6 +1123,7 @@ function biterFunctions.createProjectileAttack(attributes, projectile, animation return { type = "projectile", ammo_category = "biological", + range_mode = "bounding-box-to-bounding-box", cooldown = attributes.cooldown or 15, warmup = attributes.warmup, cooldown_deviation = 0.15, @@ -1168,6 +1171,7 @@ function biterFunctions.createMeleeAttack(attackAttributes) range = attackAttributes.range or 0.5, cooldown = attackAttributes.cooldown or 35, cooldown_deviation = 0.15, + range_mode = "bounding-box-to-bounding-box", ammo_category = "melee", ammo_type = { category = "melee", @@ -1274,7 +1278,7 @@ function biterFunctions.createStreamAttack(attributes, fireAttack, animation) warmup = attributes.warmup or 0, damage_modifier = attributes.damageModifier or 1.0, - + range_mode = "bounding-box-to-bounding-box", lead_target_for_projectile_speed = attributes.particleHoizontalSpeed or 0.6, projectile_creation_parameters = spitter_shoot_shiftings(attributes.scale, attributes.scale * 20),