mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
Merge pull request #7514 from VOREStation/upstream-merge-7041
[MIRROR] Slightly clean disposal pipe construction code.
This commit is contained in:
@@ -63,6 +63,28 @@
|
|||||||
#define PIPING_DEFAULT_LAYER_ONLY 4 //can only exist at PIPING_LAYER_DEFAULT
|
#define PIPING_DEFAULT_LAYER_ONLY 4 //can only exist at PIPING_LAYER_DEFAULT
|
||||||
#define PIPING_CARDINAL_AUTONORMALIZE 8 //north/south east/west doesn't matter, auto normalize on build.
|
#define PIPING_CARDINAL_AUTONORMALIZE 8 //north/south east/west doesn't matter, auto normalize on build.
|
||||||
|
|
||||||
|
// Disposals Construction
|
||||||
|
// Future: Eliminate these type codes by adding disposals equivilent of pipe_state.
|
||||||
|
#define DISPOSAL_PIPE_STRAIGHT 0
|
||||||
|
#define DISPOSAL_PIPE_CORNER 1
|
||||||
|
#define DISPOSAL_PIPE_JUNCTION 2
|
||||||
|
#define DISPOSAL_PIPE_JUNCTION_FLIPPED 3
|
||||||
|
#define DISPOSAL_PIPE_JUNCTION_Y 4
|
||||||
|
#define DISPOSAL_PIPE_TRUNK 5
|
||||||
|
#define DISPOSAL_PIPE_BIN 6
|
||||||
|
#define DISPOSAL_PIPE_OUTLET 7
|
||||||
|
#define DISPOSAL_PIPE_CHUTE 8
|
||||||
|
#define DISPOSAL_PIPE_SORTER 9
|
||||||
|
#define DISPOSAL_PIPE_SORTER_FLIPPED 10
|
||||||
|
#define DISPOSAL_PIPE_UPWARD 11
|
||||||
|
#define DISPOSAL_PIPE_DOWNWARD 12
|
||||||
|
#define DISPOSAL_PIPE_TAGGER 13
|
||||||
|
#define DISPOSAL_PIPE_TAGGER_PARTIAL 14
|
||||||
|
|
||||||
|
#define DISPOSAL_SORT_NORMAL 0
|
||||||
|
#define DISPOSAL_SORT_WILDCARD 1
|
||||||
|
#define DISPOSAL_SORT_UNTAGGED 2
|
||||||
|
|
||||||
// Macro for easy use of boilerplate code for searching for a valid node connection.
|
// Macro for easy use of boilerplate code for searching for a valid node connection.
|
||||||
#define STANDARD_ATMOS_CHOOSE_NODE(node_num, direction) \
|
#define STANDARD_ATMOS_CHOOSE_NODE(node_num, direction) \
|
||||||
for(var/obj/machinery/atmospherics/target in get_step(src, direction)) { \
|
for(var/obj/machinery/atmospherics/target in get_step(src, direction)) { \
|
||||||
|
|||||||
@@ -140,92 +140,39 @@ Nah
|
|||||||
|
|
||||||
qdel(pipe)
|
qdel(pipe)
|
||||||
|
|
||||||
/obj/machinery/pipedispenser/disposal/attack_hand(user as mob)
|
/obj/machinery/pipedispenser/disposal/interact(mob/user)
|
||||||
if(..())
|
user.set_machine(src)
|
||||||
|
|
||||||
|
var/list/lines = list()
|
||||||
|
for(var/category in disposal_pipe_recipes)
|
||||||
|
lines += "<b>[category]:</b><BR>"
|
||||||
|
for(var/datum/pipe_recipe/PI in disposal_pipe_recipes[category])
|
||||||
|
lines += PI.Render(src)
|
||||||
|
var/dat = lines.Join()
|
||||||
|
var/datum/browser/popup = new(user, "pipedispenser", name, 300, 500, src)
|
||||||
|
popup.set_content("<TT>[dat]</TT>")
|
||||||
|
popup.open()
|
||||||
return
|
return
|
||||||
|
|
||||||
///// Z-Level stuff
|
|
||||||
var/dat = {"<b>Disposal Pipes</b><br><br>
|
|
||||||
<A href='?src=\ref[src];dmake=0'>Pipe</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=1'>Bent Pipe</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=2'>Junction</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=3'>Y-Junction</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=4'>Trunk</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=5'>Bin</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=6'>Outlet</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=7'>Chute</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=21'>Upwards</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=22'>Downwards</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=8'>Sorting</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=9'>Sorting (Wildcard)</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=10'>Sorting (Untagged)</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=11'>Tagger</A><BR>
|
|
||||||
<A href='?src=\ref[src];dmake=12'>Tagger (Partial)</A><BR>
|
|
||||||
"}
|
|
||||||
///// Z-Level stuff
|
|
||||||
|
|
||||||
user << browse("<HEAD><TITLE>[src]</TITLE></HEAD><TT>[dat]</TT>", "window=pipedispenser")
|
|
||||||
return
|
|
||||||
|
|
||||||
// 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk
|
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/pipedispenser/disposal/Topic(href, href_list)
|
/obj/machinery/pipedispenser/disposal/Topic(href, href_list)
|
||||||
if(..())
|
if(href_list["makepipe"] || href_list["setlayer"] || href_list["makemeter"]) // Asking the disposal machine to do atmos stuff?
|
||||||
|
return // That's a no no.
|
||||||
|
if((. = ..()))
|
||||||
return
|
return
|
||||||
usr.set_machine(src)
|
|
||||||
src.add_fingerprint(usr)
|
|
||||||
if(href_list["dmake"])
|
if(href_list["dmake"])
|
||||||
if(unwrenched || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
if(unwrenched || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||||
usr << browse(null, "window=pipedispenser")
|
usr << browse(null, "window=pipedispenser")
|
||||||
return
|
return
|
||||||
if(!wait)
|
if(!wait)
|
||||||
var/p_type = text2num(href_list["dmake"])
|
var/ptype = text2num(href_list["dmake"])
|
||||||
var/obj/structure/disposalconstruct/C = new (src.loc)
|
var/pdir = (href_list["dir"] ? text2num(href_list["dir"]) : NORTH)
|
||||||
switch(p_type)
|
var/psub = (href_list["sort"] ? text2num(href_list["sort"]) : 0)
|
||||||
if(0)
|
var/obj/structure/disposalconstruct/C = new (src.loc, ptype, pdir, 0, psub)
|
||||||
C.ptype = 0
|
|
||||||
if(1)
|
|
||||||
C.ptype = 1
|
|
||||||
if(2)
|
|
||||||
C.ptype = 2
|
|
||||||
if(3)
|
|
||||||
C.ptype = 4
|
|
||||||
if(4)
|
|
||||||
C.ptype = 5
|
|
||||||
if(5)
|
|
||||||
C.ptype = 6
|
|
||||||
C.density = 1
|
|
||||||
if(6)
|
|
||||||
C.ptype = 7
|
|
||||||
C.density = 1
|
|
||||||
if(7)
|
|
||||||
C.ptype = 8
|
|
||||||
C.density = 1
|
|
||||||
if(8)
|
|
||||||
C.ptype = 9
|
|
||||||
C.subtype = 0
|
|
||||||
if(9)
|
|
||||||
C.ptype = 9
|
|
||||||
C.subtype = 1
|
|
||||||
if(10)
|
|
||||||
C.ptype = 9
|
|
||||||
C.subtype = 2
|
|
||||||
if(11)
|
|
||||||
C.ptype = 13
|
|
||||||
if(12)
|
|
||||||
C.ptype = 14
|
|
||||||
///// Z-Level stuff
|
|
||||||
if(21)
|
|
||||||
C.ptype = 11
|
|
||||||
if(22)
|
|
||||||
C.ptype = 12
|
|
||||||
///// Z-Level stuff
|
|
||||||
C.add_fingerprint(usr)
|
C.add_fingerprint(usr)
|
||||||
C.update()
|
C.update()
|
||||||
wait = 1
|
wait = 1
|
||||||
spawn(15)
|
VARSET_IN(src, wait, FALSE, 15)
|
||||||
wait = 0
|
|
||||||
return
|
return
|
||||||
|
|
||||||
// adding a pipe dispensers that spawn unhooked from the ground
|
// adding a pipe dispensers that spawn unhooked from the ground
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
var/global/list/atmos_pipe_recipes = null
|
var/global/list/atmos_pipe_recipes = null
|
||||||
|
var/global/list/disposal_pipe_recipes = null
|
||||||
|
|
||||||
/hook/startup/proc/init_pipe_recipes()
|
/hook/startup/proc/init_pipe_recipes()
|
||||||
global.atmos_pipe_recipes = list(
|
global.atmos_pipe_recipes = list(
|
||||||
@@ -48,15 +49,37 @@ var/global/list/atmos_pipe_recipes = null
|
|||||||
new /datum/pipe_recipe/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple/insulated),
|
new /datum/pipe_recipe/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple/insulated),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
global.disposal_pipe_recipes = list(
|
||||||
|
"Disposal Pipes" = list(
|
||||||
|
new /datum/pipe_recipe/disposal("Pipe", DISPOSAL_PIPE_STRAIGHT, "conpipe-s", PIPE_STRAIGHT),
|
||||||
|
new /datum/pipe_recipe/disposal("Bent Pipe", DISPOSAL_PIPE_CORNER, "conpipe-c"),
|
||||||
|
new /datum/pipe_recipe/disposal("Junction", DISPOSAL_PIPE_JUNCTION, "conpipe-j1", PIPE_TRIN_M),
|
||||||
|
new /datum/pipe_recipe/disposal("Y-Junction", DISPOSAL_PIPE_JUNCTION_Y, "conpipe-y"),
|
||||||
|
new /datum/pipe_recipe/disposal("Sort Junction", DISPOSAL_PIPE_SORTER, "conpipe-j1s", PIPE_TRIN_M, DISPOSAL_SORT_NORMAL),
|
||||||
|
new /datum/pipe_recipe/disposal("Sort Junction (Wildcard)", DISPOSAL_PIPE_SORTER, "conpipe-j1s", PIPE_TRIN_M, DISPOSAL_SORT_WILDCARD),
|
||||||
|
new /datum/pipe_recipe/disposal("Sort Junction (Untagged)", DISPOSAL_PIPE_SORTER, "conpipe-j1s", PIPE_TRIN_M, DISPOSAL_SORT_UNTAGGED),
|
||||||
|
new /datum/pipe_recipe/disposal("Tagger", DISPOSAL_PIPE_TAGGER, "pipe-tagger", PIPE_STRAIGHT),
|
||||||
|
new /datum/pipe_recipe/disposal("Tagger (Partial)", DISPOSAL_PIPE_TAGGER_PARTIAL, "pipe-tagger-partial", PIPE_STRAIGHT),
|
||||||
|
new /datum/pipe_recipe/disposal("Trunk", DISPOSAL_PIPE_TRUNK, "conpipe-t"),
|
||||||
|
new /datum/pipe_recipe/disposal("Upwards", DISPOSAL_PIPE_UPWARD, "pipe-u"),
|
||||||
|
new /datum/pipe_recipe/disposal("Downwards", DISPOSAL_PIPE_DOWNWARD, "pipe-d"),
|
||||||
|
new /datum/pipe_recipe/disposal("Bin", DISPOSAL_PIPE_BIN, "disposal", PIPE_ONEDIR),
|
||||||
|
new /datum/pipe_recipe/disposal("Outlet", DISPOSAL_PIPE_OUTLET, "outlet"),
|
||||||
|
new /datum/pipe_recipe/disposal("Chute", DISPOSAL_PIPE_CHUTE, "intake"),
|
||||||
|
)
|
||||||
|
)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
//
|
//
|
||||||
// New method of handling pipe construction. Instead of numeric constants and a giant switch statement of doom
|
// New method of handling pipe construction. Instead of numeric constants and a giant switch statement of doom
|
||||||
// every pipe type has a datum instance which describes its name, placement rules and construction method, dispensing etc.
|
// every pipe type has a datum instance which describes its name, placement rules and construction method, dispensing etc.
|
||||||
// The advantages are obvious, mostly in simplifying the code of the dispenser, and the ability to add new pipes without hassle.
|
// The advantages are obvious, mostly in simplifying the code of the dispenser, and the ability to add new pipes without hassle.
|
||||||
|
// icon_state and icon_state_m must be from among those available from the dmi files included in /datum/asset/iconsheet/pipes
|
||||||
//
|
//
|
||||||
/datum/pipe_recipe
|
/datum/pipe_recipe
|
||||||
var/name = "Abstract Pipe (fixme)" // Recipe name
|
var/name = "Abstract Pipe (fixme)" // Recipe name
|
||||||
|
var/icon_state = null // This tells the RPD what kind of pipe icon to render for the preview.
|
||||||
|
var/icon_state_m = null // This stores the mirrored version of the regular state (if available).
|
||||||
var/dirtype // If using an RPD, this tells more about what previews to show.
|
var/dirtype // If using an RPD, this tells more about what previews to show.
|
||||||
|
|
||||||
// Render an HTML link to select this pipe type. Returns text.
|
// Render an HTML link to select this pipe type. Returns text.
|
||||||
@@ -78,7 +101,10 @@ var/global/list/atmos_pipe_recipes = null
|
|||||||
name = label
|
name = label
|
||||||
pipe_type = path
|
pipe_type = path
|
||||||
construction_type = initial(path.construction_type)
|
construction_type = initial(path.construction_type)
|
||||||
|
icon_state = initial(path.pipe_state)
|
||||||
dirtype = initial(construction_type.dispenser_class)
|
dirtype = initial(construction_type.dispenser_class)
|
||||||
|
if (dirtype == PIPE_TRIN_M)
|
||||||
|
icon_state_m = "[icon_state]m"
|
||||||
|
|
||||||
// Render an HTML link to select this pipe type
|
// Render an HTML link to select this pipe type
|
||||||
/datum/pipe_recipe/pipe/Render(dispenser)
|
/datum/pipe_recipe/pipe/Render(dispenser)
|
||||||
@@ -98,9 +124,32 @@ var/global/list/atmos_pipe_recipes = null
|
|||||||
//
|
//
|
||||||
/datum/pipe_recipe/meter
|
/datum/pipe_recipe/meter
|
||||||
dirtype = PIPE_ONEDIR
|
dirtype = PIPE_ONEDIR
|
||||||
|
icon_state = "meter"
|
||||||
|
|
||||||
/datum/pipe_recipe/meter/New(label)
|
/datum/pipe_recipe/meter/New(label)
|
||||||
name = label
|
name = label
|
||||||
|
|
||||||
/datum/pipe_recipe/meter/Params()
|
/datum/pipe_recipe/meter/Params()
|
||||||
return "makemeter=1"
|
return "makemeter=1"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Subtype for disposal pipes
|
||||||
|
//
|
||||||
|
/datum/pipe_recipe/disposal
|
||||||
|
var/pipe_type // pipe_type is one of the DISPOSAL_PIPE_ ptype constants.
|
||||||
|
var/subtype // subtype is one of the DISPOSAL_SORT_ constants.
|
||||||
|
|
||||||
|
/datum/pipe_recipe/disposal/New(var/label, var/ptype, var/state, dt=PIPE_DIRECTIONAL, var/sort=0)
|
||||||
|
name = label
|
||||||
|
icon_state = state
|
||||||
|
pipe_type = ptype
|
||||||
|
dirtype = dt
|
||||||
|
subtype = sort
|
||||||
|
if (dirtype == PIPE_TRIN_M)
|
||||||
|
icon_state_m = replacetext(state, "j1", "j2")
|
||||||
|
|
||||||
|
/datum/pipe_recipe/disposal/Params()
|
||||||
|
var/param = "dmake=[pipe_type]"
|
||||||
|
if (subtype)
|
||||||
|
param += "&sort=[subtype]"
|
||||||
|
return param
|
||||||
|
|||||||
@@ -14,11 +14,38 @@
|
|||||||
level = 2
|
level = 2
|
||||||
var/sortType = ""
|
var/sortType = ""
|
||||||
var/ptype = 0
|
var/ptype = 0
|
||||||
// 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk, 6=disposal bin, 7=outlet, 8=inlet 9=pipe-j1s 10=pipe-j2s
|
|
||||||
var/subtype = 0
|
var/subtype = 0
|
||||||
var/dpdir = 0 // directions as disposalpipe
|
var/dpdir = 0 // directions as disposalpipe
|
||||||
var/base_state = "pipe-s"
|
var/base_state = "pipe-s"
|
||||||
|
|
||||||
|
/obj/structure/disposalconstruct/New(var/newturf, var/newtype, var/newdir, var/flipped, var/newsubtype)
|
||||||
|
..(newturf)
|
||||||
|
ptype = newtype
|
||||||
|
dir = newdir
|
||||||
|
// Disposals handle "bent"/"corner" strangely, handle this specially.
|
||||||
|
if(ptype == DISPOSAL_PIPE_STRAIGHT && dir in cornerdirs)
|
||||||
|
ptype = DISPOSAL_PIPE_CORNER
|
||||||
|
switch(dir)
|
||||||
|
if(NORTHWEST)
|
||||||
|
dir = WEST
|
||||||
|
if(NORTHEAST)
|
||||||
|
dir = NORTH
|
||||||
|
if(SOUTHWEST)
|
||||||
|
dir = SOUTH
|
||||||
|
if(SOUTHEAST)
|
||||||
|
dir = EAST
|
||||||
|
|
||||||
|
switch(ptype)
|
||||||
|
if(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE)
|
||||||
|
density = 1
|
||||||
|
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
|
subtype = newsubtype
|
||||||
|
|
||||||
|
if(flipped)
|
||||||
|
do_a_flip()
|
||||||
|
else
|
||||||
|
update() // do_a_flip() calls update anyway, so, lazy way of catching unupdated pipe!
|
||||||
|
|
||||||
// update iconstate and dpdir due to dir and type
|
// update iconstate and dpdir due to dir and type
|
||||||
/obj/structure/disposalconstruct/proc/update()
|
/obj/structure/disposalconstruct/proc/update()
|
||||||
var/flip = turn(dir, 180)
|
var/flip = turn(dir, 180)
|
||||||
@@ -26,59 +53,56 @@
|
|||||||
var/right = turn(dir, -90)
|
var/right = turn(dir, -90)
|
||||||
|
|
||||||
switch(ptype)
|
switch(ptype)
|
||||||
if(0)
|
if(DISPOSAL_PIPE_STRAIGHT)
|
||||||
base_state = "pipe-s"
|
base_state = "pipe-s"
|
||||||
dpdir = dir | flip
|
dpdir = dir | flip
|
||||||
if(1)
|
if(DISPOSAL_PIPE_CORNER)
|
||||||
base_state = "pipe-c"
|
base_state = "pipe-c"
|
||||||
dpdir = dir | right
|
dpdir = dir | right
|
||||||
if(2)
|
if(DISPOSAL_PIPE_JUNCTION)
|
||||||
base_state = "pipe-j1"
|
base_state = "pipe-j1"
|
||||||
dpdir = dir | right | flip
|
dpdir = dir | right | flip
|
||||||
if(3)
|
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||||
base_state = "pipe-j2"
|
base_state = "pipe-j2"
|
||||||
dpdir = dir | left | flip
|
dpdir = dir | left | flip
|
||||||
if(4)
|
if(DISPOSAL_PIPE_JUNCTION_Y)
|
||||||
base_state = "pipe-y"
|
base_state = "pipe-y"
|
||||||
dpdir = dir | left | right
|
dpdir = dir | left | right
|
||||||
if(5)
|
if(DISPOSAL_PIPE_TRUNK)
|
||||||
base_state = "pipe-t"
|
base_state = "pipe-t"
|
||||||
dpdir = dir
|
dpdir = dir
|
||||||
// disposal bin has only one dir, thus we don't need to care about setting it
|
// disposal bin has only one dir, thus we don't need to care about setting it
|
||||||
if(6)
|
if(DISPOSAL_PIPE_BIN)
|
||||||
if(anchored)
|
if(anchored)
|
||||||
base_state = "disposal"
|
base_state = "disposal"
|
||||||
else
|
else
|
||||||
base_state = "condisposal"
|
base_state = "condisposal"
|
||||||
if(7)
|
if(DISPOSAL_PIPE_OUTLET)
|
||||||
base_state = "outlet"
|
base_state = "outlet"
|
||||||
dpdir = dir
|
dpdir = dir
|
||||||
if(8)
|
if(DISPOSAL_PIPE_CHUTE)
|
||||||
base_state = "intake"
|
base_state = "intake"
|
||||||
dpdir = dir
|
dpdir = dir
|
||||||
if(9)
|
if(DISPOSAL_PIPE_SORTER)
|
||||||
base_state = "pipe-j1s"
|
base_state = "pipe-j1s"
|
||||||
dpdir = dir | right | flip
|
dpdir = dir | right | flip
|
||||||
if(10)
|
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
base_state = "pipe-j2s"
|
base_state = "pipe-j2s"
|
||||||
dpdir = dir | left | flip
|
dpdir = dir | left | flip
|
||||||
///// Z-Level stuff
|
if(DISPOSAL_PIPE_UPWARD)
|
||||||
if(11)
|
|
||||||
base_state = "pipe-u"
|
base_state = "pipe-u"
|
||||||
dpdir = dir
|
dpdir = dir
|
||||||
if(12)
|
if(DISPOSAL_PIPE_DOWNWARD)
|
||||||
base_state = "pipe-d"
|
base_state = "pipe-d"
|
||||||
dpdir = dir
|
dpdir = dir
|
||||||
if(13)
|
if(DISPOSAL_PIPE_TAGGER)
|
||||||
base_state = "pipe-tagger"
|
base_state = "pipe-tagger"
|
||||||
dpdir = dir | flip
|
dpdir = dir | flip
|
||||||
if(14)
|
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||||
base_state = "pipe-tagger-partial"
|
base_state = "pipe-tagger-partial"
|
||||||
dpdir = dir | flip
|
dpdir = dir | flip
|
||||||
|
|
||||||
|
if(!(ptype in list(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE, DISPOSAL_PIPE_UPWARD, DISPOSAL_PIPE_DOWNWARD, DISPOSAL_PIPE_TAGGER, DISPOSAL_PIPE_TAGGER_PARTIAL)))
|
||||||
///// Z-Level stuff
|
|
||||||
if(!(ptype in list(6, 7, 8, 11, 12, 13, 14)))
|
|
||||||
icon_state = "con[base_state]"
|
icon_state = "con[base_state]"
|
||||||
else
|
else
|
||||||
icon_state = base_state
|
icon_state = base_state
|
||||||
@@ -123,58 +147,59 @@
|
|||||||
to_chat(usr, "You must unfasten the pipe before flipping it.")
|
to_chat(usr, "You must unfasten the pipe before flipping it.")
|
||||||
return
|
return
|
||||||
|
|
||||||
set_dir(turn(dir, 180))
|
do_a_flip()
|
||||||
|
|
||||||
|
/obj/structure/disposalconstruct/proc/do_a_flip()
|
||||||
switch(ptype)
|
switch(ptype)
|
||||||
if(2)
|
if(DISPOSAL_PIPE_JUNCTION)
|
||||||
ptype = 3
|
ptype = DISPOSAL_PIPE_JUNCTION_FLIPPED
|
||||||
if(3)
|
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||||
ptype = 2
|
ptype = DISPOSAL_PIPE_JUNCTION
|
||||||
if(9)
|
if(DISPOSAL_PIPE_SORTER)
|
||||||
ptype = 10
|
ptype = DISPOSAL_PIPE_SORTER_FLIPPED
|
||||||
if(10)
|
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
ptype = 9
|
ptype = DISPOSAL_PIPE_SORTER
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|
||||||
// returns the type path of disposalpipe corresponding to this item dtype
|
// returns the type path of disposalpipe corresponding to this item dtype
|
||||||
/obj/structure/disposalconstruct/proc/dpipetype()
|
/obj/structure/disposalconstruct/proc/dpipetype()
|
||||||
switch(ptype)
|
switch(ptype)
|
||||||
if(0,1)
|
if(DISPOSAL_PIPE_STRAIGHT,DISPOSAL_PIPE_CORNER)
|
||||||
return /obj/structure/disposalpipe/segment
|
return /obj/structure/disposalpipe/segment
|
||||||
if(2,3,4)
|
if(DISPOSAL_PIPE_JUNCTION,DISPOSAL_PIPE_JUNCTION_FLIPPED,DISPOSAL_PIPE_JUNCTION_Y)
|
||||||
return /obj/structure/disposalpipe/junction
|
return /obj/structure/disposalpipe/junction
|
||||||
if(5)
|
if(DISPOSAL_PIPE_TRUNK)
|
||||||
return /obj/structure/disposalpipe/trunk
|
return /obj/structure/disposalpipe/trunk
|
||||||
if(6)
|
if(DISPOSAL_PIPE_BIN)
|
||||||
return /obj/machinery/disposal
|
return /obj/machinery/disposal
|
||||||
if(7)
|
if(DISPOSAL_PIPE_OUTLET)
|
||||||
return /obj/structure/disposaloutlet
|
return /obj/structure/disposaloutlet
|
||||||
if(8)
|
if(DISPOSAL_PIPE_CHUTE)
|
||||||
return /obj/machinery/disposal/deliveryChute
|
return /obj/machinery/disposal/deliveryChute
|
||||||
if(9)
|
if(DISPOSAL_PIPE_SORTER)
|
||||||
switch(subtype)
|
switch(subtype)
|
||||||
if(0)
|
if(DISPOSAL_SORT_NORMAL)
|
||||||
return /obj/structure/disposalpipe/sortjunction
|
return /obj/structure/disposalpipe/sortjunction
|
||||||
if(1)
|
if(DISPOSAL_SORT_WILDCARD)
|
||||||
return /obj/structure/disposalpipe/sortjunction/wildcard
|
return /obj/structure/disposalpipe/sortjunction/wildcard
|
||||||
if(2)
|
if(DISPOSAL_SORT_UNTAGGED)
|
||||||
return /obj/structure/disposalpipe/sortjunction/untagged
|
return /obj/structure/disposalpipe/sortjunction/untagged
|
||||||
if(10)
|
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
switch(subtype)
|
switch(subtype)
|
||||||
if(0)
|
if(DISPOSAL_SORT_NORMAL)
|
||||||
return /obj/structure/disposalpipe/sortjunction/flipped
|
return /obj/structure/disposalpipe/sortjunction/flipped
|
||||||
if(1)
|
if(DISPOSAL_SORT_WILDCARD)
|
||||||
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
|
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
|
||||||
if(2)
|
if(DISPOSAL_SORT_UNTAGGED)
|
||||||
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
|
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
|
||||||
///// Z-Level stuff
|
if(DISPOSAL_PIPE_UPWARD)
|
||||||
if(11)
|
|
||||||
return /obj/structure/disposalpipe/up
|
return /obj/structure/disposalpipe/up
|
||||||
if(12)
|
if(DISPOSAL_PIPE_DOWNWARD)
|
||||||
return /obj/structure/disposalpipe/down
|
return /obj/structure/disposalpipe/down
|
||||||
if(13)
|
if(DISPOSAL_PIPE_TAGGER)
|
||||||
return /obj/structure/disposalpipe/tagger
|
return /obj/structure/disposalpipe/tagger
|
||||||
if(14)
|
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||||
return /obj/structure/disposalpipe/tagger/partial
|
return /obj/structure/disposalpipe/tagger/partial
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -188,25 +213,25 @@
|
|||||||
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
||||||
src.add_fingerprint(user)
|
src.add_fingerprint(user)
|
||||||
switch(ptype)
|
switch(ptype)
|
||||||
if(6)
|
if(DISPOSAL_PIPE_BIN)
|
||||||
nicetype = "disposal bin"
|
nicetype = "disposal bin"
|
||||||
if(7)
|
if(DISPOSAL_PIPE_OUTLET)
|
||||||
nicetype = "disposal outlet"
|
nicetype = "disposal outlet"
|
||||||
if(8)
|
if(DISPOSAL_PIPE_CHUTE)
|
||||||
nicetype = "delivery chute"
|
nicetype = "delivery chute"
|
||||||
if(9, 10)
|
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
switch(subtype)
|
switch(subtype)
|
||||||
if(0)
|
if(DISPOSAL_SORT_NORMAL)
|
||||||
nicetype = "sorting pipe"
|
nicetype = "sorting pipe"
|
||||||
if(1)
|
if(DISPOSAL_SORT_WILDCARD)
|
||||||
nicetype = "wildcard sorting pipe"
|
nicetype = "wildcard sorting pipe"
|
||||||
if(2)
|
if(DISPOSAL_SORT_UNTAGGED)
|
||||||
nicetype = "untagged sorting pipe"
|
nicetype = "untagged sorting pipe"
|
||||||
ispipe = 1
|
ispipe = 1
|
||||||
if(13)
|
if(DISPOSAL_PIPE_TAGGER)
|
||||||
nicetype = "tagging pipe"
|
nicetype = "tagging pipe"
|
||||||
ispipe = 1
|
ispipe = 1
|
||||||
if(14)
|
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||||
nicetype = "partial tagging pipe"
|
nicetype = "partial tagging pipe"
|
||||||
ispipe = 1
|
ispipe = 1
|
||||||
else
|
else
|
||||||
@@ -231,7 +256,7 @@
|
|||||||
density = 1
|
density = 1
|
||||||
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
||||||
else
|
else
|
||||||
if(ptype>=6 && ptype <= 8) // Disposal or outlet
|
if(ptype == DISPOSAL_PIPE_BIN || ptype == DISPOSAL_PIPE_OUTLET || ptype == DISPOSAL_PIPE_CHUTE) // Disposal or outlet
|
||||||
if(CP) // There's something there
|
if(CP) // There's something there
|
||||||
if(!istype(CP,/obj/structure/disposalpipe/trunk))
|
if(!istype(CP,/obj/structure/disposalpipe/trunk))
|
||||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||||
@@ -281,26 +306,26 @@
|
|||||||
P.updateicon()
|
P.updateicon()
|
||||||
|
|
||||||
//Needs some special treatment ;)
|
//Needs some special treatment ;)
|
||||||
if(ptype==9 || ptype==10)
|
if(ptype==DISPOSAL_PIPE_SORTER || ptype==DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||||
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
||||||
SortP.sortType = sortType
|
SortP.sortType = sortType
|
||||||
SortP.updatedir()
|
SortP.updatedir()
|
||||||
SortP.updatedesc()
|
SortP.updatedesc()
|
||||||
SortP.updatename()
|
SortP.updatename()
|
||||||
|
|
||||||
else if(ptype==6) // Disposal bin
|
else if(ptype==DISPOSAL_PIPE_BIN)
|
||||||
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
|
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
|
||||||
src.transfer_fingerprints_to(P)
|
src.transfer_fingerprints_to(P)
|
||||||
P.mode = 0 // start with pump off
|
P.mode = 0 // start with pump off
|
||||||
|
|
||||||
else if(ptype==7) // Disposal outlet
|
else if(ptype==DISPOSAL_PIPE_OUTLET)
|
||||||
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
||||||
src.transfer_fingerprints_to(P)
|
src.transfer_fingerprints_to(P)
|
||||||
P.set_dir(dir)
|
P.set_dir(dir)
|
||||||
var/obj/structure/disposalpipe/trunk/Trunk = CP
|
var/obj/structure/disposalpipe/trunk/Trunk = CP
|
||||||
Trunk.linked = P
|
Trunk.linked = P
|
||||||
|
|
||||||
else if(ptype==8) // Disposal outlet
|
else if(ptype==DISPOSAL_PIPE_CHUTE)
|
||||||
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
||||||
src.transfer_fingerprints_to(P)
|
src.transfer_fingerprints_to(P)
|
||||||
P.set_dir(dir)
|
P.set_dir(dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user