mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
[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:
@@ -82,7 +82,7 @@
|
||||
zomboid.suiciding = 0
|
||||
zomboid.set_nutrition(max(zomboid.nutrition, NUTRITION_LEVEL_HUNGRY))
|
||||
if(zomboid.buckled) //Unbuckle the mob and clear the alerts.
|
||||
zomboid.buckled.unbuckle_mob(src, force = TRUE)
|
||||
zomboid.unbuckle(force = TRUE)
|
||||
|
||||
var/datum/organ/heart/heart = zomboid.get_int_organ_datum(ORGAN_DATUM_HEART)
|
||||
var/heart_type = zomboid.dna?.species?.has_organ["heart"]
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
destturf = safepick(posturfs)
|
||||
else
|
||||
destturf = get_turf(destination)
|
||||
|
||||
|
||||
// Make sure the target tile does not contain a teleporter on it
|
||||
for(var/teleporter_type in blacklisted)
|
||||
var/teleporters = destturf.search_contents_for(teleporter_type)
|
||||
@@ -167,7 +167,7 @@
|
||||
if(isliving(teleatom))
|
||||
var/mob/living/target_mob = teleatom
|
||||
if(target_mob.buckled)
|
||||
target_mob.buckled.unbuckle_mob(target_mob, force = TRUE)
|
||||
target_mob.unbuckle(force = TRUE)
|
||||
if(target_mob.has_buckled_mobs())
|
||||
target_mob.unbuckle_all_mobs(force = TRUE)
|
||||
if(ismachinery(target_mob.loc) || istype(target_mob.loc, /obj/item/mecha_parts/mecha_equipment/medical/sleeper))
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
return
|
||||
|
||||
if(target && target.buckled)
|
||||
target.buckled.unbuckle_mob(target, force = TRUE)
|
||||
target.unbuckle(force = TRUE)
|
||||
|
||||
if(target && target.has_buckled_mobs())
|
||||
target.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
// No cheesing with buckling ourselves, this spinning is too fast for seatbelts
|
||||
if(user.buckled)
|
||||
user.buckled.unbuckle_mob(user, force = TRUE)
|
||||
user.unbuckle(force = TRUE)
|
||||
|
||||
// Check if the machine and the user are still next to each other
|
||||
if(!do_after(user, delay = 1.2 SECONDS, target = src, use_default_checks = FALSE))
|
||||
|
||||
@@ -191,4 +191,4 @@
|
||||
|
||||
/mob/living/proc/check_buckled()
|
||||
if(buckled && !(buckled in loc))
|
||||
buckled.unbuckle_mob(src, force = TRUE)
|
||||
unbuckle(force = TRUE)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
user.visible_message("<span class='notice'>[user] cuts [C]'s restraints with [src]!</span>")
|
||||
QDEL_NULL(C.handcuffed)
|
||||
if(C.buckled && C.buckled.buckle_requires_restraints)
|
||||
C.buckled.unbuckle_mob(C)
|
||||
C.unbuckle()
|
||||
C.update_handcuffed()
|
||||
return
|
||||
else
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
. += "<span class='notice'>Number of uses: [uses]. This scroll will vanish after the final use.</span>"
|
||||
. += "<span class='notice'>P.S. Don't forget to bring your gear, you'll need it to cast most spells.</span>"
|
||||
|
||||
/obj/item/teleportation_scroll/attack_self(mob/user)
|
||||
/obj/item/teleportation_scroll/attack_self(mob/living/user)
|
||||
if(!uses) //somehow?
|
||||
to_chat(user, "<span class='warning'>You attempt to read the scroll but it disintegrates in your hand, it appears that is has run out of charges!</span>")
|
||||
qdel(src)
|
||||
@@ -59,7 +59,7 @@
|
||||
return
|
||||
|
||||
if(user && user.buckled)
|
||||
user.buckled.unbuckle_mob(user, force = TRUE)
|
||||
user.unbuckle(force = TRUE)
|
||||
|
||||
if(user?.has_buckled_mobs())
|
||||
user.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user