Creating new entity that has 0kw consumption

Place to get help with not working mods / modding interface.
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Creating new entity that has 0kw consumption

Post by robertpaulson »

Hi, I want to create a radar that works without power grid, however when I place it with 0kw consumption setting the game crashes. I tried making it "solar" with 1w consumption but that didnt work- didn't crash the game tho. Is there a way to modify the energy source to allow it to function without power? I need it to scan only nearby sectors and only for a short duration (implementing charting will be more problematic)
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by Adil »

Probably no. The game have things like this hardcoded to the very depth of it.

This might have been uncalled for, but the following statement
robertpaulson wrote:(implementing charting will be more problematic)
caught my thought and I've spent fifteen minutes to prove the opposite:
code
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by impetus maximus »

Creative mode mod has entities (including radar) that run without power, with power flashing icon still present.
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by robertpaulson »

Adil wrote:Probably no. The game have things like this hardcoded to the very depth of it.

This might have been uncalled for, but the following statement
robertpaulson wrote:(implementing charting will be more problematic)
caught my thought and I've spent fifteen minutes to prove the opposite:
code
Well then, maybe I don't belong here or I'm really slow because it took me more than 15 to understand the code lol.... Much thanks for the work! btw, the variable e is never used, why is it there? to verify the r.next is there to simulate the radar scanning sector by sector? that's elegant!
impetus maximus wrote:Creative mode mod has entities (including radar) that run without power, with power flashing icon still present.
those can be removed with render_no_power_icon =false, but if its there the entity doesn't work on 0 power and the work is done by scripts (like the one provided by Adil, above)
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by impetus maximus »

ok, i'm not a coder/modder. just trying to help.
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by robertpaulson »

impetus maximus wrote:ok, i'm not a coder/modder. just trying to help.
no worries, I will probably take a look at the mod you mentioned. Thank you for info, and sorry if I came on rude, wasn't my intention. cheers.
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by impetus maximus »

not at all. cheers :)
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Creating new entity that has 0kw consumption

Post by Adil »

robertpaulson wrote:Much thanks for the work! btw, the variable e is never used, why is it there? to verify the r.next is there to simulate the radar scanning sector by sector? that's elegant!
You are welcome. Unused e is a typo, I've intended to read position, force and surface from it, not from r:

Code: Select all

                local e=r.entity
                local p,s,f=e.position,e.surface,e.force
Sorry, about that.

Yes. r.next_x and r.next_y are there to keep track of the next chunk to scan.

Also, I'm lagging behind somewhat. We didn't have the `render_no_power_icon ` field back then. With that, who knows, maybe adding a buffer to the entity's power source (like roboport has) and using scripts to refill it, will suffice.
something like this
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Modding help”