Page 1 of 1

How do I import my personal roboport area?

Posted: Mon Dec 19, 2016 9:45 am
by sore68
I would like to call the construction area of the robotic ports on the device or player.
eq.png
eq.png (142.79 KiB) Viewed 1117 times

I made a code to load the equipment of the player armor.
code
Is there a command to simplify this further?

Re: How do I import my personal roboport area?

Posted: Mon Dec 19, 2016 2:09 pm
by Nexela
Equipping a personal roboport attaches a logistic_cell to your character http://lua-api.factorio.com/latest/LuaLogisticCell.html

Example code

Code: Select all

c = game.players[1].character --Get the player's character
if c and c .valid then --Make sure we have a character as some players (god mode for instance) won't have a character
  if c.logistic_cell and c.logistic_cell.mobile then --See if character is a logistic cell AND is a mobile cell
  radius = c.logistic_cell.construction_radius or 0 -- Return a radius for the construction cell
  robot_count = c.logistic_cell.stationed_construction_robot_count -- total robots (or available not sure which)
  end
--For you to check as I am not sure: are any/all of these available if power in roboport is 0 .cell, .mobile, .construction_radius
--These might be able to be wrapped with .active
end

Re: How do I import my personal roboport area?

Posted: Mon Dec 19, 2016 2:43 pm
by sore68
Nexela wrote:Equipping a personal roboport attaches a logistic_cell to your character http://lua-api.factorio.com/latest/LuaLogisticCell.html
Oh! Thank you!! I missed [players.character]
This is what I was looking for. :D