Skip to content

Instantly share code, notes, and snippets.

@YotaXP
Created March 27, 2016 11:52
Show Gist options
  • Save YotaXP/4b996eb96f4a39b0ea0a to your computer and use it in GitHub Desktop.
Save YotaXP/4b996eb96f4a39b0ea0a to your computer and use it in GitHub Desktop.
diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm
index b3461ab..01a65ae 100644
--- a/code/__HELPERS/icon_smoothing.dm
+++ b/code/__HELPERS/icon_smoothing.dm
@@ -54,6 +54,32 @@
/atom/movable/var/can_be_unanchored = 0
/turf/var/list/fixed_underlay = null
+/var/list/rotatableSmoothIcons = list()
+
+/proc/getRotatableSmoothIcon(ico)
+ var/premade = rotatableSmoothIcons[ico]
+ if(premade)
+ return premade
+
+ if(!isicon(ico))
+ throw EXCEPTION("getRotatableSmoothIcon() may only be given an icon.")
+
+ var/icon/newIcon = icon()
+ for(var/state in icon_states(ico))
+ var/icon/copyIco = icon(ico, state)
+ newIcon.Insert(copyIco, state, SOUTH)
+ copyIco.Turn(90)
+ newIcon.Insert(copyIco, state, WEST)
+ copyIco.Turn(90)
+ newIcon.Insert(copyIco, state, NORTH)
+ copyIco.Turn(90)
+ newIcon.Insert(copyIco, state, EAST)
+
+ var/rsc = newIcon.RscFile()
+ rotatableSmoothIcons[ico] = rsc
+ rotatableSmoothIcons[rsc] = rsc
+ return rsc
+
/proc/calculate_adjacencies(atom/A)
if(!A.loc)
return 0
@@ -116,6 +142,7 @@
spawn(0)
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
var/adjacencies = calculate_adjacencies(A)
+ A.icon = getRotatableSmoothIcon(A.icon)
if(A.smooth & SMOOTH_DIAGONAL)
A.diagonal_smooth(adjacencies)
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 733f42d..56a3d2c 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -473,7 +473,6 @@
/obj/structure/window/fulltile
icon = 'icons/obj/smooth_structures/window.dmi'
icon_state = "window"
- dir = 5
maxhealth = 50
fulltile = 1
smooth = SMOOTH_TRUE
@@ -482,7 +481,6 @@
/obj/structure/window/reinforced/fulltile
icon = 'icons/obj/smooth_structures/reinforced_window.dmi'
icon_state = "r_window"
- dir = 5
maxhealth = 100
fulltile = 1
smooth = SMOOTH_TRUE
@@ -492,7 +490,6 @@
/obj/structure/window/reinforced/tinted/fulltile
icon = 'icons/obj/smooth_structures/tinted_window.dmi'
icon_state = "tinted_window"
- dir = 5
fulltile = 1
smooth = SMOOTH_TRUE
canSmoothWith = list(/obj/structure/window/fulltile, /obj/structure/window/reinforced/fulltile, /obj/structure/window/reinforced/tinted/fulltile/)
@@ -510,7 +507,6 @@
desc = "A reinforced, air-locked pod window."
icon = 'icons/obj/smooth_structures/shuttle_window.dmi'
icon_state = "shuttle_window"
- dir = 5
maxhealth = 100
wtype = "shuttle"
fulltile = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment