LuaRendering: asteroid as orientation_target support

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
Quezler
Fast Inserter
Fast Inserter
Posts: 184
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

LuaRendering: asteroid as orientation_target support

Post by Quezler »

Asteroid rotation is based on some unit number + tick math which is not exposed as it's orientation towards e.g. luarendering, it would be nice if render objects could be made to rotate along with asteroids.
Genhis
Factorio Staff
Factorio Staff
Posts: 817
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: LuaRendering: asteroid as orientation_target support

Post by Genhis »

Hello, please describe your use case and proposed API - ideally something which I can copy&paste into the game to test the logic.
User avatar
Quezler
Fast Inserter
Fast Inserter
Posts: 184
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

Re: LuaRendering: asteroid as orientation_target support

Post by Quezler »

- new world
- /cheat all
- create a non-nauvis platform
- wait for asteroids to spawn
- run this code

Code: Select all

/c local asteroid = game.player.selected
rendering.draw_sprite{
  sprite = "item/rail",
  target = asteroid,
  surface = asteroid.surface,
  orientation = math.random(),
  oriented_offset = {1, 1},
  orientation_target = asteroid,
  use_target_orientation = true,
}
this would cause the rendered sprite to rotate along with the asteroid's slow rotation speed, this works just fine on vehicles since they actually expose their orientation, but asteroids don't know their orientation until they are rendered.

do consider this low priority, this would just be a convenient way to have them rotate without needing to script an invisible entity on the surface and updating that each tick, i tried to just have a slowly spinning train on a hidden surface but the orientation target can apparently not cross surfaces.
Post Reply

Return to “Modding interface requests”