Jungle Raiders
A Factorio 2.0 mod that adds hostile human enemies (Raiders) that hunt players in coordinated packs. Adds a new threat to your factory beyond the native biters!
Features
Raider Unit Types
Nine distinct raider classes, each with unique roles and combat styles:
Standard Units
| Unit | Role | Speed | Health | Description |
|---|---|---|---|---|
| Scout | Flanker | 0.18 | 80 | Fast, lightly armored. Flanks at wide angles during combat. |
| Assault | Assault | 0.12 | 150 | Balanced combat stats. The backbone of raider squads. Can sabotage power poles. |
| Heavy | Tank | 0.06 | 400 | Slow but extremely durable. High damage output. Can sabotage power poles. |
| Sniper | Sniper | 0.10 | 100 | Long-range specialist (30 tile range). Stays far from targets during combat. |
| Support | Support | 0.11 | 120 | Combat medic. Faster self-healing, stays behind front lines. |
| Thief | Thief | 0.22 | 50 | Fastest unit. Dedicated to stealing from belts. Drops stolen items on death. |
Elite Units (Rare Spawns - Power Armor Visuals)
| Unit | Role | Speed | Health | Description |
|---|---|---|---|---|
| Commander | Commander | 0.10 | 300 | Elite leader in modular armor. Coordinates attacks. ~3% spawn chance. |
| Enforcer | Tank | 0.08 | 600 | Heavy soldier in power armor. Devastating machine gun. ~2% spawn chance. |
| Juggernaut | Juggernaut | 0.05 | 1000 | Ultimate threat in power armor MK2. Massive damage, nearly unstoppable. ~1% spawn chance. |
Boss Unit (Manual Spawn Only)
| Unit | Role | Speed | Health | Description |
|---|---|---|---|---|
| Warlord | Warlord | 0.04 | 2500 | Final boss in mech armor (Space Age). Walking fortress with 120 damage per hit. Must be spawned via console. |
Pack AI System
Raiders operate in coordinated packs with an Alpha leader:
- Alpha Leader: Heavy, Assault, or Elite unit that leads the pack. Pack morale depends on Alpha survival.
- Pack States:
hunting- Actively seeking player targetsflanking- Coordinated attack with role-based positioningregrouping- Gathering around Alpha before engagingambush- Waiting silently for player to approach (30% of spawns)fleeing- Retreating after Alpha death (50% chance)-
berserk- Aggressive scatter after Alpha death (50% chance) -
Role-Based Positioning: During combat, units position based on their role:
- Snipers stay 25 tiles back
- Heavies close to 6 tiles
- Scouts flank at 90-degree angles
-
Support stays 15 tiles behind front line
-
Retreat Behavior: Units below 30% HP retreat toward Alpha or away from danger
- Pack Communication: When one pack finds a target, nearby packs within 80 tiles are alerted
- Base Targeting: When no players are nearby, raiders head toward the center of player infrastructure (calculated from assemblers, furnaces, labs, etc.)
Raider Camps
Camps spawn in the world and generate patrols:
| Structure | Health | Description |
|---|---|---|
| Command Tent | 500 | Main structure. Destroying it drops a loot chest. |
| Barracks | 300 | Unit quarters. Two per camp. |
| Watchtower | 200 | Lookout post. |
| Barricade | 150 | Defensive walls around the perimeter. |
| Loot Chest | 100 | Spawns when command tent is destroyed. |
Camp features:
- Spawn 300-600 tiles from player spawn point
- Minimum 200 tile spacing between camps
- Maximum 5 camps on the map
- Each camp has an initial garrison of 4 raiders in ambush mode
- Camps spawn patrols of 3 units every 2 minutes (max 2 active patrols per camp)
- Destroying the command tent drops valuable loot (plates, ammo, grenades)
Special Behaviors
Saboteurs (Assault/Heavy)
Assault and Heavy units may target your power infrastructure:
- Search radius: 30 tiles for power poles
- 30% chance to seek sabotage targets when not in combat
- Persists attack until target destroyed
Belt Raiders
Thieves prioritize stealing items from transport belts:
- Valuable items: ores, plates, circuits, gears, cables, ammo, science packs
- Stolen items are tracked per-unit and drop on death when killed
- Thieves can carry up to 20 items total before their inventory is full
- Uses 5-tile steal radius for responsive belt detection
Performance Optimization
Special behaviors use a staggered update system:
- Updates spread across 60 ticks (1 second)
- Only a fraction of raiders processed each tick
- Prevents lag spikes even with many raiders
- Thieves update every 10 ticks (staggered) for balanced performance
Forces
The mod uses one custom force:
| Force | Relationship to Player | Purpose |
|---|---|---|
raiders |
Hostile | All raider units including thieves |
Note: Thieves are hostile to players but prioritize stealing from belts. They will only attack in self-defense and drop all stolen items when killed.
Configuration
Runtime settings available in Factorio's mod settings:
| Setting | Default | Description |
|---|---|---|
| Maximum Raiders | 20 | Max raiders on map at once |
| Spawn Check Interval | 60s | How often spawn checks occur |
| Spawn Chance | 30% | Chance to spawn on each check |
| Min Spawn Distance | 100 | Minimum tiles from player |
| Max Spawn Distance | 200 | Maximum tiles from player |
| Show Spawn Messages | true | Display messages when raiders spawn |
Console Commands
Debug and testing commands (use in Factorio console with /c):
Setup (Required for existing saves)
-- Initialize forces (run once on existing saves)
/c remote.call("jungle-raiders", "init_forces")
Spawning
-- Spawn a random pack of 4 raiders
/c remote.call("jungle-raiders", "spawn_pack", game.player.index, 4)
-- Spawn a pack in ambush mode
/c remote.call("jungle-raiders", "spawn_ambush", game.player.index, 4)
-- Spawn specific unit type (scout/assault/heavy/sniper/support/thief/commander/enforcer/juggernaut/warlord)
/c remote.call("jungle-raiders", "spawn_unit", game.player.index, "scout", 3)
/c remote.call("jungle-raiders", "spawn_unit", game.player.index, "juggernaut", 1)
-- Spawn the final boss (requires Space Age for mech armor visuals)
/c remote.call("jungle-raiders", "spawn_unit", game.player.index, "warlord", 1)
-- Spawn a camp near you
/c remote.call("jungle-raiders", "spawn_camp", game.player.index)
Information
-- Get all pack info
/c game.print(serpent.block(remote.call("jungle-raiders", "get_packs")))
-- Get active raider count
/c game.print(remote.call("jungle-raiders", "get_raider_count"))
-- Get all camps
/c game.print(serpent.block(remote.call("jungle-raiders", "get_camps")))
-- Get camp count
/c game.print(remote.call("jungle-raiders", "get_camp_count"))
-- Get all thieves (raiders with stolen items)
/c game.print(serpent.block(remote.call("jungle-raiders", "get_thieves")))
-- Get all active saboteurs
/c game.print(serpent.block(remote.call("jungle-raiders", "get_saboteurs")))
-- Get specific unit info
/c game.print(serpent.block(remote.call("jungle-raiders", "get_unit_info", <unit_number>)))
Debugging
-- Debug belt detection near player
/c remote.call("jungle-raiders", "debug_belts", game.player.index)
-- Debug thief state and force them to find belts
/c remote.call("jungle-raiders", "debug_force_steal", game.player.index)
-- Check thief tracking
/c game.print(serpent.block(remote.call("jungle-raiders", "debug_thieves")))
-- View current base center target (where raiders head when hunting)
/c game.print(serpent.block(remote.call("jungle-raiders", "get_base_center", game.player.index)))
-- Force recalculate base center
/c remote.call("jungle-raiders", "recalculate_base_center", game.player.index)
State Control
-- Force all packs into a specific state
/c remote.call("jungle-raiders", "set_pack_state", "hunting")
-- Valid states: hunting, flanking, regrouping, ambush, fleeing, berserk
Technical Details
Factorio 2.0 API Changes
This mod is built for Factorio 2.0 and uses:
- storage instead of global for data persistence
- absorptions_to_join_attack instead of pollution_to_join_attack
- New get_contents() format: returns {{name="item", count=N, quality="normal"}, ...}
- set_command moved from LuaEntity to LuaCommandable: use entity.commandable.set_command()
- spill_item_stack takes a single table argument: {position=, stack=, enable_looted=, allow_belts=}
- Entity references stored directly instead of relying on game.get_entity_by_unit_number()
Force System
raidersforce: Hostile to players and biters (all raider units use this force)
Entity Types
- Raider units use the
unitprototype type with character animations - Camp structures use
simple-entity-with-owner - Loot chest uses
container
Graphics
All graphics are borrowed from base Factorio:
- Standard units use character animations (light/medium/heavy armor)
- Elite units use power armor animations (modular/power/power-mk2)
- Boss unit uses mech armor animations (Space Age DLC, falls back to power-mk2)
- Camp structures use chest and lamp graphics
Mech Armor Compatibility
The Warlord uses Space Age's mech armor animations via data-final-fixes.lua:
- Runs after Space Age loads to access mech armor animation data
- Mech armor uses running_with_gun instead of standard running animation
- Falls back gracefully to power-armor-mk2 visuals if Space Age isn't installed
Unit Spawn Weights
| Unit | Weight | Chance |
|---|---|---|
| Assault | 35 | ~33% |
| Scout | 20 | ~19% |
| Heavy | 15 | ~14% |
| Sniper | 10 | ~9% |
| Support | 10 | ~9% |
| Thief | 10 | ~9% |
| Commander | 3 | ~3% |
| Enforcer | 2 | ~2% |
| Juggernaut | 1 | ~1% |
| Warlord | 0 | Manual only |
File Structure
jungle-raiders_0.1.0/
info.json - Mod metadata
data.lua - Data phase entry point
data-final-fixes.lua - Late data phase (mech armor compatibility)
control.lua - Runtime logic (~2000 lines)
settings.lua - Mod settings definitions
changelog.txt - Version history
README.md - This file
locale/
en/
locale.cfg - English translations
prototypes/
entities/
units.lua - Raider unit definitions
camps.lua - Camp structure definitions
Compatibility
- Factorio Version: 2.0+
- Dependencies: Base game only
- Incompatibilities: None known
Known Issues
- Camp structures: Static, no animations
- Graphics: Uses base game character graphics (no custom sprites)
Credits
- Author: Lukah
- Factorio Version: 2.0
License
MIT License - Feel free to use, modify, and distribute.