diff --git a/GainStation13/code/machinery/doors/airlock_types.dm b/GainStation13/code/machinery/doors/airlock_types.dm index 3f925583de..1b6c605ef7 100644 --- a/GainStation13/code/machinery/doors/airlock_types.dm +++ b/GainStation13/code/machinery/doors/airlock_types.dm @@ -13,9 +13,8 @@ L.visible_message("[L] gets stuck in the doorway!") to_chat(L, "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.") 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("[L] gets stuck in the doorway!") to_chat(L, "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.") 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, "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.") @@ -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("[L] gets stuck in the doorway!") + to_chat(L, "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.") + 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("[L] gets stuck in the doorway!") + to_chat(L, "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.") + 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, "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.") + return ..() + + else if(L.fatness > (stuckage_weight / 2)) + if(rand(1, 5) == 1) + L.visible_message("[L]'s hips brush against the doorway...") + to_chat(L, "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..") + return ..() + + return ..() + +// Callback proc to replace sleep function +/obj/machinery/door/proc/AsyncDoorstuckCall(mob/living/carbon/L) + L.doorstuck = 0 + L.Knockdown(1)