replace sleep with timer

This commit is contained in:
AlManiak
2024-12-01 19:38:37 +01:00
parent bf43f4d817
commit 95ef6f6942
@@ -13,9 +13,8 @@
L.visible_message("<span class'danger'>[L] gets stuck in the doorway!</span>")
to_chat(L, "<span class='danger'>As you attempt to pass through \the [src], your ample curves get wedged in the narrow opening. You find yourself stuck in the [src] frame, struggling to free yourself from the tight squeeze.</span>")
L.Stun(100, updating = TRUE, ignore_canstun = TRUE)
sleep(100)
L.doorstuck = 0
L.Knockdown(1)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/door, AsyncDoorstuckCall), L), 100)
//sleep(100)
return ..()
else if(L.fatness > stuckage_weight)
@@ -24,9 +23,8 @@
L.visible_message("<span class'danger'>[L] gets stuck in the doorway!</span>")
to_chat(L, "<span class='danger'>As you attempt to pass through \the [src], your ample curves get wedged in the narrow opening. You find yourself stuck in the [src] frame, struggling to free yourself from the tight squeeze.</span>")
L.Stun(55, updating = TRUE, ignore_canstun = TRUE)
sleep(55)
L.doorstuck = 0
L.Knockdown(1)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/door, AsyncDoorstuckCall), L), 55)
//sleep(55)
return ..()
if(rand(1, 5) == 5)
to_chat(L, "<span class='danger'>With great effort, you manage to squeeze your massive form through \the [src]. It's a tight fit, but you successfully navigate the narrow opening, barely avoiding getting stuck.</span>")
@@ -39,3 +37,47 @@
return ..()
return ..()
/obj/structure/mineral_door/Crossed(mob/living/carbon/L)
if(!istype(L))
return ..()
var/stuckage_weight = L?.client?.prefs?.stuckage
if(isnull(stuckage_weight) || (stuckage_weight < 10))
return ..() // They aren't able to get stuck
if(L.fatness > (stuckage_weight * 2))
if(rand(1, 3) == 1)
L.doorstuck = 1
L.visible_message("<span class'danger'>[L] gets stuck in the doorway!</span>")
to_chat(L, "<span class='danger'>As you attempt to pass through \the [src], your ample curves get wedged in the narrow opening. You find yourself stuck in the [src] frame, struggling to free yourself from the tight squeeze.</span>")
L.Stun(100, updating = TRUE, ignore_canstun = TRUE)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/door, AsyncDoorstuckCall), L), 100)
//sleep(100)
return ..()
else if(L.fatness > stuckage_weight)
if(rand(1, 5) == 1)
L.doorstuck = 1
L.visible_message("<span class'danger'>[L] gets stuck in the doorway!</span>")
to_chat(L, "<span class='danger'>As you attempt to pass through \the [src], your ample curves get wedged in the narrow opening. You find yourself stuck in the [src] frame, struggling to free yourself from the tight squeeze.</span>")
L.Stun(55, updating = TRUE, ignore_canstun = TRUE)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/door, AsyncDoorstuckCall), L), 55)
//sleep(55)
return ..()
if(rand(1, 5) == 5)
to_chat(L, "<span class='danger'>With great effort, you manage to squeeze your massive form through \the [src]. It's a tight fit, but you successfully navigate the narrow opening, barely avoiding getting stuck.</span>")
return ..()
else if(L.fatness > (stuckage_weight / 2))
if(rand(1, 5) == 1)
L.visible_message("<span class'danger'>[L]'s hips brush against the doorway...</span>")
to_chat(L, "<span class='danger'>As you pass through \the [src], you feel a slight brushing against your hips. The [src] frame accommodates your form, but it's a close fit..</span>")
return ..()
return ..()
// Callback proc to replace sleep function
/obj/machinery/door/proc/AsyncDoorstuckCall(mob/living/carbon/L)
L.doorstuck = 0
L.Knockdown(1)