Robot information in mod

Place to get help with not working mods / modding interface.
Post Reply
hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Robot information in mod

Post by hreintke »

Hi,

I am looking for a way to get robot information in my mod.

Trying to get information on all logistic robots :

Code: Select all

/c 
local rt = game.player.surface.find_entities_filtered({type = "logistic-robot"})
local i = 0
local ln
for a, robot in pairs(rt) do
	i = i + 1
	game.player.print(i..robot.name..robot.position.x.."e = "..robot.energy)
	if (robot.has_items_inside() ) then game.player.print(i.."loaded") else game.player.print(i.."no load") end
	ln = robot.logistic_network
	if (robot.logistic_network ) then game.player.print(i.."networked") else game.player.print(i.."no network") end
end
This shows
- only part of the robots in the game
- all robots show -> no network

When doing a simular query on roboports

Code: Select all

/c 
local rt = game.player.surface.find_entities_filtered({type = "roboport"})
local i = 0
local ln
for a, roboport in pairs(rt) do
	i = i + 1
	game.player.print(i..roboport.name..roboport.position.x.."e = "..roboport.energy)
	if (roboport.has_items_inside() ) then game.player.print(i.."loaded") else game.player.print(i.."no load") end
	ln = roboport.logistic_network
	if (roboport.logistic_network ) then game.player.print(i.."networked") else game.player.print(i.."no network") end
end


It shows network info correct including the available/all robot counts.

Starting questions :

- How can I find all robots (not only available)
- How can I find the "command/destination" of the robot
- Or more in general "What properties/methods are available for a robot entity ?

Post Reply

Return to “Modding help”