Eye for an Eye fixed


Biters that damage your structures take a portion of that damage in return – turning every breach into a self‑defeating attack. Fully updated for Factorio 2.0 and Space Age with enhanced reliability and debugging.

Content
2 hours ago
0.17 - 2.0
677
Enemies

FAQ

FAQ – Eye for an Eye

General

What does this mod do?

When an enemy (biter, spitter, worm, etc.) damages a player‑owned building, the attacker takes a configurable percentage of that damage back as reflected damage (default: 20%). Additionally, every enemy kill reduces the global evolution factor by a configurable amount, giving you a small reward for successful defence.


Is this compatible with Space Age?

Yes. This mod has been thoroughly tested with Factorio 2.0.77 and the Space Age expansion. It uses the verified API methods (force.get_evolution_factor() and force.set_evolution_factor()) that work correctly in the latest version.


Settings

What settings are available?

The mod adds the following runtime‑global settings (find them in Settings → Mod Settings → Runtime Global):

Setting Default Description
Enable Debug Logging false Logs detailed messages to factorio-current.log (does NOT affect in‑game chat).
Show Evolution Changes in Chat false Prints evolution change messages in the in‑game chat. Can be spammy when killing many enemies.
Prevent Evolution from Nest Destruction true When enabled, destroying spawners does not add evolution. Disable to allow the vanilla evolution gain.
Evolution Reduction per Kill 0.005 Amount subtracted from the global evolution factor when an enemy dies. Example: 0.01 = 1 percentage point.
Reflection Damage Multiplier 0.2 Multiplier for damage reflected back to attackers. 0 = no reflection, 0.2 = 20%, 1 = 100%, 100 = 10000%.

Why do I see Unknown key: "eye-for-an-eye-..." in the settings menu?

This means you are missing the locale file. Ensure the locale/en/settings.cfg file is present in your mod folder. If the issue persists, re‑download the mod from the portal.


Evolution

How does the evolution reduction work?

Every time an enemy (biter, spitter, worm, spawner, etc.) dies, the mod reads the current global evolution factor, subtracts the configured amount, and writes the new value. The mod uses the verified API methods:
- Reading: force.get_evolution_factor()
- Writing: force.set_evolution_factor(value)


Why does the evolution not drop as fast as I expect?

The default reduction is 0.005 (0.5 percentage points) per kill. If you kill 10 enemies, that's a total reduction of 5 percentage points. You can increase this value in the mod settings if you want a more aggressive drop.

Also, time and pollution continue to increase evolution in the background, which can offset your gains. If you want to completely stop evolution growth, you can also set the time_factor and pollution_factor in the map settings to 0.


Does killing spawners (nests) increase evolution?

By default, no. The mod sets destroy_factor = 0, which means destroying spawners adds zero evolution. If you want the vanilla behaviour (evolution increases when you destroy nests), disable the setting Prevent Evolution from Nest Destruction.


Reflection Damage

How much damage is reflected?

By default, the attacker receives 20% of the original damage dealt to the player's building. However, this is fully configurable via the Reflection Damage Multiplier setting.


Can I change the amount of damage reflected?

Yes. The mod includes a setting Reflection Damage Multiplier in Settings → Mod Settings → Runtime Global. You can set it to any value from 0 (no reflection) to 100 (10000% damage). Examples:
- 0 = 0% (reflection disabled)
- 0.1 = 10%
- 0.2 = 20% (default)
- 1.0 = 100%
- 10.0 = 1000%
- 100.0 = 10000%

This setting takes effect immediately – no restart required.


Why does the reflected damage sometimes not kill the attacker?

The reflection is applied as electric damage. Some enemies may have resistance to electric damage, or the reflected amount may simply not be enough to kill them in one hit. The mod applies the damage and lets the game's combat system handle the rest.


I see a crash with LuaEntity API call when LuaEntity was invalid!

This error occurs when the attacker dies during the damage event, before the reflection can be applied. This has been fixed in version 2.9.7 and above. The mod now safely checks whether the entity is still valid before applying damage and logging.

If you are still experiencing this issue, please update to the latest version.


Commands

What console commands are available?

Command Description
/evolution-down Reduces the global evolution factor by the configured amount. Useful for testing.
/evolution-get Displays the current evolution factor with full precision (6 decimal places).

Example usage: /evolution-get -> Evolution: 0.045090 (4.5090%)


Troubleshooting

The mod is not reducing evolution!

Check the following:
1. Ensure the setting Evolution Reduction per Kill is set to a positive value (e.g., 0.005 or higher).
2. Enable Enable Debug Logging and check factorio-current.log for error messages.
3. Use the /evolution-get command to verify the current value before and after killing enemies.
4. Make sure you are killing enemies that belong to the enemy force (biters, spitters, worms, spawners). Other entities (e.g., neutral animals from other mods) may not trigger the reduction.


The mod is spamming chat!

Disable the setting Show Evolution Changes in Chat (it is false by default). The mod will still reduce evolution, but you won't see the messages.


The reflected damage is not working!

Check that:
- The target building belongs to the player force.
- The attacker belongs to the enemy force.
- The damage amount is greater than zero.
- The Reflection Damage Multiplier is set to a value greater than 0.
- No other mod is interfering with the on_entity_damaged event.

Enable Enable Debug Logging to see detailed reflection logs in factorio-current.log.


I have a conflict with another mod!

This mod uses standard API events (on_entity_died and on_entity_damaged). Conflicts are rare, but if you suspect one:
1. Disable other mods one by one to isolate the conflict.
2. Enable debug logging and look for error messages.
3. Report the issue on the mod portal or GitHub with your factorio-current.log file.


Mod Credits

  • Original idea: abregado
  • Previous fixes: gearsgod
  • Factorio 2.0 / Space Age rebuild and updates: Dabria

Support

If you encounter any issues, please report them on the Factorio Mod Portal with your factorio-current.log file attached. Include details about your Factorio version, mod list, and steps to reproduce the problem.


Version: 2.9.8
Last Updated: 2026-07-24
Factorio Version: 2.0.77+