[REFACTOR] Helper proc for unbuckling a mob (#26918)

* Helper proc from unbuckling a mob

* Rename to unbuckle

* Minor fixes

* Move buckled up /mob/living

---------

Co-authored-by: Adrer <adrermail@gmail.com>
This commit is contained in:
Chap
2024-10-10 14:54:09 +02:00
committed by GitHub
parent 7ed4ef4f76
commit a060093b59
18 changed files with 41 additions and 38 deletions
@@ -733,7 +733,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
else if(I == handcuffed)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob(src)
unbuckle()
update_handcuffed()
else if(I == legcuffed)
legcuffed = null
@@ -994,7 +994,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob(src)
unbuckle()
update_handcuffed()
if(client)
@@ -586,7 +586,7 @@
if(target.anchored)
return FALSE
if(target.buckled)
target.buckled.unbuckle_mob(target)
target.unbuckle()
var/shove_dir = get_dir(user.loc, target.loc)
var/turf/shove_to = get_step(target.loc, shove_dir)
@@ -454,7 +454,7 @@
if(!isturf(picked))
return
if(H.buckled)
H.buckled.unbuckle_mob(H, force = TRUE)
H.unbuckle(force = TRUE)
do_teleport(H, picked)
return TRUE
@@ -538,7 +538,7 @@
if(!isturf(picked))
return
if(H.buckled)
H.buckled.unbuckle_mob(H, force = TRUE)
H.unbuckle(force = TRUE)
do_teleport(H, picked)
last_teleport = world.time
UpdateButtons() //action icon looks unavailable
+5 -1
View File
@@ -538,7 +538,7 @@
on_fire = 0
suiciding = 0
if(buckled) //Unbuckle the mob and clear the alerts.
buckled.unbuckle_mob(src, force = TRUE)
unbuckle(force = TRUE)
if(iscarbon(src))
var/mob/living/carbon/C = src
@@ -803,6 +803,10 @@
END RESIST PROCS
*///////////////////////
/// Unbuckle the mob from whatever it is buckled to.
/mob/living/proc/unbuckle(force)
buckled.unbuckle_mob(src, force)
/mob/living/proc/Exhaust()
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
Weaken(10 SECONDS)
@@ -41,6 +41,9 @@
var/mob_biotypes = MOB_ORGANIC
var/metabolism_efficiency = 1 //more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature..
/// movable atom we are buckled to
var/atom/movable/buckling
var/ventcrawler = VENTCRAWLER_NONE
var/list/icon/pipes_shown = list()
var/last_played_vent
@@ -316,7 +316,7 @@
if(T.density)
forceMove(H.loc)
if(H.buckled)
H.buckled.unbuckle_mob(H, force = TRUE)
H.unbuckle(force = TRUE)
manifested = TRUE
Manifest()
to_chat(H, "<span class='userdanger'>You feel the floor closing in on your feet!</span>")
@@ -118,7 +118,7 @@
visible_message("<span class='warning'>[src] has let go of [buckled]!</span>", \
"<span class='notice'><i>I stopped feeding.</i></span>")
layer = initial(layer)
buckled.unbuckle_mob(src,force=TRUE)
unbuckle(force=TRUE)
/mob/living/simple_animal/slime/proc/Evolve()
if(stat)
-2
View File
@@ -75,8 +75,6 @@
var/lastKnownIP = null
/// movable atoms buckled to this mob
var/atom/movable/buckled = null //Living
/// movable atom we are buckled to
var/atom/movable/buckling
var/obj/item/l_hand = null //Living
var/obj/item/r_hand = null //Living