mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Add constructible transit tubes. (#24045)
* Add constructible transit tubes. * Apply suggestions from code review Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * change construction type, add icon state * don't give any glass back, support RPD recycling * destroy/explode into glass decals * Update code/game/objects/structures/transit_tubes/transit_tube_construction.dm Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * tube automatic orientation is unintuitive * support manual flip/rotate like pipes * better logic for installation * better support for building in space * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * second half of review suggestions * Update code/game/objects/structures/transit_tubes/transit_tube_construction.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --------- Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
co-authored by
GDN
Luc
parent
de894636f4
commit
35ca57c262
@@ -33,6 +33,7 @@
|
||||
var/pipe_category = RPD_ATMOS_PIPING //For TGUI menus, this is a subtype of pipes e.g. scrubbers pipes, devices
|
||||
var/whatpipe = PIPE_SIMPLE_STRAIGHT //What kind of atmos pipe is it?
|
||||
var/whatdpipe = PIPE_DISPOSALS_STRAIGHT //What kind of disposals pipe is it?
|
||||
var/whatttube = PIPE_TRANSIT_TUBE
|
||||
var/spawndelay = RPD_COOLDOWN_TIME
|
||||
var/walldelay = RPD_WALLBUILD_TIME
|
||||
var/ranged = FALSE
|
||||
@@ -43,6 +44,7 @@
|
||||
var/list/mainmenu = list(
|
||||
list("category" = "Atmospherics", "mode" = RPD_ATMOS_MODE, "icon" = "wrench"),
|
||||
list("category" = "Disposals", "mode" = RPD_DISPOSALS_MODE, "icon" = "recycle"),
|
||||
list("category" = "Transit", "mode" = RPD_TRANSIT_MODE, "icon" = "subway"),
|
||||
list("category" = "Rotate", "mode" = RPD_ROTATE_MODE, "icon" = "sync-alt"),
|
||||
list("category" = "Flip", "mode" = RPD_FLIP_MODE, "icon" = "arrows-alt-h"),
|
||||
list("category" = "Recycle", "mode" = RPD_DELETE_MODE, "icon" = "trash"))
|
||||
@@ -125,17 +127,36 @@
|
||||
to_chat(user, "<span class='notice'>[src] rapidly dispenses [P]!</span>")
|
||||
activate_rpd(TRUE)
|
||||
|
||||
/obj/item/rpd/proc/create_transit_tube(mob/user, turf/dest)
|
||||
if(!can_dispense_pipe(whatttube, PIPETYPE_TRANSIT))
|
||||
CRASH("Failed to spawn [get_pipe_name(whatttube, PIPETYPE_TRANSIT)] - possible tampering detected")
|
||||
|
||||
for(var/datum/pipes/transit/T in GLOB.construction_pipe_list)
|
||||
if(T.pipe_id == whatttube)
|
||||
var/obj/structure/transit_tube_construction/S = new T.construction_type(dest)
|
||||
if(!istype(S))
|
||||
CRASH("found [S] when constructing transit tube but expected /obj/structure/transit_tube_construction")
|
||||
|
||||
S.dir = iconrotation ? iconrotation : user.dir
|
||||
|
||||
to_chat(user, "<span class='notice'>[src] rapidly dispenses [S]!</span>")
|
||||
activate_rpd(TRUE)
|
||||
|
||||
/obj/item/rpd/proc/rotate_all_pipes(mob/user, turf/T) //Rotate all pipes on a turf
|
||||
for(var/obj/item/pipe/P in T)
|
||||
P.rotate()
|
||||
for(var/obj/structure/disposalconstruct/D in T)
|
||||
D.rotate()
|
||||
for(var/obj/structure/transit_tube_construction/tube in T)
|
||||
tube.rotate()
|
||||
|
||||
/obj/item/rpd/proc/flip_all_pipes(mob/user, turf/T) //Flip all pipes on a turf
|
||||
for(var/obj/item/pipe/P in T)
|
||||
P.flip()
|
||||
for(var/obj/structure/disposalconstruct/D in T)
|
||||
D.flip()
|
||||
for(var/obj/structure/transit_tube_construction/tube in T)
|
||||
tube.flip()
|
||||
|
||||
/obj/item/rpd/proc/delete_all_pipes(mob/user, turf/T) //Delete all pipes on a turf
|
||||
var/eaten
|
||||
@@ -154,6 +175,9 @@
|
||||
if(!D.anchored)
|
||||
QDEL_NULL(D)
|
||||
eaten = TRUE
|
||||
for(var/obj/structure/transit_tube_construction/C in T)
|
||||
QDEL_NULL(C)
|
||||
eaten = TRUE
|
||||
if(eaten)
|
||||
to_chat(user, "<span class='notice'>[src] sucks up the loose pipes on [T].")
|
||||
activate_rpd()
|
||||
@@ -197,6 +221,7 @@
|
||||
data["pipe_category"] = pipe_category
|
||||
data["whatdpipe"] = whatdpipe
|
||||
data["whatpipe"] = whatpipe
|
||||
data["whatttube"] = whatttube
|
||||
return data
|
||||
|
||||
/obj/item/rpd/ui_act(action, list/params)
|
||||
@@ -212,6 +237,8 @@
|
||||
whatpipe = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("whatdpipe")
|
||||
whatdpipe = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("whatttube")
|
||||
whatttube = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("pipe_category")
|
||||
pipe_category = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("mode")
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
base_icon_state = "station0"
|
||||
exit_delay = 1
|
||||
enter_delay = 2
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/station
|
||||
var/pod_moving = FALSE
|
||||
var/launch_cooldown = 0
|
||||
var/reverse_launch = FALSE
|
||||
@@ -183,6 +184,7 @@
|
||||
icon_state = "closed_terminus0"
|
||||
base_icon_state = "terminus0"
|
||||
reverse_launch = TRUE
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/terminus
|
||||
|
||||
/obj/structure/transit_tube/station/reverse/init_tube_dirs()
|
||||
tube_dirs = list(turn(dir, -90))
|
||||
@@ -205,6 +207,7 @@
|
||||
enter_delay = 1
|
||||
base_icon_state = "dispenser0"
|
||||
hatch_state = TRANSIT_TUBE_OPEN
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/station/dispenser
|
||||
|
||||
/obj/structure/transit_tube/station/dispenser/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -241,7 +244,6 @@
|
||||
qdel(pod)
|
||||
|
||||
|
||||
|
||||
/obj/structure/transit_tube/station/dispenser/flipped
|
||||
icon_state = "open_dispenser1"
|
||||
base_icon_state = "dispenser1"
|
||||
@@ -255,9 +257,10 @@
|
||||
reverse_launch = TRUE
|
||||
icon_state = "open_terminusdispenser0"
|
||||
base_icon_state = "terminusdispenser0"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/terminus/dispenser
|
||||
|
||||
/obj/structure/transit_tube/station/dispenser/reverse/init_tube_dirs()
|
||||
tube_dirs = list(turn(dir, 90))
|
||||
tube_dirs = list(turn(dir, -90))
|
||||
boarding_dir = reverse_direction(dir)
|
||||
|
||||
/obj/structure/transit_tube/station/dispenser/reverse/flipped
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
var/list/tube_dirs = null
|
||||
var/exit_delay = 1
|
||||
var/enter_delay = 0
|
||||
var/uninstalled_type = /obj/structure/transit_tube_construction/straight
|
||||
|
||||
/obj/structure/transit_tube/Initialize(mapload, new_direction)
|
||||
. = ..()
|
||||
@@ -45,16 +46,14 @@
|
||||
AM.loc = loc
|
||||
AM.ex_act(severity++)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
deconstruct(disassembled = FALSE)
|
||||
if(EXPLODE_HEAVY)
|
||||
if(prob(50))
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.loc = loc
|
||||
AM.ex_act(severity++)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
deconstruct(disassembled = FALSE)
|
||||
if(EXPLODE_LIGHT)
|
||||
return
|
||||
|
||||
@@ -148,6 +147,30 @@
|
||||
else
|
||||
. += create_tube_overlay(direction ^ (EAST|WEST), WEST)
|
||||
|
||||
/obj/structure/transit_tube/wrench_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
to_chat(user, "<span class='notice'>You must uninstall [src] before disassembling it!</span>")
|
||||
|
||||
/obj/structure/transit_tube/screwdriver_act(mob/living/user, obj/item/I)
|
||||
var/obj/structure/transit_tube_construction/construction = new uninstalled_type(get_turf(src))
|
||||
if(!istype(construction))
|
||||
CRASH("expected [construction] to be a transit_tube construction")
|
||||
. = TRUE
|
||||
|
||||
var/leaf = copytext("[type]", (findlasttext("[type]", "/") + 1))
|
||||
construction.dir = dir
|
||||
if(leaf == "flipped")
|
||||
construction.flip()
|
||||
|
||||
user.visible_message("<span class='notice'>[user] uninstalls [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/transit_tube/deconstruct(disassembled = TRUE)
|
||||
if(!(flags & NODECONSTRUCT) && !disassembled)
|
||||
playsound(src, "shatter", 70, TRUE)
|
||||
new /obj/effect/decal/cleanable/glass(loc)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/structure/transit_tube/proc/create_tube_overlay(direction, shift_dir)
|
||||
// We use image() because a mutable appearance will have its dir mirror the parent which sort of fucks up what we're doing here
|
||||
@@ -176,6 +199,7 @@
|
||||
|
||||
/obj/structure/transit_tube/diagonal
|
||||
icon_state = "diagonal"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/diagonal
|
||||
|
||||
/obj/structure/transit_tube/diagonal/init_tube_dirs()
|
||||
switch(dir)
|
||||
@@ -195,6 +219,7 @@
|
||||
/obj/structure/transit_tube/diagonal/crossing
|
||||
density = FALSE
|
||||
icon_state = "diagonal_crossing"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/diagonal/crossing
|
||||
|
||||
//mostly for mapping use
|
||||
/obj/structure/transit_tube/diagonal/crossing/topleft
|
||||
@@ -203,6 +228,7 @@
|
||||
|
||||
/obj/structure/transit_tube/curved
|
||||
icon_state = "curved0"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/curved
|
||||
|
||||
/obj/structure/transit_tube/curved/init_tube_dirs()
|
||||
switch(dir)
|
||||
@@ -232,6 +258,7 @@
|
||||
|
||||
/obj/structure/transit_tube/junction
|
||||
icon_state = "junction0"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/junction
|
||||
|
||||
/obj/structure/transit_tube/junction/init_tube_dirs()
|
||||
switch(dir)
|
||||
@@ -261,6 +288,7 @@
|
||||
|
||||
/obj/structure/transit_tube/crossing
|
||||
icon_state = "crossing"
|
||||
uninstalled_type = /obj/structure/transit_tube_construction/straight/crossing
|
||||
density = FALSE
|
||||
|
||||
//mostly for mapping use
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/obj/structure/transit_tube_construction
|
||||
name = "transit tube segment"
|
||||
desc = "An uninstalled piece of a transit tube network."
|
||||
anchored = FALSE
|
||||
density = FALSE
|
||||
|
||||
icon = 'icons/obj/pipes/transit_tube_rpd.dmi'
|
||||
|
||||
var/installed_type = null
|
||||
var/installed_type_flipped = null
|
||||
var/flipped = FALSE
|
||||
|
||||
/obj/structure/transit_tube_construction/proc/rotate()
|
||||
setDir(turn(dir, -90))
|
||||
|
||||
/obj/structure/transit_tube_construction/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='info'><b>Alt-Click</b> to rotate it, <b>Alt-Shift-Click</b> to flip it.</span>"
|
||||
|
||||
/obj/structure/transit_tube_construction/AltClick(mob/user)
|
||||
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user))
|
||||
return
|
||||
|
||||
rotate()
|
||||
|
||||
/obj/structure/transit_tube_construction/AltShiftClick(mob/user)
|
||||
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user))
|
||||
return
|
||||
|
||||
flip()
|
||||
|
||||
/obj/structure/transit_tube_construction/update_icon_state()
|
||||
icon_state = "[base_icon_state][flipped ? "_flipped" : ""]"
|
||||
|
||||
/obj/structure/transit_tube_construction/proc/flip()
|
||||
if(!installed_type_flipped)
|
||||
return
|
||||
|
||||
flipped = !flipped
|
||||
update_icon_state()
|
||||
|
||||
/obj/structure/transit_tube_construction/screwdriver_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
var/turf/T = get_turf(src)
|
||||
if(!isfloorturf(T) && !isspaceturf(T))
|
||||
to_chat(user, "<span class='notice'>You cannot install [src] here.</span>")
|
||||
return
|
||||
for(var/obj/turf_contents in T)
|
||||
// It's okay for tube parts to be installed over existing pods.
|
||||
if(!istype(turf_contents, /obj/structure/transit_tube_pod) && turf_contents.density)
|
||||
to_chat(user, "<span class='notice'>There is not enough space to install [src] here.</span>")
|
||||
return
|
||||
|
||||
var/install_type = flipped ? installed_type_flipped : installed_type
|
||||
var/atom/installed = new install_type(T)
|
||||
installed.dir = dir
|
||||
user.visible_message("<span class='notice'>[user] installs [src].</span>")
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/transit_tube_construction/wrench_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(I.use_tool(src, user, 2 SECONDS, volume = I.tool_volume))
|
||||
user.visible_message("<span class='notice'>[user] disassembles [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/transit_tube_construction/pod
|
||||
name = "uninstalled transit pod"
|
||||
layer = 3.2 // Necessary to be able to install them if on the same tile as tube/construction
|
||||
installed_type = /obj/structure/transit_tube_pod
|
||||
base_icon_state = "transit_pod"
|
||||
icon_state = "transit_pod"
|
||||
|
||||
/obj/structure/transit_tube_construction/pod/screwdriver_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/obj/turf_contents in T)
|
||||
if(istype(turf_contents, /obj/structure/transit_tube))
|
||||
var/atom/installed = new installed_type(T)
|
||||
installed.dir = dir
|
||||
user.visible_message("<span class='notice'>[user] installs [src].</span>")
|
||||
|
||||
qdel(src)
|
||||
|
||||
to_chat(user, "<span class='notice'>[src] can only be installed in a transit tube!</span>")
|
||||
|
||||
/obj/structure/transit_tube_construction/straight
|
||||
installed_type = /obj/structure/transit_tube
|
||||
base_icon_state = "transit_straight"
|
||||
icon_state = "transit_straight"
|
||||
|
||||
/obj/structure/transit_tube_construction/straight/crossing
|
||||
installed_type = /obj/structure/transit_tube/crossing
|
||||
base_icon_state = "transit_straight_crossing"
|
||||
icon_state = "transit_straight_crossing"
|
||||
|
||||
/obj/structure/transit_tube_construction/diagonal
|
||||
installed_type = /obj/structure/transit_tube/diagonal
|
||||
base_icon_state = "transit_diagonal"
|
||||
icon_state = "transit_diagonal"
|
||||
|
||||
/obj/structure/transit_tube_construction/diagonal/crossing
|
||||
installed_type = /obj/structure/transit_tube/diagonal/crossing
|
||||
base_icon_state = "transit_diagonal_crossing"
|
||||
icon_state = "transit_diagonal_crossing"
|
||||
|
||||
/obj/structure/transit_tube_construction/curved
|
||||
installed_type = /obj/structure/transit_tube/curved
|
||||
installed_type_flipped = /obj/structure/transit_tube/curved/flipped
|
||||
base_icon_state = "transit_curved"
|
||||
icon_state = "transit_curved"
|
||||
|
||||
/obj/structure/transit_tube_construction/junction
|
||||
installed_type = /obj/structure/transit_tube/junction
|
||||
installed_type_flipped = /obj/structure/transit_tube/junction/flipped
|
||||
base_icon_state = "transit_junction"
|
||||
icon_state = "transit_junction"
|
||||
|
||||
/obj/structure/transit_tube_construction/terminus
|
||||
installed_type = /obj/structure/transit_tube/station/reverse
|
||||
installed_type_flipped = /obj/structure/transit_tube/station/reverse/flipped
|
||||
base_icon_state = "transit_terminus"
|
||||
icon_state = "transit_terminus"
|
||||
|
||||
/obj/structure/transit_tube_construction/station
|
||||
installed_type = /obj/structure/transit_tube/station
|
||||
base_icon_state = "transit_station"
|
||||
icon_state = "transit_station"
|
||||
|
||||
/obj/structure/transit_tube_construction/terminus/dispenser
|
||||
installed_type = /obj/structure/transit_tube/station/dispenser/reverse
|
||||
installed_type_flipped = /obj/structure/transit_tube/station/dispenser/reverse/flipped
|
||||
base_icon_state = "transit_dispenser_terminus"
|
||||
icon_state = "transit_dispenser_terminus"
|
||||
|
||||
/obj/structure/transit_tube_construction/station/dispenser
|
||||
installed_type = /obj/structure/transit_tube/station/dispenser
|
||||
base_icon_state = "transit_dispenser_station"
|
||||
icon_state = "transit_dispenser_station"
|
||||
@@ -72,6 +72,17 @@
|
||||
user.visible_message("<span class='notice'>[user] pries [src] open.</span>")
|
||||
empty_pod()
|
||||
|
||||
/obj/structure/transit_tube_pod/screwdriver_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
var/obj/structure/transit_tube_construction/pod/P = new(get_turf(src))
|
||||
P.dir = dir
|
||||
to_chat(user, "<span class='notice'>You uninstall [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/transit_tube/wrench_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
to_chat(user, "<span class='notice'>You must uninstall [src] before disassembling it!</span>")
|
||||
|
||||
/obj/structure/transit_tube_pod/process()
|
||||
..()
|
||||
|
||||
@@ -271,8 +282,8 @@
|
||||
/obj/structure/transit_tube_pod/dispensed
|
||||
name = "temporary transit tube pod"
|
||||
desc = "Gets you from here to there, and no further."
|
||||
icon_state = "temppod"
|
||||
occupied_icon_state = "temppod_occupied"
|
||||
icon_state = "pod"
|
||||
occupied_icon_state = "pod_occupied"
|
||||
|
||||
|
||||
/obj/structure/transit_tube_pod/dispensed/outside_tube()
|
||||
|
||||
Reference in New Issue
Block a user