RP Art Utilities

Helper functions for using RP Art mods

8 days ago
2 months ago
Latest Version:
0.0.7 (8 days ago)
Factorio version:
965 times

Helper functions for using a large set of turret sprites in other mods.


  • Overwrite all of an entity's sprites with a single line of code
  • Can use the same sprites for all kinds of turrets
  • Preparing and attacking animations
  • Normal, shadow, glow, and player tint sprites
  • Automatic sprite scaling to match footprint size
  • Multiple levels of detail, it uses different sprites for larger turrets. Most turrets look great up to 4x4 tiles and up to 8x8 in non-HR
  • Somewhat correct projectile launch points... Help Wanted - Please tell me how artillery turrets set this
  • Automatically sets the turret's item icons in most cases

Compatible Art Mods


local rp_art_util = require("__rp_art_util__/rp_art_util");
-- Note: tesla_turret_1 comes in a separate mod
local turret_art = require("__rp_tesla_turret_1_art__/tesla_turret_1");

local my_turret = {
   type = 'ammo-turret',
   name = 'my-gun-turret,
   --... all the other fields a turret prototype needs

-- Makes the turret look like tesla_turret_1
-- my_turret must be the entity prototype, not just the name
rp_art_util:use_sprites(my_turret, turret_art);

-- Makes the turret item look like tesla_turret_1
-- This step should be unnecessary if the item has already been created when calling use_sprites on the turret
rp_art_util:use_icon(my_item, turret_art);

-- Makes the turret technology look like tesla_turret_1
rp_art_util:use_icon(my_technology, turret_art);

Secret Inputs

use_sprites can take a third table parameter with the following fields

  • footprint (float) - The width of the entity_prototype in tiles. If not set, then it is inferred from the collision_box
  • enable_attack_animation (boolean) - Defaults to true. Very fast firing turrets will look silly if their attack animation wasn't made for that
  • ack_artillery_gun_warning (boolean) allows you to use the same gun entity for multiple artillery


Each turret type seems to define their sprites in a different way. This library tries to hide those differences from users but some things are untested or unimplemented.

One of my main TODO's is to make sure the turret's muzzle locations are used correctly for each turret type. This table shows the current level of support.

Turret Type Projectile Beam Stream
ammo-turret Full Untested TODO
electric-turret Untested Full TODO
fluid-turret NA NA Full
artillery-turret Partial TODO TODO