Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surgery holosign, operating table console and stethoscope improvements #37133

Open
wants to merge 29 commits into
base: Bleeding-Edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5d38f39
holosign stuff and very simple pulsecode, note: clean up pulsecode
Jul 9, 2023
8a17a81
much cleaner and more accurate pulsing
Jul 10, 2023
5476997
the actual sounds themselves
Jul 10, 2023
4742f3d
stops heartbeat loop altogether during death, makes icon states for c…
Jul 10, 2023
a9913f5
Merge branch 'Bleeding-Edge' into surgery-room-improvements
Jan 20, 2024
bef83e4
adds this for stethoscopes too as fluff
Jan 20, 2024
b6d9bd7
Merge branch 'Bleeding-Edge' into surgery-room-improvements
SECBATON-GRIFFON Sep 17, 2024
8006245
removes buttons on all maps
SECBATON-GRIFFON Sep 17, 2024
9aa4f3f
cleanup
SECBATON-GRIFFON Sep 17, 2024
99b6fbc
sanity
SECBATON-GRIFFON Sep 17, 2024
08352a7
cleaner
SECBATON-GRIFFON Sep 17, 2024
4260e19
can't wait for this to be in gitignore
SECBATON-GRIFFON Sep 17, 2024
8881402
Revert "removes buttons on all maps"
SECBATON-GRIFFON Oct 1, 2024
bd70037
Merge branch 'Bleeding-Edge' into surgery-room-improvements
SECBATON-GRIFFON Oct 2, 2024
3467fe7
beginning rework
SECBATON-GRIFFON Oct 3, 2024
ad5b569
moves the order of this
SECBATON-GRIFFON Oct 3, 2024
d297b17
removes unused var
SECBATON-GRIFFON Oct 3, 2024
01d6856
sanity
SECBATON-GRIFFON Oct 3, 2024
6a4ff5a
nobreath feature request lul
SECBATON-GRIFFON Oct 3, 2024
58db4e3
sanity
SECBATON-GRIFFON Oct 3, 2024
9934d19
another loop lock
SECBATON-GRIFFON Oct 3, 2024
e30ca85
oh that's why it was like that
SECBATON-GRIFFON Oct 3, 2024
b6ec7c3
makes holosigns toggleable again, plus actually outputs stethos right
SECBATON-GRIFFON Oct 3, 2024
cceb842
now with more customisation
SECBATON-GRIFFON Oct 3, 2024
4868074
works like this
SECBATON-GRIFFON Oct 3, 2024
171c633
Revert "works like this"
SECBATON-GRIFFON Oct 3, 2024
86a639f
Revert "now with more customisation"
SECBATON-GRIFFON Oct 3, 2024
c76fad6
Merge branch 'Bleeding-Edge' into surgery-room-improvements
SECBATON-GRIFFON Dec 30, 2024
a28d144
converts to spawn()
SECBATON-GRIFFON Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ var/list/vehicle_list = list()
var/list/paicard_list = list()
var/list/effects_list = list()
var/list/laser_pointers_list = list()
var/list/obj/machinery/optable/optable_list = list()
var/list/obj/structure/morgue/morgue_list = list()
var/list/obj/effect/time_anomaly/time_anomaly_list = list()
var/list/map_pickspawners = list()
66 changes: 57 additions & 9 deletions code/game/machinery/OpTable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,30 @@
var/rating = 1 //Use this for upgrades some day
pass_flags_self = PASSTABLE
var/obj/machinery/computer/operating/computer = null
var/pulsing = FALSE

/obj/machinery/optable/New()
..()
for(dir in list(NORTH,EAST,SOUTH,WEST))
computer = locate(/obj/machinery/computer/operating, get_step(src, dir))
if (computer)
break
optable_list += src
updatemodules()
// spawn(100) //Wont the MC just call this process() before and at the 10 second mark anyway?
// process()

/obj/machinery/optable/Destroy()
optable_list -= src
..()

/obj/machinery/optable/proc/updatemodules()
computer = find_computer()
if(computer && !computer.optable)
computer.optable = src

/obj/machinery/optable/proc/find_computer()
for(dir in cardinal)
. = locate(/obj/machinery/computer/operating) in get_step(src, dir)
if (.)
break

/obj/machinery/optable/ex_act(severity)

switch(severity)
Expand Down Expand Up @@ -93,23 +107,41 @@
take_victim(L, user)
return

/obj/machinery/optable/proc/flatline(mob/user, body_destroyed)
if(user == victim && victim.loc == src.loc && victim.lying)
if(computer)
playsound(computer.loc, 'sound/machines/Flatline.ogg', 50)
computer.icon_state = "operating-dead"
icon_state = "table2-idle"

