Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transit tube dispensers for JOHN GOBBEL on DISCORD.GG #46344

Merged
merged 7 commits into from Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
99 changes: 89 additions & 10 deletions code/game/objects/structures/transit_tubes/station.dm
Expand Up @@ -12,10 +12,10 @@
enter_delay = 2
tube_construction = /obj/structure/c_transit_tube/station
var/open_status = STATION_TUBE_CLOSED
var/pod_moving = 0
var/pod_moving = FALSE
var/cooldown_delay = 50
var/launch_cooldown = 0
var/reverse_launch = 0
var/reverse_launch = FALSE
var/base_icon = "station0"
var/boarding_dir //from which direction you can board the tube

Expand All @@ -31,7 +31,7 @@
return ..()

/obj/structure/transit_tube/station/should_stop_pod(pod, from_dir)
return 1
return TRUE

/obj/structure/transit_tube/station/Bumped(atom/movable/AM)
if(!pod_moving && open_status == STATION_TUBE_OPEN && ismob(AM) && AM.dir == boarding_dir)
Expand Down Expand Up @@ -130,28 +130,28 @@
return
for(var/obj/structure/transit_tube_pod/pod in loc)
if(!pod.moving)
pod_moving = 1
pod_moving = TRUE
close_animation()
sleep(CLOSE_DURATION + 2)
if(open_status == STATION_TUBE_CLOSED && pod && pod.loc == loc)
pod.follow_tube()
pod_moving = 0
return 1
return 0
pod_moving = FALSE
return TRUE
return FALSE

/obj/structure/transit_tube/station/process()
if(!pod_moving)
launch_pod()

/obj/structure/transit_tube/station/pod_stopped(obj/structure/transit_tube_pod/pod, from_dir)
pod_moving = 1
pod_moving = TRUE
spawn(5)
if(reverse_launch)
pod.setDir(tube_dirs[1]) //turning the pod around for next launch.
launch_cooldown = world.time + cooldown_delay
open_animation()
sleep(OPEN_DURATION + 2)
pod_moving = 0
pod_moving = FALSE
if(!QDELETED(pod))
var/datum/gas_mixture/floor_mixture = loc.return_air()
floor_mixture.archive()
Expand Down Expand Up @@ -185,7 +185,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
reverse_launch = TRUE
icon_state = "closed_terminus0"
base_icon = "terminus0"

Expand All @@ -209,3 +209,82 @@
/obj/structure/transit_tube/station/reverse/flipped/init_tube_dirs()
..()
boarding_dir = dir

//special dispenser station, it creates a pod for you to enter when you bump into it.

/obj/structure/transit_tube/station/dispenser
name = "station tube pod dispenser"
icon_state = "open_dispenser0"
desc = "The lynchpin of a GOOD transit system."
enter_delay = 1
tube_construction = /obj/structure/c_transit_tube/station/dispenser
base_icon = "dispenser0"
open_status = STATION_TUBE_OPEN

/obj/structure/transit_tube/station/dispenser/close_animation()
return

/obj/structure/transit_tube/station/dispenser/launch_pod()
for(var/obj/structure/transit_tube_pod/pod in loc)
if(!pod.moving)
pod_moving = TRUE
pod.follow_tube()
pod_moving = FALSE
return TRUE
return FALSE

/obj/structure/transit_tube/station/dispenser/examine(mob/user)
. = ..()
. += "<span class='notice'>This station will create a pod for you to ride, no need to wait for one.</span>"

/obj/structure/transit_tube/station/dispenser/Bumped(atom/movable/AM)
if(!(istype(AM) && AM.dir == boarding_dir))
return
var/obj/structure/transit_tube_pod/dispensed/pod = new(loc)
AM.visible_message("<span class='notice'>[pod] forms around [AM].</span>", "<span class='notice'>[pod] materializes around you.</span>")
playsound(src, 'sound/weapons/emitter2.ogg', 50, TRUE)
pod.setDir(turn(src.dir, -90))
AM.forceMove(pod)
pod.update_icon()
launch_pod()

/obj/structure/transit_tube/station/dispenser/pod_stopped(obj/structure/transit_tube_pod/pod, from_dir)
playsound(src, 'sound/machines/ding.ogg', 50, TRUE)
qdel(pod)

/obj/structure/transit_tube/station/dispenser/flipped
icon_state = "open_dispenser1"
base_icon = "dispenser1"
tube_construction = /obj/structure/c_transit_tube/station/dispenser/flipped

/obj/structure/transit_tube/station/dispenser/flipped/init_tube_dirs()
..()
boarding_dir = dir


/obj/structure/transit_tube/station/dispenser/reverse
tube_construction = /obj/structure/c_transit_tube/station/dispenser/reverse
reverse_launch = TRUE
icon_state = "closed_terminusdispenser0"
base_icon = "terminusdispenser0"

/obj/structure/transit_tube/station/dispenser/reverse/init_tube_dirs()
switch(dir)
if(NORTH)
tube_dirs = list(EAST)
if(SOUTH)
tube_dirs = list(WEST)
if(EAST)
tube_dirs = list(SOUTH)
if(WEST)
tube_dirs = list(NORTH)
boarding_dir = turn(dir, 180)

/obj/structure/transit_tube/station/dispenser/reverse/flipped
icon_state = "closed_terminusdispenser1"
base_icon = "terminusdispenser1"
tube_construction = /obj/structure/c_transit_tube/station/dispenser/reverse/flipped

