TG: Revolutionary update!

You can now dispense Disposal Bins, Outlets and Chutes from the disposal
dispenser. These are movable and you can attach them above open trunks with a
wrench, then weld them to attach them completely.
You can remove Bins by turning off their pump, then screwdriver, then weld, then
wrench. Same with outlet and chute except for the pump part.
Revision: r3690
Author: 	 daniel.cf.hultgren
This commit is contained in:
Erthilo
2012-06-02 15:45:58 +01:00
parent bb820f06ef
commit 20fcd32f68
6 changed files with 271 additions and 68 deletions

View File

@@ -119,8 +119,11 @@
<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'>Sort Junction 1</A><BR>
<A href='?src=\ref[src];dmake=6'>Sort Junction 2</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=8'>Sort Junction 1</A><BR>
<A href='?src=\ref[src];dmake=9'>Sort Junction 2</A><BR>
"}
user << browse("<HEAD><TITLE>[src]</TITLE></HEAD><TT>[dat]</TT>", "window=pipedispenser")
@@ -154,8 +157,17 @@
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 = 8
if(9)
C.ptype = 9
C.update()
wait = 1

View File

@@ -1,4 +1,5 @@
// Disposal pipe construction
// This is the pipe that you drag around, not the attached ones.
/obj/structure/disposalconstruct
@@ -12,7 +13,7 @@
m_amt = 1850
level = 2
var/ptype = 0
// 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk, 6=junction-j1s, 7=junction-j2s
// 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk, 6=disposal bin, 7=outlet, 8=inlet, 9=junction-j1s, 10=junction-j2s
var/dpdir = 0 // directions as disposalpipe
var/base_state = "pipe-s"
@@ -42,15 +43,32 @@
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(7)
if(10)
base_state = "pipe-j2s"
dpdir = dir | left | flip
icon_state = "con[base_state]"
if(ptype<6 && ptype != 9 && ptype != 10)
icon_state = "con[base_state]"
else
icon_state = base_state
if(invisibility) // if invisible, fade icon
icon -= rgb(0,0,0,128)
@@ -99,7 +117,13 @@
return /obj/structure/disposalpipe/junction
if(5)
return /obj/structure/disposalpipe/trunk
if(6,7)
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
@@ -110,57 +134,98 @@
// weldingtool: convert to real pipe
attackby(var/obj/item/I, var/mob/user)
var/nicetype = "pipe"
var/ispipe = 0 // Indicates if we should change the level of this pipe
switch(ptype)
if(6)
nicetype = "disposal bin"
if(7)
nicetype = "disposal outlet"
if(8)
nicetype = "delivery chute"
else
nicetype = "pipe"
ispipe = 1
var/turf/T = src.loc
if(T.intact)
user << "You can only attach the pipe if the floor plating is removed."
user << "You can only attach the [nicetype] if the floor plating is removed."
return
var/obj/structure/disposalpipe/CP = locate() in T
if(CP)
update()
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
user << "There is already a pipe at that location."
if(ptype>=6 && ptype != 9 && ptype != 10) // Disposal or outlet
if(CP) // There's something there
if(!istype(CP,/obj/structure/disposalpipe/trunk))
user << "The [nicetype] requires a trunk underneath it in order to work."
return
else // Nothing under, fuck.
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)
user << "There is already a [nicetype] at that location."
return
var/obj/structure/disposalpipe/trunk/Trunk = CP
if(istype(I, /obj/item/weapon/wrench))
if(anchored)
anchored = 0
level = 2
density = 1
user << "You detach the pipe from the underfloor."
if(ispipe)
level = 2
density = 0
else
density = 1
user << "You detach the [nicetype] from the underfloor."
else
anchored = 1
level = 1
density = 0
user << "You attach the pipe to the underfloor."
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
user << "You attach the [nicetype] to the underfloor."
playsound(src.loc, 'Ratchet.ogg', 100, 1)
update()
else if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "Welding the pipe in place."
user << "Welding the [nicetype] in place."
W:welding = 2
if(do_after(user, 20))
update()
var/pipetype = dpipetype()
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
P.base_icon_state = base_state
P.dir = dir
if(ptype >= 6)
var/obj/structure/disposalpipe/sortjunction/V = P
V.posdir = dir
if(ptype == 6)
V.sortdir = turn(dir, -90)
V.negdir = turn(dir, 180)
else
V.sortdir = turn(dir, 90)
V.negdir = turn(dir, 180)
P.dpdir = dpdir
P.updateicon()
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)
P.base_icon_state = base_state
P.dir = dir
P.dpdir = dpdir
P.updateicon()
else if(ptype==6) // Disposal bin
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
P.mode = 0 // start with pump off
else if(ptype==7) // Disposal outlet
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
P.dir = dir
Trunk.linked = P
else if(ptype==8) // Disposal outlet
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
P.dir = dir
del(src)
return
W:welding = 1

