mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
* fix map * Fixing bad syntax * Maybe this will work * Travis wanted me to remove this * Unticking attempt * Unticking attempt 2 * Removing all useless broken zshadow stuff * Maybe now? * Oh weird * Adding up/down pipe sprites * Adding darkness overlay, attempt #1 * Second attempt, now works * Turf tweaks, now much less visually glitchy, plus walls now make blank floors above them for less weirdness * Fix, plus keeps this floor in place * Really bad fix that stops space looking weird * Now everything should work normally, except lighting overlays * Updates the map * Consistency * Adds new fall damage sound * Typo * Jetpack fun * Better * Less bad brackets and parantheses pain * OHhh * These fly too, brooms next whenever I figure those out * Finishing pipe icons * Making it easier to build catwalks and stuff on turfs without clicking the stuff below by mistake * Bringing back zshadow, but with no icon * Oh it's this issue again * Final fix, better attempt at image relay * Now for it looking nice, vis_contents are bad here too * Attempt at refactoring this, light overlays are now finally underneath players, at the cost of blocking everything else, but exxion wanted to testmerge it * Map change * Changing it back, test server stays on box anyways * Removing non-working solution * Removes broken lighting overlays * Finally fixes up floor generation above walls * Adding bones of a 3d implementation of spiral block for git push origin multizfungit push origin multiz * More, almost done * Finalised * Cube option * Logic fix * Syntax * Attempting to make item fall on arc * Compile * Now this is no longer needed * BRACE FOR ENABLING MULTI-Z ZAS * Attempt at fixing glass floor tiles * Splitting off explosion proc into destroy part, bones of calling it recursively and smaller on above and below layers, implementation of multi-z explosion suggested by DeityLink * Missing var * Removing unused var and fixes consistency * Fixing logic and syntax etc, still needs testing before uncomment * Uncommenting, some fixes too * Makes this a seperate function otherwise it won't call at all, MULTI Z EXPLOSIONS NOW CONFIRMED WORKING * Client proc to test this * Adds to list * Typo not drawing red on main layer * Here too * Adding debug logs for clarity * Better * Even better * Experimental multi-Z EMP support, cylindrical effect for now * Better distance falloff * Sound/visual support on other layers? * Z cap for EMP sound * Booms too * Adds back accidentally deleted file * Muuuch more sane check * Attempt at connecting heard speech between multi Z * Cleaner * Missing bracket * Removing zshadow mobs entirely again, no need for them whatsoever * Multi-z visible messages * Emotes * Fix? * Wew * K * Much nicer function * I forget about this define * Ohhhh * Comma fix * Aaa * This might fix * Removing visible message one for now * Trying this solution * Typo * RIP location, hope this won't break anything * Actually location gets to come back, fix is here * I give up, the tests are clearly what's borken * Let's see what this does with those nullspaces test items (yes really) * Indent fix, plus nice comments * MULTI-Z SOUND??? * Woops * Jetpack and etc trails over open space now! * No macros, this is why we can't have nice things * Watch how coder stops potion of levitation, broom and fairy wing wielders from falling with ONE NEAT TRICK * Gotta make leapers not fall somehow * Bad oversight * Fully allows going down stairs with weird border objects * Flying now works properly for humans on open space * Now, fall instantly on stop * Oversight * Oh this function * New helper functions * Oversight again * Replacing lines with abs(), multi z singulo pull attempt * Quick supermatter fix * Don't cut overlays * Move down here * Typo * Now actually works, implementation could be better though * Additional helper function for z distances because BYOND hates comparing z * Reimplementing for sound * abs() to keep positive for max comparisons in line distances * Keeping gas overlays outside of multi-z viewing to stop some glitches * That didn't work * Testing removal from float planes for stuff that never needed to be on it * Fixes gas overlays showing up all wrong in multi Z ZAS * Gutting this controller, no longer needed period, system works fine without it * Now glass floors look mostly perfect on open spaces * Var name change for fun stuff later * Knew I'd miss one * Gravity based fall delay? * Settle with using sleep() for now, what could go wrong? * Lagged the game horribly, so everything * Here all along, huh * Just remove it for now, it kinda works but not ideally at all * Thank you TK code for giving me a nice and working way to do this * Comments, oversights * No wait it was right the first time * Now for the damage multiplier * Knockdown too * Nicer format * This should still be min, plus now have a debug log and shifted around logic * Now for mech stuff * Clamping knockdown * Definition fix * Dusting this off, hopeful fix to things not falling * Probably don't need this, I forget * Hahaha nope, this did nothing * Finally, a way to make fall() call in mid air after a delay without horrible lag * Tunes pipe layering if on same zlevel, getting there * Now fully tuned * Adding bones for pipe item support * Test * z_up pipe item icon state * z_up and z_down pipe item icon state * Adding these to pipe dispensers * Typo * RCDs too * Moved here * Moved back * Makes space work nicer * Oh and here * Fall updates * Don't need this * Oversights everywhere * Fixes * More * More, and new stuff * Even more * Dampening these a bit * So many, so moved to new file * Forgot this * Refactor * Forgot to actually use * Indentation issues * Works better like this * Refactors into nicer proc * One oversight * Stair frames, to construct into stairs * Stack recipe for em * Cutting useless stuff * Fixes * Last fixes * Stops uncrossing at non existant aboves * Better logic * Better logic * Fix * Fixes nullspace checking runtime * Removes redundant check on stairs * Replaces CanPass with Cross, functionality is same and definition is duplicate of it * Missed one * Darkening and falling tweaks * Better call for gravity * Oversight * Stops falling in space, zero-g open space movement fixes etc * Consistency * Fixes slipping on open spaces with catwalks (lattices make sense I guess) and stairs not being snapped down to * Var name fix * Much nicer system with no recursive function or last_fall variable use * Adds buildFrom()s so z-pipes can actually be fitted, stops spam of fall() calls on enter with lock for nicer gravity * Makes z distances pay attention to multi z support * Maybe this is better * Left this in * Adding visible and hidden variants for mapping * Counts glass floors as open space for the purpose of open space checks * Bracket fix * Makes it a macro for easy viewing * Space looks much better like this honestly * Makes schematics actually show up on RPD in multi-z * Making these tied to WORLD_ICON_SIZE * Changes for someone to test * Now the fix actually works * Removes forceMove(), nicer solution * Giving stairs all their dirs * Fixing stair position problem and other things * Stair deconstruction * Removing redundant enter() check to move() * Some updates as requested * .dme and map/file fixes * .dme and map/file fixes * Updating can_falls * Ladder climb fix * Some port notes updates * Docs itself * Removing unused edge_type var * Removing landmark object, converts it code side * Removing unsimmed walls doing it, not necessary * Updated descs * Fixing observer non-standards in file * More file cleanup * Jetpacks allow z-travelling * Now they really do * Robots too * Updating docs * Code cleanup * Catch one * Indent fix * Not sure what that even is * Catching these * Applying some old fixes * Removing unused file * Moving nodes back to original places, or an attempt to * Here too * Removing unused file * Moving these back too * Some fixes for now * Some more * Even more, almost done * Better pipe icons * More icons * Disposal pipe construction * Mixup * List optimisation, new fixes Co-authored-by: Damian <damian@autistici.org> Co-authored-by: kanef <kanef9x@protonmail.com>
845 lines
23 KiB
Plaintext
845 lines
23 KiB
Plaintext
#define PIPE_NONE 0
|
|
#define PIPE_BINARY 1
|
|
#define PIPE_BENT 2
|
|
#define PIPE_TRINARY 3
|
|
#define PIPE_TRIN_M 4
|
|
#define PIPE_UNARY 5
|
|
#define PIPE_Z_UP_BINARY 6
|
|
#define PIPE_Z_DOWN_BINARY 7
|
|
|
|
//UTILITIES.
|
|
|
|
/datum/rcd_schematic/decon_pipes
|
|
name = "Eat pipes"
|
|
category = "Utilities"
|
|
flags = RCD_RANGE | RCD_ALLOW_SWITCH
|
|
|
|
/datum/rcd_schematic/decon_pipes/attack(var/atom/A, var/mob/user)
|
|
if(!istype(A, /atom/movable))
|
|
return 1
|
|
|
|
var/atom/movable/AM = A
|
|
|
|
if(!is_type_in_list(AM, list(/obj/item/pipe, /obj/item/pipe_meter, /obj/item/pipe_gsensor, /obj/structure/disposalconstruct)))
|
|
return 1
|
|
|
|
to_chat(user, "Destroying Pipe...")
|
|
playsound(master, 'sound/machines/click.ogg', 50, 1)
|
|
if(!master.delay(user, AM, 0.5 SECONDS))
|
|
return 1
|
|
|
|
if(!AM)
|
|
return 1
|
|
|
|
playsound(master, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
|
|
if(istype(AM, /obj/item/pipe))
|
|
qdel(A)
|
|
else
|
|
qdel(AM)
|
|
|
|
/datum/rcd_schematic/paint_pipes
|
|
name = "Paint pipes"
|
|
category = "Utilities"
|
|
flags = RCD_RANGE
|
|
var/mass_colour = 0
|
|
var/list/available_colors = list(
|
|
"grey" = PIPE_COLOR_GREY,
|
|
"red" = PIPE_COLOR_RED,
|
|
"blue" = PIPE_COLOR_BLUE,
|
|
"cyan" = PIPE_COLOR_CYAN,
|
|
"green" = PIPE_COLOR_GREEN,
|
|
"orange" = PIPE_COLOR_ORANGE,
|
|
"purple" = PIPE_COLOR_PURPLE,
|
|
"custom" = "custom"
|
|
)
|
|
var/last_colouration = 0
|
|
var/selected_color = "grey"
|
|
var/colouring_delay = 0
|
|
|
|
/datum/rcd_schematic/paint_pipes/New(var/obj/item/device/rcd/n_master)
|
|
. = ..()
|
|
|
|
if(!master || !master.interface)
|
|
return
|
|
|
|
//Add the colour CSS defines to the master's interface's HEAD.
|
|
var/color_css
|
|
|
|
for(var/color_name in available_colors)
|
|
var/color = available_colors[color_name]
|
|
if (color == "custom")
|
|
color = "#000000"
|
|
color_css += {"
|
|
a.color.[color_name] {
|
|
color: [color];
|
|
}
|
|
a.color.[color_name]:hover {
|
|
border:1px solid [color];
|
|
}
|
|
a.color.[color_name].selected {
|
|
background-color: [color];
|
|
}
|
|
"}
|
|
|
|
master.interface.head += "<style type='text/css'>[color_css]</style><br><"
|
|
|
|
/datum/rcd_schematic/paint_pipes/deselect(var/mob/user, var/datum/rcd_schematic/new_schematic)
|
|
. = ..()
|
|
|
|
selected_color = available_colors[1]
|
|
|
|
/datum/rcd_schematic/paint_pipes/get_HTML()
|
|
. += "<h4>Colour Choice:</h4>"
|
|
for(var/color_name in available_colors)
|
|
var/selected = ""
|
|
if(color_name == selected_color)
|
|
selected = " selected"
|
|
if (selected_color == "custom")
|
|
selected_color = input("Select Colour to change the pipe to", "Custom Pipe Colour", selected_color) as color
|
|
if (selected_color == "#ffffff")
|
|
selected_color = "#fffffe"
|
|
. += "<a class='color [color_name][selected]' href='?src=\ref[master.interface];set_color=[color_name]'>•</a>"
|
|
var/mass_colour_on = mass_colour ? "On" : "Off"
|
|
. += {" <br>
|
|
<h4>Mass Colour:</h4>
|
|
Mass Colouration: <b><A href='?src=\ref[master.interface];set_mass_colour=1'>[mass_colour_on]</a></b>"}
|
|
|
|
/datum/rcd_schematic/paint_pipes/attack(var/atom/A, var/mob/user)
|
|
if(!istype(A, /obj/machinery/atmospherics))
|
|
return 1
|
|
|
|
var/obj/machinery/atmospherics/O = A
|
|
|
|
if(!O.can_be_coloured)
|
|
to_chat(user, "<span class='danger'>\The [O] cannot be painted.</span>")
|
|
return 1
|
|
|
|
playsound(master, 'sound/machines/click.ogg', 50, 1)
|
|
if (selected_color in available_colors)
|
|
selected_color = available_colors[selected_color]
|
|
if(mass_colour && world.timeofday < last_colouration + colouring_delay)
|
|
return "We aren't ready to mass paint again; please wait [(last_colouration+colouring_delay)-world.timeofday] more seconds!"
|
|
if(mass_colour && istype(O, /obj/machinery/atmospherics/unary/cap))
|
|
var/obj/machinery/atmospherics/unary/cap/cap = O
|
|
var/obj/machinery/atmospherics/pipe/maybe_pipe_to_colour = cap.node1
|
|
if (istype(maybe_pipe_to_colour))
|
|
var/datum/pipeline/pipe_line = maybe_pipe_to_colour.parent
|
|
var/list/pipeline_members = pipe_line.members
|
|
if(pipeline_members.len < 500)
|
|
last_colouration = world.timeofday
|
|
colouring_delay = (pipeline_members.len)/2
|
|
O.color = selected_color
|
|
maybe_pipe_to_colour.mass_colouration(selected_color)
|
|
else
|
|
return "That pipe network is simply too big to paint!"
|
|
else if(mass_colour && istype(O, /obj/machinery/atmospherics/pipe))
|
|
var/obj/machinery/atmospherics/pipe/pipe_to_colour = O
|
|
var/datum/pipeline/pipe_line = pipe_to_colour.parent
|
|
var/list/pipeline_members = pipe_line.members
|
|
if(pipeline_members.len < 500)
|
|
last_colouration = world.timeofday
|
|
colouring_delay = (pipeline_members.len)/2
|
|
O.color = selected_color
|
|
pipe_to_colour.mass_colouration(selected_color)
|
|
else
|
|
return "That pipe network is simply too big to paint!"
|
|
else
|
|
O.color = selected_color
|
|
O.update_icon()
|
|
user.visible_message("<span class='notice'>[user] paints \the [O] [selected_color].</span>","<span class='notice'>You paint \the [O] [selected_color].</span>")
|
|
|
|
/datum/rcd_schematic/paint_pipes/Topic(var/href, var/list/href_list)
|
|
if(href_list["set_color"])
|
|
if(href_list["set_color"] in available_colors)
|
|
selected_color = href_list["set_color"]
|
|
master.update_options_menu()
|
|
if(href_list["set_mass_colour"])
|
|
mass_colour = mass_colour ? 0:1
|
|
master.update_options_menu()
|
|
return 1
|
|
|
|
//METERS AND SENSORS.
|
|
|
|
/datum/rcd_schematic/gsensor
|
|
name = "Gas sensor"
|
|
category = "Devices"
|
|
flags = RCD_RANGE | RCD_GET_TURF | RCD_ALLOW_SWITCH
|
|
|
|
/datum/rcd_schematic/gsensor/attack(var/atom/A, var/mob/user)
|
|
if(!isturf(A))
|
|
return
|
|
|
|
to_chat(user, "Building gas sensor...")
|
|
playsound(master, 'sound/machines/click.ogg', 50, 1)
|
|
if(!master.delay(user, A, 2 SECONDS))
|
|
return 1
|
|
|
|
playsound(master, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
new /obj/item/pipe_gsensor(A)
|
|
|
|
/datum/rcd_schematic/pmeter
|
|
name = "Pipe meter"
|
|
category = "Devices"
|
|
flags = RCD_RANGE | RCD_GET_TURF | RCD_ALLOW_SWITCH
|
|
|
|
/datum/rcd_schematic/pmeter/attack(var/atom/A, var/mob/user)
|
|
if(!isturf(A))
|
|
return
|
|
|
|
to_chat(user, "Building pipe meter...")
|
|
playsound(master, 'sound/machines/click.ogg', 50, 1)
|
|
if(!master.delay(user, A, 2 SECONDS))
|
|
return 1
|
|
|
|
playsound(master, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
new /obj/item/pipe_meter(A)
|
|
|
|
//ACTUAL PIPES.
|
|
|
|
/datum/rcd_schematic/pipe
|
|
name = "Pipe"
|
|
category = "Regular pipes"
|
|
flags = RCD_RANGE | RCD_GET_TURF | RCD_ALLOW_SWITCH
|
|
|
|
var/pipe_id = PIPE_SIMPLE_STRAIGHT
|
|
var/pipe_type = PIPE_BINARY
|
|
var/selected_dir = NORTH
|
|
var/layer = PIPING_LAYER_DEFAULT //Layer selected, at 0, no layer picker will be available (disposals).
|
|
|
|
/datum/rcd_schematic/pipe/New(var/obj/item/device/rcd/n_master)
|
|
. = ..()
|
|
if(n_master) // So we don't do this in case we're created for asset registering.
|
|
selected_dir = get_base_dir()
|
|
|
|
/datum/rcd_schematic/pipe/proc/get_base_dir()
|
|
if(pipe_type == PIPE_BENT)
|
|
return NORTHEAST
|
|
|
|
return NORTH
|
|
|
|
/datum/rcd_schematic/pipe/register_assets()
|
|
var/list/dir_list = get_dirs()
|
|
|
|
for(var/dir in dir_list)
|
|
register_icon(dir)
|
|
|
|
/datum/rcd_schematic/pipe/send_assets(var/client/client)
|
|
var/list/dir_list = get_dirs()
|
|
|
|
for(var/dir in dir_list)
|
|
send_icon(client, dir)
|
|
|
|
send_asset(client, "RPD-layer-blended-1.png")
|
|
send_asset(client, "RPD-layer-blended-4.png")
|
|
|
|
send_asset(client, "RPD_0_4.png")
|
|
send_asset(client, "RPD_0_1.png")
|
|
|
|
// NOTE: these define the order in which scrolling with alt+mousewheel occur too!
|
|
// These have been made the same as the directions used in get_HTML() because of that.
|
|
// Rule of thumb: scrolling is clockwise.
|
|
/datum/rcd_schematic/pipe/proc/get_dirs()
|
|
switch(pipe_type)
|
|
if(PIPE_UNARY, PIPE_Z_UP_BINARY, PIPE_Z_DOWN_BINARY)
|
|
. = list(NORTH, EAST, SOUTH, WEST)
|
|
|
|
if(PIPE_TRINARY)
|
|
. = list(NORTH, EAST, WEST, SOUTH)
|
|
|
|
if(PIPE_BINARY)
|
|
. = list(NORTH, EAST)
|
|
|
|
if(PIPE_BENT)
|
|
. = list(NORTHWEST, NORTHEAST, SOUTHEAST, SOUTHWEST)
|
|
|
|
if(PIPE_TRIN_M)
|
|
. = list(NORTH, EAST, WEST, NORTHEAST, SOUTHWEST, NORTHWEST, SOUTHEAST, SOUTH)
|
|
|
|
else
|
|
. = list()
|
|
|
|
/datum/rcd_schematic/pipe/proc/register_icon(var/dir)
|
|
register_asset("RPD_[pipe_id]_[dir].png", new/icon('icons/obj/pipe-item.dmi', pipeID2State[pipe_id + 1], dir))
|
|
|
|
/datum/rcd_schematic/pipe/proc/send_icon(var/client/client, var/dir)
|
|
send_asset(client, "RPD_[pipe_id]_[dir].png")
|
|
|
|
/datum/rcd_schematic/pipe/get_HTML()
|
|
. += "<h4>Directions & layers</h4>"
|
|
. += "<div id='dir_holder'>"
|
|
|
|
switch(pipe_type)
|
|
if(PIPE_BINARY)
|
|
. += render_dir_image(NORTH, "Vertical")
|
|
. += render_dir_image(EAST, "Horizontal")
|
|
|
|
if(PIPE_UNARY)
|
|
. += render_dir_image(NORTH, "North")
|
|
. += render_dir_image(EAST, "East")
|
|
. += render_dir_image(SOUTH, "South")
|
|
. += render_dir_image(WEST, "West")
|
|
|
|
if(PIPE_BENT)
|
|
. += render_dir_image(NORTHWEST, "West to North")
|
|
. += render_dir_image(NORTHEAST, "North to East")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTHWEST, "South to West")
|
|
. += render_dir_image(SOUTHEAST, "East to South")
|
|
|
|
if(PIPE_TRINARY)
|
|
. += render_dir_image(NORTH, "West South East")
|
|
. += render_dir_image(EAST, "North West South")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTH, "East North West")
|
|
. += render_dir_image(WEST, "South East North")
|
|
|
|
if(PIPE_TRIN_M)
|
|
. += render_dir_image(NORTH, "West South East")
|
|
. += render_dir_image(EAST, "North West South")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTH, "East North West")
|
|
. += render_dir_image(WEST, "South East North")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTHEAST, "West South East")
|
|
. += render_dir_image(NORTHEAST, "North West South")
|
|
. += "<br/>"
|
|
. += render_dir_image(NORTHWEST, "East North West")
|
|
. += render_dir_image(SOUTHWEST, "South East North")
|
|
|
|
if(PIPE_Z_UP_BINARY)
|
|
. += render_dir_image(NORTH, "North to Up")
|
|
. += render_dir_image(EAST, "East to Up")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTH, "South to Up")
|
|
. += render_dir_image(WEST, "West to Up")
|
|
|
|
if(PIPE_Z_DOWN_BINARY)
|
|
. += render_dir_image(NORTH, "North to Down")
|
|
. += render_dir_image(EAST, "East to Down")
|
|
. += "<br/>"
|
|
. += render_dir_image(SOUTH, "South to Down")
|
|
. += render_dir_image(WEST, "West to Down")
|
|
|
|
. += "</div>"
|
|
|
|
if(layer)
|
|
. += {"
|
|
<div class="layer_holder">
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=1"><div class="layer vertical one [layer == 1 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=2"><div class="layer vertical two [layer == 2 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=3"><div class="layer vertical three [layer == 3 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=4"><div class="layer vertical four [layer == 4 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=5"><div class="layer vertical five [layer == 5 ? "selected" : ""]"></div></a>
|
|
</div>
|
|
|
|
<div class="layer_holder" style="left: 200px;">
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=1"><div class="layer horizontal one [layer == 1 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=2"><div class="layer horizontal two [layer == 2 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=3"><div class="layer horizontal three [layer == 3 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=4"><div class="layer horizontal four [layer == 4 ? "selected" : ""]"></div></a>
|
|
<a class="no_dec" href="?src=\ref[master.interface];set_layer=5"><div class="layer horizontal five [layer == 5 ? "selected" : ""]"></div></a>
|
|
</div>
|
|
"}
|
|
|
|
/datum/rcd_schematic/pipe/proc/render_dir_image(var/dir, var/title)
|
|
var/selected = ""
|
|
if(selected_dir == dir)
|
|
selected = " class='selected'"
|
|
|
|
return "<a href='?src=\ref[master.interface];set_dir=[dir]'[selected] title='[title]'><img src='RPD_[pipe_id]_[dir].png'/></a>"
|
|
|
|
/datum/rcd_schematic/pipe/Topic(var/href, var/href_list)
|
|
if(href_list["set_dir"])
|
|
var/dir = text2num(href_list["set_dir"])
|
|
if(!(dir in get_dirs()) || selected_dir == dir)
|
|
return 1
|
|
|
|
set_dir(dir)
|
|
|
|
return 1
|
|
|
|
if(href_list["set_layer"] && layer) //Only handle this is layer is nonzero.
|
|
var/n_layer = clamp(round(text2num(href_list["set_layer"])), PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
|
if(layer == n_layer) //No point doing anything.
|
|
return 1
|
|
|
|
set_layer(n_layer)
|
|
|
|
return 1
|
|
|
|
/datum/rcd_schematic/pipe/proc/set_dir(var/new_dir)
|
|
selected_dir = new_dir
|
|
master.update_options_menu()
|
|
|
|
/datum/rcd_schematic/pipe/proc/set_layer(var/new_layer)
|
|
layer = new_layer
|
|
master.data["pipe_layer"] = new_layer
|
|
master.update_options_menu()
|
|
|
|
/datum/rcd_schematic/pipe/MouseWheeled(var/mob/user, var/delta_x, var/delta_y, var/params)
|
|
var/list/modifiers = params2list(params)
|
|
if (modifiers["shift"] && layer)
|
|
var/new_layer = layer
|
|
if (delta_y <= 0)
|
|
new_layer++
|
|
if (new_layer > PIPING_LAYER_MAX)
|
|
new_layer = PIPING_LAYER_MIN
|
|
else
|
|
new_layer--
|
|
if (new_layer < PIPING_LAYER_MIN)
|
|
new_layer = PIPING_LAYER_MAX
|
|
|
|
set_layer(new_layer)
|
|
|
|
if (modifiers["alt"] && pipe_type != PIPE_NONE)
|
|
var/list/dirs = get_dirs()
|
|
var/index = dirs.Find(selected_dir)
|
|
if (delta_y >= 0)
|
|
index++
|
|
if (index > dirs.len)
|
|
index = 1
|
|
else
|
|
index = index - 1 || dirs.len
|
|
|
|
set_dir(dirs[index])
|
|
|
|
/datum/rcd_schematic/pipe/attack(var/atom/A, var/mob/user)
|
|
to_chat(user, "Building Pipes ...")
|
|
playsound(user, 'sound/machines/click.ogg', 50, 1)
|
|
var/thislayer = layer
|
|
var/thisdir = selected_dir
|
|
if(!master.delay(user, A, 2 SECONDS))
|
|
return 1
|
|
|
|
playsound(user, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
|
|
var/obj/item/pipe/P = new /obj/item/pipe(A, pipe_id, thisdir)
|
|
P.setPipingLayer(thislayer)
|
|
P.update()
|
|
P.add_fingerprint(user)
|
|
var/obj/item/device/rcd/rpd/ourmaster = master
|
|
if(ourmaster.autowrench)
|
|
P.attackby(ourmaster.internal_wrench, user)
|
|
|
|
/datum/rcd_schematic/pipe/select(var/mob/user, var/datum/rcd_schematic/old_schematic)
|
|
if(!istype(old_schematic, /datum/rcd_schematic/pipe))
|
|
return ..()
|
|
|
|
if (layer && master.data["pipe_layer"])
|
|
layer = master.data["pipe_layer"]
|
|
|
|
return ..()
|
|
|
|
//Disposal piping.
|
|
/datum/rcd_schematic/pipe/disposal
|
|
category = "Disposal Pipes"
|
|
|
|
layer = 0 // Set to 0 to disable layer selection.
|
|
pipe_id = DISP_PIPE_STRAIGHT
|
|
var/actual_id = 0 // This is needed because disposals construction code is a shit.
|
|
|
|
/datum/rcd_schematic/pipe/disposal/register_icon(var/dir)
|
|
register_asset("RPD_D_[pipe_id]_[dir].png", new/icon('icons/obj/pipes/disposal.dmi', disposalpipeID2State[pipe_id + 1], dir))
|
|
|
|
/datum/rcd_schematic/pipe/disposal/send_icon(var/client/client, var/dir)
|
|
send_asset(client, "RPD_D_[pipe_id]_[dir].png")
|
|
|
|
/datum/rcd_schematic/pipe/disposal/render_dir_image(var/dir, var/title)
|
|
var/selected = ""
|
|
if(selected_dir == dir)
|
|
selected = " class='selected'"
|
|
|
|
return "<a href='?src=\ref[master.interface];set_dir=[dir]'[selected] title='[title]'><img src='RPD_D_[pipe_id]_[dir].png'/></a>"
|
|
|
|
/datum/rcd_schematic/pipe/disposal/attack(var/atom/A, var/mob/user)
|
|
to_chat(user, "Building Pipes ...")
|
|
playsound(user, 'sound/machines/click.ogg', 50, 1)
|
|
var/thisdir = selected_dir
|
|
if(!master.delay(user, A, 2 SECONDS))
|
|
return 1
|
|
|
|
playsound(user, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
|
|
var/obj/structure/disposalconstruct/C = new/obj/structure/disposalconstruct(A)
|
|
C.dir = thisdir
|
|
C.ptype = actual_id
|
|
C.update()
|
|
|
|
C.add_fingerprint(user)
|
|
|
|
var/global/list/disposalpipeID2State = list(
|
|
"pipe-s",
|
|
"pipe-c",
|
|
"pipe-j1",
|
|
"pipe-y",
|
|
"pipe-t",
|
|
"disposal",
|
|
"outlet",
|
|
"intake",
|
|
"pipe-j1s",
|
|
"pipe-j1s",
|
|
"pipe-u",
|
|
"pipe-d"
|
|
)
|
|
|
|
//This is a meta thing to send a blended pipe sprite to clients, basically the default straight pipe, but blended blue.
|
|
//Yes I tried to find a proper way to blend things in HTML/CSS, alas.
|
|
/datum/rcd_schematic/pipe/blender/register_assets()
|
|
var/icon/I = new/icon('icons/obj/pipe-item.dmi', pipeID2State[1], 1)
|
|
I.Blend("#0000FF", ICON_MULTIPLY) //Make it blue
|
|
register_asset("RPD-layer-blended-1.png", I)
|
|
|
|
I = new/icon('icons/obj/pipe-item.dmi', pipeID2State[1], 4)
|
|
I.Blend("#0000FF", ICON_MULTIPLY) //Make it blue
|
|
register_asset("RPD-layer-blended-4.png", I)
|
|
|
|
//PIPE DEFINES START HERE.
|
|
|
|
//REGULAR PIPES.
|
|
//Straight is the base class, so not included.
|
|
|
|
/datum/rcd_schematic/pipe/bent
|
|
name = "Bent Pipe"
|
|
|
|
pipe_id = PIPE_SIMPLE_BENT
|
|
pipe_type = PIPE_BENT
|
|
|
|
/datum/rcd_schematic/pipe/z_up
|
|
name = "Up Pipe"
|
|
|
|
pipe_id = PIPE_Z_UP
|
|
pipe_type = PIPE_Z_UP_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/z_down
|
|
name = "Down Pipe"
|
|
|
|
pipe_id = PIPE_Z_DOWN
|
|
pipe_type = PIPE_Z_DOWN_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/manifold
|
|
name = "Manifold"
|
|
|
|
pipe_id = PIPE_MANIFOLD
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/valve
|
|
name = "Manual Valve"
|
|
|
|
pipe_id = PIPE_MVALVE
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/dvalve
|
|
name = "Digital Valve"
|
|
|
|
pipe_id = PIPE_DVALVE
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/cap
|
|
name = "Pipe Cap"
|
|
|
|
pipe_id = PIPE_CAP
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/manifold_4w
|
|
name = "4-Way Manifold"
|
|
|
|
pipe_id = PIPE_MANIFOLD4W
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/mtvalve
|
|
name = "Manual T-Valve"
|
|
|
|
pipe_id = PIPE_MTVALVE
|
|
pipe_type = PIPE_TRIN_M
|
|
|
|
/datum/rcd_schematic/pipe/dtvalve
|
|
name = "Digital T-Valve"
|
|
|
|
pipe_id = PIPE_DTVALVE
|
|
pipe_type = PIPE_TRIN_M
|
|
|
|
/datum/rcd_schematic/pipe/layer_manifold
|
|
name = "Layer Manifold"
|
|
|
|
pipe_id = PIPE_LAYER_MANIFOLD
|
|
pipe_type = PIPE_UNARY
|
|
layer = 0
|
|
|
|
/datum/rcd_schematic/pipe/layer_adapter
|
|
name = "Layer Adapter"
|
|
|
|
pipe_id = PIPE_LAYER_ADAPTER
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/layer_adapter/register_icon(var/dir)
|
|
for(var/layer = PIPING_LAYER_MIN to PIPING_LAYER_MAX)
|
|
var/icon/I = new/icon('icons/obj/atmospherics/pipe_adapter.dmi', "adapter_[layer]", dir)
|
|
I.Blend(PIPE_COLOR_GREY, ICON_MULTIPLY)
|
|
register_asset("RPD_[pipe_id]_[dir]_[layer].png", I)
|
|
|
|
/datum/rcd_schematic/pipe/layer_adapter/send_icon(var/client/client, var/dir)
|
|
send_asset(client, "RPD_[pipe_id]_[dir]_[layer].png")
|
|
|
|
|
|
/datum/rcd_schematic/pipe/layer_adapter/render_dir_image(var/dir, var/title)
|
|
var/selected = ""
|
|
if(selected_dir == dir)
|
|
selected = " class='selected'"
|
|
|
|
return "<a href='?src=\ref[master.interface];set_dir=[dir]'[selected] title='[title]'><img src='RPD_[pipe_id]_[dir]_[layer].png'/></a>"
|
|
|
|
//DEVICES.
|
|
|
|
/datum/rcd_schematic/pipe/connector
|
|
name = "Connector"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_CONNECTOR
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/unary_vent
|
|
name = "Unary Vent"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_UVENT
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/passive_vent
|
|
name = "Passive Vent"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_PASV_VENT
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/pump
|
|
name = "Gas Pump"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_PUMP
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/passive_gate
|
|
name = "Passive gate"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_PASSIVE_GATE
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/volume_pump
|
|
name = "Volume Pump"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_VOLUME_PUMP
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/scrubber
|
|
name = "Scrubber"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_SCRUBBER
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/filter
|
|
name = "Gas Filter"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_GAS_FILTER
|
|
pipe_type = PIPE_TRIN_M
|
|
|
|
/datum/rcd_schematic/pipe/mixer
|
|
name = "Gas Mixer"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_GAS_MIXER
|
|
pipe_type = PIPE_TRIN_M
|
|
|
|
/datum/rcd_schematic/pipe/thermal_plate
|
|
name = "Thermal Plate"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_THERMAL_PLATE
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/heat_pump
|
|
name = "Thermoelectric Cooler"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_HEAT_PUMP
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/injector
|
|
name = "Injector"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_INJECTOR
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/dp_vent
|
|
name = "Dual-Port Vent"
|
|
category = "Devices"
|
|
|
|
pipe_id = PIPE_DP_VENT
|
|
pipe_type = PIPE_UNARY
|
|
|
|
//H/E Pipes.
|
|
|
|
/datum/rcd_schematic/pipe/he
|
|
name = "Pipe"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HE_STRAIGHT
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/he_bent
|
|
name = "Bent Pipe"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HE_BENT
|
|
pipe_type = PIPE_BENT
|
|
|
|
/datum/rcd_schematic/pipe/juntion
|
|
name = "Junction"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_JUNCTION
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/heat_exchanger
|
|
name = "Heat Exchanger"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HEAT_EXCHANGE
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/he_manifold
|
|
name = "Manifold"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HE_MANIFOLD
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/he_manifold4w
|
|
name = "4-Way Manifold"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HE_MANIFOLD4W
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/he_cap
|
|
name = "Pipe Cap"
|
|
category = "Heat Exchange"
|
|
|
|
pipe_id = PIPE_HE_CAP
|
|
pipe_type = PIPE_UNARY
|
|
|
|
//INSULATED PIPES.
|
|
|
|
/datum/rcd_schematic/pipe/insulated
|
|
name = "Pipe"
|
|
category = "Insulated Pipes"
|
|
|
|
pipe_id = PIPE_INSULATED_STRAIGHT
|
|
pipe_type = PIPE_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/insulated_bent
|
|
name = "Bent Pipe"
|
|
category = "Insulated Pipes"
|
|
|
|
pipe_id = PIPE_INSULATED_BENT
|
|
pipe_type = PIPE_BENT
|
|
|
|
/datum/rcd_schematic/pipe/insulated_manifold
|
|
name = "Manifold"
|
|
category = "Insulated Pipes"
|
|
|
|
pipe_id = PIPE_INSUL_MANIFOLD
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/insulated_4w_manifold
|
|
name = "4-Way Manifold"
|
|
category = "Insulated Pipes"
|
|
|
|
pipe_id = PIPE_INSUL_MANIFOLD4W
|
|
pipe_type = PIPE_BINARY
|
|
|
|
//DISPOSAL PIPES
|
|
//Again basic straight is handled in the parent.
|
|
|
|
/datum/rcd_schematic/pipe/disposal/bent
|
|
name = "Bent Pipe"
|
|
|
|
pipe_id = DISP_PIPE_BENT
|
|
actual_id = 1
|
|
pipe_type = PIPE_UNARY //Yes this makes no sense but BLAME FUCKING DISPOSALS CODE.
|
|
|
|
/datum/rcd_schematic/pipe/disposal/junction
|
|
name = "Junction"
|
|
|
|
pipe_id = DISP_JUNCTION
|
|
actual_id = 2
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/y_junction
|
|
name = "Y-Junction"
|
|
|
|
pipe_id = DISP_YJUNCTION
|
|
actual_id = 4
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/trunk
|
|
name = "Trunk"
|
|
|
|
pipe_id = DISP_END_TRUNK
|
|
actual_id = 5
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/bin
|
|
name = "Bin"
|
|
|
|
pipe_id = DISP_END_BIN
|
|
actual_id = 6
|
|
pipe_type = PIPE_NONE //Will disable the icon.
|
|
|
|
/datum/rcd_schematic/pipe/disposal/outlet
|
|
name = "Outlet"
|
|
|
|
pipe_id = DISP_END_OUTLET
|
|
actual_id = 7
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/chute
|
|
name = "Chute"
|
|
|
|
pipe_id = DISP_END_CHUTE
|
|
actual_id = 8
|
|
pipe_type = PIPE_UNARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/sort
|
|
name = "Sorting Junction"
|
|
|
|
pipe_id = DISP_SORT_JUNCTION
|
|
actual_id = 9
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/sort_wrap
|
|
name = "Wrapped Sorting Junction"
|
|
|
|
pipe_id = DISP_SORT_WRAP_JUNCTION
|
|
actual_id = 11
|
|
pipe_type = PIPE_TRINARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/up
|
|
name = "Up Pipe"
|
|
|
|
pipe_id = DISP_PIPE_UP
|
|
actual_id = 13
|
|
pipe_type = PIPE_Z_UP_BINARY
|
|
|
|
/datum/rcd_schematic/pipe/disposal/down
|
|
name = "Down Pipe"
|
|
|
|
pipe_id = DISP_PIPE_DOWN
|
|
actual_id = 14
|
|
pipe_type = PIPE_Z_DOWN_BINARY
|