mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Changes flip/rotation, better diagonal handling
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
icon_state = "closed"
|
||||
exit_delay = 2
|
||||
enter_delay = 3
|
||||
tube_construction = /obj/structure/c_transit_tube/station
|
||||
var/pod_moving = 0
|
||||
var/automatic_launch_time = 100
|
||||
var/cooldown_delay = 200
|
||||
@@ -27,6 +28,7 @@
|
||||
|
||||
// Stations which will send the tube in the opposite direction after their stop.
|
||||
/obj/structure/transit_tube/station/reverse
|
||||
tube_construction = /obj/structure/c_transit_tube/station/reverse
|
||||
reverse_launch = 1
|
||||
|
||||
/obj/structure/transit_tube/station/should_stop_pod(pod, from_dir)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
density = 1
|
||||
layer = 3.1
|
||||
anchored = 1.0
|
||||
var/tube_construction = /obj/structure/c_transit_tube
|
||||
var/list/tube_dirs = null
|
||||
var/exit_delay = 2
|
||||
var/enter_delay = 1
|
||||
@@ -49,28 +50,35 @@ obj/structure/transit_tube/ex_act(severity)
|
||||
|
||||
/obj/structure/transit_tube/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
for(var/obj/structure/transit_tube_pod/pod in loc)
|
||||
user << "<span class='notice'>Remove the pod first.</span>"
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] starts to deattach the [src]!</span>", "<span class='notice'>You start deattaching the [name]...</span>")
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
if(do_after(user, 35))
|
||||
user << "<span class='notice'>You deattach the [name]!</span>"
|
||||
if(copytext(icon_state, 1, 3) != "D-")
|
||||
if(istype(src, /obj/structure/transit_tube/station/reverse))
|
||||
var/obj/structure/R = new/obj/structure/c_transit_tube/station/reverse(src.loc)
|
||||
src.transfer_fingerprints_to(R)
|
||||
R.add_fingerprint(user)
|
||||
else if(istype(src, /obj/structure/transit_tube/station))
|
||||
var/obj/structure/R = new/obj/structure/c_transit_tube/station(src.loc)
|
||||
src.transfer_fingerprints_to(R)
|
||||
R.add_fingerprint(user)
|
||||
else
|
||||
var/obj/structure/R = new/obj/structure/c_transit_tube(src.loc)
|
||||
R.icon_state = src.icon_state
|
||||
src.transfer_fingerprints_to(R)
|
||||
R.add_fingerprint(user)
|
||||
qdel(src)
|
||||
if(copytext(icon_state, 1, 3) != "D-") //decorative diagonals cannot be unwrenched directly
|
||||
for(var/obj/structure/transit_tube_pod/pod in loc)
|
||||
user << "<span class='notice'>Remove the pod first.</span>"
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] starts to deattach the [src]!</span>", "<span class='notice'>You start deattaching the [name]...</span>")
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
if(do_after(user, 35))
|
||||
user << "<span class='notice'>You deattach the [name]!</span>"
|
||||
var/obj/structure/R = new tube_construction(src.loc)
|
||||
R.icon_state = src.icon_state
|
||||
src.transfer_fingerprints_to(R)
|
||||
R.add_fingerprint(user)
|
||||
src.destroy_diagonals()
|
||||
qdel(src)
|
||||
|
||||
//destroys disconnected decorative diagonals
|
||||
/obj/structure/transit_tube/proc/destroy_diagonals()
|
||||
for(var/obj/structure/transit_tube/D in orange(1, src))
|
||||
if(copytext(D.icon_state, 1, 3) == "D-") //is diagonal
|
||||
var/my_dir = text2dir_extended(copytext(D.icon_state, 3, 5))
|
||||
var/is_connecting = 0
|
||||
for(var/obj/structure/transit_tube/N in orange(1,D))
|
||||
if( (( get_dir(D,N) == turn(my_dir, -45) && D.has_exit(turn(my_dir, 90)) ) || \
|
||||
( get_dir(D,N) == turn(my_dir, 45) && D.has_exit(turn(my_dir, -90))) ) && \
|
||||
D != src )
|
||||
is_connecting = 1
|
||||
break
|
||||
if(!is_connecting)
|
||||
qdel(D)
|
||||
|
||||
// Called to check if a pod should stop upon entering this tube.
|
||||
/obj/structure/transit_tube/proc/should_stop_pod(pod, from_dir)
|
||||
@@ -80,7 +88,6 @@ obj/structure/transit_tube/ex_act(severity)
|
||||
/obj/structure/transit_tube/proc/pod_stopped(pod, from_dir)
|
||||
return
|
||||
|
||||
|
||||
// Returns a /list of directions this tube section can connect to.
|
||||
// Tubes that have some sort of logic or changing direction might
|
||||
// override it with additional logic.
|
||||
|
||||
@@ -23,28 +23,42 @@
|
||||
newdir = list2text(split_text, "-")
|
||||
icon_state = newdir
|
||||
|
||||
// disposals-style "flip" and rotate verbs
|
||||
/obj/structure/c_transit_tube/proc/tube_flip()
|
||||
var/list/split_text = text2list(icon_state, "-")
|
||||
//skip straight pipes
|
||||
if(length(split_text[2]) < 2)
|
||||
return
|
||||
//for junctions, just swap the diagonals with each other
|
||||
if(split_text.len == 3 && split_text[3] != "Pass")
|
||||
split_text.Swap(2,3)
|
||||
//for curves, swap the diagonal direction that is not in the same axis as the cardinal direction
|
||||
else
|
||||
if(split_text[1] == "N" || split_text[1] == "S")
|
||||
split_text[2] = copytext(split_text[2],1,2) + ((copytext(split_text[2],2,3) == "E") ? "W" : "E")
|
||||
else
|
||||
split_text[2] = ((copytext(split_text[2],1,2) == "N") ? "S" : "N") + copytext(split_text[2],2,3)
|
||||
icon_state = list2text(split_text, "-")
|
||||
|
||||
// disposals-style flip and rotate verbs
|
||||
/obj/structure/c_transit_tube/verb/rotate()
|
||||
set name = "Rotate Tube"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.canUseTopic())
|
||||
return
|
||||
|
||||
tube_turn(-90)
|
||||
|
||||
//not a real flip because it won't mirror junction pipe exits
|
||||
//yes i am autistic
|
||||
/obj/structure/c_transit_tube/verb/flip()
|
||||
set name = "Rotate Tube Twice"
|
||||
set name = "Flip"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.canUseTopic())
|
||||
return
|
||||
|
||||
tube_turn(180)
|
||||
tube_flip()
|
||||
|
||||
/obj/structure/c_transit_tube/proc/buildtube()
|
||||
var/obj/structure/transit_tube/R = new/obj/structure/transit_tube(src.loc)
|
||||
@@ -71,25 +85,11 @@
|
||||
icon = 'icons/obj/pipes/transit_tube_station.dmi'
|
||||
icon_state = "closed"
|
||||
|
||||
/obj/structure/c_transit_tube/station/rotate()
|
||||
set name = "Rotate Tube"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
/obj/structure/c_transit_tube/station/tube_turn(var/angle)
|
||||
src.dir = turn(src.dir, angle)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
src.dir = turn(src.dir, -90)
|
||||
|
||||
/obj/structure/c_transit_tube/station/flip()
|
||||
set name = "Rotate Tube Twice"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
src.dir = turn(src.dir, 180)
|
||||
/obj/structure/c_transit_tube/station/tube_flip()
|
||||
src.tube_turn(180)
|
||||
|
||||
/obj/structure/c_transit_tube/station/buildtube()
|
||||
var/obj/structure/transit_tube/station/R = new/obj/structure/transit_tube/station(src.loc)
|
||||
|
||||
Reference in New Issue
Block a user