
how to disable unplugged icon?
how to disable unplugged icon?
Is there a way to force turn off or hide icon of buiding unplugged?


-
- Smart Inserter
- Posts: 1847
- Joined: Sun Feb 23, 2014 3:37 pm
- Contact:
Re: how to disable unplugged icon?
Power the building? Lol.
Apart from a mod I don't think there is a way.
Ed: just noticed this is in modding help, my bad.
Apart from a mod I don't think there is a way.
Ed: just noticed this is in modding help, my bad.
Last edited by FishSandwich on Thu Jul 10, 2014 6:39 pm, edited 1 time in total.
Re: how to disable unplugged icon?
The only way i can think of is to replace the data\core\graphics\electricity-icon-unplugged.png image with a transparent image.
like: (it's 'technically' shown but since it's transparent there's nothing to actually see).
Of course that will apply across the entire game, so if you just want it fixed for a single thing and to still have it shown for everything else...i don't know
edit: a mod could probably 'connect' it by spawning in an electric pole if it's the steam engine complaining about nothing taking power, if it's a machine being out of power the only thing that could correct it is giving it power (or maybe setting it's active property to false)
like: (it's 'technically' shown but since it's transparent there's nothing to actually see).
Of course that will apply across the entire game, so if you just want it fixed for a single thing and to still have it shown for everything else...i don't know
edit: a mod could probably 'connect' it by spawning in an electric pole if it's the steam engine complaining about nothing taking power, if it's a machine being out of power the only thing that could correct it is giving it power (or maybe setting it's active property to false)
Re: how to disable unplugged icon?
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.
i need hide icon for 1 building entity from mod thats can be moved.
i tried make a simple powernet with no sprites\collision\ets , but its bugy, cos if building is teleported - power connection calculates wrong\or do not calculates. if they destroyed after teleport - game crashed.
Re: how to disable unplugged icon?
Hm, since I'm not sure exactly what you're doing (though I have a general idea now) 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

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

Re: how to disable unplugged icon?
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

but when i tried do that with code, game crashed.
car creation code
car move code
so i think there may be a property of conncted\or not.Re: how to disable unplugged icon?
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

Re: how to disable unplugged icon?
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
Re: how to disable unplugged icon?
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.
Re: how to disable unplugged icon?
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.

Graphically, a battery with it's charge represented by the item stack is 'visually' the same at all points between empty and full other than the stack count (empty and full could be separate items with different graphics, but everything else will be the same item so has the same image), whereas when each charge is a different item they can all have different graphics (perhaps showing the 'percent' charge or a power bar). So, yes, it can be done that way, it just depends on how you want it to look/work in game; I personally would prefer the more accurate version, even though it requires many items internally


Obviously, if items had metadata of some sort (like minecraft does for instance and how damage works for entities) it could be a single item with the metadata holding the charge value (and perhaps the item itself could specify different graphics for different metadata values, though I'd survive with the same graphic lol)