/obj/machinery/optable/proc/check_victim()
updatemodules()
if (victim)
if (victim.loc == src.loc)
if (victim.lying)
if (victim.pulse)
icon_state = "table2-active"
else
icon_state = "table2-idle"

return 1

victim.reset_view()
victim.unregister_event(/event/death, src, nameof(src::flatline()))
victim = null
update()

if(computer)
computer.icon_state = "operating"
icon_state = "table2-idle"
return 0

/obj/machinery/optable/proc/update()
var/area/this_area = get_area(src)
for(var/obj/machinery/holosign/surgery/sign in holosigns)
var/area/sign_area = get_area(sign)
if(this_area != sign_area)
continue
if(sign.should_update)
continue
sign.should_update = TRUE
processing_objects += sign

/obj/machinery/optable/process()
check_victim()

Expand Down Expand Up @@ -140,6 +172,7 @@
victim = C
C.resting = 1 //This probably shouldn't be using this variable
C.update_canmove() //but for as long as it does we're adding sanity to it
C.register_event(/event/death, src, nameof(src::flatline()))

if (C == user)
user.visible_message("[user] climbs on the operating table.","You climb on the operating table.")
Expand All @@ -148,6 +181,21 @@

add_fingerprint(user)

update()

spawn()
if(!pulsing)
while(victim.loc == src.loc && victim.lying && victim.pulse != PULSE_NONE && victim.stat != DEAD && !victim.timestopped)
pulsing = TRUE
var/pulsespeed = victim.get_pulsespeed()
if(pulsespeed)
if(computer)
playsound(computer.loc, 'sound/machines/Heartbeat.ogg', 50)
computer.icon_state = "operating-living"
icon_state = "table2-active"
sleep(max(1,pulsespeed))
pulsing = FALSE

/obj/machinery/optable/attackby(obj/item/weapon/W as obj, mob/living/carbon/user as mob)
if(W.is_wrench(user))
W.playtoolsound(src, 50)
Expand Down
29 changes: 6 additions & 23 deletions code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,21 @@
..()
spawn(5)
updatemodules()
return
return

/obj/machinery/computer/operating/proc/updatemodules()
src.optable = findoptable()
optable = findoptable()
if(optable && !optable.computer)
optable.computer = src

/obj/machinery/computer/operating/proc/findoptable()
var/obj/machinery/optable/optablef = null

// Loop through every direction
for(dir in list(NORTH,EAST,SOUTH,WEST))

for(dir in cardinal)
// Try to find a scanner in that direction
optablef = locate(/obj/machinery/optable, get_step(src, dir))

. = locate(/obj/machinery/optable) in get_step(src, dir)
// If found, then we break, and return the scanner
if (!isnull(optablef))
if (.)
break

// If no scanner was found, it will return null
return optablef

/obj/machinery/computer/operating/attack_paw(user as mob)
return attack_hand(user)

Expand Down Expand Up @@ -91,15 +84,5 @@
/obj/machinery/computer/operating/process()
if(..())
src.updateDialog()
update_icon()

/obj/machinery/computer/operating/update_icon()
..()
if(!(stat & (FORCEDISABLE |BROKEN | NOPOWER)))
updatemodules()
if(!isnull(src.optable) && (src.optable.check_victim()))
src.victim = src.optable.victim
if(victim.stat == DEAD)
icon_state = "operating-dead"
else
icon_state = "operating-living"
19 changes: 17 additions & 2 deletions code/game/machinery/holosign.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var/list/obj/machinery/holosign/holosigns = list()
var/lit = 0
var/on_icon = ""
var/image/overlay
var/should_update = FALSE

light_color = "#6496FA"

Expand Down Expand Up @@ -60,6 +61,21 @@ var/list/obj/machinery/holosign/holosigns = list()
on_icon = "surgery"
id_tag = "surgery"

/obj/machinery/holosign/surgery/process()
var/area/this_area = get_area(src)
for(var/obj/machinery/optable/OT in optable_list)
var/area/optable_area = get_area(OT)
if(optable_area != this_area)
continue
if(OT.victim)
toggle(TRUE)
should_update = FALSE
return PROCESS_KILL
if(lit < 2)
toggle(FALSE)
should_update = FALSE
return PROCESS_KILL

/obj/machinery/holosign/virology
name = "virology holosign"
desc = "Small wall-mounted holographic projector. This one reads BIOHAZARD."
Expand All @@ -72,7 +88,6 @@ var/list/obj/machinery/holosign/holosigns = list()
desc = "Small wall-mounted holographic projector. This one reads MORGUE."
on_icon = "morgue"
id_tag = "morgue"
var/should_update = FALSE

/obj/machinery/holosign/morgue/process()
var/area/this_area = get_area(src)
Expand Down Expand Up @@ -136,7 +151,7 @@ var/list/obj/machinery/holosign/holosigns = list()

