Skip to content

Commit

Permalink
crashu
Browse files Browse the repository at this point in the history
  • Loading branch information
Leshana committed Jun 10, 2017
1 parent f108be6 commit 47dc493
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions code/modules/tables/tables.dm
Expand Up @@ -309,33 +309,34 @@ var/list/table_icon_cache = list()
return I

/obj/structure/table/update_icon()
var/mutable_appearance/ma = new(src)
if(flipped != 1)
icon_state = "blank"
overlays.Cut()
ma.icon_state = "blank"
ma.overlays.Cut()

// Base frame shape. Mostly done for glass/diamond tables, where this is visible.
for(var/i = 1 to 4)
var/image/I = get_table_image(icon, connections[i], 1<<(i-1))
overlays += I
ma.overlays += I

// Standard table image
if(material)
for(var/i = 1 to 4)
var/image/I = get_table_image(icon, "[material.icon_base]_[connections[i]]", 1<<(i-1), material.icon_colour, 255 * material.opacity)
overlays += I
ma.overlays += I

// Reinforcements
if(reinforced)
for(var/i = 1 to 4)
var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connections[i]]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity)
overlays += I
ma.overlays += I

if(carpeted)
for(var/i = 1 to 4)
var/image/I = get_table_image(icon, "carpet_[connections[i]]", 1<<(i-1))
overlays += I
ma.overlays += I
else
overlays.Cut()
ma.overlays.Cut()
var/type = 0
var/tabledirs = 0
for(var/direction in list(turn(dir,90), turn(dir,-90)) )
Expand All @@ -351,12 +352,12 @@ var/list/table_icon_cache = list()
if (tabledirs & turn(dir,-90))
type += "+"

icon_state = "flip[type]"
ma.icon_state = "flip[type]"
if(material)
var/image/I = image(icon, "[material.icon_base]_flip[type]")
I.color = material.icon_colour
I.alpha = 255 * material.opacity
overlays += I
ma.overlays += I
name = "[material.display_name] table"
else
name = "table frame"
Expand All @@ -365,10 +366,11 @@ var/list/table_icon_cache = list()
var/image/I = image(icon, "[reinforced.icon_reinf]_flip[type]")
I.color = reinforced.icon_colour
I.alpha = 255 * reinforced.opacity
overlays += I
ma.overlays += I

if(carpeted)
overlays += "carpet_flip[type]"
ma.overlays += "carpet_flip[type]"
src.appearance = ma

// set propagate if you're updating a table that should update tables around it too, for example if it's a new table or something important has changed (like material).
/obj/structure/table/proc/update_connections(propagate=0)
Expand Down

0 comments on commit 47dc493

Please sign in to comment.