ThunderStorm: Lightning energy

by AivanF

Thunderstorm is coming! Build lightning rods to protect yourself or to tame this mighty element of nature by capturing divine amount of electricity or attacking biter beasts. Supports SE planets. WIP, even more fun will be added!

Content
6 months ago
1.1
439
Combat Environment Power
Owner:
AivanF
Source:
https://github.com/AivanF/factorio-Ai...
Homepage:
https://mods.factorio.com/mod/Lightning/
License:
GNU GPLv3
Created:
9 months ago
Latest Version:
1.0.15 (6 months ago)
Factorio version:
1.1
Downloaded by:
439 users

Thunderstorm is coming – protect yourself and to tame this mighty element of nature by capturing divine amount of electricity!

Here are YouTube demos:

I. Features

1. Occasional lightning

Max strength (1-5) and frequency differs by region and planet. All the lightning rods & handlers visualise current electricity potential.

Electric energy of a lightning is 100–500 * power_level MJ. Damage scales from small small ignition to a sort of nuclear explosion – but don't worry, 5th lightning power level cannot be produced naturally!

2. Constructions

2.1. Lightning rod

Simple structure that is able to catch a lightning and transfer it into the ground. Base capture probability is 95%, decreasing with lightning strength.

2.2. Lightning handler

Advanced construction that can catch lightnings and store their energy as an accumulator (outflow only). If you find a region with stable high electricity potential, you can use lightning handler as a primary power source (e.g. disconnecting your burner power plant when acc energy > 80%). Capture probability decreases with accumulator filling, so, remember to also place usual rods!

2.3. Mighty Heaven Handler

Expensive building with extremely large coverage, high resistance and durability, provides decent amount of accumulator capacity, has a change to catch strikes even being full.


This works like manual artillery with a dedicated remote. It has 2 attack types: single strike (level 4) or area bombarding (many lightnings of level 2). Note that Alt-mode click/select allows to preview available towers nearby.

2.4. Tesla tower

Allows to call your own lightning strikes! This is not a rod, so it only consumes energy: 20MW till 5GJ.

2.5. Zeus tower

Allows to attack even farther. Consumes even more energy: 200MW till 50GJ.

2.6. Electric potential radar (WIP)

Helps to find regions more suitable as a power source.

3. Technology researches

You can research mentioned building as well as improvements to increase lightning catch probability, lightning energy collection coefficient, distance and max level of manual lightning strikes.

4. Settings customisation

You can change global coefficients (capture probability, frequency, power scale, quality reduction), Nauvis homeworld parameters, planets condition presets (when SE is on). I strive to make settings map/runtime, so you can change most of them on the fly!

5. Space Exploration support

Some other planets (with iron and holmium, cryonite and vulcanite) also have lightnings, with different occurrence conditions.

6. Nice performance

The mod uses heavy calculations, but I tried to add as much optimisation, heuristics, cache as possible, You can get even better performance with proper runtime settings:

  • Decrease common lightnings rate, and increase lightning energy to compensate.
  • Set 1 or 2 extra reduction level for quality of distribution calculation.
  • If custom lightning attacks are more important to you, you can disable natural lightnings with console commands.

7. Console commands

7.1. Own lightnings strength
  • tsl-stri – set lightning level for single lightning strikes, argument is a number (1-5).
  • tsl-bomb – set lightning level for lightning bombarding, argument is a number (1-5).

Since v1.0.13 you can do this with a GUI button!

7.2 Surface management for admins
  • tsl-remove-surface – argument: surface name or index (e.g. nauvis).
  • tsl-add-surface – arguments: 1. surface name or index, 2. preset name (see below, but use lower case).
7.3 Debugging
  • tsl-rods-reload, tsl-clean-draw, tsl-clean-cache

II. Fun to be added / ToDo-list

  • Thunder weapon equipment.
  • Electric potential radar.
  • Lightning energy source priority issue: replace Lightning Handlers as accumulators to kinda assembly machines: store lightning energy in special batteries and use as a fuel.
  • Lightning targets priorities (after the rods, like steam engines).
  • Even more performance optimisation.
  • I'd like to make more different graphics, animations (but artworks are time-consuming hard-work, so I need more motivation for this, see more appreciation, higher download numbers; or somebody can help with this!).

Note that the mod is in active development and testing, so constant regions distribution, rates/balance, setting names can be changed. Although I try to keep everything stable. If you mention a bug or bad performance – feel free to tell this on Discord or here in discussions.

III. Advices

  1. A rod can miss but still lead the lightning to strike nearby, so it's better to place it 8+ tiles from important buildings.
  2. A rule of thumb is to place rods of number = 1 + 1 * local power level, more for critical structures.
  3. A random inflammation can easily burn a forest, so, if you like the nature, I recommend to use some growing trees mod.
  4. Technically, Lightning handlers are accumulators internally, so they provide energy as 3rd order, after 1st after solar panels and 2nd nuclear/burner plants. To prioritise energy sources, you can use a latch, especially with a timer, to disable nuclear/burner plants until accumulators capacity <70%,, so that accumulators are secondary power source. Below is my setup:

IV. Technical details

1. Lightning rate and power level

Lightings appearing depends on 3 rates:

  1. Common rate – affects frequency of all surfaces, it doesn't affect power level.
  2. Base rate for a surface, it sets uniform distribution for the whole planet, and affects power level.
  3. Regional lightning rate which assigns each chunk its own rate and also affects power level. The formula is based on Perlin noise with several surface parameters:

    • Regional rate – sets max rate per chunk.
    • Regions size – specifies spatial scale of regions.
    • Change speed – if set, regions and rates will change over time.

Lightning probability is based on all 3 rates, and chunk max power level is base rate + region rate (actually it has 10% chance to be higher).

2. Presets

There are several presets of lightning behaviour for a planet:

  • Home – used at Nauvis and other possible homeworlds. By default, it has 0 base rate, 1 region rate, 1 regions scale, 0 region change speed, but you can change it with runtime settings.
  • Total – used at iron and holmium planets. It sets base rate to 1.
  • Moving – used at cryonite and vulcanite planets. It sets base rate to 0, speed and regions size and power rate higher than home's defaults, and a small regions change speed.

There are map/runtime settings to change presets for planets of every resource type.

V. License

You can do whatever you want, but:
1. If you wanna make a fork to add some features, I'd prefer a pull request to GitHub, or you can reach me on Discord to discuss.
2. If you use my sounds or pictures, add attribution with an active link.

VI. Marketing