Add robot.speed [R]

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
ILLISIS
Inserter
Inserter
Posts: 32
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Add robot.speed [R]

Post by ILLISIS »

Hi

I would like the ability to read a robot's speed in order to determine if a robot is working or waiting / hovering for something such as;

- The inventory being full in a spidertron
- A player standing on a ghost entity it is trying to build
- Cases like where the robot is trying to build a train on top of a ghost rail that is just outside of construction range or does not have items to build it

If I could check robot.speed and observe it to be zero I would be well on the way to knowing that a robot is not active.

Prior to 2.0, code, I was checking every 90 ticks and tracking robot positions to see if they have moved, with the 2.0 bot optimizations that has been thrown out the window a little bit as it is less accurate given that robots update less frequently.
ILLISIS
Inserter
Inserter
Posts: 32
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Re: Add robot.speed [R]

Post by ILLISIS »

Rethinking this... It suffers from the same issue due to the update frequency.

I am going to try watching orientation over a few checks and making a determination on that.
curiosity
Filter Inserter
Filter Inserter
Posts: 610
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add robot.speed [R]

Post by curiosity »

I would've expected this to be covered by status. Don't robots have that? Seems like it would be more informative than just speed, since robots always move at maximum possible speed anyway.
ILLISIS
Inserter
Inserter
Posts: 32
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Re: Add robot.speed [R]

Post by ILLISIS »

Hey mate
Robots do not have `status`. That would be a better alternative as it would be the game saying everything is okay(robots are doing something) rather than needing to try and determine it at lua stage.

I have deemed it necessary to watch an attribute of the robots over a few ticks if this determination logic is to remain in lua.
Post Reply

Return to “Modding interface requests”