Files
Bubberstation/code/game/objects/items/bodybag.dm
SkyratBot f02e30a50e [MIRROR] Implements timed_action_flags for do_after-like procs (#1385)
* Implements timed_action_flags for do_after-like procs (#54409)

Originally I wanted to fix an issue where the `get_up()` `do_after()` would ignore the callback checks, because it was `uninterruptible`, so that made me refactor these procs to allow for higher granularity on checks and standardize behavior a bit more.
There's more work to be done for them, but one thing at a time.

* Removes the `uninterruptible` check in favor of the more granular `timed_action_flags`
* Cleans code on the `do_atom`, `do_after_mob`, `do_mob` and `do_after` procs to standardize them a little better.

* Implements timed_action_flags for do_after-like procs

* Update horror_form.dm

Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Azarak <azarak10@gmail.com>
2020-10-21 07:06:03 +02:00

89 lines
3.4 KiB
Plaintext

/obj/item/bodybag
name = "body bag"
desc = "A folded bag designed for the storage and transportation of cadavers."
icon = 'icons/obj/bodybag.dmi'
icon_state = "bodybag_folded"
w_class = WEIGHT_CLASS_SMALL
var/unfoldedbag_path = /obj/structure/closet/body_bag
/obj/item/bodybag/attack_self(mob/user)
deploy_bodybag(user, user.loc)
/obj/item/bodybag/afterattack(atom/target, mob/user, proximity)
. = ..()
if(proximity)
if(isopenturf(target))
deploy_bodybag(user, target)
/obj/item/bodybag/proc/deploy_bodybag(mob/user, atom/location)
var/obj/structure/closet/body_bag/R = new unfoldedbag_path(location)
R.open(user)
R.add_fingerprint(user)
R.foldedbag_instance = src
moveToNullspace()
/obj/item/bodybag/suicide_act(mob/user)
if(isopenturf(user.loc))
user.visible_message("<span class='suicide'>[user] is crawling into [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
var/obj/structure/closet/body_bag/R = new unfoldedbag_path(user.loc)
R.add_fingerprint(user)
qdel(src)
user.forceMove(R)
playsound(src, 'sound/items/zip.ogg', 15, TRUE, -3)
return (OXYLOSS)
..()
// Bluespace bodybag
/obj/item/bodybag/bluespace
name = "bluespace body bag"
desc = "A folded bluespace body bag designed for the storage and transportation of cadavers."
icon = 'icons/obj/bodybag.dmi'
icon_state = "bluebodybag_folded"
unfoldedbag_path = /obj/structure/closet/body_bag/bluespace
w_class = WEIGHT_CLASS_SMALL
item_flags = NO_MAT_REDEMPTION
/obj/item/bodybag/bluespace/examine(mob/user)
. = ..()
if(contents.len)
var/s = contents.len == 1 ? "" : "s"
. += "<span class='notice'>You can make out the shape[s] of [contents.len] object[s] through the fabric.</span>"
/obj/item/bodybag/bluespace/Destroy()
for(var/atom/movable/A in contents)
A.forceMove(get_turf(src))
if(isliving(A))
to_chat(A, "<span class='notice'>You suddenly feel the space around you torn apart! You're free!</span>")
return ..()
/obj/item/bodybag/bluespace/deploy_bodybag(mob/user, atom/location)
var/obj/structure/closet/body_bag/R = new unfoldedbag_path(location)
for(var/atom/movable/A in contents)
A.forceMove(R)
if(isliving(A))
to_chat(A, "<span class='notice'>You suddenly feel air around you! You're free!</span>")
R.open(user)
R.add_fingerprint(user)
R.foldedbag_instance = src
moveToNullspace()
/obj/item/bodybag/bluespace/container_resist_act(mob/living/user)
if(user.incapacitated())
to_chat(user, "<span class='warning'>You can't get out while you're restrained like this!</span>")
return
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "<span class='notice'>You claw at the fabric of [src], trying to tear it open...</span>")
to_chat(loc, "<span class='warning'>Someone starts trying to break free of [src]!</span>")
if(!do_mob(user, src, 12 SECONDS, timed_action_flags = (IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM)))
return
// you are still in the bag? time to go unless you KO'd, honey!
// if they escape during this time and you rebag them the timer is still clocking down and does NOT reset so they can very easily get out.
if(user.incapacitated())
to_chat(loc, "<span class='warning'>The pressure subsides. It seems that they've stopped resisting...</span>")
return
loc.visible_message("<span class='warning'>[user] suddenly appears in front of [loc]!</span>", "<span class='userdanger'>[user] breaks free of [src]!</span>")
qdel(src)