Page 1 of 2

[MOD 0.15.0+] Big Brother 0.4.2 - Radar & Surveillance

Posted: Mon May 09, 2016 2:54 am
by Afforess
Type: Mod
Name: Big Brother
Description: Radar Upgrades and Surveillance technologies
License: MIT License
Version: 0.4.2
Release: 2017-04-28
Tested-With-Factorio-Version: 0.15.03
Category: Gameplay
Tags: Radar, Electricity
Download-Url: https://mods.factorio.com/mods/Afforess/Big_Brother
Website: https://github.com/Afforess/Big_Brother
Long description
Version history
Contributions welcome.

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Mon May 09, 2016 8:49 pm
by zytukin
Sounds like a great mod to help out with mega bases.
Going to download this and give it a try :)

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 3:18 pm
by MiniMe943
So with all the upgrades, the radar has an extra 27 sectors of range, and 675 kW of power consumption?

It might be nice to put the stats of a fully upgraded radar in the description somewhere, or at the very least, add some images to show what it looks like having all the upgrades.

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 5:06 pm
by Afforess
MiniMe943 wrote:So with all the upgrades, the radar has an extra 27 sectors of range, and 675 kW of power consumption?
Extra range is correct (so 14 base range + 27 extra ) but the power is 250KW base + 675KW extra (~1MW total)
MiniMe943 wrote: It might be nice to put the stats of a fully upgraded radar in the description somewhere, or at the very least, add some images to show what it looks like having all the upgrades.
Good point. I'll break out the list.

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 5:50 pm
by orzelek
I added mod to existing game and I can build Surveillance center without any research.
Is that by design or I'm missing something ?
And what it would do in this case?

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 5:51 pm
by Afforess
orzelek wrote:I added mod to existing game and I can build Surveillance center without any research.
Is that by design or I'm missing something ?
And what it would do in this case?
Hmm, I may have forgotten to disable the recipe until research. I'll double check that and release a fix. It shouldn't do anything without the techs researched though.

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 8:06 pm
by steinio
Hello,

dies this work with RSORadar?

This mod extends the scabber range, maybe this mod could extend it again.

Greetings steinio

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Tue May 10, 2016 9:44 pm
by Afforess
steinio wrote:Hello,

dies this work with RSORadar?

This mod extends the scabber range, maybe this mod could extend it again.

Greetings steinio
It will "work" as in it won't do anything bad to your save, but it isn't going to extend the range of any radar except the vanilla 'radar'.

I recommend just using this mod, as radar-5 amplification is equivalent to the range of the RSO radar.

Re: [MOD 0.12.20+] Big Brother 0.2.0 - Radar & Surveillance

Posted: Wed May 11, 2016 1:51 am
by Afforess
orzelek wrote:I added mod to existing game and I can build Surveillance center without any research.
Is that by design or I'm missing something ?
And what it would do in this case?
This should be fixed in version 0.2.1

Re: [MOD 0.12.20+] Big Brother 0.2.1 - Radar & Surveillance

Posted: Wed May 11, 2016 5:01 pm
by orzelek
Mod is complaining about accessing LuaEntity when it's invalid on line 216.
It errored once when surveillance center was built and then frequently after center was removed.
Edit: I can see surveillance center working on trains so it works as intended. Seems it had some old no longer valid entities in list.
I added additional check on line 216:

Code: Select all

function update_surveillance(entity, follow)
    local surv_center
	if entity.valid then
		surv_center = get_nearest_surveillance_center(entity.position, entity.surface, entity.force)
	end

Re: [MOD 0.12.20+] Big Brother 0.2.1 - Radar & Surveillance

Posted: Wed May 11, 2016 7:40 pm
by Afforess
orzelek wrote:Mod is complaining about accessing LuaEntity when it's invalid on line 216.
It errored once when surveillance center was built and then frequently after center was removed.
Edit: I can see surveillance center working on trains so it works as intended. Seems it had some old no longer valid entities in list.
I added additional check on line 216:

Code: Select all

function update_surveillance(entity, follow)
    local surv_center
	if entity.valid then
		surv_center = get_nearest_surveillance_center(entity.position, entity.surface, entity.force)
	end
Thanks, I'll make sure to get that fixed.

Re: [MOD 0.12.20+] Big Brother 0.2.1 - Radar & Surveillance

Posted: Wed May 11, 2016 10:45 pm
by Afforess
orzelek wrote:Mod is complaining about accessing LuaEntity when it's invalid on line 216.
It errored once when surveillance center was built and then frequently after center was removed.
Edit: I can see surveillance center working on trains so it works as intended. Seems it had some old no longer valid entities in list.
I added additional check on line 216:

Code: Select all

function update_surveillance(entity, follow)
    local surv_center
	if entity.valid then
		surv_center = get_nearest_surveillance_center(entity.position, entity.surface, entity.force)
	end
