Updated toilets, urinals, and showers with NEW features.

The shower path has changed!
From /obj/structure/shower to /obj/machinery/shower

Made bookcases appear empty if they have no books, and fill up as more books are placed in them.

Updated do_after() to have an extra var that determines if the user is required to keep the item in the active hand. This is only used in swirlies at the moment.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3684 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
petethegoat@gmail.com
2012-05-27 16:31:08 +00:00
parent aff56113a4
commit f2f3c6bebf
5 changed files with 159 additions and 73 deletions
+6 -3
View File
@@ -1301,8 +1301,8 @@ proc/listclearnulls(list/list)
return 1
*/
/proc/do_after(var/mob/user as mob, delay as num, var/numticks = 5) // Replacing the upper one with this one because Byond keeps feeling that the upper one is an infinate loop
if(!user || isnull(user)) // This one should have less temptation
/proc/do_after(var/mob/user as mob, delay as num, var/numticks = 5, var/needhand = 1) // Replacing the upper one with this one because Byond keeps feeling that the upper one is an infinate loop
if(!user || isnull(user)) // This one should have less temptation
return 0
if(numticks == 0)
return 0
@@ -1313,7 +1313,10 @@ proc/listclearnulls(list/list)
for(var/i = 0, i<numticks, i++)
sleep(delayfraction)
if(!user || user.stat || user.weakened || user.stunned || !(user.loc == T) || !(user.equipped() == holding))
if(needhand && !(user.equipped() == holding)) //Sometimes you don't want the user to have to keep their active hand
return 0
if(!user || user.stat || user.weakened || user.stunned || !(user.loc == T))
return 0
return 1
+54 -51
View File
@@ -74,62 +74,63 @@
/obj/structure/bookcase
name = "bookcase"
icon = 'library.dmi'
icon_state = "bookcase"
icon_state = "book-0"
anchored = 1
density = 1
opacity = 1
attackby(obj/O as obj, mob/user as mob)
if(istype(O, /obj/item/weapon/book))
user.drop_item()
O.loc = src
else if(istype(O, /obj/item/weapon/pen))
var/newname = copytext(sanitize(input("What would you like to title this bookshelf?") as text|null),1,MAX_MESSAGE_LEN)
if(!newname)
return
else
src.setname(sanitize(newname))
/obj/structure/bookcase/attackby(obj/O as obj, mob/user as mob)
if(istype(O, /obj/item/weapon/book))
user.drop_item()
O.loc = src
update_icon()
else if(istype(O, /obj/item/weapon/pen))
var/newname = copytext(sanitize(input("What would you like to title this bookshelf?") as text|null),1,MAX_MESSAGE_LEN)
if(!newname)
return
else
..()
attack_hand(var/mob/user as mob)
var/list/books = list()
for(var/obj/item/weapon/book/b in src.contents)
books.Add(b)
if(books.len)
var/obj/item/weapon/book/choice = input("Which book would you like to remove from the shelf?") in books as obj|null
if(choice)
choice.loc = src.loc
name = ("bookcase ([sanitize(newname)])")
else
..()
/obj/structure/bookcase/attack_hand(var/mob/user as mob)
if(contents.len)
var/obj/item/weapon/book/choice = input("Which book would you like to remove from the shelf?") in contents as obj|null
if(choice)
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hand(choice)
else
return
choice.loc = get_turf(src)
update_icon()
/obj/structure/bookcase/ex_act(severity)
switch(severity)
if(1.0)
for(var/obj/item/weapon/book/b in contents)
del(b)
del(src)
return
if(2.0)
for(var/obj/item/weapon/book/b in contents)
if (prob(50)) b.loc = (get_turf(src))
else del(b)
del(src)
return
if(3.0)
if (prob(50))
for(var/obj/item/weapon/book/b in contents)
b.loc = (get_turf(src))
del(src)
return
else
user << "None of these books pique your interest in the slightest."
return
proc
setname(var/t as text)
if(t)
src.name = "bookcase ([t])"
ex_act(severity)
switch(severity)
if(1.0)
for(var/obj/item/weapon/book/b in src.contents)
del(b)
del(src)
return
if(2.0)
for(var/obj/item/weapon/book/b in src.contents)
if (prob(50)) b.loc = (get_turf(src))
else del(b)
del(src)
return
if(3.0)
if (prob(50))
for(var/obj/item/weapon/book/b in src.contents)
b.loc = (get_turf(src))
del(src)
return
else
return
/obj/structure/bookcase/update_icon()
if(contents.len < 5)
icon_state = "book-[contents.len]"
else
icon_state = "book-5"
/obj/structure/bookcase/manuals/medical
@@ -138,6 +139,7 @@
New()
..()
new /obj/item/weapon/book/manual/medical_cloning(src)
update_icon()
/obj/structure/bookcase/manuals/engineering
@@ -151,6 +153,7 @@
new /obj/item/weapon/book/manual/engineering_guide(src)
new /obj/item/weapon/book/manual/engineering_singularity_safety(src)
new /obj/item/weapon/book/manual/robotics_cyborgs(src)
update_icon()
/obj/structure/bookcase/manuals/research_and_development
name = "R&D Manuals bookcase"
@@ -158,6 +161,7 @@
New()
..()
new /obj/item/weapon/book/manual/research_and_development(src)
update_icon()
@@ -437,9 +441,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
dat += "<A href='?src=\ref[src];switchscreen=7'>7. Access the Forbidden Lore Vault</A><BR>"
if(src.arcanecheckout)
new /obj/item/weapon/tome(src.loc)
user << "<font color=red>Your sanity barely endures the seconds spent in the vault's browsing window. The only thing to remind you of this when you stop browsing is a dusty old tome sitting on the desk. You don't really remember printing it.</font>"
for (var/mob/V in hearers(src))
V.show_message("[usr] stares at the blank screen for a few moments, his expression frozen in fear. When he finally awakens from it, he looks a lot older.", 2)
user << "<span class='warning'>Your sanity barely endures the seconds spent in the vault's browsing window. The only thing to remind you of this when you stop browsing is a dusty old tome sitting on the desk. You don't really remember printing it.</span>"
user.visible_message("[user] stares at the blank screen for a few moments, his expression frozen in fear. When he finally awakens from it, he looks a lot older.", 2)
src.arcanecheckout = 0
if(1)
// Inventory
+95 -15
View File
@@ -1,4 +1,4 @@
//todo: flushing, flushing heads, showers actually cleaning people
//todo: toothbrushes, and some sort of "toilet-filthinator" for the hos
/obj/structure/toilet
name = "toilet"
@@ -8,18 +8,43 @@
density = 0
anchored = 1
var/open = 0
var/mob/swirlie = null
/obj/structure/toilet/New()
open = round(rand(0, 1))
update_icon()
/obj/structure/toilet/attack_hand()
open = !open
update_icon()
if(!swirlie)
open = !open
update_icon()
else
usr.visible_message("<span class='danger'>[usr] slams the toilet seat onto [swirlie.name]'s head!</span>", "<span class='notice'>You slam the toilet seat onto [swirlie.name]'s head!</span>", "You hear reverberating porcelain.")
swirlie.adjustBruteLoss(8)
/obj/structure/toilet/update_icon()
icon_state = "toilet[open]"
/obj/structure/toilet/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = I
var/mob/GM = G.affecting
if(ismob(G.affecting))
if(G.state>1 && GM.loc == get_turf(src))
if(open && !swirlie)
user.visible_message("<span class='danger'>[user] starts to give [GM.name] a swirlie!</span>", "<span class='notice'>You start to give [GM.name] a swirlie!</span>")
swirlie = GM
if(do_after(user, 30, 5, 0))
user.visible_message("<span class='danger'>[user] gives [GM.name] a swirlie!</span>", "<span class='notice'>You give [GM.name] a swirlie!</span>", "You hear a toilet flushing.")
if(!GM.internal)
GM.adjustOxyLoss(5)
swirlie = null
else
user.visible_message("<span class='danger'>[user] slams [GM.name] into the [src]!</span>", "<span class='notice'>You slam [GM.name] into the [src]!</span>")
GM.adjustBruteLoss(8)
else
user << "<span class='notice'>You need a tighter grip.</span>"
/obj/structure/urinal
@@ -30,9 +55,20 @@
density = 0
anchored = 1
/obj/structure/urinal/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = I
var/mob/GM = G.affecting
if(ismob(G.affecting))
if(G.state>1 && GM.loc == get_turf(src))
user.visible_message("<span class='danger'>[user] slams [GM.name] into the [src]!</span>", "<span class='notice'>You slam [GM.name] into the [src]!</span>")
GM.adjustBruteLoss(8)
else
user << "<span class='notice'>You need a tighter grip.</span>"
/obj/structure/shower
/obj/machinery/shower
name = "shower"
desc = "The HS-451. Installed in the 2550s by the Nanotrasen Hygiene Division."
icon = 'watercloset.dmi'
@@ -41,7 +77,9 @@
anchored = 1
var/on = 0
var/obj/effect/mist/mymist = null
var/ismist = 0 //needs a var so we can make it linger~
var/ismist = 0 //needs a var so we can make it linger~
var/watertemp = "normal" //freezing, normal, or boiling
var/mobpresent = 0 //true if there is a mob on the shower's loc, this is to ease process()
//add heat controls? when emagged, you can freeze to death in it?
@@ -52,22 +90,37 @@
layer = MOB_LAYER + 1
mouse_opacity = 0
/obj/structure/shower/attack_hand(mob/M as mob)
/obj/machinery/shower/attack_hand(mob/M as mob)
on = !on
update_icon()
if(on && M.loc == loc)
wash(M)
check_heat(M)
/obj/structure/shower/attackby(mob/M as mob)
attack_hand(M)
/obj/machinery/shower/attackby(var/obj/item/I, var/mob/user)
if(I.type == /obj/item/device/analyzer)
user << "<span class='notice'>The water temperature seems to be [watertemp].</span>"
if(istype(I, /obj/item/weapon/wrench))
user << "<span class='notice'>You begin to adjust the temperature valve with the [I].</span>"
if(do_after(user, 50))
switch(watertemp)
if("normal")
watertemp = "freezing"
if("freezing")
watertemp = "boiling"
if("boiling")
watertemp = "normal"
user.visible_message("<span class='notice'>[user] adjusts the shower with the [I].</span>", "<span class='notice'>You adjust the shower with the [I].</span>")
/obj/structure/shower/update_icon()
overlays = null
/obj/machinery/shower/update_icon() //this is terribly unreadable, but basically it makes the shower mist up
overlays = null //once it's been on for a while, in addition to handling the water overlay.
if(mymist)
del(mymist)
if(on)
overlays += image('watercloset.dmi', src, "water", MOB_LAYER + 1, dir)
if(watertemp == "freezing")
return
if(!ismist)
spawn(50)
if(src && on)
@@ -84,13 +137,20 @@
del(mymist)
ismist = 0
/obj/structure/shower/HasEntered(atom/movable/O as obj|mob)
/obj/machinery/shower/HasEntered(atom/movable/O)
..()
wash(O)
if(ismob(O))
mobpresent += 1
check_heat(O)
/obj/machinery/shower/Uncrossed(atom/movable/O)
if(ismob(O))
mobpresent -= 1
..()
//Yes, showers are super powerful as far as washing goes.
/obj/structure/shower/proc/wash(atom/movable/O as obj|mob)
..()
/obj/machinery/shower/proc/wash(atom/movable/O as obj|mob)
if(!on) return
O.clean_blood()
@@ -108,10 +168,10 @@
var/mob/living/carbon/human/washer = O
if(washer.head)
washer.head.clean_blood()
if(washer.w_uniform)
washer.w_uniform.clean_blood()
if(washer.wear_suit)
washer.wear_suit.clean_blood()
else if(washer.w_uniform)
washer.w_uniform.clean_blood()
if(washer.shoes)
washer.shoes.clean_blood()
if(washer.gloves)
@@ -129,6 +189,26 @@
for(var/obj/effect/overlay/R in tile)
del(R)
/obj/machinery/shower/process()
if(!on || !mobpresent) return
for(var/mob/living/carbon/C in loc)
check_heat(C)
/obj/machinery/shower/proc/check_heat(mob/M as mob)
if(!on || watertemp == "normal") return
if(iscarbon(M))
var/mob/living/carbon/C = M
if(watertemp == "freezing")
C.bodytemperature = min(100, C.bodytemperature - 80)
C << "<span class='warning'>The water is freezing!</span>"
return
if(watertemp == "boiling")
C.bodytemperature = max(500, C.bodytemperature + 35)
C.adjustFireLoss(10)
C << "<span class='danger'>The water is searing!</span>"
return
/obj/item/weapon/bikehorn/rubberducky
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

