Skip to content

Commit f15586d

Browse files
Auto-smoothed cabling on maps (#38269)
* cable stuff * colors * Update cable.dm * test wiring * Update cable.dm * Update cable.dm * Update cable.dm * Update cable.dm * some mapping and tweaks * Update cable.dm * Update tgstation.dmm * Update cable.dm * rest of box * so that powernets being set up works * last grille * some custom alignment of cables * Update global.dm * more specific directions for smoothing * done mapping * not a good idea * should hopefully work * Update cable.dm * Update cable.dm * Update cable.dm * Update cable.dm
1 parent fec97ef commit f15586d

File tree

5 files changed

+2612
-14516
lines changed

5 files changed

+2612
-14516
lines changed

__DEFINES/global.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ var/list/voxstart = list() //Vox raider spawn points
151151
var/list/voxlocker = list() //Vox locker spawn points
152152
// list/traitors = list() //traitor list
153153
var/list/cardinal = list( NORTH, SOUTH, EAST, WEST )
154+
154155
var/list/diagonal = list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
155156
var/list/alldirs = list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
156157

__DEFINES/subsystem.dm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#define SS_INIT_HUMANS 21
1414
#define SS_INIT_MAP 20
1515
#define SS_INIT_COMPONENT 19.5
16-
#define SS_INIT_POWER 19
17-
#define SS_INIT_PERSISTENCE_MISC 18.5 // Because Tetris needs to read from previous rounds. It inits in 0 seconds anyway.
18-
#define SS_INIT_OBJECT 18
16+
#define SS_INIT_PERSISTENCE_MISC 19 // Because Tetris needs to read from previous rounds. It inits in 0 seconds anyway.
17+
#define SS_INIT_OBJECT 18.5
18+
#define SS_INIT_POWER 18
1919
#define SS_INIT_PIPENET 17.5
2020
#define SS_INIT_XENOARCH 17
2121
#define SS_INIT_MORE_INIT 16

code/modules/power/cable.dm

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,8 @@ By design, d1 is the smallest direction and d2 is the highest
141141
update_icon()
142142

143143
/obj/structure/cable/update_icon()
144-
if(invisibility)
145-
icon_state = "[d1]-[d2]-f"
146-
else
147-
icon_state = "[d1]-[d2]"
144+
alpha = invisibility ? 128 : 255
145+
icon_state = "[d1]-[d2]"
148146

149147
/obj/structure/cable/t_scanner_expose()
150148
if (level != LEVEL_BELOW_FLOOR)
@@ -556,3 +554,74 @@ By design, d1 is the smallest direction and d2 is the highest
556554

557555
/obj/structure/cable/proc/hasDir(var/dir)
558556
return (d1 == dir || d2 == dir)
557+
558+
/obj/structure/cable/mapping
559+
icon_state = "auto"
560+
561+
/obj/structure/cable/mapping/canSmoothWith()
562+
var/static/list/smoothables = list(/obj/structure/cable)
563+
return smoothables
564+
565+
/obj/structure/cable/mapping/isSmoothableNeighbor(atom/A)
566+
if(istype(A,/obj/structure/cable))
567+
if(istype(A,/obj/structure/cable/mapping))
568+
return TRUE
569+
var/obj/structure/cable/C = A
570+
return C.hasDir(get_dir(C,src))
571+
572+
/obj/structure/cable/mapping/relativewall()
573+
. = ..()
574+
var/list/found_dirs = list()
575+
for(var/subdir in cardinal)
576+
if(junction & subdir)
577+
found_dirs += list(subdir)
578+
var/dir_in_found = (dir in found_dirs) ? TRUE : FALSE
579+
if(found_dirs.len > 1 && dir_in_found)
580+
found_dirs.Remove(dir)
581+
unshift(found_dirs,dir)
582+
if(found_dirs.len > 2)
583+
for(var/i in 3 to found_dirs.len)
584+
var/list/subfound = dir_in_found ? list(dir,found_dirs[i]) : list(found_dirs[i-1],found_dirs[i])
585+
sortTim(subfound)
586+
var/obj/structure/cable/C = new(loc)
587+
C.d1 = subfound[1]
588+
C.d2 = subfound[2]
589+
C.color = src.color
590+
C.update_icon()
591+
if(found_dirs.len >= 2)
592+
var/list/subfound = list(found_dirs[1],found_dirs[2])
593+
sortTim(subfound)
594+
d1 = subfound[1]
595+
d2 = subfound[2]
596+
if((locate(/obj/machinery/power) in loc) || (locate(/obj/structure/grille) in loc))
597+
var/obj/structure/cable/C = new(loc)
598+
C.d1 = 0
599+
C.d2 = found_dirs[1]
600+
C.color = src.color
601+
C.update_icon()
602+
else if(found_dirs.len == 1)
603+
d1 = 0
604+
d2 = found_dirs[1]
605+
update_icon()
606+
dir = SOUTH
607+
608+
/obj/structure/cable/mapping/yellow
609+
color = "#FFED00"
610+
611+
/obj/structure/cable/mapping/green
612+
color = "#0B8400"
613+
614+
/obj/structure/cable/mapping/blue
615+
color = "#005C84"
616+
617+
/obj/structure/cable/mapping/pink
618+
color = "#CA00B6"
619+
620+
/obj/structure/cable/mapping/orange
621+
color = "#CA6900"
622+
623+
/obj/structure/cable/mapping/cyan
624+
color = "#00B5CA"
625+
626+
/obj/structure/cable/mapping/white
627+
color = "#D0D0D0"

icons/obj/power_cond_white.dmi

-2.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)