[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
+4 -4
View File
@@ -482,12 +482,12 @@
if(globalMalf > 16 && globalMalf < 35)
visible_message("<span class='warning'>[src] melts [exp_on], ian-izing the air around it!</span>")
throwSmoke(loc)
var/mob/tracked_ian = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list
var/mob/living/tracked_ian = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list
if(tracked_ian)
throwSmoke(tracked_ian.loc)
tracked_ian.loc = loc
if(tracked_ian.buckled)
tracked_ian.buckled.unbuckle_mob(tracked_ian, TRUE)
tracked_ian.unbuckle(force = TRUE)
investigate_log("Experimentor has stolen Ian!", "experimentor") //...if anyone ever fixes it...
else
new /mob/living/simple_animal/pet/dog/corgi(loc)
@@ -496,12 +496,12 @@
if(globalMalf > 36 && globalMalf < 59)
visible_message("<span class='warning'>[src] encounters a run-time error!</span>")
throwSmoke(loc)
var/mob/tracked_runtime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list
var/mob/living/tracked_runtime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list
if(tracked_runtime)
throwSmoke(tracked_runtime.loc)
tracked_runtime.loc = loc
if(tracked_runtime.buckled)
tracked_runtime.buckled.unbuckle_mob(tracked_runtime, TRUE)
tracked_runtime.unbuckle(force = TRUE)
investigate_log("Experimentor has stolen Runtime!", "experimentor")
else
new /mob/living/simple_animal/pet/cat(loc)
+12 -14
View File
@@ -645,20 +645,18 @@
var/obj/mecha/mech = AM
if(mech.occupant)
INVOKE_ASYNC(mech, TYPE_PROC_REF(/obj/mecha, get_out_and_die))
if(ismob(AM))
var/mob/M = AM
if(M.buckled)
M.buckled.unbuckle_mob(M, force = TRUE)
if(isliving(AM))
var/mob/living/L = AM
if(L.incorporeal_move || L.status_flags & GODMODE)
continue
L.stop_pulling()
L.visible_message("<span class='warning'>[L] is hit by \
a hyperspace ripple!</span>",
"<span class='userdanger'>You feel an immense \
crushing pressure as the space around you ripples.</span>")
L.gib()
if(isliving(AM))
var/mob/living/L = AM
if(L.buckled)
L.unbuckle(force = TRUE)
if(L.incorporeal_move || L.status_flags & GODMODE)
continue
L.stop_pulling()
L.visible_message("<span class='warning'>[L] is hit by \
a hyperspace ripple!</span>",
"<span class='userdanger'>You feel an immense \
crushing pressure as the space around you ripples.</span>")
L.gib()
else if(lance_docking) //corrupt the child, destroy them all
if(!AM.simulated)
continue
+1 -1
View File
@@ -433,7 +433,7 @@ GLOBAL_DATUM_INIT(multispin_words, /regex, regex("like a record baby"))
for(var/V in listeners)
var/mob/living/L = V
if(L.buckled && istype(L.buckled, /obj/structure/chair))
L.buckled.unbuckle_mob(L)
L.unbuckle()
next_command = world.time + cooldown_meme
//DANCE