Files
Paradise/code/modules/recycling/disposal-construction.dm
T
AurorabladeandFox McCloud 476cdc3e06 Blood Refactor (#6220)
* commit for branch swap

* branch swap again

* BLEED

* trying to clear up compile errors

* i killed everything when i tested this...

* restorealltheblood

* I REMOVED A THING

* well some progress

* stop bleeding

* got to swap branches again.

* grr

* damn bloodcolors

* Squash everything

* color....colourrrrrrr

* color....colourrrrrrr

* well now that updated the branch...

* Changes

* Some tweaks..before i upload something major

* COLOR NOT COLOUR...COLOR

YES I KNOW NOT EVERYONE SPELLS IT LIKE THAT BUT MY GOD

* Foot print shit..

blood coloring is going to be PAIN

* trying to handle some colors..maybe.

* blood colorsing sucks..di i mention this?

* commenting cod malfunctions.

* Changes

* lets try this

* Its too late at night.

* blargh

* woops

* almost works...

* progress..

* Branch swap

* figured out the overlay issue....

* BRANCH SWAP

* BLARGH

* fixed merged conflicts..expect something to be horribly wrong.

* bunch of changes

* Major Fixes

 - Moved blood_state and bloodiness var definitions to
 /obj/effect/decal/cleanable/blood as well as /cleanable/Crossed(), in
 order to make blood color work properly.
   - These were not used by any other decal, so it was pointless.
 - Tweaked human/add_blood so that hand_blood_color uses the correct
 value now.
 - Corrected gibs having the wrong basecolor.
 - Tracks of different blood colors will no longer combine weirdly, and
 will instead form seperate overlays.
   - This also fixes all of the issues with tracks in general and not
   updating correctly.
 - Fixed transfering blood in add_fingerprint; the old detective code
 didn't use the new format for add_blood().
 - Fixed xenomorphs causing runtimes in makeTrail(), and gave them their
 own trails. Sprites should probably be brightened later.
 - Fixed mobs occasionally randomly having their blood_DNA list reset.

* may have accidently removed shit.

* Mrowl

* stiff

water is not bleeding
lowered trail making threshold

* tweaks then conflcits

* weee

* indent

* some tweaks

* somefox tweaks.

* derp

* why won't they bleed!?

* BLEED DAMMIT

* Flattist comments and removes simple animale blood volume

Cause i cannot get it to work right.

* PRAISE FLATTIST

* Simple animals have a blood volume now

Bug with trail fixed.

* changes

* thanksmrowlmrowl

* exotice blood trails

* makesure is an exotic bleeder has a bleed rate first...

* FoxBoxTweakSox

* BoxVoxSoXFox

* ONE MORE THING

* animalsbleedreds

* Buh? BUGH!

* thisismescreaming

* removing note needed thing

* Color changes but the rabbit hole continues.

* This is not pretty....

* wot

* IT WORKS DAMMIT

* colors.

* germaphobic commit..

* we have to use the old system

* nothing to see here

* doubleprocarady

* try to fix mulebots

* mulebot fixed

* DONE
2017-07-11 16:49:11 -04:00

270 lines
6.9 KiB
Plaintext

// Disposal pipe construction
// This is the pipe that you drag around, not the attached ones.
/obj/structure/disposalconstruct
name = "disposal pipe segment"
desc = "A huge pipe segment used for constructing disposal systems."
icon = 'icons/obj/pipes/disposal.dmi'
icon_state = "conpipe-s"
anchored = 0
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/dpdir = 0 // directions as disposalpipe
var/base_state = "pipe-s"
// update iconstate and dpdir due to dir and type
/obj/structure/disposalconstruct/proc/update()
var/flip = turn(dir, 180)
var/left = turn(dir, 90)
var/right = turn(dir, -90)
switch(ptype)
if(0)
base_state = "pipe-s"
dpdir = dir | flip
if(1)
base_state = "pipe-c"
dpdir = dir | right
if(2)
base_state = "pipe-j1"
dpdir = dir | right | flip
if(3)
base_state = "pipe-j2"
dpdir = dir | left | flip
if(4)
base_state = "pipe-y"
dpdir = dir | left | right
if(5)
base_state = "pipe-t"
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"
dpdir = dir | right | flip
if(10)
base_state = "pipe-j2s"
dpdir = dir | left | flip
if(ptype<6 || ptype>8)
icon_state = "con[base_state]"
else
icon_state = base_state
if(invisibility) // if invisible, fade icon
icon -= rgb(0,0,0,128)
// hide called by levelupdate if turf intact status changes
// change visibility status and force update of icon
/obj/structure/disposalconstruct/hide(var/intact)
invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact
update()
// flip and rotate verbs
/obj/structure/disposalconstruct/verb/rotate()
set name = "Rotate Pipe"
set src in view(1)
if(usr.stat)
return
if(anchored)
to_chat(usr, "You must unfasten the pipe before rotating it.")
return
dir = turn(dir, -90)
update()
/obj/structure/disposalconstruct/AltClick(mob/user)
if(user.incapacitated())
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!Adjacent(user))
return
rotate()
/obj/structure/disposalconstruct/verb/flip()
set name = "Flip Pipe"
set src in view(1)
if(usr.stat)
return
if(anchored)
to_chat(usr, "You must unfasten the pipe before flipping it.")
return
dir = turn(dir, 180)
switch(ptype)
if(2)
ptype = 3
if(3)
ptype = 2
if(9)
ptype = 10
if(10)
ptype = 9
update()
// returns the type path of disposalpipe corresponding to this item dtype
/obj/structure/disposalconstruct/proc/dpipetype()
switch(ptype)
if(0,1)
return /obj/structure/disposalpipe/segment
if(2,3,4)
return /obj/structure/disposalpipe/junction
if(5)
return /obj/structure/disposalpipe/trunk
if(6)
return /obj/machinery/disposal
if(7)
return /obj/structure/disposaloutlet
if(8)
return /obj/machinery/disposal/deliveryChute
if(9,10)
return /obj/structure/disposalpipe/sortjunction
return
// attackby item
// wrench: (un)anchor
// weldingtool: convert to real pipe
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user, params)
var/nicetype = "pipe"
var/ispipe = 0 // Indicates if we should change the level of this pipe
src.add_fingerprint(user)
switch(ptype)
if(6)
nicetype = "disposal bin"
if(7)
nicetype = "disposal outlet"
if(8)
nicetype = "delivery chute"
if(9, 10)
nicetype = "sorting pipe"
ispipe = 1
else
nicetype = "pipe"
ispipe = 1
var/turf/T = src.loc
if(T.intact)
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
return
if(istype(I, /obj/item/weapon/wrench))
if(anchored)
anchored = 0
if(ispipe)
level = 2
density = 0
else
density = 1
to_chat(user, "You detach the [nicetype] from the underfloor.")
else
anchored = 1
if(ispipe)
level = 1 // We don't want disposal bins to disappear under the floors
density = 0
else
density = 1 // We don't want disposal bins or outlets to go density 0
to_chat(user, "You attach the [nicetype] to the underfloor.")
playsound(src.loc, I.usesound, 100, 1)
update()
return
var/obj/structure/disposalpipe/CP = locate() in T
if(ptype>=6 && ptype <= 8) // 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.")
return
else // Nothing under, fuck.
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
return
else
if(CP)
update()
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
to_chat(user, "There is already a [nicetype] at that location.")
return
if(istype(I, /obj/item/weapon/weldingtool))
if(anchored)
var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, W.usesound, 100, 1)
to_chat(user, "Welding the [nicetype] in place.")
if(do_after(user, 20 * W.toolspeed, target = src))
if(!src || !W.isOn()) return
to_chat(user, "The [nicetype] has been welded in place!")
update() // TODO: Make this neat
if(ispipe) // Pipe
var/pipetype = dpipetype()
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
src.transfer_fingerprints_to(P)
P.base_icon_state = base_state
P.dir = dir
P.dpdir = dpdir
P.update_icon()
//Needs some special treatment ;)
if(ptype==9 || ptype==10)
var/obj/structure/disposalpipe/sortjunction/SortP = P
SortP.updatedir()
else if(ptype==6) // 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
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
src.transfer_fingerprints_to(P)
P.dir = dir
var/obj/structure/disposalpipe/trunk/Trunk = CP
Trunk.linked = P
else if(ptype==8) // Disposal outlet
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
src.transfer_fingerprints_to(P)
P.dir = dir
qdel(src)
return
else
to_chat(user, "You need more welding fuel to complete this task.")
return
else
to_chat(user, "You need to attach it to the plating first!")
return