for(var/obj/machinery/holosign/M in holosigns)
if (M.id_tag == src.id_tag)
M.toggle(active)
M.toggle(active*2)

/obj/machinery/holosign_switch/attack_ghost(var/mob/dead/observer/ghost)
if(!can_spook())
Expand Down
36 changes: 17 additions & 19 deletions code/modules/clothing/accessories/accessory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,43 +185,41 @@
origin_tech = Tc_BIOTECH + "=1"
restraint_resist_time = 30 SECONDS
toolsounds = list("rustle")
var/listening = FALSE

/obj/item/clothing/accessory/stethoscope/attack(mob/living/carbon/human/M, mob/living/user)
if(ishuman(M) && isliving(user))
if(user.a_intent == I_HELP)
var/body_part = parse_zone(user.zone_sel.selecting)
if(body_part)
var/their = "their"
switch(M.gender)
if(MALE)
their = "his"
if(FEMALE)
their = "her"

var/sound = "pulse"
var/sound_strength

if(M.isDead())
if(M.isDead() || body_part == "eyes" || body_part == "mouth")
sound_strength = "cannot hear"
sound = "anything"
else
sound_strength = "hear a weak"
switch(body_part)
if(LIMB_CHEST)
if(M.oxyloss < 50)
sound_strength = "hear a healthy"
if(body_part == LIMB_CHEST)
if(M.oxyloss < 50)
sound_strength = "hear a healthy"
if(!(M_NO_BREATH in M.mutations))
sound = "pulse and respiration"
if("eyes","mouth")
sound_strength = "cannot hear"
sound = "anything"
else
sound_strength = "hear a weak"

user.visible_message("[user] places [src] against [M]'s [body_part] and listens attentively.", "You place [src] against [their] [body_part]. You [sound_strength] [sound].")
user.visible_message("[user] places [src] against [M]'s [body_part] and listens attentively.", "You place [src] against [M]'s [body_part]. You [sound_strength] [sound].")

spawn()
if(!listening)
while(M.pulse != PULSE_NONE && loc == user && M.Adjacent(user) && !M.timestopped)
listening = TRUE
var/pulsespeed = M.get_pulsespeed()
if(pulsespeed)
to_chat(user,"*thump*")
sleep(max(1,pulsespeed))
listening = FALSE
return
return ..(M,user)


//Medals
/obj/item/clothing/accessory/medal
name = "bronze medal"
Expand Down
25 changes: 25 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,31 @@
temp += rand(-10, 10)
return num2text(round(temp))

/mob/living/carbon/proc/get_pulsespeed()
. = 600
switch(src.pulse)
if(PULSE_NONE)
. = 0
if(PULSE_2SLOW)
. /= (30 + sin(life_tick / 2) * 10)
if(PULSE_SLOW)
. /= (50 + sin(life_tick / 2) * 10)
if(PULSE_NORM)
. /= (75 + sin(life_tick / 2) * 15)
if(PULSE_FAST)
. /= (105 + sin(life_tick / 2) * 15)
if(PULSE_2FAST)
. /= (140 + sin(life_tick / 2) * 20)
if(PULSE_THREADY)
. = 2

/*/mob/living/carbon/proc/pulse_loop() // commented out because not used beyond fluff, was requested
while(pulse != PULSE_NONE)
var/pulsespeed = get_pulsespeed()
if(pulsespeed && !timestopped)
INVOKE_EVENT(src, /event/heartbeat, "user" = src)
sleep(max(1,pulsespeed))*/

/mob/living/carbon/verb/mob_sleep()
set name = "Sleep"
set category = "IC"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/carbon_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
..()
hud_list[CONVERSION_HUD] = new/image/hud('icons/mob/hud.dmi', src, "hudblank")
register_event(/event/after_move, src, /mob/living/carbon/proc/update_holomaps)
//spawn()
//pulse_loop()

/mob/living/carbon/Destroy()
unregister_event(/event/after_move, src, /mob/living/carbon/proc/update_holomaps)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ var/global/list/organ_damage_overlays = list(
update_canmove()
//Update our name based on whether our face is obscured/disfigured
handle_regular_hud_updates()
//var/oldpulse = pulse
pulse = handle_pulse()
for(var/obj/item/weapon/grab/G in src)
G.process()
Expand All @@ -194,6 +195,9 @@ var/global/list/organ_damage_overlays = list(
UpdateDamageIcon()
cycle++
..()
//if(oldpulse == PULSE_NONE && pulse != PULSE_NONE)
//spawn()
//pulse_loop() //restart this if pulse comes back

//Need this in species.
//#undef HUMAN_MAX_OXYLOSS
Expand Down
Binary file added sound/machines/Flatline.ogg
Binary file not shown.
Binary file added sound/machines/Heartbeat.ogg
Binary file not shown.
Loading