That and another issue are fixed in 0.2.3.

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Mon May 16, 2016 5:01 am
by DarkHelmet
With this mod active and radars all upgraded, Blueprints and bots seem to ignore it. Eg: deconstruction planner bots will ignore the radar, and making a blueprint leaves the radar out.

Its not a huge deal but I was wondering if this an easy fix?

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Mon May 16, 2016 1:36 pm
by Afforess
DarkHelmet wrote:With this mod active and radars all upgraded, Blueprints and bots seem to ignore it. Eg: deconstruction planner bots will ignore the radar, and making a blueprint leaves the radar out.

Its not a huge deal but I was wondering if this an easy fix?
Hm, yeah, that's odd. I will take a look.

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Mon May 16, 2016 3:34 pm
by orzelek
Afforess wrote:
DarkHelmet wrote:With this mod active and radars all upgraded, Blueprints and bots seem to ignore it. Eg: deconstruction planner bots will ignore the radar, and making a blueprint leaves the radar out.

Its not a huge deal but I was wondering if this an easy fix?
Hm, yeah, that's odd. I will take a look.
Do your radars have actual items? I recall this being an issue for blueprinting.

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Sun May 29, 2016 7:36 pm
by DarkHelmet
I'm not quite sure what you mean but here's what I see..

If I take an old blueprint with a radar in it that was created without the mod active, I can place it with the mod active and it is turned into the upgraded radar on placement.

If I place a radar on the ground with the mod active and try to create a blueprint of it, the blueprint comes out with the radar missing from the print - everything else is there. Yes, there are radars in my inventory and obviously on the ground when I'm trying to create the blueprint.

And likewise with the deconstruction planner.. I can use the red "deconstruct" print and drag it over the structure. The bots will remove all the entities except the upgraded radar.

I have a new problem now too. This seems to interact poorly with FARL. When FARL places big power poles, they don't get upgraded to surveillance power poles by this mod so there's no line of sight radar on FARL-placed lines. To work around this I have to remove and re-deploy the power poles. If the FARL placement can't be hooked, perhaps add a way to iterate over the big-power-pole entities for an upgrade?

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Sun May 29, 2016 8:51 pm
by Choumiko
DarkHelmet wrote:I have a new problem now too. This seems to interact poorly with FARL. When FARL places big power poles, they don't get upgraded to surveillance power poles by this mod so there's no line of sight radar on FARL-placed lines. To work around this I have to remove and re-deploy the power poles. If the FARL placement can't be hooked, perhaps add a way to iterate over the big-power-pole entities for an upgrade?
I'll make FARL raise an event when it places a pole. Seems like the cleanest solution.

As for the blueprint issue, looks like BigBrother has no items for the upgraded radars, which seems to be needed for them to be blueprinted.

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Sun May 29, 2016 9:10 pm
by Afforess
Choumiko wrote:
DarkHelmet wrote:I have a new problem now too. This seems to interact poorly with FARL. When FARL places big power poles, they don't get upgraded to surveillance power poles by this mod so there's no line of sight radar on FARL-placed lines. To work around this I have to remove and re-deploy the power poles. If the FARL placement can't be hooked, perhaps add a way to iterate over the big-power-pole entities for an upgrade?
I'll make FARL raise an event when it places a pole. Seems like the cleanest solution.
Yeah, that should fix that particular issue.
Choumiko wrote: As for the blueprint issue, looks like BigBrother has no items for the upgraded radars, which seems to be needed for them to be blueprinted.
I'm not sure I have a good solution for this... The way Big Brother works is that there is only 1 item, the vanilla radar item, and the radar entity that is needed it placed based on the current research level. Unless Factorio has a way to associate the same placement item to multiple entities, which I am unaware of, then blueprints are never going to work with the current design.

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Sun May 29, 2016 9:32 pm
by DarkHelmet
I looked at the code and removing and replacing the surveillance looked like it might do the trick but that didn't work as it used the previously known entity list. I stole the one-time-upgrade code and placed it in a remote.call handler instead. This did solve my problem.

Code: Select all

-- Manually deal with entity creation by other mods that were not hooked.
-- Console:  /c remote.call("Big_Brother", "upgrade_all")
function upgrade_all()
	-- track all radars
	table.each(Surface.find_all_entities({name = 'radar'}) or {}, function(entity) track_entity('radars', entity) end)
	table.each(game.forces, upgrade_radars)

	-- track electric poles
	table.each(Surface.find_all_entities({name = 'big-electric-pole'}) or {}, function(entity)
		track_entity('power_poles', entity)
		if entity.force.technologies['surveillance-2'].researched then
			update_surveillance(entity, false)
		end
	end)
end
remote.add_interface("Big_Brother", { upgrade_all = upgrade_all })
Don't laugh too much..

Re: [MOD 0.12.20+] Big Brother 0.2.3 - Radar & Surveillance

Posted: Sun May 29, 2016 9:51 pm
by Choumiko
This: https://github.com/Choumiko/FARL/commit ... 0714160cf2 should solve the issue with FARL and big poles, enjoy :D Gonna hold off with a new release until 0.13 hits though