From 2acd27f962b31bbd85db78f098e78604c634d4c1 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Wed, 20 Mar 2024 16:11:10 -0400
Subject: [PATCH] Optable fixes (#24101)
---
code/game/atoms.dm | 3 +-
code/game/machinery/OpTable.dm | 51 +++++++++----------
.../living/carbon/human/species/_species.dm | 3 ++
3 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 48a77570a01..57211a2fd69 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -415,7 +415,8 @@
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
-/atom/proc/examine_more(mob/user) ///Extended description of an object. Allows you to double examine objects and have them give you a second description of an item. Useful for writing flavourful stuff.
+/// Extended description of an object. Allows you to double examine objects and have them give you a second description of an item. Useful for writing flavourful stuff.
+/atom/proc/examine_more(mob/user)
SHOULD_CALL_PARENT(TRUE)
RETURN_TYPE(/list)
diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm
index 6a918a1e363..b0a630087f7 100644
--- a/code/game/machinery/OpTable.dm
+++ b/code/game/machinery/OpTable.dm
@@ -52,53 +52,50 @@
/obj/machinery/optable/MouseDrop_T(atom/movable/O, mob/user)
return take_patient(O, user)
-/// Updates `patient` to be a carbon mob occupying the table, and returns it
-/obj/machinery/optable/proc/update_patient()
- if(patient in buckled_mobs)
- return patient // Current patient is still here, no need to look
-
- patient = null
-
- if(length(buckled_mobs))
- for(var/mob/living/carbon/C in buckled_mobs)
- patient = C
-
- if(length(injected_reagents))
- to_chat(C, "You feel a series of tiny pricks!")
-
- break
-
- if(!no_icon_updates)
- if(patient && patient.pulse)
- icon_state = "table2-active"
- else
- icon_state = "table2-idle"
-
- return patient
+/obj/machinery/optable/post_unbuckle_mob(mob/living/M)
+ . = ..()
+ if(M == patient)
+ patient = null
+ update_appearance(UPDATE_ICON_STATE)
/obj/machinery/optable/proc/take_patient(mob/living/carbon/new_patient, mob/living/carbon/user)
if((!ishuman(user) && !isrobot(user)) || !istype(new_patient))
return
- if(update_patient())
- to_chat(usr, "The table is already occupied!")
+ if(patient in buckled_mobs)
+ to_chat(user, "The table is already occupied!")
return
// Attempt to settle the patient in
if(!user_buckle_mob(new_patient, user, check_loc = FALSE))
return // User is incapacitated, patient is already buckled to something else, etc.
- update_patient()
+ patient = new_patient
+
+ if(length(injected_reagents))
+ to_chat(new_patient, "You feel a series of tiny pricks!")
+
+ update_appearance(UPDATE_ICON_STATE)
+
return TRUE
/obj/machinery/optable/process()
- update_patient()
if(!length(injected_reagents) || !patient || patient.stat == DEAD)
return
+ update_appearance(UPDATE_ICON_STATE)
+
for(var/chemical in injected_reagents)
patient.reagents.check_and_add(chemical, reagent_target_amount, inject_amount)
+/obj/machinery/optable/update_icon_state()
+ if(no_icon_updates)
+ return
+ if(patient?.pulse)
+ icon_state = "table2-active"
+ else
+ icon_state = "table2-idle"
+
/obj/machinery/optable/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_start_check(src, user, 0))
diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm
index ff088bf3825..9ebd645114e 100644
--- a/code/modules/mob/living/carbon/human/species/_species.dm
+++ b/code/modules/mob/living/carbon/human/species/_species.dm
@@ -500,6 +500,9 @@
if(target.check_block())
target.visible_message("[target] blocks [user]'s grab attempt!")
return FALSE
+ if(!attacker_style && target.buckled)
+ target.buckled.user_unbuckle_mob(target, user)
+ return TRUE
if(attacker_style && attacker_style.grab_act(user, target) == MARTIAL_ARTS_ACT_SUCCESS)
return TRUE
else