Worm Attack!

by wodzu93
Adds Behemoth and Colossal worms in the late game. These worms can burrow and dig to your base, then attack from beneath.
4 months ago
0.15 - 0.16
Owner: wodzu93
Source: N/A
Homepage: https://forums.factorio.com/viewtopic...
License: CC BY-NC-SA
Created: 1 year, 8 months ago
Latest Version: 2.2.3 (4 months ago)
Factorio version: 0.15 - 0.16
Downloaded: 2272 times

Release: 31/03/2016
Factorio-Version: 0.16.X
Original Author: iamseph, https://forums.factorio.com/viewtopic.php?f=93&t=22790
Note: This is an update to 0.15, all credit goes to iamseph for making this mod.

This mod adds extra tiers of worms, Behemoth and Colossal.
The higher tier worms are bigger, tougher and attack with a long-ranged area-effect acid splash
Most importantly: Worms can come for you!

Starting from evolution factor of 75%, Big, Behemoth and Colossal worms gain the ability to dig underground and slowly tunnel towards your base (they are attracted to the highest pollution area).

When they find you or your structures they will surface beneath them, destroying them from below before surfacing to spit acid splashes at nearby targets.

This late-game change shakes up your turtling, making even the best-laid defences vulnerable to attack.

Base attack video: https://youtu.be/AAVUZG96QHk
Size demonstration video: https://youtu.be/D0BlNfSWSD4

Counterplay options:
- Research new Orbital Seismic Scanners tech to be aware of worm movements.
- Pave area with player made tiles. It discourages worms from surfacing there and severly hinders their attempts at surfacing. Higher "Walking Speed Modifier" of a tile improves these effects.
- Have Construction Robots in endangered areas. Worms will die if they can't surface within set amount of attempts, so keeping buildings from being destroyed will prevent worms from surfacing.
- Worms will grow and burrow only if within pollution range. Either clear area surrounding your base or invest in Efficiency Modules to reduce pollution cloud.
- Enough walls in a chunk can provoke worms to try surfacing in that area. Use this to control where they attack. High enough pollution in adjacent chunks can migitate this preference however.
- Place turrets in areas with high pollution. Chances are, your turrets will kill or damage the worm while it is busy surfacing.

Under the hood mechanics:
- Each worm type has different number of attacks while trying to surface. If it can't clear space to dig out within those attempts, it will die. These numbers are 6, 12 and 18 for Big, Behemoth and Collossal Worms respectively. Tiles that speed up player movement will reduce these numbers, up to by a third with Reinforced Concrete.
- Each burrowing check, worm decides between attacking inside current chunk and moving to adjacent chunks. Logic is as follows:
1) If there are no player structures, move orthogonally towards adjacent chunk with most pollution.
2) If current chunk has more pollution than all adjacent chunks AND there are structures present, attack that location.
3) If any adjacent chunk has more pollution than current one AND there are structures present, calculate decision with formula: [(pollution in adjacent chunk - pollution in current chunk) * pollution weight LESS THAN target signature]
"Target signature" is a total score calculated from counting structures in a chunk. Most entities have score of 100, walls have score of 250, Thumper (NE Buidings) has score of 500k. Presence of tiles reduces target signature. If formula is true, worm attacks current chunk, else it moves towards adjacent chunk. "pollution weight" can be adjusted im mod setting to player liking.
- Worms that start digging will spawn a Small Worm in their place.
- Behemoth and Collossal Worms do not spawn naturally. Instead, worms have a chance to grow bigger when there is any pollution in the chunk they occupy and evolution factor is high enough:

50% Small Worm -> Medium Worm
75% Medium Worm -> Big Worm
95% Big Worm -> Behemoth Worm
99% Behemoth Worm -> Colossal Worm

Known issues:
- Worms won't target non-military structures by themselves. Turrets are hardcoded to act this way, so this can't be fixed, unfortunately.