Cheese's Concentrated Solar


Adds concentrated solar energy based around heliostat mirrors, which can point at solar power towers to generate heat for heliothermal energy production, or solar lens towers to generate giant lasers.

Content
6 months ago
1.1 - 2.0
48.7K
Combat Power

b Crash when leveling up Solar Laser Tower

10 days ago

Hello! I'm running this in a pack alongside Quality Turrets Reworked mod. When the Solar Laser Tower leveled up in quality, it caused this error:

The mod Quality Turrets Reworked (0.11.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event quality-turrets-reworked::on_entity_died (ID 4)
The mod Cheese's Concentrated Solar (0.5.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event ch-concentrated-solar::script_raised_built (ID 92)
ch-concentrated-solar/control/database.lua:89: DATABASE CORRUPTION: Mirror is linked to an invalid tower
stack traceback:
[C]: in function 'assert'
ch-concentrated-solar/control/database.lua:89: in function 'link_mirror_to_tower'
ch-concentrated-solar/control/database.lua:169: in function 'link_mirror_to_tower_if_closer'
ch-concentrated-solar/control/database.lua:403: in function 'on_built_entity_callback'
ch-concentrated-solar/control.lua:50: in function <ch-concentrated-solar/control.lua:49>
stack traceback:
[C]: in function 'create_entity'
quality-turrets-reworked/control.lua:204: in function 'DidTurretKill'
quality-turrets-reworked/control.lua:131: in function <quality-turrets-reworked/control.lua:127>

Unsure which mod is more responsible in causing this, so I'm informing you both. Thanks!

9 days ago

Hi! I believe the crash is due to a strict assertion in ch-concentrated-solar/control/database.lua:89 (“DATABASE
CORRUPTION: Mirror is linked to an invalid tower”).
When another mod replaces a tower via create_entity with raise_built = true, there’s a short window where a mirror
still points at a now-invalid tower. Your code currently asserts in that case, which hard-crashes.

Suggested fix:

  • In db.link_mirror_to_tower, if storage.mirrors[mid].tower exists but is invalid, clean up that relation instead of
    asserting (e.g., remove mirror->tower link and proceed to relink).
  • Alternatively, defensively validate in db.link_mirror_to_tower_if_closer / db.on_built_entity_callback before
    linking.

This would make the mod robust against external fast-replace/upgrade flows.

5 days ago

👍

New response