mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Merge remote-tracking branch 'bay12-upstream/master' into development
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
|
||||
// Mostly for debugging table connections
|
||||
// This file is not #included in the .dme.
|
||||
|
||||
/obj/structure/table/debug
|
||||
New()
|
||||
material = get_material_by_name("debugium")
|
||||
..()
|
||||
|
||||
/material/debug
|
||||
name = "debugium"
|
||||
stack_type = /obj/item/stack/material/debug
|
||||
icon_base = "debug"
|
||||
icon_reinf = "rdebug"
|
||||
icon_colour = "#FFFFFF"
|
||||
|
||||
/obj/item/stack/material/debug
|
||||
name = "debugium"
|
||||
icon = 'icons/obj/tables.dmi'
|
||||
icon_state = "debugium"
|
||||
default_type = "debugium"
|
||||
|
||||
@@ -51,8 +51,9 @@
|
||||
visible_message("<span class='warning'>\The [src] breaks down!</span>")
|
||||
return break_to_parts() // if we break and form shards, return them to the caller to do !FUN! things with
|
||||
|
||||
/obj/structure/table/New()
|
||||
/obj/structure/table/initialize()
|
||||
..()
|
||||
|
||||
// One table per turf.
|
||||
for(var/obj/structure/table/T in loc)
|
||||
if(T != src)
|
||||
@@ -61,8 +62,6 @@
|
||||
break_to_parts(full_return = 1)
|
||||
return
|
||||
|
||||
/obj/structure/table/initialize()
|
||||
..()
|
||||
// reset color/alpha, since they're set for nice map previews
|
||||
color = "#ffffff"
|
||||
alpha = 255
|
||||
@@ -296,29 +295,33 @@
|
||||
icon_state = "blank"
|
||||
overlays.Cut()
|
||||
|
||||
var/image/I
|
||||
|
||||
// Base frame shape. Mostly done for glass/diamond tables, where this is visible.
|
||||
for(var/n in connections)
|
||||
overlays += n
|
||||
for(var/i = 1 to 4)
|
||||
I = image(icon, dir = 1<<(i-1), icon_state = connections[i])
|
||||
overlays += I
|
||||
|
||||
// Standard table image
|
||||
if(material)
|
||||
for(var/n in connections)
|
||||
var/image/I = image(icon, "[material.icon_base]_[n]")
|
||||
I.color = material.icon_colour
|
||||
for(var/i = 1 to 4)
|
||||
I = image(icon, "[material.icon_base]_[connections[i]]", dir = 1<<(i-1))
|
||||
if(material.icon_colour) I.color = material.icon_colour
|
||||
I.alpha = 255 * material.opacity
|
||||
overlays += I
|
||||
|
||||
// Reinforcements
|
||||
if(reinforced)
|
||||
for(var/n in connections)
|
||||
var/image/I = image(icon, "[reinforced.icon_reinf]_[n]")
|
||||
for(var/i = 1 to 4)
|
||||
I = image(icon, "[reinforced.icon_reinf]_[connections[i]]", dir = 1<<(i-1))
|
||||
I.color = reinforced.icon_colour
|
||||
I.alpha = 255 * reinforced.opacity
|
||||
overlays += I
|
||||
|
||||
if(carpeted)
|
||||
for(var/n in connections)
|
||||
overlays += "carpet_[n]"
|
||||
for(var/i = 1 to 4)
|
||||
I = image(icon, "carpet_[connections[i]]", dir = 1<<(i-1))
|
||||
overlays += I
|
||||
else
|
||||
overlays.Cut()
|
||||
var/type = 0
|
||||
@@ -353,13 +356,12 @@
|
||||
overlays += I
|
||||
|
||||
if(carpeted)
|
||||
for(var/n in connections)
|
||||
overlays += "carpet_flip[type]"
|
||||
overlays += "carpet_flip[type]"
|
||||
|
||||
// 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)
|
||||
if(!material)
|
||||
connections = list("nw0", "ne0", "sw0", "se0")
|
||||
connections = list("0", "0", "0", "0")
|
||||
|
||||
if(propagate)
|
||||
for(var/obj/structure/table/T in oview(src, 1))
|
||||
@@ -369,7 +371,7 @@
|
||||
var/list/blocked_dirs = list()
|
||||
for(var/obj/structure/window/W in get_turf(src))
|
||||
if(W.is_fulltile())
|
||||
connections = list("nw0", "ne0", "sw0", "se0")
|
||||
connections = list("0", "0", "0", "0")
|
||||
return
|
||||
blocked_dirs |= W.dir
|
||||
|
||||
@@ -412,42 +414,36 @@
|
||||
connections = dirs_to_corner_states(connection_dirs)
|
||||
|
||||
#define CORNER_NONE 0
|
||||
#define CORNER_EASTWEST 1
|
||||
#define CORNER_COUNTERCLOCKWISE 1
|
||||
#define CORNER_DIAGONAL 2
|
||||
#define CORNER_NORTHSOUTH 4
|
||||
#define CORNER_CLOCKWISE 4
|
||||
|
||||
/*
|
||||
turn() is weird:
|
||||
turn(icon, angle) turns icon by angle degrees clockwise
|
||||
turn(matrix, angle) turns matrix by angle degrees clockwise
|
||||
turn(dir, angle) turns dir by angle degrees counter-clockwise
|
||||
*/
|
||||
|
||||
/proc/dirs_to_corner_states(list/dirs)
|
||||
if(!istype(dirs)) return
|
||||
|
||||
var/NE = CORNER_NONE
|
||||
var/NW = CORNER_NONE
|
||||
var/SE = CORNER_NONE
|
||||
var/SW = CORNER_NONE
|
||||
var/list/ret = list(NORTHWEST, SOUTHEAST, NORTHEAST, SOUTHWEST)
|
||||
|
||||
if(NORTH in dirs)
|
||||
NE |= CORNER_NORTHSOUTH
|
||||
NW |= CORNER_NORTHSOUTH
|
||||
if(SOUTH in dirs)
|
||||
SW |= CORNER_NORTHSOUTH
|
||||
SE |= CORNER_NORTHSOUTH
|
||||
if(EAST in dirs)
|
||||
SE |= CORNER_EASTWEST
|
||||
NE |= CORNER_EASTWEST
|
||||
if(WEST in dirs)
|
||||
NW |= CORNER_EASTWEST
|
||||
SW |= CORNER_EASTWEST
|
||||
if(NORTHWEST in dirs)
|
||||
NW |= CORNER_DIAGONAL
|
||||
if(NORTHEAST in dirs)
|
||||
NE |= CORNER_DIAGONAL
|
||||
if(SOUTHEAST in dirs)
|
||||
SE |= CORNER_DIAGONAL
|
||||
if(SOUTHWEST in dirs)
|
||||
SW |= CORNER_DIAGONAL
|
||||
for(var/i = 1 to ret.len)
|
||||
var/dir = ret[i]
|
||||
. = CORNER_NONE
|
||||
if(dir in dirs)
|
||||
. |= CORNER_DIAGONAL
|
||||
if(turn(dir,45) in dirs)
|
||||
. |= CORNER_COUNTERCLOCKWISE
|
||||
if(turn(dir,-45) in dirs)
|
||||
. |= CORNER_CLOCKWISE
|
||||
ret[i] = "[.]"
|
||||
|
||||
return list("ne[NE]", "se[SE]", "sw[SW]", "nw[NW]")
|
||||
return ret
|
||||
|
||||
#undef CORNER_NONE
|
||||
#undef CORNER_EASTWEST
|
||||
#undef CORNER_COUNTERCLOCKWISE
|
||||
#undef CORNER_DIAGONAL
|
||||
#undef CORNER_NORTHSOUTH
|
||||
#undef CORNER_CLOCKWISE
|
||||
|
||||
Reference in New Issue
Block a user