From 29c6e6d69bb46e73d8f29693749fe8971cfdc8a1 Mon Sep 17 00:00:00 2001 From: Citinited Date: Mon, 16 Jul 2018 00:23:03 +0100 Subject: [PATCH] A bunch of refactoring; RPD runtimes if a forbidden pipe is attempted to be dispensed; names loose disposals pipes --- code/__DEFINES/pipes.dm | 23 +- code/__HELPERS/global_lists.dm | 13 +- code/datums/pipe_datums.dm | 216 ++++++++++++------ code/game/machinery/pipe/construction.dm | 88 +------ code/game/machinery/pipe/pipe_dispenser.dm | 29 +-- code/game/objects/items/weapons/rpd.dm | 12 +- code/modules/client/asset_cache.dm | 2 +- .../recycling/disposal-construction.dm | 117 ++++------ code/modules/recycling/disposal.dm | 20 +- code/modules/recycling/sortingmachinery.dm | 2 +- icons/obj/pipes/disposal.dmi | Bin 97824 -> 97836 bytes 11 files changed, 252 insertions(+), 270 deletions(-) diff --git a/code/__DEFINES/pipes.dm b/code/__DEFINES/pipes.dm index cd67811ecdf..c855a5e4260 100644 --- a/code/__DEFINES/pipes.dm +++ b/code/__DEFINES/pipes.dm @@ -45,14 +45,18 @@ //Disposals pipes -#define PIPE_DISPOSALS_STRAIGHT 0 -#define PIPE_DISPOSALS_BENT 1 -#define PIPE_DISPOSALS_JUNCTION 2 -#define PIPE_DISPOSALS_Y_JUNCTION 4 -#define PIPE_DISPOSALS_TRUNK 5 -#define PIPE_DISPOSALS_BIN 6 -#define PIPE_DISPOSALS_OUTLET 7 -#define PIPE_DISPOSALS_CHUTE 8 +#define PIPE_DISPOSALS_STRAIGHT 100 +#define PIPE_DISPOSALS_BENT 101 +#define PIPE_DISPOSALS_JUNCTION_RIGHT 102 +#define PIPE_DISPOSALS_JUNCTION_LEFT 103 +#define PIPE_DISPOSALS_Y_JUNCTION 104 +#define PIPE_DISPOSALS_TRUNK 105 +#define PIPE_DISPOSALS_BIN 106 +#define PIPE_DISPOSALS_OUTLET 107 +#define PIPE_DISPOSALS_CHUTE 108 +#define PIPE_DISPOSALS_SORT_RIGHT 109 +#define PIPE_DISPOSALS_SORT_LEFT 110 + //RPD stuff @@ -67,3 +71,6 @@ #define RPD_SCRUBBERS_PIPING 3 #define RPD_DEVICES 4 #define RPD_HEAT_PIPING 5 + +#define PIPETYPE_ATMOS 1 +#define PIPETYPE_DISPOSAL 2 diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 2c36a04eab9..edec5d7c952 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -51,12 +51,17 @@ init_subtypes(/datum/crafting_recipe, crafting_recipes) //RPD pipe list building - var/list/temp_pipe_list = list() - init_subtypes(/datum/pipes/atmospheric, temp_pipe_list) - init_subtypes(/datum/pipes/disposal, temp_pipe_list) +/* var/list/temp_pipe_list = list() + init_subtypes(/datum/pipes/atmospheric/dispensable, temp_pipe_list) + init_subtypes(/datum/pipes/disposal/dispensable, temp_pipe_list) for(var/datum/pipes/P in temp_pipe_list) //Yes I know the list(list(...)) thing looks weird, but it allows us to group pipe metadata into ordered lists instead of being one big list GLOB.construction_pipe_list += list(list("pipe_name" = P.pipe_name, "pipe_id" = P.pipe_id, "pipe_type" = P.pipe_type, "pipe_category" = P.pipe_category, "orientations" = P.orientations, "pipe_icon" = P.pipe_icon, "bendy" = P.bendy)) - +*/ + init_subtypes(/datum/pipes, GLOB.construction_pipe_list) + for(var/D in GLOB.construction_pipe_list) + var/datum/pipes/P = D + if(P.rpd_dispensable) + GLOB.rpd_pipe_list += list(list("pipe_name" = P.pipe_name, "pipe_id" = P.pipe_id, "pipe_type" = P.pipe_type, "pipe_category" = P.pipe_category, "orientations" = P.orientations, "pipe_icon" = P.pipe_icon, "bendy" = P.bendy)) return 1 /* // Uncomment to debug chemical reaction list. diff --git a/code/datums/pipe_datums.dm b/code/datums/pipe_datums.dm index ea6d2f016f8..007f08c6673 100644 --- a/code/datums/pipe_datums.dm +++ b/code/datums/pipe_datums.dm @@ -1,95 +1,99 @@ -//For use with the RPD (for now). All pipes here are ones that can be dispensed with the RPD - -#define RPD_ATMOS 1 -#define RPD_DISPOSAL 2 - GLOBAL_LIST_EMPTY(construction_pipe_list) //List of all pipe datums +GLOBAL_LIST_EMPTY(rpd_pipe_list) //Some pipes we don't want to be dispensable by the RPD, so we have a separate thing /datum/pipes - var/pipe_name //What the pipe is called in the interface - var/pipe_id //Use the pipe define for this - var/pipe_type //Atmos, disposals etc. - var/pipe_category //What category of pipe - var/bendy = FALSE//Is this pipe bendy? - var/orientations //Number of orientations (for interface purposes) - var/pipe_icon //icon_state of the dispensed pipe (for interface purposes) + var/pipe_name //What the pipe is called in the interface + var/pipe_id //Use the pipe define for this + var/pipe_type //Atmos, disposals etc. + var/pipe_category //What category of pipe + var/bendy = FALSE //Is this pipe bendy? + var/orientations //Number of orientations (for interface purposes) + var/pipe_icon //icon_state of the dispensed pipe (for interface purposes) + var/rpd_dispensable = FALSE /datum/pipes/atmospheric - pipe_type = RPD_ATMOS - pipe_category = RPD_ATMOS_PIPING + pipe_type = PIPETYPE_ATMOS + pipe_category = PIPETYPE_ATMOS /datum/pipes/disposal - pipe_type = RPD_DISPOSAL + pipe_type = PIPETYPE_DISPOSAL //Normal pipes /datum/pipes/atmospheric/simple - pipe_name = "Straight pipe" + pipe_name = "straight pipe" pipe_id = PIPE_SIMPLE_STRAIGHT orientations = 2 pipe_icon = "simple" + rpd_dispensable = TRUE /datum/pipes/atmospheric/bent //Why is this not atmospheric/simple/bent you ask? Because otherwise the ordering of the pipes in the UI menu gets weird - pipe_name = "Bent pipe" + pipe_name = "bent pipe" pipe_id = PIPE_SIMPLE_BENT orientations = 4 bendy = TRUE pipe_icon = "simple" + rpd_dispensable = TRUE /datum/pipes/atmospheric/manifold - pipe_name = "T-manifold" + pipe_name = "t-manifold" pipe_id = PIPE_MANIFOLD orientations = 4 pipe_icon = "manifold" + rpd_dispensable = TRUE /datum/pipes/atmospheric/manifold4w pipe_name = "4-way manifold" pipe_id = PIPE_MANIFOLD4W orientations = 1 pipe_icon = "manifold4w" + rpd_dispensable = TRUE /datum/pipes/atmospheric/cap - pipe_name = "Pipe cap" + pipe_name = "pipe cap" pipe_id = PIPE_CAP orientations = 4 pipe_icon = "cap" + rpd_dispensable = TRUE /datum/pipes/atmospheric/valve - pipe_name = "Manual valve" + pipe_name = "manual valve" pipe_id = PIPE_MVALVE orientations = 2 pipe_icon = "mvalve" + rpd_dispensable = TRUE /datum/pipes/atmospheric/valve/digital - pipe_name = "Digital valve" + pipe_name = "digital valve" pipe_id = PIPE_DVALVE pipe_icon = "dvalve" /datum/pipes/atmospheric/tvalve - pipe_name = "Manual T-valve" + pipe_name = "manual t-valve" pipe_id = PIPE_TVALVE orientations = 4 pipe_icon = "tvalve" + rpd_dispensable = TRUE /datum/pipes/atmospheric/tvalve/digital - pipe_name = "Digital T-valve" + pipe_name = "digital t-valve" pipe_id = PIPE_DTVALVE pipe_icon = "dtvalve" //Supply pipes /datum/pipes/atmospheric/simple/supply - pipe_name = "Straight supply pipe" + pipe_name = "straight supply pipe" pipe_id = PIPE_SUPPLY_STRAIGHT pipe_category = RPD_SUPPLY_PIPING /datum/pipes/atmospheric/bent/supply - pipe_name = "Bent supply pipe" + pipe_name = "bent supply pipe" pipe_id = PIPE_SUPPLY_BENT pipe_category = RPD_SUPPLY_PIPING /datum/pipes/atmospheric/manifold/supply - pipe_name = "Supply T-manifold" + pipe_name = "supply T-manifold" pipe_id = PIPE_SUPPLY_MANIFOLD pipe_category = RPD_SUPPLY_PIPING @@ -99,24 +103,24 @@ GLOBAL_LIST_EMPTY(construction_pipe_list) //List of all pipe datums pipe_category = RPD_SUPPLY_PIPING /datum/pipes/atmospheric/cap/supply - pipe_name = "Supply pipe cap" + pipe_name = "supply pipe cap" pipe_id = PIPE_SUPPLY_CAP pipe_category = RPD_SUPPLY_PIPING //Scrubbers pipes /datum/pipes/atmospheric/simple/scrubbers - pipe_name = "Straight scrubbers pipe" + pipe_name = "straight scrubbers pipe" pipe_id = PIPE_SCRUBBERS_STRAIGHT pipe_category = RPD_SCRUBBERS_PIPING /datum/pipes/atmospheric/bent/scrubbers - pipe_name = "Bent scrubbers pipe" + pipe_name = "bent scrubbers pipe" pipe_id = PIPE_SCRUBBERS_BENT pipe_category = RPD_SCRUBBERS_PIPING /datum/pipes/atmospheric/manifold/scrubbers - pipe_name = "Scrubbers T-manifold" + pipe_name = "scrubbers t-manifold" pipe_id = PIPE_SCRUBBERS_MANIFOLD pipe_category = RPD_SCRUBBERS_PIPING @@ -126,188 +130,260 @@ GLOBAL_LIST_EMPTY(construction_pipe_list) //List of all pipe datums pipe_category = RPD_SCRUBBERS_PIPING /datum/pipes/atmospheric/cap/scrubbers - pipe_name = "Scrubbers pipe cap" + pipe_name = "scrubbers pipe cap" pipe_id = PIPE_SCRUBBERS_CAP pipe_category = RPD_SCRUBBERS_PIPING //Devices /datum/pipes/atmospheric/upa - pipe_name = "Universal pipe adapter" + pipe_name = "universal pipe adapter" pipe_id = PIPE_UNIVERSAL orientations = 2 pipe_icon = "universal" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/connector - pipe_name = "Connector" + pipe_name = "connector" pipe_id = PIPE_CONNECTOR orientations = 4 pipe_icon = "connector" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/unaryvent - pipe_name = "Unary vent" + pipe_name = "unary vent" pipe_id = PIPE_UVENT orientations = 4 pipe_icon = "uvent" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/scrubber - pipe_name = "Scrubber" + pipe_name = "scrubber" pipe_id = PIPE_SCRUBBER orientations = 4 pipe_icon = "scrubber" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/pump - pipe_name = "Gas pump" + pipe_name = "pump" pipe_id = PIPE_PUMP orientations = 4 pipe_icon = "pump" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/volume_pump - pipe_name = "Volume pump" + pipe_name = "volume pump" pipe_id = PIPE_VOLUME_PUMP orientations = 4 pipe_icon = "volumepump" pipe_category = RPD_DEVICES /datum/pipes/atmospheric/gate - pipe_name = "Passive gate" + pipe_name = "passive gate" pipe_id = PIPE_PASSIVE_GATE orientations = 4 pipe_icon = "passivegate" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/filter - pipe_name = "Gas filter" + pipe_name = "gas filter" pipe_id = PIPE_GAS_FILTER orientations = 4 pipe_icon = "filter" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/mixer - pipe_name = "Gas mixer" + pipe_name = "gas mixer" pipe_id = PIPE_GAS_MIXER orientations = 4 pipe_icon = "mixer" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/sensor - pipe_name = "Gas sensor" + pipe_name = "gas sensor" pipe_id = PIPE_GAS_SENSOR orientations = 1 pipe_icon = "sensor" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/meter - pipe_name = "Gas meter" + pipe_name = "meter" pipe_id = PIPE_METER orientations = 1 pipe_icon = "meter" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/passive_vent - pipe_name = "Passive vent" + pipe_name = "passive vent" pipe_id = PIPE_PASV_VENT orientations = 4 pipe_icon = "passive vent" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/dual_vent_pump - pipe_name = "Dual-port vent pump" + pipe_name = "dual-port vent pump" pipe_id = PIPE_DP_VENT orientations = 2 pipe_icon = "dual-port vent" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE /datum/pipes/atmospheric/injector - pipe_name = "Air injector" + pipe_name = "air injector" pipe_id = PIPE_INJECTOR orientations = 4 pipe_icon = "injector" pipe_category = RPD_DEVICES + rpd_dispensable = TRUE //Heat exchange pipes -/datum/pipes/atmospheric/he - pipe_name = "Straight pipe" +/datum/pipes/atmospheric/simple/he + pipe_name = "straight h/e pipe" pipe_id = PIPE_HE_STRAIGHT - orientations = 2 pipe_icon = "he" pipe_category = RPD_HEAT_PIPING -/datum/pipes/atmospheric/he/bent - pipe_name = "Bent pipe" +/datum/pipes/atmospheric/bent/he + pipe_name = "bent h/e pipe" pipe_id = PIPE_HE_BENT - orientations = 4 + pipe_icon = "he" bendy = TRUE + pipe_category = RPD_HEAT_PIPING /datum/pipes/atmospheric/he_junction - pipe_name = "Junction" + pipe_name = "junction" pipe_id = PIPE_JUNCTION orientations = 4 pipe_icon = "junction" pipe_category = RPD_HEAT_PIPING + rpd_dispensable = TRUE /datum/pipes/atmospheric/heat_exchanger - pipe_name = "Heat exchanger" + pipe_name = "heat exchanger" pipe_id = PIPE_HEAT_EXCHANGE orientations = 4 pipe_icon = "heunary" pipe_category = RPD_HEAT_PIPING + rpd_dispensable = TRUE //DISPOSALS PIPES /datum/pipes/disposal/straight - pipe_name = "Straight pipe" + pipe_name = "straight disposals pipe" pipe_id = PIPE_DISPOSALS_STRAIGHT orientations = 2 - pipe_icon = "conpipe-s" + pipe_icon = "pipe-s" + rpd_dispensable = TRUE /datum/pipes/disposal/bent - pipe_name = "Bent pipe" + pipe_name = "bent disposals pipe" pipe_id = PIPE_DISPOSALS_BENT orientations = 4 - pipe_icon = "conpipe-c" + pipe_icon = "pipe-c" + rpd_dispensable = TRUE /datum/pipes/disposal/junction - pipe_name = "Junction" - pipe_id = PIPE_DISPOSALS_JUNCTION + pipe_name = "disposals junction" + pipe_id = PIPE_DISPOSALS_JUNCTION_RIGHT orientations = 4 - pipe_icon = "conpipe-j1" + pipe_icon = "pipe-j1" + rpd_dispensable = TRUE /datum/pipes/disposal/y_junction - pipe_name = "Y-junction" + pipe_name = "disposals y-junction" pipe_id = PIPE_DISPOSALS_Y_JUNCTION orientations = 4 - pipe_icon = "conpipe-y" + pipe_icon = "pipe-y" + rpd_dispensable = TRUE /datum/pipes/disposal/trunk - pipe_name = "Trunk" + pipe_name = "disposals trunk" pipe_id = PIPE_DISPOSALS_TRUNK orientations = 4 - pipe_icon = "conpipe-t" + pipe_icon = "pipe-t" + rpd_dispensable = TRUE /datum/pipes/disposal/bin - pipe_name = "Bin" + pipe_name = "disposals pipe bin" pipe_id = PIPE_DISPOSALS_BIN orientations = 1 - pipe_icon = "condisposal" + pipe_icon = "disposal" + rpd_dispensable = TRUE /datum/pipes/disposal/outlet - pipe_name = "Outlet" + pipe_name = "disposals outlet" pipe_id = PIPE_DISPOSALS_OUTLET orientations = 4 pipe_icon = "outlet" + rpd_dispensable = TRUE /datum/pipes/disposal/chute - pipe_name = "Chute" + pipe_name = "disposals chute" pipe_id = PIPE_DISPOSALS_CHUTE orientations = 4 pipe_icon = "intake" + rpd_dispensable = TRUE -#undef RPD_ATMOS -#undef RPD_DISPOSAL +//Pipes the RPD can't dispense. Since these don't use an interface, we don't need to bother with setting an icon. We do, however, want to name these for other purposes + +/datum/pipes/atmospheric/circulator + pipe_name = "circulator / heat exchanger" + pipe_id = PIPE_CIRCULATOR + pipe_icon = "circ" + +/datum/pipes/atmospheric/omni_filter + pipe_name = "omni filter" + pipe_id = PIPE_OMNI_FILTER + pipe_icon = "omni_filter" + +/datum/pipes/atmospheric/omni_mixer + pipe_name = "omni mixer" + pipe_id = PIPE_OMNI_MIXER + pipe_icon = "omni_mixer" + +/datum/pipes/atmospheric/insulated + pipe_name = "insulated pipe" + pipe_id = PIPE_INSULATED_STRAIGHT + pipe_icon = "insulated" + +/datum/pipes/atmospheric/insulated/bent + pipe_name = "bent insulated pipe" + pipe_id = PIPE_INSULATED_BENT + +/datum/pipes/disposal/sortjunction + pipe_name = "disposals sort junction" + pipe_id = PIPE_DISPOSALS_SORT_RIGHT + pipe_icon = "pipe-j1s" + +/datum/pipes/disposal/sortjunction/left + pipe_id = PIPE_DISPOSALS_SORT_LEFT + pipe_icon = "pipe-j2s" + +/datum/pipes/disposal/left_junction + pipe_name = "disposals junction" + pipe_id = PIPE_DISPOSALS_JUNCTION_LEFT + pipe_icon = "pipe-j2" + +/proc/get_pipe_name(var/pipe_id, var/pipe_type) + for(var/datum/pipes/P in GLOB.construction_pipe_list) + if(P.pipe_id == pipe_id && P.pipe_type == pipe_type) + return P.pipe_name + return "unknown pipe" + +/proc/get_pipe_icon(var/pipe_id) + for(var/datum/pipes/P in GLOB.construction_pipe_list) + if(P.pipe_id == pipe_id) + return P.pipe_icon + return "unknown icon" diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 4c702be5c39..270b2a99411 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -150,92 +150,8 @@ ..() /obj/item/pipe/proc/update(var/obj/machinery/atmospherics/make_from) - var/list/nlist = list( \ - "pipe", \ - "bent pipe", \ - "h/e pipe", \ - "bent h/e pipe", \ - "connector", \ - "manifold", \ - "junction", \ - "uvent", \ - "mvalve", \ - "pump", \ - "scrubber", \ - "insulated pipe", \ - "bent insulated pipe", \ - "gas filter", \ - "gas mixer", \ - "passive gate", \ - "volume pump", \ - "heat exchanger", \ - "t-valve", \ - "4-way manifold", \ - "pipe cap", \ - "omni mixer", \ - "omni filter", \ - "universal pipe adapter", \ - "supply pipe", \ - "bent supply pipe", \ - "scrubbers pipe", \ - "bent scrubbers pipe", \ - "supply manifold", \ - "scrubbers manifold", \ - "supply 4-way manifold", \ - "scrubbers 4-way manifold", \ - "supply pipe cap", \ - "scrubbers pipe cap", \ - "air injector", \ - "digital valve", \ - "dual-port vent", \ - "passive vent", \ - "digital t-valve", \ - "circulator/heat exchanger", \ - ) - name = nlist[pipe_type+1] + " fitting" - var/list/islist = list( \ - "simple", \ - "simple", \ - "he", \ - "he", \ - "connector", \ - "manifold", \ - "junction", \ - "uvent", \ - "mvalve", \ - "pump", \ - "scrubber", \ - "insulated", \ - "insulated", \ - "filter", \ - "mixer", \ - "passivegate", \ - "volumepump", \ - "heunary", \ - "tvalve", \ - "manifold4w", \ - "cap", \ - "omni_mixer", \ - "omni_filter", \ - "universal", \ - "simple", \ - "simple", \ - "simple", \ - "simple", \ - "manifold", \ - "manifold", \ - "manifold4w", \ - "manifold4w", \ - "cap", \ - "cap", \ - "injector", \ - "dvalve", \ - "dual-port vent", \ - "passive vent", \ - "dtvalve", \ - "circ", \ - ) - icon_state = islist[pipe_type + 1] + name = "[get_pipe_name(pipe_type, PIPETYPE_ATMOS)] fitting" + icon_state = get_pipe_icon(pipe_type) var/obj/machinery/atmospherics/trinary/triP = make_from if(istype(triP) && triP.flipped) icon_state = "m_[icon_state]" diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index 138efcc0f9b..43613ef4990 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -171,14 +171,14 @@ /obj/machinery/pipedispenser/disposal/interact(mob/user) var/dat = {"Disposal Pipes

