Resource Patches Mouse Over Details

Place to get help with not working mods / modding interface.
Post Reply
AlienX
Fast Inserter
Fast Inserter
Posts: 103
Joined: Wed May 17, 2017 7:13 pm
Contact:

Resource Patches Mouse Over Details

Post by AlienX »

Hi All,
When you mouse over a resource in the map view, it shows you what type of resource it is, and how much is left.
Is this data accessible anywhere in the API - I cant seem to find anything useful towards it in the API Docs.

I'm thinking something like:

Code: Select all

for _,resource in pairs(game.surface["blah"].get_resource_piles()) do
  resource.type = "iron-ore" (Read Only)
  resource.amount = "320000" (Read Only)
  resource.area = {x,y} (Read Only)
end
 

Thanks

Pandemoneus
Fast Inserter
Fast Inserter
Posts: 127
Joined: Fri May 08, 2015 2:25 pm
Contact:

Re: Resource Patches Mouse Over Details

Post by Pandemoneus »

No, it's not in the API.
However, since I tackled the same problem recently, I have implemented my own search that is now part of the modder's StdLib. If you can get the position of an ore, the function returns a list with all connected resources that you can iterate over and sum up the resource count.
My RSO+Bob's+Angel's modpack: Farlands (outdated)
Mods (current): Resource Labels
Mods (old): Biter Spires

AlienX
Fast Inserter
Fast Inserter
Posts: 103
Joined: Wed May 17, 2017 7:13 pm
Contact:

Re: Resource Patches Mouse Over Details

Post by AlienX »

Love you :D

On another note:
@Devs - Could this be included as an internal API to call - I feel it would be useful knowing exactly what the map thinks is there.

Post Reply

Return to “Modding help”