View File

@@ -1,5 +1,3 @@
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:05
// Disposal bin
// Holds items for disposal into pipe system
// Draws air from turf, gradually charges internal reservoir
@@ -49,6 +47,37 @@
if(isrobot(user) && !istype(I, /obj/item/weapon/trashbag))
return
if(mode<=0) // It's off
if(istype(I, /obj/item/weapon/screwdriver))
if(mode==0) // It's off but still not unscrewed
mode=-1 // Set it to doubleoff l0l
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You remove the screws around the power connection."
return
else if(mode==-1)
mode=0
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You attach the screws around the power connection."
return
else if(istype(I,/obj/item/weapon/weldingtool) && mode==-1)
var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the disposal unit."
W:welding = 2
if(do_after(user,20))
user << "You sliced the floorweld off the disposal unit."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 6 // 6 = disposal unit
C.anchored = 1
C.density = 1
C.update()
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."
return
if(istype(I, /obj/item/weapon/melee/energy/blade))
user << "You can't place that item inside the disposal unit."
@@ -72,26 +101,6 @@
update()
return
if(istype(I, /obj/item/weapon/weldingtool) && I:welding)
var/obj/item/weapon/weldingtool/W = I
playsound(src.loc, 'Welder.ogg', 100, 1)
var/turf/T = get_turf(user)
user.visible_message("[user] welds apart the disposal.", "You start to weld apart the disposal.")
sleep(40)
if(get_turf(user) == T && W.remove_fuel(2,user))
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(loc)
M.state = 2
M.icon_state = "box_1"
for(var/obj/O in component_parts)
if(O.reliability != 100 && crit_fail)
O.crit_fail = 1
O.loc = src.loc
// the stuff still in the disposal
for(var/obj/O in src)
O.loc = src.loc
del(src)
return
var/obj/item/weapon/grab/G = I
if(istype(G)) // handle grabbed mob
if(ismob(G.affecting))
@@ -104,13 +113,11 @@
GM.client.eye = src
GM.loc = src
for (var/mob/C in viewers(src))
log_attack("<font color='red'>[usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.</font>")
log_admin("ATTACK: [usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.")
// message_admins("ATTACK: [usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.")
C.show_message("\red [GM.name] has been placed in the [src] by [user].", 3)
del(G)
log_attack("<font color='red'>[usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.</font>")
log_admin("ATTACK: [usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.")
message_admins("ATTACK: [usr] ([usr.ckey]) placed [GM] ([GM.ckey]) in a disposals unit.")
else
if(!I || isnull(I))
//CRASH("disposal/attackby() was called, but I was nulled before calling user.drop_item()")
@@ -258,6 +265,11 @@
if(user && user.loc == src)
usr << "\red You cannot reach the controls from inside."
return
/*
if(mode==-1)
usr << "\red The disposal units power is disabled."
return
*/
interact(user, 0)
// user interaction
@@ -278,7 +290,7 @@
dat += "<BR><HR><A href='?src=\ref[src];eject=1'>Eject contents</A><HR>"
if(mode == 0)
if(mode <= 0)
dat += "Pump: <B>Off</B> <A href='?src=\ref[src];pump=1'>On</A><BR>"
else if(mode == 1)
dat += "Pump: <A href='?src=\ref[src];pump=0'>Off</A> <B>On</B> (pressurizing)<BR>"
@@ -300,6 +312,10 @@
if(usr.loc == src)
usr << "\red You cannot reach the controls from inside."
return
if(mode==-1 && !href_list["eject"]) // only allow ejecting if mode is -1
usr << "\red The disposal units power is disabled."
return
..()
src.add_fingerprint(usr)
if(stat & BROKEN)
@@ -356,7 +372,7 @@
overlays += image('disposal.dmi', "dispover-handle")
// only handle is shown if no power
if(stat & NOPOWER)
if(stat & NOPOWER || mode == -1)
return
// check for items in disposal - occupied light
@@ -375,6 +391,10 @@
if(stat & BROKEN) // nothing can happen if broken
return
if(!air_contents) // Potentially causes a runtime otherwise (if this is really shitty, blame pete //Donkie)
return
if(length(src.contents) > 0)
if(timeleft == 0)
flush = 1
@@ -913,6 +933,8 @@
C.ptype = 5
C.dir = dir
C.density = 0
C.anchored = 1
C.update()
del(src)
@@ -1245,6 +1267,37 @@
update()
return
// Override attackby so we disallow trunkremoval when somethings ontop
attackby(var/obj/item/I, var/mob/user)
if(linked != null)
return
var/turf/T = src.loc
if(T.intact)
return // prevent interaction with T-scanner revealed pipes
if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = I
if(W.welding)
if(W.remove_fuel(0,user))
W:welding = 2
playsound(src.loc, 'Welder2.ogg', 100, 1)
// check if anything changed over 2 seconds
var/turf/uloc = user.loc
var/atom/wloc = W.loc
user << "Slicing the disposal pipe."
sleep(30)
if(user.loc == uloc && wloc == W.loc)
welded()
else
user << "You must stay still while welding the pipe."
W:welding = 1
else
user << "You need more welding fuel to cut the pipe."
return
// would transfer to next pipe segment, but we are in a trunk
// if not entering from disposal bin,
// transfer to linked object (outlet or bin)
@@ -1306,6 +1359,7 @@
anchored = 1
var/active = 0
var/turf/target // this will be where the output objects are 'thrown' to.
var/mode = 0
var/playing_sound = 0
var/playing_buzzer = 0
@@ -1338,13 +1392,47 @@
for(var/atom/movable/AM in H)
AM.loc = src.loc
AM.pipe_eject(dir)
spawn(1)
spawn(5)
AM.throw_at(target, 3, 1)
H.vent_gas(src.loc)
del(H)
return
attackby(var/obj/item/I, var/mob/user)
if(!I || !user)
return
if(istype(I, /obj/item/weapon/screwdriver))
if(mode==0)
mode=1
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You remove the screws around the power connection."
return
else if(mode==1)
mode=0
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You attach the screws around the power connection."
return
else if(istype(I,/obj/item/weapon/weldingtool) && mode==1)
var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the disposal outlet."
W:welding = 2
if(do_after(user,20))
user << "You sliced the floorweld off the disposal outlet."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 7 // 7 = outlet
C.update()
C.anchored = 1
C.density = 1
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."
return

View File

@@ -361,9 +361,13 @@
var/currentlyFlushing = 0
var/defaultDestination = "Disposals"
var/c_mode = 0
interact()
return
update()
return
HasEntered(AM as mob|obj) //Go straight into the chute
if (istype(AM, /obj))
var/obj/O = AM
@@ -414,6 +418,41 @@
update()
return
attackby(var/obj/item/I, var/mob/user)
if(!I || !user)
return
if(istype(I, /obj/item/weapon/screwdriver))
if(c_mode==0)
c_mode=1
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You remove the screws around the power connection."
return
else if(c_mode==1)
c_mode=0
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "You attach the screws around the power connection."
return
else if(istype(I,/obj/item/weapon/weldingtool) && c_mode==1)
var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the delivery chute."
W:welding = 2
if(do_after(user,20))
user << "You sliced the floorweld off the delivery chute."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 8 // 8 = Delivery chute
C.update()
C.anchored = 1
C.density = 1
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."
return
CanPass(atom/A, turf/T)
if(istype(A, /mob/living)) // You Shall Get Sucked In And Killed!
var/mob/living/M = A