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

@@ -205,7 +205,6 @@
#define FILE_DIR "icons/vending_icons" #define FILE_DIR "icons/vending_icons"
#define FILE_DIR "interface" #define FILE_DIR "interface"
#define FILE_DIR "maps" #define FILE_DIR "maps"
#define FILE_DIR "maps/backup"
#define FILE_DIR "maps/RandomZLevels" #define FILE_DIR "maps/RandomZLevels"
#define FILE_DIR "sound" #define FILE_DIR "sound"
#define FILE_DIR "sound/AI" #define FILE_DIR "sound/AI"

View File

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

View File

@@ -1,4 +1,5 @@
// Disposal pipe construction // Disposal pipe construction
// This is the pipe that you drag around, not the attached ones.
/obj/structure/disposalconstruct /obj/structure/disposalconstruct
@@ -12,7 +13,7 @@
m_amt = 1850 m_amt = 1850
level = 2 level = 2
var/ptype = 0 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/dpdir = 0 // directions as disposalpipe
var/base_state = "pipe-s" var/base_state = "pipe-s"
@@ -42,15 +43,32 @@
if(5) if(5)
base_state = "pipe-t" base_state = "pipe-t"
dpdir = dir dpdir = dir
// disposal bin has only one dir, thus we don't need to care about setting it
if(6) 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" base_state = "pipe-j1s"
dpdir = dir | right | flip dpdir = dir | right | flip
if(7) if(10)
base_state = "pipe-j2s" base_state = "pipe-j2s"
dpdir = dir | left | flip 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 if(invisibility) // if invisible, fade icon
icon -= rgb(0,0,0,128) icon -= rgb(0,0,0,128)
@@ -99,7 +117,13 @@
return /obj/structure/disposalpipe/junction return /obj/structure/disposalpipe/junction
if(5) if(5)
return /obj/structure/disposalpipe/trunk 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 /obj/structure/disposalpipe/sortjunction
return return
@@ -110,57 +134,98 @@
// weldingtool: convert to real pipe // weldingtool: convert to real pipe
attackby(var/obj/item/I, var/mob/user) 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 var/turf/T = src.loc
if(T.intact) 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 return
var/obj/structure/disposalpipe/CP = locate() in T var/obj/structure/disposalpipe/CP = locate() in T
if(CP) if(ptype>=6 && ptype != 9 && ptype != 10) // Disposal or outlet
update() if(CP) // There's something there
var/pdir = CP.dpdir if(!istype(CP,/obj/structure/disposalpipe/trunk))
if(istype(CP, /obj/structure/disposalpipe/broken)) user << "The [nicetype] requires a trunk underneath it in order to work."
pdir = CP.dir return
if(pdir & dpdir) else // Nothing under, fuck.
user << "There is already a pipe at that location." user << "The [nicetype] requires a trunk underneath it in order to work."
return 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(istype(I, /obj/item/weapon/wrench))
if(anchored) if(anchored)
anchored = 0 anchored = 0
level = 2 if(ispipe)
density = 1 level = 2
user << "You detach the pipe from the underfloor." density = 0
else
density = 1
user << "You detach the [nicetype] from the underfloor."
else else
anchored = 1 anchored = 1
level = 1 if(ispipe)
density = 0 level = 1 // We don't want disposal bins to disappear under the floors
user << "You attach the pipe to the underfloor." 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) playsound(src.loc, 'Ratchet.ogg', 100, 1)
update()
else if(istype(I, /obj/item/weapon/weldingtool)) else if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = I var/obj/item/weapon/weldingtool/W = I
if(W.remove_fuel(0,user)) if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1) playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "Welding the pipe in place." user << "Welding the [nicetype] in place."
W:welding = 2 W:welding = 2
if(do_after(user, 20)) if(do_after(user, 20))
update() user << "The [nicetype] has been welded in place!"
var/pipetype = dpipetype() update() // TODO: Make this neat
var/obj/structure/disposalpipe/P = new pipetype(src.loc) if(ispipe) // Pipe
P.base_icon_state = base_state
P.dir = dir var/pipetype = dpipetype()
if(ptype >= 6) var/obj/structure/disposalpipe/P = new pipetype(src.loc)
var/obj/structure/disposalpipe/sortjunction/V = P P.base_icon_state = base_state
V.posdir = dir P.dir = dir
if(ptype == 6) P.dpdir = dpdir
V.sortdir = turn(dir, -90) P.updateicon()
V.negdir = turn(dir, 180)
else else if(ptype==6) // Disposal bin
V.sortdir = turn(dir, 90) var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
V.negdir = turn(dir, 180) P.mode = 0 // start with pump off
P.dpdir = dpdir
P.updateicon() 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) del(src)
return return
W:welding = 1 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 // Disposal bin
// Holds items for disposal into pipe system // Holds items for disposal into pipe system
// Draws air from turf, gradually charges internal reservoir // Draws air from turf, gradually charges internal reservoir
@@ -49,6 +47,37 @@
if(isrobot(user) && !istype(I, /obj/item/weapon/trashbag)) if(isrobot(user) && !istype(I, /obj/item/weapon/trashbag))
return 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)) if(istype(I, /obj/item/weapon/melee/energy/blade))
user << "You can't place that item inside the disposal unit." user << "You can't place that item inside the disposal unit."
@@ -72,26 +101,6 @@
update() update()
return 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 var/obj/item/weapon/grab/G = I
if(istype(G)) // handle grabbed mob if(istype(G)) // handle grabbed mob
if(ismob(G.affecting)) if(ismob(G.affecting))
@@ -104,13 +113,11 @@
GM.client.eye = src GM.client.eye = src
GM.loc = src GM.loc = src
for (var/mob/C in viewers(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) C.show_message("\red [GM.name] has been placed in the [src] by [user].", 3)
del(G) 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 else
if(!I || isnull(I)) if(!I || isnull(I))
//CRASH("disposal/attackby() was called, but I was nulled before calling user.drop_item()") //CRASH("disposal/attackby() was called, but I was nulled before calling user.drop_item()")
@@ -258,6 +265,11 @@
if(user && user.loc == src) if(user && user.loc == src)
usr << "\red You cannot reach the controls from inside." usr << "\red You cannot reach the controls from inside."
return return
/*
if(mode==-1)
usr << "\red The disposal units power is disabled."
return
*/
interact(user, 0) interact(user, 0)
// user interaction // user interaction
@@ -278,7 +290,7 @@
dat += "<BR><HR><A href='?src=\ref[src];eject=1'>Eject contents</A><HR>" 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>" dat += "Pump: <B>Off</B> <A href='?src=\ref[src];pump=1'>On</A><BR>"
else if(mode == 1) else if(mode == 1)
dat += "Pump: <A href='?src=\ref[src];pump=0'>Off</A> <B>On</B> (pressurizing)<BR>" dat += "Pump: <A href='?src=\ref[src];pump=0'>Off</A> <B>On</B> (pressurizing)<BR>"
@@ -300,6 +312,10 @@
if(usr.loc == src) if(usr.loc == src)
usr << "\red You cannot reach the controls from inside." usr << "\red You cannot reach the controls from inside."
return 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) src.add_fingerprint(usr)
if(stat & BROKEN) if(stat & BROKEN)
@@ -356,7 +372,7 @@
overlays += image('disposal.dmi', "dispover-handle") overlays += image('disposal.dmi', "dispover-handle")
// only handle is shown if no power // only handle is shown if no power
if(stat & NOPOWER) if(stat & NOPOWER || mode == -1)
return return
// check for items in disposal - occupied light // check for items in disposal - occupied light
@@ -375,6 +391,10 @@
if(stat & BROKEN) // nothing can happen if broken if(stat & BROKEN) // nothing can happen if broken
return return
if(!air_contents) // Potentially causes a runtime otherwise (if this is really shitty, blame pete //Donkie)
return
if(length(src.contents) > 0) if(length(src.contents) > 0)
if(timeleft == 0) if(timeleft == 0)
flush = 1 flush = 1
@@ -913,6 +933,8 @@
C.ptype = 5 C.ptype = 5
C.dir = dir C.dir = dir
C.density = 0
C.anchored = 1
C.update() C.update()
del(src) del(src)
@@ -1245,6 +1267,37 @@
update() update()
return 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 // would transfer to next pipe segment, but we are in a trunk
// if not entering from disposal bin, // if not entering from disposal bin,
// transfer to linked object (outlet or bin) // transfer to linked object (outlet or bin)
@@ -1306,6 +1359,7 @@
anchored = 1 anchored = 1
var/active = 0 var/active = 0
var/turf/target // this will be where the output objects are 'thrown' to. var/turf/target // this will be where the output objects are 'thrown' to.
var/mode = 0
var/playing_sound = 0 var/playing_sound = 0
var/playing_buzzer = 0 var/playing_buzzer = 0
@@ -1338,13 +1392,47 @@
for(var/atom/movable/AM in H) for(var/atom/movable/AM in H)
AM.loc = src.loc AM.loc = src.loc
AM.pipe_eject(dir) AM.pipe_eject(dir)
spawn(1) spawn(5)
AM.throw_at(target, 3, 1) AM.throw_at(target, 3, 1)
H.vent_gas(src.loc) H.vent_gas(src.loc)
del(H) del(H)
return 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/currentlyFlushing = 0
var/defaultDestination = "Disposals" var/defaultDestination = "Disposals"
var/c_mode = 0
interact() interact()
return return
update()
return
HasEntered(AM as mob|obj) //Go straight into the chute HasEntered(AM as mob|obj) //Go straight into the chute
if (istype(AM, /obj)) if (istype(AM, /obj))
var/obj/O = AM var/obj/O = AM
@@ -414,6 +418,41 @@
update() update()
return 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) CanPass(atom/A, turf/T)
if(istype(A, /mob/living)) // You Shall Get Sucked In And Killed! if(istype(A, /mob/living)) // You Shall Get Sucked In And Killed!
var/mob/living/M = A var/mob/living/M = A

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 112 KiB