+4 -4
View File
@@ -51,7 +51,7 @@
"aaY" = (/obj/structure/cable{d1 = 4; d2 = 8; icon_state = "4-8"; pixel_x = 0; tag = "Streight"},/obj/machinery/atmospherics/pipe/simple{dir = 4},/turf/simulated/floor{icon_state = "floorgrime"},/area/security/prison)
"aaZ" = (/obj/structure/cable{d1 = 1; d2 = 8; icon_state = "1-8"; tag = "90Curve"},/obj/structure/cable{d1 = 2; d2 = 8; icon_state = "2-8"; tag = "90Curve"},/obj/machinery/atmospherics/unary/outlet_injector{dir = 8; frequency = 1443; icon_state = "on"; id = "air_in"; on = 1},/obj/machinery/hologram/holopad,/turf/simulated/floor,/area/security/prison)
"aba" = (/obj/machinery/light/small{dir = 1},/obj/structure/window/reinforced/tinted{dir = 8; icon_state = "twindow"; tag = ""},/turf/simulated/floor{icon_state = "freezerfloor"},/area/security/prison)
"abb" = (/obj/item/weapon/soap/nanotrasen,/obj/structure/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/obj/structure/sink{pixel_y = 30},/turf/simulated/floor{icon_state = "freezerfloor"},/area/security/prison)
"abb" = (/obj/item/weapon/soap/nanotrasen,/obj/machinery/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/obj/structure/sink{pixel_y = 30},/turf/simulated/floor{icon_state = "freezerfloor"},/area/security/prison)
"abc" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced{dir = 1},/turf/simulated/floor/plating,/area/security/range)
"abd" = (/turf/simulated/floor,/area/security/range)
"abe" = (/obj/machinery/atmospherics/pipe/simple,/obj/machinery/portable_atmospherics/scrubber/stationary,/turf/simulated/floor/plating,/area/security/prison)
@@ -2513,9 +2513,9 @@
"aWq" = (/obj/structure/reagent_dispensers/watertank,/turf/simulated/floor/plating,/area/maintenance/port)
"aWr" = (/obj/machinery/door/airlock{name = "Unit 2"},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWs" = (/obj/machinery/atmospherics/unary/vent_scrubber{dir = 1; on = 1; scrub_N2O = 0; scrub_Toxins = 0},/obj/structure/cable{d1 = 1; d2 = 2; icon_state = "1-2"; pixel_y = 0; tag = "Streight"},/obj/structure/sink{dir = 4; icon_state = "sink"; pixel_x = 11; pixel_y = 0},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWt" = (/obj/structure/shower{tag = "icon-shower (EAST)"; icon_state = "shower"; dir = 4},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWt" = (/obj/machinery/shower{tag = "icon-shower (EAST)"; icon_state = "shower"; dir = 4},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWu" = (/obj/effect/landmark{name = "blobstart"},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWv" = (/obj/structure/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWv" = (/obj/machinery/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/turf/simulated/floor{icon_state = "freezerfloor"},/area/crew_quarters/locker/locker_toilet)
"aWw" = (/obj/machinery/portable_atmospherics/pump,/obj/machinery/camera{c_tag = "Locker Room South"; dir = 4; network = "SS13"},/turf/simulated/floor{icon_state = "delivery"},/area/crew_quarters/locker)
"aWx" = (/obj/machinery/light{icon_state = "tube1"; dir = 4},/obj/structure/cable{d1 = 1; d2 = 2; icon_state = "1-2"; pixel_y = 0; tag = "Streight"},/turf/simulated/floor,/area/crew_quarters/locker)
"aWy" = (/obj/structure/closet/crate,/turf/simulated/floor{icon_state = "floorgrime"},/area/quartermaster/storage)
@@ -4887,7 +4887,7 @@
"bPY" = (/obj/effect/sign/biohazard,/turf/simulated/wall/r_wall,/area/medical/virology)
"bPZ" = (/obj/machinery/access_button{command = "cycle_exterior"; master_tag = "virology_airlock_control"; name = "Virology Access Button"; pixel_x = -23; pixel_y = -8; req_access_txt = "39"},/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bQa" = (/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bQb" = (/obj/structure/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bQb" = (/obj/machinery/shower{tag = "icon-shower (WEST)"; icon_state = "shower"; dir = 8},/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bQc" = (/obj/machinery/alarm{dir = 4; icon_state = "alarm0"; pixel_x = -22},/obj/machinery/light/small{dir = 8},/turf/simulated/floor,/area/medical/research{name = "Research Division"})
"bQd" = (/turf/simulated/floor,/area/medical/research{name = "Research Division"})
"bQe" = (/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{dir = 5},/turf/simulated/floor,/area/medical/research{name = "Research Division"})