Biter Detector Sentinel Combinator deprecated

by mk-fg

Adds Sentinel Alarm and Combinator buildings that detect biters within configurable range, sending signals to connected circuit network.

Content
1 year, 9 months ago
0.18 - 1.1
1.71K
Circuit network

i [fixed] Breaks on large range values, configurable stuff

1 year, 9 months ago
(updated 1 year, 9 months ago)

Please, add two checkboxes to settings — enable/disable entities/recipe: for alarm and combinator (Startup tab).
Also, add max R (radius) value in settings (Map tab).

and fix crash for an ultra large or negative value in R signal. Also, check it for Alarm too.
---CUT---
The mod Biter Detector Sentinel Combinator (0.0.18) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Biter_Detector_Sentinel_Combinator::on_nth_tick(12)
position: -2147483633.500000 is out of range
stack traceback:
[C]: in function 'find_units'
Biter_Detector_Sentinel_Combinator/control.lua:204: in function 'update_sentinel_signal'
Biter_Detector_Sentinel_Combinator/control.lua:282: in function <Biter_Detector_Sentinel_Combinator/control.lua:247>

1 year, 9 months ago

Not sure about entities, but radius probably makes sense to limit, to avoid hanging the game if signal accidentally goes too high or something.

The bug looks weird though, as code specifically has if range < 1 then return end check before find-units calls, but guess maybe that breaks with super-small values due to some Lua bug (its numbers do behave a bit weirdly).
Can't seem to test it atm as looks like factorio stopped working here and immediately crashes with segfault on start.
Will maybe try to resolve it later, or just mark these mods as deprecated I guess.

Thanks for reporting.

1 year, 9 months ago
(updated 1 year, 9 months ago)

why do you ignore worms and nests in signals?

EDIT: patched it locally. Is it because you didn't want to do it, or something else? maybe better to add some setting to enable/disable them too?

1 year, 9 months ago

Iirc they're grouped under "others" because they're not relevant for perimeter-defence/alert purposes.

1 year, 9 months ago

it is ignored from "total" signal counter (for me — with bunch of mods)

1 year, 9 months ago

I think worm/nest is not "unit" type

1 year, 9 months ago
(updated 1 year, 9 months ago)

Ah, right, looks like it was a switch in 0.0.3 to "Use surface.find_units() which only detects mobile units, for better performance and less noise."
Where guess these stopped being detected at all. Can be easy to add an option switch too I guess.

1 year, 9 months ago

I've found the issue with my factorio, looks like was some silly ulimit change.

But I can't reproduce this:

The mod Biter Detector Sentinel Combinator (0.0.18) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Biter_Detector_Sentinel_Combinator::on_nth_tick(12)
position: -2147483633.500000 is out of range
stack traceback:
[C]: in function 'find_units'
Biter_Detector_Sentinel_Combinator/control.lua:204: in function 'update_sentinel_signal'
Biter_Detector_Sentinel_Combinator/control.lua:282: in function <Biter_Detector_Sentinel_Combinator/control.lua:247>

Setting either -999999999999999 on a constant combinator or literal range = -2147483633.500000 in the code before aforementioned check doesn't work - range < 1 does catch it all, it seems. So don't think I understand how to make it crash with any kind of negative values.

1 year, 9 months ago
(updated 1 year, 9 months ago)

Oh, hold on, it's a "position: -2147483633.500000 is out of range", not range.
Seem to be a bug with too large range value making utils.area produce boinding box going out of the map - makes sense, will fix.

1 year, 9 months ago

Position should be fixed in 0.0.19 with configurable "Scan Range Limit".

I think with any reasonable values, it should end up within map bounds, but beyond that, it can apparently easily crash factorio - not just print Lua error, but actual crash to desktop with something like "Error Chunk.cpp:701: Trying to make chunk at unreasonable position [-32773, -32773]".
Seem to happen when you try to scan beyond the edges of position limits, making factorio generate map chunks there.
Map limits for that kind of thing seem to be [-2^15 * 32, 2^15 * 32], but I didn't add the check, as it seems unnecessary if even factorio itself doesn't expect anything to go there.

Also added default scan range option and "Detect Stationary Enemies" flag, which should revert https://github.com/mk-fg/games/commit/fdc880af change in 0.0.3 and allow to detect stationary stuff too, if it's useful, with comment on performance in the option description.

1 year, 9 months ago

Please, add two checkboxes to settings — enable/disable entities/recipe: for alarm and combinator (Startup tab).

Didn't want to add those two, as it seems kinda silly for a mod with only two entities.
I'd recommend https://mods.factorio.com/mod/SchallCircuitGroup mod for better circuit-network item group instead, if it's still used/maintained.

Also, all settings here are in Startup tab for simplicity, since dynamic ones require a bunch more fiddly code to handle their changes on the fly.

1 year, 9 months ago

thanks

New response