mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-07-20 03:23:36 +01:00
Ported Catwalks from Eris
* Catwalks are an upgrade to lattice; instead of just a framework of wires its a mostly solid grid walkway. * They are semi-transparent so you can see wires/pipes below them a bit. * Smoothly auto-joining sprites to look proper. * Constructed by upgrading lattice; like lattice it will stop you falling if build over an open space. * Changes from Eris: Converted << to to_chat(), fix redraw on Destroy(), Fix color macros in text.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// Based on catwalk.dm from https://github.com/Endless-Horizon/CEV-Eris
|
||||
/obj/structure/catwalk
|
||||
layer = TURF_LAYER + 0.5
|
||||
icon = 'icons/turf/catwalks.dmi'
|
||||
icon_state = "catwalk"
|
||||
name = "catwalk"
|
||||
desc = "Cats really don't like these things."
|
||||
density = 0
|
||||
anchored = 1.0
|
||||
|
||||
/obj/structure/catwalk/New()
|
||||
..()
|
||||
spawn(4)
|
||||
if(src)
|
||||
for(var/obj/structure/catwalk/C in get_turf(src))
|
||||
if(C != src)
|
||||
qdel(C)
|
||||
update_icon()
|
||||
redraw_nearby_catwalks()
|
||||
|
||||
/obj/structure/catwalk/Destroy()
|
||||
..()
|
||||
redraw_nearby_catwalks()
|
||||
|
||||
/obj/structure/catwalk/proc/redraw_nearby_catwalks()
|
||||
for(var/direction in alldirs)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, direction)))
|
||||
var/obj/structure/catwalk/L = locate(/obj/structure/catwalk, get_step(src, direction))
|
||||
L.update_icon() //so siding get updated properly
|
||||
|
||||
|
||||
/obj/structure/catwalk/update_icon()
|
||||
var/connectdir = 0
|
||||
for(var/direction in cardinal)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, direction)))
|
||||
connectdir |= direction
|
||||
|
||||
//Check the diagonal connections for corners, where you have, for example, connections both north and east. In this case it checks for a north-east connection to determine whether to add a corner marker or not.
|
||||
var/diagonalconnect = 0 //1 = NE; 2 = SE; 4 = NW; 8 = SW
|
||||
//NORTHEAST
|
||||
if(connectdir & NORTH && connectdir & EAST)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, NORTHEAST)))
|
||||
diagonalconnect |= 1
|
||||
//SOUTHEAST
|
||||
if(connectdir & SOUTH && connectdir & EAST)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, SOUTHEAST)))
|
||||
diagonalconnect |= 2
|
||||
//NORTHWEST
|
||||
if(connectdir & NORTH && connectdir & WEST)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, NORTHWEST)))
|
||||
diagonalconnect |= 4
|
||||
//SOUTHWEST
|
||||
if(connectdir & SOUTH && connectdir & WEST)
|
||||
if(locate(/obj/structure/catwalk, get_step(src, SOUTHWEST)))
|
||||
diagonalconnect |= 8
|
||||
|
||||
icon_state = "catwalk[connectdir]-[diagonalconnect]"
|
||||
|
||||
|
||||
/obj/structure/catwalk/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
if(2.0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/structure/catwalk/attackby(obj/item/C as obj, mob/user as mob)
|
||||
if (istype(C, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = C
|
||||
if(WT.isOn())
|
||||
if(WT.remove_fuel(0, user))
|
||||
to_chat(user, "<span class='notice'>Slicing lattice joints ...</span>")
|
||||
PoolOrNew(/obj/item/stack/rods, src.loc)
|
||||
PoolOrNew(/obj/item/stack/rods, src.loc)
|
||||
PoolOrNew(/obj/structure/lattice, src.loc)
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
/obj/structure/catwalk/Crossed()
|
||||
. = ..()
|
||||
if(isliving(usr))
|
||||
playsound(src, pick('sound/effects/footstep/catwalk1.ogg', 'sound/effects/footstep/catwalk2.ogg', 'sound/effects/footstep/catwalk3.ogg', 'sound/effects/footstep/catwalk4.ogg', 'sound/effects/footstep/catwalk5.ogg'), 25, 1)
|
||||
@@ -67,7 +67,16 @@
|
||||
user << "<span class='notice'>Slicing lattice joints ...</span>"
|
||||
PoolOrNew(/obj/item/stack/rods, src.loc)
|
||||
qdel(src)
|
||||
|
||||
return
|
||||
if (istype(C, /obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/R = C
|
||||
if(R.use(2))
|
||||
user << "<span class='notice'>You start connecting \the [R.name] to \the [src.name] ...</span>"
|
||||
if(do_after(user, 5 SECONDS))
|
||||
src.alpha = 0 // Note: I don't know why this is set, Eris did it, just trusting for now. ~Leshana
|
||||
PoolOrNew(/obj/structure/catwalk, src.loc)
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/structure/lattice/proc/updateOverlays()
|
||||
|
||||
Reference in New Issue
Block a user