Roller bed IVs, tea nerf, atropine removal. (#9029)

This commit is contained in:
Matt Atlas
2020-06-08 11:32:25 +02:00
committed by GitHub
parent a8f8a4fa90
commit 59d6463235
5 changed files with 170 additions and 121 deletions
@@ -197,9 +197,134 @@
name = "roller bed"
icon = 'icons/obj/rollerbed.dmi'
icon_state = "standard_down"
anchored = FALSE
var/base_state = "standard"
var/item_bedpath = /obj/item/roller
anchored = 0
var/obj/item/reagent_containers/beaker
var/iv_attached = 0
var/iv_stand = TRUE
/obj/structure/bed/roller/update_icon()
overlays.Cut()
if(density)
icon_state = "[base_state]_up"
else
icon_state = "[base_state]_down"
if(beaker)
var/image/iv = image(icon, "iv[iv_attached]")
var/percentage = round((beaker.reagents.total_volume / beaker.volume) * 100, 25)
var/image/filling = image(icon, "iv_filling[percentage]")
filling.color = beaker.reagents.get_color()
iv.overlays += filling
if(percentage < 25)
iv.overlays += image(icon, "light_low")
if(density)
iv.pixel_y = 6
overlays += iv
/obj/structure/bed/roller/attackby(obj/item/I, mob/user)
if(iswrench(I) || istype(I, /obj/item/stack) || iswirecutter(I))
return 1
if(iv_stand && !beaker && istype(I, /obj/item/reagent_containers))
if(!user.unEquip(I, target = src))
return
to_chat(user, SPAN_NOTICE("You attach \the [I] to \the [src]."))
beaker = I
update_icon()
return 1
..()
/obj/structure/bed/roller/attack_hand(mob/living/user)
if(beaker && !buckled_mob)
remove_beaker(user)
else
..()
/obj/structure/bed/roller/proc/collapse()
visible_message("<b>[usr]</b> collapses \the [src].")
new item_bedpath(get_turf(src))
qdel(src)
/obj/structure/bed/roller/process()
if(!iv_attached || !buckled_mob || !beaker)
return PROCESS_KILL
if(SSprocessing.times_fired % 2)
return
if(beaker.volume > 0)
beaker.reagents.trans_to_mob(buckled_mob, beaker.amount_per_transfer_from_this, CHEM_BLOOD)
update_icon()
/obj/structure/bed/roller/proc/remove_beaker(mob/user)
to_chat(user, SPAN_NOTICE("You detach \the [beaker] from \the [src]."))
iv_attached = FALSE
beaker.dropInto(loc)
beaker = null
update_icon()
/obj/structure/bed/roller/proc/attach_iv(mob/living/carbon/human/target, mob/user)
if(!beaker)
return
if(do_mob(user, target, 1 SECOND))
visible_message("<b>[user]</b> attaches [target] to the IV on \the [src].")
iv_attached = TRUE
update_icon()
START_PROCESSING(SSprocessing, src)
/obj/structure/bed/roller/proc/detach_iv(mob/living/carbon/human/target, mob/user)
visible_message("<b>[user]</b> takes [target] off the IV on \the [src].")
iv_attached = FALSE
update_icon()
STOP_PROCESSING(SSprocessing, src)
/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location)
..()
if(use_check(usr) || !Adjacent(usr))
return
if(!(ishuman(usr) || isrobot(usr)))
return
if(over_object == buckled_mob && beaker)
if(iv_attached)
detach_iv(buckled_mob, usr)
else
attach_iv(buckled_mob, usr)
return
if(ishuman(over_object))
if(user_buckle_mob(over_object, usr))
attach_iv(buckled_mob, usr)
return
if(beaker)
remove_beaker(usr)
return
if(buckled_mob)
return
collapse()
/obj/structure/bed/roller/Move()
..()
if(makes_rolling_sound)
playsound(src, 'sound/effects/roll.ogg', 100, 1)
if(buckled_mob)
if(buckled_mob.buckled == src)
buckled_mob.forceMove(src.loc)
else
buckled_mob = null
/obj/structure/bed/roller/post_buckle_mob(mob/living/M)
. = ..()
if(M == buckled_mob)
density = TRUE
M.pixel_y = 6
M.old_y = 6
update_icon()
else
density = FALSE
M.pixel_y = 0
M.old_y = 0
if(iv_attached)
detach_iv(M, usr)
update_icon()
/obj/structure/bed/roller/hover
name = "medical hoverbed"
@@ -212,23 +337,6 @@
.=..()
set_light(2,1,LIGHT_COLOR_CYAN)
/obj/structure/bed/roller/update_icon()
return // Doesn't care about material or anything else.
/obj/structure/bed/roller/attackby(obj/item/W as obj, mob/user as mob)
if(W.iswrench() || istype(W,/obj/item/stack) || W.iswirecutter())
return
else if(istype(W,/obj/item/roller_holder))
if(buckled_mob)
user_unbuckle_mob(user)
else
visible_message("[user] collapses \the [src.name].")
new/obj/item/roller(get_turf(src))
spawn(0)
qdel(src)
return
..()
/obj/item/roller
name = "roller bed"
desc = "A collapsed roller bed that can be carried around."
@@ -285,39 +393,3 @@
R.add_fingerprint(user)
qdel(held)
held = null
/obj/structure/bed/roller/Move()
..()
if(makes_rolling_sound)
playsound(src, 'sound/effects/roll.ogg', 100, 1)
if(buckled_mob)
if(buckled_mob.buckled == src)
buckled_mob.forceMove(src.loc)
else
buckled_mob = null
/obj/structure/bed/roller/post_buckle_mob(mob/living/M as mob)
if(M == buckled_mob)
M.pixel_y = 6
M.old_y = 6
density = 1
icon_state = "[base_state]_up"
else
M.pixel_y = 0
M.old_y = 0
density = 0
icon_state = "[base_state]_down"
return ..()
/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location)
..()
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
if(!ishuman(usr)) return
if(buckled_mob) return 0
visible_message("[usr] collapses \the [src.name].")
new item_bedpath(get_turf(src))
spawn(0)
qdel(src)
return