-Pipe
-Bent Pipe
-Junction
-Y-Junction
-Trunk
-Bin
-Outlet
-Chute
+Pipe
+Bent Pipe
+Junction
+Y-Junction
+Trunk
+Bin
+Outlet
+Chute
"} var/datum/browser/popup = new(user, "pipedispenser", name, 400, 400) @@ -194,15 +194,10 @@ if(!wait) var/p_type = text2num(href_list["dmake"]) - var/obj/structure/disposalconstruct/C = new (loc, p_type) - switch(p_type) - if(6) - C.density = TRUE - if(7) - C.density = TRUE - if(8) - C.density = TRUE + var/obj/structure/disposalconstruct/C = new(loc, p_type) + if(p_type in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) + C.density = TRUE C.add_fingerprint(usr) wait = 1 spawn(15) - wait = 0 \ No newline at end of file + wait = 0 diff --git a/code/game/objects/items/weapons/rpd.dm b/code/game/objects/items/weapons/rpd.dm index c7f16776a57..e130c3ed606 100644 --- a/code/game/objects/items/weapons/rpd.dm +++ b/code/game/objects/items/weapons/rpd.dm @@ -37,7 +37,7 @@ spark_system.set_up(1, 0, src) spark_system.attach(src) -/obj/item/rcd/Destroy() +/obj/item/rpd/Destroy() QDEL_NULL(spark_system) return ..() @@ -51,7 +51,7 @@ lastused = world.time /obj/item/rpd/proc/can_dispense_pipe(var/pipe_id, var/pipe_type) //Returns TRUE if this is a legit pipe we can dispense, otherwise returns FALSE - for(var/list/L in GLOB.construction_pipe_list) + for(var/list/L in GLOB.rpd_pipe_list) if(pipe_type != L["pipe_type"]) //Sometimes pipes in different categories have the same pipe_id, so we need to skip anything not in the category we want continue if(pipe_id == L["pipe_id"]) //Found the pipe, we can dispense it @@ -59,7 +59,7 @@ /obj/item/rpd/proc/create_atmos_pipe(mob/user, turf/T) //Make an atmos pipe, meter, or gas sensor if(!can_dispense_pipe(whatpipe, RPD_ATMOS_MODE)) - to_chat(user, "[src] beeps, \"ERROR\" ") //Damn dirty apes -- I mean hackers + log_runtime(EXCEPTION("Failed to spawn [get_pipe_name(whatpipe, PIPETYPE_ATMOS)] - possible tampering detected")) //Damn dirty apes -- I mean hackers return var/obj/item/pipe/P if(whatpipe == PIPE_GAS_SENSOR) @@ -81,12 +81,12 @@ /obj/item/rpd/proc/create_disposals_pipe(mob/user, turf/T) //Make a disposals pipe / construct if(!can_dispense_pipe(whatdpipe, RPD_DISPOSALS_MODE)) - to_chat(user, "[src] beeps, \"ERROR\" ") + log_runtime(EXCEPTION("Failed to spawn [get_pipe_name(whatdpipe, PIPETYPE_DISPOSAL)] - possible tampering detected")) return var/obj/structure/disposalconstruct/P = new(T, whatdpipe, iconrotation) if(!iconrotation) //Automatic rotation P.dir = user.dir - if(!iconrotation && whatdpipe != PIPE_DISPOSALS_JUNCTION) //Disposals pipes are in the opposite direction to atmos pipes, so we need to flip them. Junctions don't have this quirk though + if(!iconrotation && whatdpipe != PIPE_DISPOSALS_JUNCTION_RIGHT) //Disposals pipes are in the opposite direction to atmos pipes, so we need to flip them. Junctions don't have this quirk though P.flip() to_chat(user, "[src] rapidly dispenses [P]!") activate_rpd(TRUE) @@ -161,7 +161,7 @@ var/list/pipemenu = list( data["iconrotation"] = iconrotation data["mainmenu"] = mainmenu data["mode"] = mode - data["pipelist"] = GLOB.construction_pipe_list + data["pipelist"] = GLOB.rpd_pipe_list data["pipemenu"] = pipemenu data["pipe_category"] = pipe_category data["whatdpipe"] = whatdpipe diff --git a/code/modules/client/asset_cache.dm b/code/modules/client/asset_cache.dm index d3dd6a5438b..acd9e12721c 100644 --- a/code/modules/client/asset_cache.dm +++ b/code/modules/client/asset_cache.dm @@ -317,7 +317,7 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE) for(var/D in cardinal) assets["[state]-[dir2text(D)].png"] = icon('icons/obj/pipe-item.dmi', state, D) for(var/state in icon_states('icons/obj/pipes/disposal.dmi')) - if(!(state in list("conpipe-c", "conpipe-j1", "conpipe-s", "conpipe-t", "conpipe-y", "intake", "outlet"))) //Pipes we want sprites for + if(!(state in list("pipe-c", "pipe-j1", "pipe-s", "pipe-t", "pipe-y", "intake", "outlet"))) //Pipes we want sprites for continue for(var/D in cardinal) assets["[state]-[dir2text(D)].png"] = icon('icons/obj/pipes/disposal.dmi', state, D) diff --git a/code/modules/recycling/disposal-construction.dm b/code/modules/recycling/disposal-construction.dm index ebdd9b5fde4..c7e276cae17 100644 --- a/code/modules/recycling/disposal-construction.dm +++ b/code/modules/recycling/disposal-construction.dm @@ -11,11 +11,9 @@ density = 0 pressure_resistance = 5*ONE_ATMOSPHERE level = 2 - 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 - + var/ptype = PIPE_DISPOSALS_STRAIGHT //Use the defines + var/base_state var/dpdir = 0 // directions as disposalpipe - var/base_state = "pipe-s" /obj/structure/disposalconstruct/New(loc, pipe_type, direction) ..() @@ -27,58 +25,43 @@ // update iconstate and dpdir due to dir and type /obj/structure/disposalconstruct/proc/update() + base_state = get_pipe_icon(ptype) + icon_state = "con[base_state]" var/flip = turn(dir, 180) var/left = turn(dir, 90) var/right = turn(dir, -90) - + name = get_pipe_name(ptype, PIPETYPE_DISPOSAL) switch(ptype) - if(0) - base_state = "pipe-s" + if(PIPE_DISPOSALS_STRAIGHT) dpdir = dir | flip - if(1) - base_state = "pipe-c" + if(PIPE_DISPOSALS_BENT) dpdir = dir | right - if(2) - base_state = "pipe-j1" + if(PIPE_DISPOSALS_JUNCTION_RIGHT) dpdir = dir | right | flip - if(3) - base_state = "pipe-j2" + if(PIPE_DISPOSALS_JUNCTION_LEFT) dpdir = dir | left | flip - if(4) - base_state = "pipe-y" + if(PIPE_DISPOSALS_Y_JUNCTION) dpdir = dir | left | right - if(5) - base_state = "pipe-t" + if(PIPE_DISPOSALS_TRUNK) dpdir = dir - // disposal bin has only one dir, thus we don't need to care about setting it - if(6) - if(anchored) - base_state = "disposal" - else - base_state = "condisposal" - - if(7) - base_state = "outlet" - dpdir = dir - - if(8) - base_state = "intake" - dpdir = dir - - if(9) - base_state = "pipe-j1s" + if(PIPE_DISPOSALS_SORT_RIGHT) dpdir = dir | right | flip - - if(10) - base_state = "pipe-j2s" + if(PIPE_DISPOSALS_SORT_LEFT) dpdir = dir | left | flip - - - if(ptype<6 || ptype>8) + // disposal bin has only one dir, thus we don't need to care about setting it + if(PIPE_DISPOSALS_BIN) + if(!anchored) + icon_state = "[base_state]-unanchored" + else + icon_state = base_state + if(PIPE_DISPOSALS_OUTLET) + dpdir = dir + icon_state = base_state + if(PIPE_DISPOSALS_CHUTE) + dpdir = dir + icon_state = base_state + if(!(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE))) icon_state = "con[base_state]" - else - icon_state = base_state - if(invisibility) // if invisible, fade icon icon -= rgb(0,0,0,128) @@ -124,33 +107,33 @@ dir = turn(dir, 180) switch(ptype) - if(2) - ptype = 3 - if(3) - ptype = 2 - if(9) - ptype = 10 - if(10) - ptype = 9 + if(PIPE_DISPOSALS_JUNCTION_RIGHT) + ptype = PIPE_DISPOSALS_JUNCTION_LEFT + if(PIPE_DISPOSALS_JUNCTION_LEFT) + ptype = PIPE_DISPOSALS_JUNCTION_RIGHT + if(PIPE_DISPOSALS_SORT_RIGHT) + ptype = PIPE_DISPOSALS_SORT_LEFT + if(PIPE_DISPOSALS_SORT_LEFT) + ptype = PIPE_DISPOSALS_SORT_RIGHT update() // returns the type path of disposalpipe corresponding to this item dtype /obj/structure/disposalconstruct/proc/dpipetype() switch(ptype) - if(0,1) + if(PIPE_DISPOSALS_STRAIGHT, PIPE_DISPOSALS_BENT) return /obj/structure/disposalpipe/segment - if(2,3,4) + if(PIPE_DISPOSALS_JUNCTION_RIGHT, PIPE_DISPOSALS_JUNCTION_LEFT, PIPE_DISPOSALS_Y_JUNCTION) return /obj/structure/disposalpipe/junction - if(5) + if(PIPE_DISPOSALS_TRUNK) return /obj/structure/disposalpipe/trunk - if(6) + if(PIPE_DISPOSALS_BIN) return /obj/machinery/disposal - if(7) + if(PIPE_DISPOSALS_OUTLET) return /obj/structure/disposaloutlet - if(8) + if(PIPE_DISPOSALS_CHUTE) return /obj/machinery/disposal/deliveryChute - if(9,10) + if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT) return /obj/structure/disposalpipe/sortjunction return @@ -165,13 +148,13 @@ var/ispipe = 0 // Indicates if we should change the level of this pipe src.add_fingerprint(user) switch(ptype) - if(6) + if(PIPE_DISPOSALS_BIN) nicetype = "disposal bin" - if(7) + if(PIPE_DISPOSALS_OUTLET) nicetype = "disposal outlet" - if(8) + if(PIPE_DISPOSALS_CHUTE) nicetype = "delivery chute" - if(9, 10) + if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT) nicetype = "sorting pipe" ispipe = 1 else @@ -205,7 +188,7 @@ return var/obj/structure/disposalpipe/CP = locate() in T - if(ptype>=6 && ptype <= 8) // Disposal or outlet + if(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) // Disposal or outlet if(CP) // There's something there if(!istype(CP,/obj/structure/disposalpipe/trunk)) to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.") @@ -244,22 +227,22 @@ P.update_icon() //Needs some special treatment ;) - if(ptype==9 || ptype==10) + if(ptype == PIPE_DISPOSALS_SORT_RIGHT || ptype == PIPE_DISPOSALS_SORT_LEFT) var/obj/structure/disposalpipe/sortjunction/SortP = P SortP.updatedir() - else if(ptype==6) // Disposal bin + else if(ptype == PIPE_DISPOSALS_BIN) // Disposal bin var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc) src.transfer_fingerprints_to(P) P.mode = 0 // start with pump off - else if(ptype==7) // Disposal outlet + else if(ptype == PIPE_DISPOSALS_OUTLET) // Disposal outlet var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc) src.transfer_fingerprints_to(P) P.dir = dir - else if(ptype==8) // Disposal outlet + else if(ptype==PIPE_DISPOSALS_CHUTE) // Disposal outlet var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc) src.transfer_fingerprints_to(P) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index aaf35238d80..bf044a6b16c 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -97,7 +97,7 @@ to_chat(user, "You sliced the floorweld off the disposal unit.") var/obj/structure/disposalconstruct/C = new (src.loc) src.transfer_fingerprints_to(C) - C.ptype = 6 // 6 = disposal unit + C.ptype = PIPE_DISPOSALS_BIN C.anchored = 1 C.density = 1 C.update() @@ -889,21 +889,21 @@ var/obj/structure/disposalconstruct/C = new (src.loc) switch(base_icon_state) if("pipe-s") - C.ptype = 0 + C.ptype = PIPE_DISPOSALS_STRAIGHT if("pipe-c") - C.ptype = 1 + C.ptype = PIPE_DISPOSALS_BENT if("pipe-j1") - C.ptype = 2 + C.ptype = PIPE_DISPOSALS_JUNCTION_RIGHT if("pipe-j2") - C.ptype = 3 + C.ptype = PIPE_DISPOSALS_JUNCTION_LEFT if("pipe-y") - C.ptype = 4 + C.ptype = PIPE_DISPOSALS_Y_JUNCTION if("pipe-t") - C.ptype = 5 + C.ptype = PIPE_DISPOSALS_TRUNK if("pipe-j1s") - C.ptype = 9 + C.ptype = PIPE_DISPOSALS_SORT_RIGHT if("pipe-j2s") - C.ptype = 10 + C.ptype = PIPE_DISPOSALS_SORT_LEFT src.transfer_fingerprints_to(C) C.dir = dir C.density = 0 @@ -1339,7 +1339,7 @@ to_chat(user, "You sliced the floorweld off the disposal outlet.") var/obj/structure/disposalconstruct/C = new (src.loc) src.transfer_fingerprints_to(C) - C.ptype = 7 // 7 = outlet + C.ptype = PIPE_DISPOSALS_OUTLET C.update() C.anchored = 1 C.density = 1 diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index c40ed9fe73b..8b2f7c4197f 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -349,7 +349,7 @@ if(!src || !W.isOn()) return to_chat(user, "You sliced the floorweld off the delivery chute.") var/obj/structure/disposalconstruct/C = new (src.loc) - C.ptype = 8 // 8 = Delivery chute + C.ptype = PIPE_DISPOSALS_CHUTE C.update() C.anchored = 1 C.density = 1 diff --git a/icons/obj/pipes/disposal.dmi b/icons/obj/pipes/disposal.dmi index cbd0834b435845be68c5b2e691dff3853a1ab604..83440fc1b528adf2fe7cd008a2ca1c4997455fa6 100644 GIT binary patch delta 405 zcmV;G0c!rB`~|H11&}0vcY0Jg&-y7ydzEFn zHrWndmNrWd?RTK^EUXL+pi95~4%FH>EwACABtL%-f%jjM&+XUlKsNhb+JSY_Xi}2Z z%WInaO6~o0^~{fFmaxFASGFF=^EphqOE4S62<~wqzRXQ){&CrX;NGE1L6Jl zO=WZ=8=%!dt{#)$`4gzav&9oAUW+F^n!H5G{v@K?e><{TwN6aqA8Eotu?s0lp7moL zo+DESmR5q<6HKd$K~-eqo6~`%b*qqz?!Z#PG*>gFrg#gCU!u6wo}D4O#{r|2GEVB# zH2yyP?>fux$KWx4tyd5~{D4u@fJW5nN1o;D`(ll3fF7g80#@U=cXZ)m`fx_E{KEUxoLV)`dw^k~g_u7m#5qf}hQQn7FD zL>bde8po0Kxc(@x=3vX5sF;tAB_+42b#uf>xAOv$cRF5J;ZFn8qB zs&Y`3c{%ZLcUH)zFWgbVbgO1cP4SMi_L{_{4(!B}XB;uwDC4C*PUG*x`>yliehnUT z4vMEge#EG;TqA0K^{dE>^?flbEvJWMv50jzE