RTD Icon Improvements (#89491)

## About The Pull Request

RTDs try to use tile item icons instead of turf icons for code that was
clearly intended to work with turfs themselves (they support combination
dirs, but none of the items actually have these!)

They also recreate datums with static data *every single time* you
select a new tile in *each individual RTD*. They now make much smarter
use of this data and quit storing stuff inside temporary datums that get
deleted every time you select something else.

FYI this thing is still pretty busted but I don't have time to fix every
problem with it. I'm mainly doing this to get rid of the Turn() procs
and broken, nonexistent dirs being inserted into the spritesheet for
#89478.

## Why It's Good For The Game

Code improvements, better previews of the turfs you're going to get in
the RTD.


![image](https://github.com/user-attachments/assets/3732370b-36ba-4221-8571-e80a20ff21d8)

## Changelog

🆑
tweak: RTDs now show the icon of the actual turf being placed rather
than its tile item.
/🆑
This commit is contained in:
itsmeow
2025-03-12 16:03:01 -04:00
committed by Roxy
parent 778ab9e82e
commit d589388355
5 changed files with 96 additions and 143 deletions
+9 -42
View File
@@ -9,46 +9,13 @@
for(var/main_root in GLOB.floor_designs)
for(var/sub_category in GLOB.floor_designs[main_root])
for(var/list/design in GLOB.floor_designs[main_root][sub_category])
var/obj/item/stack/tile/type = design["type"]
var/icon_state = initial(type.icon_state)
if(registered[icon_state])
continue
Insert(sprite_name = icon_state, I = 'icons/obj/tiles.dmi', icon_state = icon_state)
registered[icon_state] = TRUE
var/list/tile_directions = design["tile_rotate_dirs"]
if(tile_directions == null)
continue
for(var/direction as anything in tile_directions)
//we can rotate the icon is css for these directions
if(direction in GLOB.tile_dont_rotate)
if(!design["datum"])
populate_rtd_datums()
var/datum/tile_info/tile_data = design["datum"]
var/list/directions = tile_data.tile_directions_numbers || list(SOUTH)
for(var/direction as anything in directions)
var/sprite_name = sanitize_css_class_name("[tile_data.icon_file]-[tile_data.icon_state]-[dir2text(direction)]")
if(registered[sprite_name])
continue
//but for these directions we have to do some hacky stuff
var/icon/img = icon(icon = 'icons/obj/tiles.dmi', icon_state = icon_state)
switch(direction)
if(NORTHEAST)
img.Turn(-180)
var/icon/east_rotated = icon(icon = 'icons/obj/tiles.dmi', icon_state = icon_state)
east_rotated.Turn(-90)
img.Blend(east_rotated,ICON_MULTIPLY)
img.SetIntensity(2,2,2)
if(NORTHWEST)
img.Turn(-180)
var/icon/west_rotated = icon(icon = 'icons/obj/tiles.dmi', icon_state = icon_state)
west_rotated.Turn(90)
img.Blend(west_rotated,ICON_MULTIPLY)
img.SetIntensity(2,2,2)
if(SOUTHEAST)
var/icon/east_rotated = icon(icon = 'icons/obj/tiles.dmi', icon_state = icon_state)
east_rotated.Turn(-90)
img.Blend(east_rotated,ICON_MULTIPLY)
img.SetIntensity(2,2,2)
if(SOUTHWEST)
var/icon/west_rotated = icon(icon = 'icons/obj/tiles.dmi', icon_state = icon_state)
west_rotated.Turn(90)
img.Blend(west_rotated,ICON_MULTIPLY)
img.SetIntensity(2,2,2)
Insert(sprite_name = "[icon_state]-[dir2text(direction)]", I = img)
Insert(sprite_name, icon(tile_data.icon_file, tile_data.icon_state, direction))
registered[sprite_name] = TRUE