mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Operating Computer - Patient Status (#14730)
* Operating Computer - Patient Status * user Fix * Tweaks * why am I stupid tonight * Credit to Moxian * Operational Tweaks * Farie's Suggestions
This commit is contained in:
@@ -8,12 +8,10 @@
|
||||
use_power = IDLE_POWER_USE
|
||||
idle_power_usage = 1
|
||||
active_power_usage = 5
|
||||
var/mob/living/carbon/human/victim = null
|
||||
var/strapped = 0.0
|
||||
|
||||
var/obj/machinery/computer/operating/computer = null
|
||||
var/mob/living/carbon/human/patient
|
||||
var/obj/machinery/computer/operating/computer
|
||||
buckle_lying = -1
|
||||
var/no_icon_updates = 0 //set this to 1 if you don't want the icons ever changing
|
||||
var/no_icon_updates = FALSE //set this to TRUE if you don't want the icons ever changing
|
||||
var/list/injected_reagents = list()
|
||||
var/reagent_target_amount = 1
|
||||
var/inject_amount = 1
|
||||
@@ -29,10 +27,8 @@
|
||||
/obj/machinery/optable/Destroy()
|
||||
if(computer)
|
||||
computer.table = null
|
||||
computer.victim = null
|
||||
computer = null
|
||||
if(victim)
|
||||
victim = null
|
||||
patient = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/optable/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
@@ -43,40 +39,37 @@
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/optable/CanPass(atom/movable/mover, turf/target, height=0)
|
||||
if(height==0) return 1
|
||||
|
||||
if(height == 0)
|
||||
return TRUE
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return 1
|
||||
return TRUE
|
||||
else
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/machinery/optable/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
|
||||
if(usr.stat || (!ishuman(user) && !isrobot(user)) || user.restrained() || !check_table(user) || user.IsWeakened() || user.stunned)
|
||||
/obj/machinery/optable/MouseDrop_T(atom/movable/O, mob/user)
|
||||
if(!ishuman(user) && !isrobot(user)) //Only Humanoids and Cyborgs can put things on this table
|
||||
return
|
||||
|
||||
if(!ismob(O)) //humans only
|
||||
if(!check_table()) //If the Operating Table is occupied, you cannot put someone else on it
|
||||
return
|
||||
|
||||
if(istype(O, /mob/living/simple_animal) || istype(O, /mob/living/silicon)) //animals and robots dont fit
|
||||
if(user.buckled || user.incapacitated()) //Is the person trying to use the table incapacitated or restrained?
|
||||
return
|
||||
if(!ismob(O) || !iscarbon(O)) //Only Mobs and Carbons can go on this table (no syptic patches please)
|
||||
return
|
||||
take_patient(O, user)
|
||||
|
||||
var/mob/living/L = O
|
||||
take_victim(L,usr)
|
||||
return
|
||||
|
||||
/obj/machinery/optable/proc/check_victim()
|
||||
if(locate(/mob/living/carbon/human, src.loc))
|
||||
var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, src.loc)
|
||||
if(M.lying)
|
||||
src.victim = M
|
||||
if(!no_icon_updates)
|
||||
icon_state = M.pulse ? "table2-active" : "table2-idle"
|
||||
return 1
|
||||
src.victim = null
|
||||
/obj/machinery/optable/proc/check_patient()
|
||||
var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, loc)
|
||||
if(!M)
|
||||
return FALSE
|
||||
if(M.lying)
|
||||
patient = M
|
||||
if(!no_icon_updates)
|
||||
icon_state = M.pulse ? "table2-active" : "table2-idle"
|
||||
return TRUE
|
||||
patient = null
|
||||
if(!no_icon_updates)
|
||||
icon_state = "table2-idle"
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/optable/Crossed(atom/movable/AM, oldloc)
|
||||
. = ..()
|
||||
@@ -84,19 +77,19 @@
|
||||
to_chat(AM, "<span class='danger'>You feel a series of tiny pricks!</span>")
|
||||
|
||||
/obj/machinery/optable/process()
|
||||
check_victim()
|
||||
check_patient()
|
||||
if(LAZYLEN(injected_reagents))
|
||||
for(var/mob/living/carbon/C in get_turf(src))
|
||||
var/datum/reagents/R = C.reagents
|
||||
for(var/chemical in injected_reagents)
|
||||
R.check_and_add(chemical,reagent_target_amount,inject_amount)
|
||||
|
||||
/obj/machinery/optable/proc/take_victim(mob/living/carbon/C, mob/living/carbon/user as mob)
|
||||
/obj/machinery/optable/proc/take_patient(mob/living/carbon/C, mob/living/carbon/user)
|
||||
if(C == user)
|
||||
user.visible_message("[user] climbs on the operating table.","You climb on the operating table.")
|
||||
else
|
||||
visible_message("<span class='alert'>[C] has been laid on the operating table by [user].</span>")
|
||||
C.resting = 1
|
||||
C.resting = TRUE
|
||||
C.update_canmove()
|
||||
C.forceMove(loc)
|
||||
if(user.pulling == C)
|
||||
@@ -105,10 +98,10 @@
|
||||
C.s_active.close(C)
|
||||
for(var/obj/O in src)
|
||||
O.loc = src.loc
|
||||
src.add_fingerprint(user)
|
||||
add_fingerprint(user)
|
||||
if(ishuman(C))
|
||||
var/mob/living/carbon/human/H = C
|
||||
src.victim = H
|
||||
patient = H
|
||||
if(!no_icon_updates)
|
||||
icon_state = H.pulse ? "table2-active" : "table2-idle"
|
||||
else
|
||||
@@ -119,17 +112,15 @@
|
||||
set name = "Climb On Table"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.stat || !ishuman(usr) || usr.restrained() || !check_table(usr))
|
||||
if(usr.stat || !ishuman(usr) || usr.restrained() || !check_table())
|
||||
return
|
||||
|
||||
take_victim(usr,usr)
|
||||
take_patient(usr, usr)
|
||||
|
||||
/obj/machinery/optable/attackby(obj/item/I, mob/living/carbon/user, params)
|
||||
if(istype(I, /obj/item/grab))
|
||||
var/obj/item/grab/G = I
|
||||
if(iscarbon(G.affecting))
|
||||
take_victim(G.affecting, user)
|
||||
take_patient(G.affecting, user)
|
||||
qdel(G)
|
||||
else
|
||||
return ..()
|
||||
@@ -143,13 +134,9 @@
|
||||
new /obj/item/stack/sheet/plasteel(loc, 5)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/optable/proc/check_table(mob/living/carbon/patient as mob)
|
||||
if(src.victim && get_turf(victim) == get_turf(src) && victim.lying)
|
||||
/obj/machinery/optable/proc/check_table()
|
||||
if(check_patient() && patient.lying)
|
||||
to_chat(usr, "<span class='notice'>The table is already occupied!</span>")
|
||||
return 0
|
||||
|
||||
if(patient.buckled)
|
||||
to_chat(usr, "<span class='notice'>Unbuckle first!</span>")
|
||||
return 0
|
||||
|
||||
return 1
|
||||
return FALSE
|
||||
else
|
||||
return TRUE
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
icon_keyboard = "med_key"
|
||||
icon_screen = "crew"
|
||||
circuit = /obj/item/circuitboard/operating
|
||||
var/obj/machinery/optable/table = null
|
||||
var/mob/living/carbon/human/victim = null
|
||||
var/obj/machinery/optable/table
|
||||
light_color = LIGHT_COLOR_PURE_BLUE
|
||||
var/verbose = 1 //general speaker toggle
|
||||
var/patientName = null
|
||||
var/verbose = TRUE //general speaker toggle
|
||||
var/oxyAlarm = 30 //oxy damage at which the computer will beep
|
||||
var/choice = 0 //just for going into and out of the options menu
|
||||
var/healthAnnounce = 1 //healther announcer toggle
|
||||
var/crit = 1 //crit beeping toggle
|
||||
var/choice = FALSE //just for going into and out of the options menu
|
||||
var/healthAnnounce = TRUE //healther announcer toggle
|
||||
var/crit = TRUE //crit beeping toggle
|
||||
var/nextTick = OP_COMPUTER_COOLDOWN
|
||||
var/healthAlarm = 50
|
||||
var/oxy = 1 //oxygen beeping toggle
|
||||
var/oxy = TRUE //oxygen beeping toggle
|
||||
var/mob/living/carbon/currentPatient //Who is on the Operating Table connected to the respective Operating Computer?
|
||||
var/patientStatusHolder //Hold the last instance of table.patient.status. When table.patient.status no longer matches this variable, the computer should tell the doctor
|
||||
|
||||
/obj/machinery/computer/operating/New()
|
||||
..()
|
||||
@@ -32,8 +32,8 @@
|
||||
if(table)
|
||||
table.computer = null
|
||||
table = null
|
||||
if(victim)
|
||||
victim = null
|
||||
if(currentPatient)
|
||||
currentPatient = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/operating/attack_ai(mob/user)
|
||||
@@ -49,7 +49,6 @@
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
|
||||
add_fingerprint(user)
|
||||
tgui_interact(user)
|
||||
|
||||
@@ -63,7 +62,7 @@
|
||||
var/data[0]
|
||||
var/mob/living/carbon/human/occupant
|
||||
if(table)
|
||||
occupant = table.victim
|
||||
occupant = table.patient
|
||||
data["hasOccupant"] = occupant ? 1 : 0
|
||||
var/occupantData[0]
|
||||
|
||||
@@ -173,20 +172,38 @@
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/computer/operating/process()
|
||||
if(!table) //Does this Operating Computer have an Operating Table connected to it?
|
||||
return
|
||||
if(!verbose) //Are the speakers on?
|
||||
return
|
||||
if(!table.check_patient()) //Is there a patient on the table?
|
||||
currentPatient = null
|
||||
return
|
||||
var/patientStatus // Tell the computer what to say based on the status of the patient on the table.
|
||||
var/isNewPatient = (table.patient != currentPatient) //Is this a new Patient?
|
||||
|
||||
if(table && table.check_victim())
|
||||
if(verbose)
|
||||
if(patientName!=table.victim.name)
|
||||
patientName=table.victim.name
|
||||
atom_say("New patient detected, loading stats")
|
||||
victim = table.victim
|
||||
atom_say("[victim.real_name], [victim.dna.blood_type] blood, [victim.stat ? "Non-Responsive" : "Awake"]")
|
||||
SStgui.update_uis(src)
|
||||
if(nextTick < world.time)
|
||||
nextTick=world.time + OP_COMPUTER_COOLDOWN
|
||||
if(crit && victim.health <= -50 )
|
||||
playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0)
|
||||
if(oxy && victim.getOxyLoss()>oxyAlarm)
|
||||
playsound(src.loc, 'sound/machines/defib_saftyoff.ogg', 50, 0)
|
||||
if(healthAnnounce && victim.health <= healthAlarm)
|
||||
atom_say("[round(victim.health)]")
|
||||
if(table.patient.stat == DEAD || table.patient.status_flags & FAKEDEATH)
|
||||
patientStatus = "Dead"
|
||||
else if(table.patient.stat == CONSCIOUS)
|
||||
patientStatus = "Awake"
|
||||
else if(table.patient.stat == UNCONSCIOUS)
|
||||
patientStatus = "Asleep"
|
||||
|
||||
if(isNewPatient)
|
||||
atom_say("New patient detected, loading stats")
|
||||
atom_say("[table.patient], [table.patient.dna.blood_type] blood, [patientStatus]")
|
||||
SStgui.update_uis(src)
|
||||
patientStatusHolder = table.patient.stat
|
||||
currentPatient = table.patient
|
||||
|
||||
if(nextTick < world.time)
|
||||
nextTick=world.time + OP_COMPUTER_COOLDOWN
|
||||
if(crit && table.patient.health <= -50 )
|
||||
playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0)
|
||||
if(oxy && table.patient.getOxyLoss()>oxyAlarm)
|
||||
playsound(src.loc, 'sound/machines/defib_saftyoff.ogg', 50, 0)
|
||||
if(healthAnnounce && table.patient.health <= healthAlarm)
|
||||
atom_say("[round(table.patient.health)]")
|
||||
if(table.patient.stat != patientStatusHolder)
|
||||
atom_say("Patient is now [patientStatus]")
|
||||
patientStatusHolder = table.patient.stat
|
||||
|
||||
Reference in New Issue
Block a user