Files
vgstation13/code/ATMOSPHERICS/pipe/pipe_dispenser.dm
kane-f 84bf965ae8 Multi-z 3: With a vengeance (#30178)
* 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>
2021-08-27 08:14:13 -05:00

274 lines
9.1 KiB
Plaintext

/obj/machinery/pipedispenser
name = "Pipe Dispenser"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "pipe_d"
density = 1
anchored = 1
var/wait = 0
machine_flags = WRENCHMOVE | FIXED2WORK
var/layer_to_make = PIPING_LAYER_DEFAULT
/********************************************************************
** Adding Stock Parts to VV so preconstructed shit has its candy **
********************************************************************/
/obj/machinery/pipedispenser/New()
. = ..()
component_parts = newlist(
/obj/item/weapon/circuitboard/pipedispenser,
/obj/item/weapon/stock_parts/matter_bin,
/obj/item/weapon/stock_parts/matter_bin,
/obj/item/weapon/stock_parts/capacitor,
/obj/item/weapon/stock_parts/scanning_module,
/obj/item/weapon/stock_parts/scanning_module,
/obj/item/weapon/stock_parts/manipulator,
/obj/item/weapon/stock_parts/manipulator
)
RefreshParts()
/obj/machinery/pipedispenser/attack_hand(user as mob)
if(..())
return
interact(user)
/obj/machinery/pipedispenser/interact(mob/user)
var/multi_z_dat = map.multiz ? {"
<b>Multi-floor pipes:</b>
<ul>
<li><a href='?src=\ref[src];make=[PIPE_Z_UP];dir=1'>Up Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_Z_DOWN];dir=1'>Down Pipe</a></li>
</ul>"} : ""
var/dat = {"
<b>Regular pipes:</b>
<ul>
<li><a href='?src=\ref[src];make=[PIPE_SIMPLE_STRAIGHT];dir=1'>Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_SIMPLE_BENT];dir=5'>Bent Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_MANIFOLD];dir=1'>Manifold</a></li>
<li><a href='?src=\ref[src];make=[PIPE_MVALVE];dir=1'>Manual Valve</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DVALVE];dir=1'>Digital Valve</a></li>
<li><a href='?src=\ref[src];make=[PIPE_CAP];dir=1'>Pipe Cap</a></li>
<li><a href='?src=\ref[src];make=[PIPE_MANIFOLD4W];dir=1'>4-Way Manifold</a></li>
<li><a href='?src=\ref[src];make=[PIPE_MTVALVE];dir=1'>Manual T-Valve</a></li>
<li><a href='?src=\ref[src];make=[PIPE_MTVALVE];dir=9'>Manual T-Valve \[M]</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DTVALVE];dir=1'>Digital T-Valve</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DTVALVE];dir=9'>Digital T-Valve \[M]</a></li>
<li><a href='?src=\ref[src];make=[PIPE_LAYER_MANIFOLD];dir=1'>Layer Manifold</a></li>
<li><a href='?src=\ref[src];make=[PIPE_LAYER_ADAPTER];dir=1'>Layer Adapter</a></li>
</ul>
<b>Devices:</b>
<ul>
<li><a href='?src=\ref[src];make=[PIPE_CONNECTOR];dir=1'>Connector</a></li>
<li><a href='?src=\ref[src];make=[PIPE_UVENT];dir=1'>Unary Vent</a></li>
<li><a href='?src=\ref[src];make=[PIPE_PASV_VENT];dir=1'>Passive Vent</a></li>
<li><a href='?src=\ref[src];make=[PIPE_PUMP];dir=1'>Gas Pump</a></li>
<li><a href='?src=\ref[src];make=[PIPE_PASSIVE_GATE];dir=1'>Passive Gate</a></li>
<li><a href='?src=\ref[src];make=[PIPE_VOLUME_PUMP];dir=1'>Volume Pump</a></li>
<li><a href='?src=\ref[src];make=[PIPE_SCRUBBER];dir=1'>Scrubber</a></li>
<li><a href='?src=\ref[src];makemeter=1'>Meter</a></li>
<li><a href='?src=\ref[src];makegsensor=1'>Gas Sensor</a></li>
<li><a href='?src=\ref[src];make=[PIPE_GAS_FILTER];dir=1'>Gas Filter</a></li>
<li><a href='?src=\ref[src];make=[PIPE_GAS_FILTER];dir=9'>Gas Filter \[M]</a></li>
<li><a href='?src=\ref[src];make=[PIPE_GAS_MIXER];dir=1'>Gas Mixer</a></li>
<li><a href='?src=\ref[src];make=[PIPE_GAS_MIXER];dir=9'>Gas Mixer \[M]</a></li>
<li><a href='?src=\ref[src];make=[PIPE_THERMAL_PLATE];dir=1'>Thermal Plate</a></li>
<li><a href='?src=\ref[src];make=[PIPE_INJECTOR];dir=1'>Injector</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DP_VENT];dir=1'>Dual-Port Vent</a></li>
</ul>
<b>Heat exchange:</b>
<ul>
<li><a href='?src=\ref[src];make=[PIPE_HE_STRAIGHT];dir=1'>Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_HE_BENT];dir=5'>Bent Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_JUNCTION];dir=1'>Junction</a></li>
<li><a href='?src=\ref[src];make=[PIPE_HEAT_EXCHANGE];dir=1'>Heat Exchanger</a></li>
<li><a href='?src=\ref[src];make=[PIPE_HE_CAP];dir=1'>Pipe Cap</a></li>
</ul>
<b>Insulated pipes:</b>
<ul>
<li><a href='?src=\ref[src];make=[PIPE_INSULATED_STRAIGHT];dir=1'>Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_INSULATED_BENT];dir=5'>Bent Pipe</a></li>
<li><a href='?src=\ref[src];make=[PIPE_INSUL_MANIFOLD];dir=1'>Manifold</a></li>
<li><a href='?src=\ref[src];make=[PIPE_INSUL_MANIFOLD4W];dir=1'>4-Way Manifold</a></li>
</ul>
[multi_z_dat]
<b> Currently aligned at: [layer_to_make] \[ <a href='?src=\ref[src];editlayer=1'>EDIT</a> \]</b></li>
"}
//What number the make points to is in the define # at the top of construction.dm in same folder
user << browse("<HEAD><TITLE>[src]</TITLE></HEAD><TT>[dat]</TT>", "window=pipedispenser")
onclose(user, "pipedispenser")
return
/obj/machinery/pipedispenser/Topic(href, href_list)
if(..())
usr << browse(null, "window=pipedispenser")
return 1
if(!anchored)
usr << browse(null, "window=pipedispenser")
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["make"])
if(!wait)
var/p_type = text2num(href_list["make"])
var/p_dir = text2num(href_list["dir"])
var/obj/item/pipe/P = new /obj/item/pipe(get_turf(src), pipe_type = p_type, dir = p_dir)
P.setPipingLayer(layer_to_make)
P.update()
P.add_fingerprint(usr)
wait = 1
spawn(10)
wait = 0
if(href_list["makemeter"])
if(!wait)
new /obj/item/pipe_meter(/*usr.loc*/ src.loc)
wait = 1
spawn(15)
wait = 0
if(href_list["makegsensor"])
if(!wait)
new /obj/item/pipe_gsensor(/*usr.loc*/ src.loc)
wait = 1
spawn(15)
wait = 0
if(href_list["editlayer"])
if(!wait)
var/num_input = input(usr, "Alignment", "Calibrate Dispenser", "") as num
num_input = clamp(round(num_input, PIPING_LAYER_INCREMENT), PIPING_LAYER_MIN, PIPING_LAYER_MAX)
layer_to_make = num_input
interact(usr)
return
/obj/machinery/pipedispenser/attackby(var/obj/item/W as obj, var/mob/user as mob)
src.add_fingerprint(usr)
if (istype(W, /obj/item/pipe) || istype(W, /obj/item/pipe_meter) || istype(W, /obj/item/pipe_gsensor))
if(user.drop_item(W, src))
to_chat(usr, "<span class='notice'>You put [W] back to [src].</span>")
if(istype(W, /obj/item/pipe))
qdel(W)
else
qdel(W)
return
else
return ..()
/obj/machinery/pipedispenser/wrenchAnchor(var/mob/user, var/obj/item/I)
. = ..()
if(!.)
return
if(anchored)
src.stat &= ~MAINT
power_change()
else
src.stat |= MAINT
if (user.machine==src)
user << browse(null, "window=pipedispenser")
/obj/machinery/pipedispenser/disposal
name = "Disposal Pipe Dispenser"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "pipe_d"
density = 1
anchored = 1.0
/obj/machinery/pipedispenser/disposal/New()
. = ..()
component_parts = newlist(
/obj/item/weapon/circuitboard/pipedispenser/disposal,
/obj/item/weapon/stock_parts/matter_bin,
/obj/item/weapon/stock_parts/matter_bin,
/obj/item/weapon/stock_parts/capacitor,
/obj/item/weapon/stock_parts/scanning_module,
/obj/item/weapon/stock_parts/scanning_module,
/obj/item/weapon/stock_parts/manipulator,
/obj/item/weapon/stock_parts/manipulator
)
RefreshParts()
/*
//Allow you to push disposal pipes into it (for those with density 1)
/obj/machinery/pipedispenser/disposal/Crossed(var/obj/structure/disposalconstruct/pipe as obj)
if(istype(pipe) && !pipe.anchored)
del(pipe)
Nah
*/
//Allow you to drag-drop disposal pipes into it
/obj/machinery/pipedispenser/disposal/MouseDropTo(var/obj/structure/disposalconstruct/pipe, mob/usr)
if(!usr.canmove || usr.stat || usr.restrained())
return
if (!istype(pipe) || get_dist(usr, src) > 1 || get_dist(src,pipe) > 2 )
return
if (pipe.anchored)
return
qdel(pipe)
/obj/machinery/pipedispenser/disposal/attack_hand(user as mob)
if(..())
return
var/dat = {"<b>Disposal Pipes</b><br><br>
<A href='?src=\ref[src];dmake=[DISP_PIPE_STRAIGHT]'>Pipe</A><BR>
<A href='?src=\ref[src];dmake=[DISP_PIPE_BENT]'>Bent Pipe</A><BR>
<A href='?src=\ref[src];dmake=[DISP_JUNCTION]'>Junction</A><BR>
<A href='?src=\ref[src];dmake=[DISP_YJUNCTION]'>Y-Junction</A><BR>
<A href='?src=\ref[src];dmake=[DISP_END_TRUNK]'>Trunk</A><BR>
<A href='?src=\ref[src];dmake=[DISP_END_BIN]'>Bin</A><BR>
<A href='?src=\ref[src];dmake=[DISP_END_OUTLET]'>Outlet</A><BR>
<A href='?src=\ref[src];dmake=[DISP_END_CHUTE]'>Chute</A><BR>
"}
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)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["dmake"])
if(!anchored || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
usr << browse(null, "window=pipedispenser")
return
if(!wait)
var/p_type = text2num(href_list["dmake"])
var/obj/structure/disposalconstruct/C = new (src.loc)
switch(p_type)
if(0)
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.setDensity(TRUE)
if(6)
C.ptype = 7
C.setDensity(TRUE)
if(7)
C.ptype = 8
C.setDensity(TRUE)
C.add_fingerprint(usr)
C.update()
wait = 1
spawn(15)
wait = 0
return