[MIRROR] Redeems my sins. Defib mount fixes. (#5588)

* Redeems my sins. Defib mount fixes. (#35727)

* Never again

* stuff

* Bumps up the recharge.

* Redeems my sins. Defib mount fixes.
This commit is contained in:
CitadelStationBot
2018-02-19 10:22:21 -06:00
committed by Poojawa
parent 350029e212
commit 58af563131
2 changed files with 39 additions and 14 deletions
+5 -11
View File
@@ -11,7 +11,6 @@
use_power = IDLE_POWER_USE
idle_power_usage = 1
power_channel = EQUIP
speed_process = TRUE //GAS GAS GAS
req_one_access = list(ACCESS_MEDICAL, ACCESS_HEADS, ACCESS_SECURITY) //used to control clamps
var/obj/item/defibrillator/defib //this mount's defibrillator
var/clamps_locked = FALSE //if true, and a defib is loaded, it can't be removed without unlocking the clamps
@@ -35,16 +34,11 @@
to_chat(user, "<span class='notice'>Its locking clamps can be [clamps_locked ? "dis" : ""]engaged by swiping an ID with access.</span>")
/obj/machinery/defibrillator_mount/process()
if(defib && defib.cell && defib.cell.charge < defib.cell.maxcharge)
use_power(20)
defib.cell.give(18) //90% efficiency, slightly better than the cell charger's 87.5%
if(defib && defib.paddles && isliving(defib.paddles.loc))
var/mob/living/L = defib.paddles.loc
if(!L.Adjacent(src))
to_chat(L, "<span class='warning'>[defib]'s paddles overextend and come out of your hands!</span>")
L.dropItemToGround(defib.paddles)
update_icon()
if(defib && defib.cell && defib.cell.charge < defib.cell.maxcharge && is_operational())
use_power(200)
defib.cell.give(180) //90% efficiency, slightly better than the cell charger's 87.5%
update_icon()
/obj/machinery/defibrillator_mount/update_icon()
cut_overlays()
if(defib)
+34 -3
View File
@@ -292,6 +292,30 @@
var/grab_ghost = FALSE
var/tlimit = DEFIB_TIME_LIMIT * 10
var/datum/component/mobhook
/obj/item/twohanded/shockpaddles/equipped(mob/user, slot)
. = ..()
if(req_defib)
if (mobhook && mobhook.parent != user)
QDEL_NULL(mobhook)
if (!mobhook)
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/check_range))
/obj/item/twohanded/shockpaddles/Moved()
. = ..()
check_range()
/obj/item/twohanded/shockpaddles/proc/check_range()
if(!in_range(src,defib))
var/mob/living/L = loc
if(istype(L))
to_chat(L, "<span class='warning'>[defib]'s paddles overextend and come out of your hands!</span>")
L.temporarilyRemoveItemFromInventory(src,TRUE)
else
visible_message("<span class='notice'>[src] snap back into [defib].</span>")
snap_back()
/obj/item/twohanded/shockpaddles/proc/recharge(var/time)
if(req_defib || !time)
return
@@ -331,16 +355,23 @@
/obj/item/twohanded/shockpaddles/dropped(mob/user)
if(!req_defib)
return ..()
if (mobhook)
QDEL_NULL(mobhook)
if(user)
var/obj/item/twohanded/offhand/O = user.get_inactive_held_item()
if(istype(O))
O.unwield()
to_chat(user, "<span class='notice'>The paddles snap back into the main unit.</span>")
defib.on = 0
forceMove(defib)
defib.update_icon()
snap_back()
return unwield(user)
/obj/item/twohanded/shockpaddles/proc/snap_back()
if(!defib)
return
defib.on = FALSE
forceMove(defib)
defib.update_icon()
/obj/item/twohanded/shockpaddles/proc/check_defib_exists(mainunit, mob/living/carbon/M, obj/O)
if(!req_defib)
return TRUE //If it doesn't need a defib, just say it exists