Files
GS13NG/code/game/objects/structures/transit_tubes/transit_tube_construction.dm
T
AnturK eb7974df7d Simple rotation component. (#34476)
I'm going to port other rotations to it when i don't feel lazy.
Closes #34064
2018-01-23 02:09:16 -06:00

127 lines
4.1 KiB
Plaintext

// transit tube construction
// normal transit tubes
/obj/structure/c_transit_tube
name = "unattached transit tube"
icon = 'icons/obj/atmospherics/pipes/transit_tube.dmi'
icon_state = "straight"
desc = "An unattached segment of transit tube."
density = FALSE
layer = LOW_ITEM_LAYER //same as the built tube
anchored = FALSE
var/flipped = 0
var/build_type = /obj/structure/transit_tube
var/flipped_build_type
var/base_icon
/obj/structure/c_transit_tube/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_FLIP | ROTATION_VERBS,null,null,CALLBACK(src,.proc/after_rot))
/obj/structure/c_transit_tube/proc/after_rot(mob/user,rotation_type)
if(flipped_build_type && rotation_type == ROTATION_FLIP)
setDir(turn(dir,-180)) //Turn back we don't actually flip
flipped = !flipped
var/cur_flip = initial(flipped) ? !flipped : flipped
if(cur_flip)
build_type = flipped_build_type
else
build_type = initial(build_type)
icon_state = "[base_icon][flipped]"
/obj/structure/c_transit_tube/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "<span class='notice'>You start attaching the [name]...</span>")
add_fingerprint(user)
playsound(src.loc, I.usesound, 50, 1)
if(do_after(user, 40*I.toolspeed, target = src))
if(QDELETED(src))
return
to_chat(user, "<span class='notice'>You attach the [name].</span>")
var/obj/structure/transit_tube/R = new build_type(loc, dir)
transfer_fingerprints_to(R)
qdel(src)
else
return ..()
// transit tube station
/obj/structure/c_transit_tube/station
name = "unattached through station"
icon_state = "closed_station0"
build_type = /obj/structure/transit_tube/station
flipped_build_type = /obj/structure/transit_tube/station/flipped
base_icon = "closed_station"
/obj/structure/c_transit_tube/station/flipped
icon_state = "closed_station1"
flipped = 1
build_type = /obj/structure/transit_tube/station/flipped
flipped_build_type = /obj/structure/transit_tube/station
// reverser station, used for the terminus
/obj/structure/c_transit_tube/station/reverse
name = "unattached terminus station"
icon_state = "closed_terminus0"
build_type = /obj/structure/transit_tube/station/reverse
flipped_build_type = /obj/structure/transit_tube/station/reverse/flipped
base_icon = "closed_terminus"
/obj/structure/c_transit_tube/station/reverse/flipped
icon_state = "closed_terminus1"
flipped = 1
build_type = /obj/structure/transit_tube/station/reverse/flipped
flipped_build_type = /obj/structure/transit_tube/station/reverse
/obj/structure/c_transit_tube/crossing
icon_state = "crossing"
build_type = /obj/structure/transit_tube/crossing
/obj/structure/c_transit_tube/diagonal
icon_state = "diagonal"
build_type = /obj/structure/transit_tube/diagonal
/obj/structure/c_transit_tube/diagonal/crossing
icon_state = "diagonal_crossing"
build_type = /obj/structure/transit_tube/diagonal/crossing
/obj/structure/c_transit_tube/curved
icon_state = "curved0"
build_type = /obj/structure/transit_tube/curved
flipped_build_type = /obj/structure/transit_tube/curved/flipped
base_icon = "curved"
/obj/structure/c_transit_tube/curved/flipped
icon_state = "curved1"
build_type = /obj/structure/transit_tube/curved/flipped
flipped_build_type = /obj/structure/transit_tube/curved
flipped = 1
/obj/structure/c_transit_tube/junction
icon_state = "junction0"
build_type = /obj/structure/transit_tube/junction
flipped_build_type = /obj/structure/transit_tube/junction/flipped
base_icon = "junction"
/obj/structure/c_transit_tube/junction/flipped
icon_state = "junction1"
flipped = 1
build_type = /obj/structure/transit_tube/junction/flipped
flipped_build_type = /obj/structure/transit_tube/junction
//transit tube pod
//see station.dm for the logic
/obj/structure/c_transit_tube_pod
name = "unattached transit tube pod"
icon = 'icons/obj/atmospherics/pipes/transit_tube.dmi'
icon_state = "pod"
anchored = FALSE
density = FALSE