how to disable unplugged icon?
Posted: Thu Jul 10, 2014 6:26 pm
Is there a way to force turn off or hide icon of buiding unplugged?


thats sad (FreeER wrote: so if you just want it fixed for a single thing and to still have it shown for everything else...i don't know.
but connection can be destroyed without loss of status "plugged".FreeER wrote:Hm, since I'm not sure exactly what you're doing it's hard for me to provide a specific answer
It might be 'easy' to give it power every tick using entity.energy = 1000 (or some sufficient number), of course if you don't want to give it power for free you'd need another entity to take power from (using power_collector.energy = power_collector.energy - energy_cost, after making sure that there is sufficient power of course). Which almost brings you back to the same problem, except that the power_collector doesn't need to be teleported (presumably), so that once a connection is set up for it, it should continue working
There is no check here to see if it's still connected or not, that's why the 'connection' can be destroyed without loss (because it's not actually connected at all, you're giving it free power). To maintain an actual connection you'd need a power_collector/power_transfer to be created as well then you'd reference that power_collector to see if it had power, if it does you'd drain some power by subtracting it from the power_collector's energy property, and give it to the roboport by incrementing it's energy as you're doing now. If it didn't have power then it wouldn't be given to the roboport, and then the status symbol would appear once again (to indicate that it's out of power).Savaro wrote: apc["roboport"].energy = apc["roboport"].energy + 20000
thank you!!!FreeER wrote:There is no check here to see if it's still connected or not, that's why the 'connection' can be destroyed without loss (because it's not actually connected at all, you're giving it free power). To maintain an actual connection you'd need a power_collector/power_transfer to be created as well then you'd reference that power_collector to see if it had power, if it does you'd drain some power by subtracting it from the power_collector's energy property, and give it to the roboport by incrementing it's energy as you're doing now. If it didn't have power then it wouldn't be given to the roboport, and then the status symbol would appear once again (to indicate that it's out of power).Savaro wrote: apc["roboport"].energy = apc["roboport"].energy + 20000
edit: alternatively to that you could create a 'battery' item that could be placed in an inventory of the apc, and only if the battery 'has' energy would you give power to the roboport. Of course there is no way to use Factorio's 'battery' like this...The only way I can think of is to have a ton of battery items with their names indicating their 'energy', so when you give power to the apc you'd remove one of the batteries and insert a new one with a name of one less than the previous. Thus assuming 100 battery items named "battery0"-"battery99" (empty-full), you'd search the apc's inventory (by using apc["chassis"].getinventory(2).getcontents(), probably or maybe a for loop of getitemcount from 99-1, stopping at the first that give a value greater than 0) for a battery that is not battery0, and if you find one (say you find battery99), then you remove it and insert battery98 and then give the roboport energy, if you don't find a battery that isn't battery0 (no stored power) then you don't give the roboport any power. Of course, you'd need a way to reverse that process to 'charge' batteries. Somewhat annoying, but should be just as functional
Couldn't you simply have one item and use it's stack number to identify charge, so that 500 charge items in inventory would correspond to 500 energy? Seems a bit less clunky than having to create hundreds of items for that purpose.Savaro wrote:The only way I can think of is to have a ton of battery items with their names indicating their 'energy', so when you give power to the apc you'd remove one of the batteries and insert a new one with a name of one less than the previous.
SureRahjital wrote:Couldn't you simply have one item and use it's stack number to identify charge, so that 500 charge items in inventory would correspond to 500 energy? Seems a bit less clunky than having to create hundreds of items for that purpose.