diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index d953775363d..f74bcc11fa5 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -1,13 +1,14 @@ /obj/structure/lattice - desc = "A lightweight support lattice." name = "lattice" + desc = "A lightweight support lattice." icon = 'icons/obj/structures.dmi' - icon_state = "latticefull" + icon_state = "lattice" density = 0 anchored = 1.0 layer = 2.3 //under pipes var/obj/item/stack/rods/stored // flags = CONDUCT + var/intact = 0 //for potential cable coil errors /obj/structure/lattice/New() ..() @@ -18,7 +19,6 @@ qdel(LAT) stored = new/obj/item/stack/rods(src) icon = 'icons/obj/smoothlattice.dmi' - icon_state = "latticeblank" updateOverlays() for (var/dir in cardinal) var/obj/structure/lattice/L @@ -60,7 +60,7 @@ if (istype(C, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = C if(WT.remove_fuel(0, user)) - user << "Slicing lattice joints ..." + user << "Slicing [initial(icon_state)] joints ..." Deconstruct() return @@ -78,7 +78,7 @@ if(!(istype(get_step(src, direction), /turf/space))) dir_sum += direction - icon_state = "lattice[dir_sum]" + icon_state = "[initial(icon_state)][dir_sum]" return /obj/structure/lattice/Deconstruct() @@ -88,4 +88,19 @@ /obj/structure/lattice/singularity_pull(S, current_size) if(current_size >= STAGE_FOUR) - Deconstruct() \ No newline at end of file + Deconstruct() + +/obj/structure/lattice/catwalk + name = "catwalk" + desc = "A catwalk for easier EVA manuevering." + icon_state = "catwalk" + +/obj/structure/lattice/catwalk/attackby(obj/item/C as obj, mob/user as mob) + ..() + if(istype(C, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/coil = C + for(var/obj/structure/cable/LC in src) + if((LC.d1==0)||(LC.d2==0)) + LC.attackby(C,user) + return + coil.catwalk_place(src, user) \ No newline at end of file diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 954c4ed91e4..3a9cfc0566e 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -23,15 +23,25 @@ if(istype(C, /obj/item/stack/rods)) var/obj/item/stack/rods/R = C var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) + var/obj/structure/lattice/catwalk/W = locate(/obj/structure/lattice/catwalk, src) + if(W) + user << "There is already a catwalk here." + return if(L) - user << "There is already a lattice." + if(R.use(2)) + user << "Constructing catwalk..." + playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) + qdel(L) + ReplaceWithCatwalk() + else + user << "You need two rods to build a catwalk." return if(R.use(1)) user << "Constructing support lattice..." playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) ReplaceWithLattice() else - user << "You need one rod to build lattice." + user << "You need one rod to build a lattice." return if(istype(C, /obj/item/stack/tile/plasteel)) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 219180b4c3b..7ea69c51755 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -173,7 +173,11 @@ /turf/proc/ReplaceWithLattice() src.ChangeTurf(/turf/space) - new /obj/structure/lattice( locate(src.x, src.y, src.z) ) + new /obj/structure/lattice(locate(src.x, src.y, src.z) ) + +/turf/proc/ReplaceWithCatwalk() + src.ChangeTurf(/turf/space) + new /obj/structure/lattice/catwalk(locate(src.x, src.y, src.z) ) /turf/proc/phase_damage_creatures(damage,mob/U = null)//>Ninja Code. Hurts and knocks out creatures on this turf for(var/mob/living/M in src) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 6b9753df305..ae6b20fa805 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -677,6 +677,57 @@ obj/structure/cable/proc/avail() if (prob(50)) //fail C.Deconstruct() + + +// called when cable_coil is clicked on a catwalk +/obj/item/stack/cable_coil/proc/catwalk_place(var/obj/structure/lattice/catwalk/W, mob/user) + if(get_amount() < 1) // Out of cable + user << "There is no cable left." + return + + if(get_dist(W,user) > 1) // Too far + user << "You can't lay cable at a place that far away." + return + + else + var/dirn + + if(user.loc == W) + dirn = user.dir // if laying on the tile we're on, lay in the direction we're facing + else + dirn = get_dir(W, user) + + for(var/obj/structure/cable/LC in W) + if(LC.d2 == dirn && LC.d1 == 0) + user << "There's already a cable at that position." + return + + var/obj/structure/cable/C = get_new_cable (W) + + //set up the new cable + C.d1 = 0 //it's a O-X node cable + C.d2 = dirn + C.add_fingerprint(user) + C.updateicon() + + //create a new powernet with the cable, if needed it will be merged later + var/datum/powernet/PN = new() + PN.add_cable(C) + + C.mergeConnectedNetworks(C.d2) //merge the powernet with adjacents powernets + C.mergeConnectedNetworksOnTurf() //merge the powernet with on turf powernets + + if(C.d2 & (C.d2 - 1))// if the cable is layed diagonally, check the others 2 possible directions + C.mergeDiagonalsNetworks(C.d2) + + + use(1) + + if (C.shock(user, 50)) + if (prob(50)) //fail + C.Deconstruct() + + // called when cable_coil is click on an installed obj/cable // or click on a turf that already contains a "node" cable /obj/item/stack/cable_coil/proc/cable_join(obj/structure/cable/C, mob/user) @@ -695,6 +746,9 @@ obj/structure/cable/proc/avail() if(U == T) //if clicked on the turf we're standing on, try to put a cable in the direction we're facing + for(var/obj/structure/lattice/catwalk/W in src) + catwalk_place(W,user) + return turf_place(T,user) return diff --git a/icons/obj/smoothlattice.dmi b/icons/obj/smoothlattice.dmi index f140a27f007..8c45a1df2b4 100644 Binary files a/icons/obj/smoothlattice.dmi and b/icons/obj/smoothlattice.dmi differ diff --git a/icons/obj/structures.dmi b/icons/obj/structures.dmi index f0ee66081a6..d5c951b31ca 100644 Binary files a/icons/obj/structures.dmi and b/icons/obj/structures.dmi differ