/* * Sleeper -- allows a mob to be preserved without further damage * * /obj/machinery/sleeper -- the sleeper itself * * /obj/machinery/computer/sleep_console -- the control console * * TODO: Sleepers currently do not use or need power. If altered, need to make the occupant suffer if the power goes out. * */ /* * The sleeper */ obj/machinery/sleeper name = "sleeper" icon = 'Cryogenic2.dmi' icon_state = "sleeper_0" density = 1 anchored = 1 var mob/occupant = null // the mob in the sleeper, or null if none // Eject verb // Remove the occupant from the sleeper verb/eject() set src in oview(1) var/result = src.canReach(usr, null, 1) if (result==0) usr << "You can't reach [src]." return src.go_out() add_fingerprint(usr) // Move inside verb // Insert the mob you are pulling into the sleeper // Sleeper must be empty, and mob cannot be wearing anything verb/move_inside() set src in oview(1) var/result = src.canReach(usr, null, 1) if (result==0) usr << "You can't reach [src]." return if (src.occupant) usr.client_mob() << "\blue The sleeper is already occupied!" return if (usr.abiotic()) usr.client_mob() << "Subject may not have abiotic items on." return usr.pulling = null if (usr.client) usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src src.occupant = usr src.icon_state = "sleeper_1" for(var/obj/O in src) del(O) src.add_fingerprint(usr) // Attack by item // Only used for the grab pseudo-item, places the grabbed mob in the sleeper attackby(obj/item/weapon/grab/G, mob/user) if ((!( istype(G, /obj/item/weapon/grab) ) || !( ismob(G.affecting) ))) return if (src.occupant) user.client_mob() << "\blue The sleeper is already occupied!" return if (G.affecting.abiotic()) user.client_mob() << "Subject may not have abiotic items on." return var/mob/M = G.affecting if (M.client) M.client.perspective = EYE_PERSPECTIVE M.client.eye = src M.loc = src src.occupant = M src.icon_state = "sleeper_1" for(var/obj/O in src) O.loc = src.loc src.add_fingerprint(user) del(G) // Called to remove a mob from the sleeper // If a client, reset the view to normal proc/go_out() if (!( src.occupant )) return for(var/obj/O in src) O.loc = src.loc if (src.occupant.client) src.occupant.client.eye = src.occupant.client.mob src.occupant.client.perspective = MOB_PERSPECTIVE src.occupant.loc = src.loc src.occupant = null src.icon_state = "sleeper_0" // Called to inject rejuve chemicals into the occupant // Maximum is 60 units proc/inject(mob/user) if (src.occupant) if (src.occupant.rejuv < 60) src.occupant.rejuv = 60 user.client_mob() << text("Occupant now has [] units of rejuvenation in his/her bloodstream.", src.occupant.rejuv) else user.client_mob() << "No occupant!" // Shows the health statistics of the occupant // Does not seem to be used? proc/check(mob/user) if (src.occupant) user.client_mob() << "\blue Occupant ([src.occupant]) Statistics:" var/t1 switch(src.occupant.stat) if(0.0) t1 = "Conscious" if(1.0) t1 = "Unconscious" if(2.0) t1 = "*dead*" else user.client_mob() << "[(src.occupant.health > 50 ? "\blue " : "\red ")]\t Health %: [src.occupant.health] ([t1])" user.client_mob() << "[(src.occupant.oxyloss < 60 ? "\blue " : "\red ")]\t -Respiratory Damage %: [src.occupant.oxyloss]" user.client_mob() << "[(src.occupant.toxloss < 60 ? "\blue " : "\red ")]\t -Toxin Content %: [src.occupant.toxloss]" user.client_mob() << "[(src.occupant.fireloss < 60 ? "\blue " : "\red ")]\t -Burn Severity %: [src.occupant.fireloss]" user.client_mob() << "\blue Expected time till occupant can safely awake: (note: If health is below 20% these times are inaccurate)" user.client_mob() << "\blue \t [src.occupant.paralysis / 5] second\s (if around 1 or 2 the sleeper is keeping them asleep.)" else user.client_mob() << "\blue There is no one inside!" return // Called in mob/Life() while the occupant is inside // Sets the health settings of the occupant alter_health(mob/M) if (M.health > 0) if (M.oxyloss >= 10) var/amount = max(0.15, 1) M.oxyloss -= amount else M.oxyloss = 0 M.health = 100 - M.oxyloss - M.toxloss - M.fireloss - M.bruteloss M.paralysis -= 4 M.weakened -= 4 M.stunned -= 4 if (M.paralysis <= 1) M.paralysis = 3 if (M.weakened <= 1) M.weakened = 3 if (M.stunned <= 1) M.stunned = 3 if (M.rejuv < 3) M.rejuv = 4 // Explosion damage // Chance to remove the occupant and explode them, then delete the sleeper ex_act(severity) switch(severity) if(1.0) for(var/atom/movable/A in src) A.loc = src.loc A.ex_act(severity) del(src) return if(2.0) if (prob(50)) for(var/atom/movable/A in src) A.loc = src.loc A.ex_act(severity) del(src) return if(3.0) if (prob(25)) for(var/atom/movable/A in src) A.loc = src.loc A.ex_act(severity) del(src) return // Blob attack, remove the occupant and delete blob_act() for(var/atom/movable/A in src) A.loc = src.loc del(src) /* Unused allow_drop() return 0 */ /* * The sleep console */ obj/machinery/computer/sleep_console name = "sleep console" icon = 'Cryogenic2.dmi' icon_state = "sleeperconsole" var obj/machinery/sleeper/connected = null // the associated sleeper // Create a new sleep console // Locate the connected sleeper 1 step west New() ..() spawn( 5 ) // wait for world to finish loading src.connected = locate(/obj/machinery/sleeper, get_step(src, WEST)) // Monkey interact same as human attack_paw(mob/user) return src.attack_hand(user) // AI interact attack_ai(mob/user) return src.attack_hand(user) // Human interact // Show the interaction window attack_hand(mob/user) if (src.connected) var/mob/occupant = src.connected.occupant var/dat = "Occupant Statistics:
" if (occupant) var/t1 switch(occupant.stat) if(0.0) t1 = "Conscious" if(1.0) t1 = "Unconscious" if(2.0) t1 = "*dead*" else dat += "[occupant.health > 50 ? "" : ""]\tHealth %: [occupant.health] ([t1])
" dat += "[occupant.oxyloss < 60 ? "" : ""]\t-Respiratory Damage %: [occupant.oxyloss]
" dat += "[occupant.toxloss < 60 ? "" : ""]\t-Toxin Content %: [occupant.toxloss]
" dat += "[occupant.fireloss < 60 ? "" : ""]\t-Burn Severity %: [occupant.fireloss]
" dat += "
Paralysis Summary %: [occupant.paralysis] ([round(occupant.paralysis / 4)] seconds left!)

" dat += "
Refresh
Inject Rejuvenators" else dat += "The sleeper is empty." dat += "

Close" user.client_mob() << browse(dat, "window=sleeper;size=400x500") // Handle topic links from interaction window Topic(href, href_list) ..() if ((usr.stat || usr.restrained())) if (!istype(usr, /mob/ai)) return if ((usr.contents.Find(src) || (get_dist(src, usr) <= 1 && istype(src.loc, /turf)))) usr.machine = src if (href_list["rejuv"]) if (src.connected) src.connected.inject(usr) if (href_list["refresh"]) src.updateDialog() src.add_fingerprint(usr) // Timed process - just update interaction window for those viewing process() src.updateDialog() // Called when area power state changes // no change - sleeper works without power // Note overrides standard /obj/machinery/computer/power_change() power_change() return // Explosion damage, chance to delete the sleeper console ex_act(severity) switch(severity) if(1.0) del(src) if(2.0) if (prob(50)) del(src)