LuaEntity.speed for asteroids

egladil
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jun 27, 2025 8:35 pm
Contact:

LuaEntity.speed for asteroids

Post by egladil »

It would be useful to be able to read and modify the speed of asteroids at runtime. This could be used i.e. for making tractor beam turrets or deflector shields.

An alternative to having it be writable would be something similar to PushBackTriggerEffectItem that modifies speed instead of position. (And works on asteroids, which PushBackTriggerEffectItem does not seem to do?)
egladil
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jun 27, 2025 8:35 pm
Contact:

Re: LuaEntity.speed for asteroids

Post by egladil »

A small bump on this in case it was missed during summer
Rseding91
Factorio Staff
Factorio Staff
Posts: 16124
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaEntity.speed for asteroids

Post by Rseding91 »

Asteroids don’t have an internal speed value. They have an internal movement per tick value which is a 2D vector that gets added to the asteroid position each tick.

So if this was exposed it would need to be as a new value: “movement” or such.
If you want to get ahold of me I'm almost always on Discord.
egladil
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jun 27, 2025 8:35 pm
Contact:

Re: LuaEntity.speed for asteroids

Post by egladil »

Right, I must have misread the documentation for speed. I assumed that was a 2d vector as well. Having "movement" exposed as read/write to script would indeed solve this for me
Bilka
Factorio Staff
Factorio Staff
Posts: 3645
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: LuaEntity.speed for asteroids

Post by Bilka »

Okay, I added LuaEntity::get_movement() and set_movement() for 2.0.67.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
egladil
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jun 27, 2025 8:35 pm
Contact:

Re: LuaEntity.speed for asteroids

Post by egladil »

Thanks!
Post Reply

Return to “Implemented mod requests”