/obj/structure/transit_tube/station/dispenser/reverse/flipped/init_tube_dirs()
..()
boarding_dir = dir
14 changes: 7 additions & 7 deletions code/game/objects/structures/transit_tubes/transit_tube.dm
Expand Up @@ -7,7 +7,7 @@
density = TRUE
layer = LOW_ITEM_LAYER
anchored = TRUE
climbable = 1
climbable = TRUE
var/tube_construction = /obj/structure/c_transit_tube
var/list/tube_dirs //list of directions this tube section can connect to.
var/exit_delay = 1
Expand All @@ -16,7 +16,7 @@

/obj/structure/transit_tube/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && (mover.pass_flags & PASSGLASS))
return 1
return TRUE
return !density

/obj/structure/transit_tube/New(loc, newdirection)
Expand Down Expand Up @@ -58,7 +58,7 @@

// Called to check if a pod should stop upon entering this tube.
/obj/structure/transit_tube/proc/should_stop_pod(pod, from_dir)
return 0
return FALSE

// Called when a pod stops in this tube section.
/obj/structure/transit_tube/proc/pod_stopped(pod, from_dir)
Expand All @@ -70,18 +70,18 @@

for(var/direction in tube_dirs)
if(direction == from_dir)
return 1
return TRUE

return 0
return FALSE



/obj/structure/transit_tube/proc/has_exit(in_dir)
for(var/direction in tube_dirs)
if(direction == in_dir)
return 1
return TRUE

return 0
return FALSE



Expand Down
Expand Up @@ -82,6 +82,36 @@
build_type = /obj/structure/transit_tube/station/reverse/flipped
flipped_build_type = /obj/structure/transit_tube/station/reverse

//all the dispenser stations

/obj/structure/c_transit_tube/station/dispenser
icon_state = "closed_dispenser0"
name = "unattached dispenser station"
build_type = /obj/structure/transit_tube/station/dispenser
flipped_build_type = /obj/structure/transit_tube/station/dispenser/flipped

/obj/structure/c_transit_tube/station/dispenser/flipped
icon_state = "closed_station1"
flipped = 1
build_type = /obj/structure/transit_tube/station/dispenser/flipped
flipped_build_type = /obj/structure/transit_tube/station/dispenser

//and the ones that reverse

/obj/structure/c_transit_tube/station/dispenser/reverse
name = "unattached terminus dispenser station"
icon_state = "closed_terminus0"
build_type = /obj/structure/transit_tube/station/dispenser/reverse
flipped_build_type = /obj/structure/transit_tube/station/dispenser/reverse/flipped
base_icon = "closed_terminus"

/obj/structure/c_transit_tube/station/dispenser/reverse/flipped
icon_state = "closed_terminus1"
flipped = 1
build_type = /obj/structure/transit_tube/station/dispenser/reverse/flipped
flipped_build_type = /obj/structure/transit_tube/station/dispenser/reverse

//onto some special tube types

/obj/structure/c_transit_tube/crossing
icon_state = "crossing"
Expand Down
31 changes: 23 additions & 8 deletions code/game/objects/structures/transit_tubes/transit_tube_pod.dm
Expand Up @@ -4,8 +4,9 @@
animate_movement = FORWARD_STEPS
anchored = TRUE
density = TRUE
var/moving = 0
var/moving = FALSE
var/datum/gas_mixture/air_contents = new()
var/occupied_icon_state = "pod_occupied"


/obj/structure/transit_tube_pod/Initialize()
Expand All @@ -22,9 +23,9 @@

/obj/structure/transit_tube_pod/update_icon()
if(contents.len)
icon_state = "pod_occupied"
icon_state = occupied_icon_state
else
icon_state = "pod"
icon_state = initial(icon_state)

/obj/structure/transit_tube_pod/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_CROWBAR)
Expand Down Expand Up @@ -73,7 +74,7 @@
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "<span class='notice'>You start trying to escape from the pod...</span>")
if(do_after(user, 600, target = src))
if(do_after(user, 1 MINUTES, target = src))
to_chat(user, "<span class='notice'>You manage to open the pod.</span>")
empty_pod()

Expand All @@ -86,7 +87,7 @@

/obj/structure/transit_tube_pod/Process_Spacemove()
if(moving) //No drifting while moving in the tubes
return 1
return TRUE
else
return ..()

Expand All @@ -95,7 +96,7 @@
if(moving)
return

moving = 1
moving = TRUE

var/obj/structure/transit_tube/current_tube = null
var/next_dir
Expand Down Expand Up @@ -143,11 +144,14 @@
break

density = TRUE
moving = 0
moving = FALSE

var/obj/structure/transit_tube/TT = locate(/obj/structure/transit_tube) in loc
if(!TT || (!(dir in TT.tube_dirs) && !(turn(dir,180) in TT.tube_dirs))) //landed on a turf without transit tube or not in our direction
deconstruct(FALSE) //we automatically deconstruct the pod
outside_tube()

/obj/structure/transit_tube_pod/proc/outside_tube()
deconstruct(FALSE)//we automatically deconstruct the pod

/obj/structure/transit_tube_pod/return_air()
return air_contents
Expand Down Expand Up @@ -186,3 +190,14 @@

/obj/structure/transit_tube_pod/return_temperature()
return air_contents.temperature

//special pod made by the dispenser, it fizzles away when reaching a station.

/obj/structure/transit_tube_pod/dispensed
name = "temporary transit tube pod"
desc = "Hits the skrrrt (tube station), then hits the dirt (nonexistence). You know how it is."
icon_state = "temppod"
occupied_icon_state = "temppod_occupied"

/obj/structure/transit_tube_pod/dispensed/outside_tube()
qdel(src)
Binary file modified icons/obj/atmospherics/pipes/transit_tube.dmi
Binary file not shown.