When I am trying to access max_distance_of_nearby_sector_revealed property of Radar prototype, I am getting this error
I am trying to fix another mod and before 2.0 the mod was working fine.2065.603 Script @__ets-test__/control.lua:15: --- radar.prototype
2065.603 Script @__ets-test__/control.lua:16: "[LuaEntityPrototype: radar (radar)]"
2065.603 Script @__ets-test__/control.lua:17: --- radar.prototype.max_distance_of_nearby_sector_revealed
2065.694 Error MainLoop.cppException at tick 1435795: The mod ET's test mod (2.0.0) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event ets-test::fire-test (ID 210)
LuaEntityPrototype doesn't contain key max_distance_of_nearby_sector_revealed.
stack traceback:
[C]: in function '__index'
__ets-test__/control.lua:18: in function <__ets-test__/control.lua:1>
Any help would be greatly appreciated~
Code example below:
Code: Select all
script.on_event("fire-test", function(event)
    local radar = nil
    for _, surface in pairs(game.surfaces) do
        for _, entity in pairs(surface.find_entities_filtered({ type = "radar" })) do
            radar = entity
            break
        end
        if radar then
            break
        end
    end
    log("--- radar.prototype ")
    log(serpent.block(radar.prototype))
    log("--- radar.prototype.max_distance_of_nearby_sector_revealed ")
    log(serpent.block(radar.prototype.max_distance_of_nearby_sector_revealed))
end)



 ) Thanks for the explanation~
 ) Thanks for the explanation~