Stops people from removing infinite power cell from combat defib (#70494)

* Stops people from removing infinite power cell from combat defib

* cleanups

* balloon alert
This commit is contained in:
Tastyfish
2022-10-14 15:45:38 -04:00
committed by GitHub
parent 89a95f6eb3
commit 8239bc9ced
+27 -12
View File
@@ -19,13 +19,20 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 50, ACID = 50)
var/obj/item/shockpaddles/paddle_type = /obj/item/shockpaddles
var/on = FALSE //if the paddles are equipped (1) or on the defib (0)
var/safety = TRUE //if you can zap people with the defibs on harm mode
var/powered = FALSE //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
/// If the paddles are equipped (1) or on the defib (0)
var/on = FALSE
/// If you can zap people with the defibs on harm mode
var/safety = TRUE
/// If there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
var/powered = FALSE
/// If the cell can be removed via screwdriver
var/cell_removable = TRUE
var/obj/item/shockpaddles/paddles
var/obj/item/stock_parts/cell/high/cell
var/combat = FALSE //if true, revive through space suits, allow for combat shocking
var/cooldown_duration = 5 SECONDS//how long does it take to recharge
/// If true, revive through space suits, allow for combat shocking
var/combat = FALSE
/// How long does it take to recharge
var/cooldown_duration = 5 SECONDS
/// The icon state for the paddle overlay, not applied if null
var/paddle_state = "defibunit-paddles"
/// The icon state for the powered on overlay, not applied if null
@@ -53,6 +60,8 @@
/obj/item/defibrillator/examine(mob/user)
. = ..()
if(!cell_removable)
return
if(cell)
. += span_notice("Use a screwdriver to remove the cell.")
else
@@ -132,13 +141,16 @@
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
/obj/item/defibrillator/screwdriver_act(mob/living/user, obj/item/tool)
if(cell)
cell.update_appearance()
cell.forceMove(get_turf(src))
cell = null
tool.play_tool_sound(src, 50)
to_chat(user, span_notice("You remove the cell from [src]."))
update_power()
if(!cell || !cell_removable)
return FALSE
cell.update_appearance()
cell.forceMove(get_turf(src))
balloon_alert(user, "removed [cell]")
cell = null
tool.play_tool_sound(src, 50)
update_power()
return TRUE
/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
if(W == paddles)
@@ -301,6 +313,9 @@
powered_state = null
emagged_state = null
/obj/item/defibrillator/compact/combat/loaded
cell_removable = FALSE // Don't let people just have an infinite power cell
/obj/item/defibrillator/compact/combat/loaded/Initialize(mapload)
. = ..()
cell = new /obj/item/stock_parts/cell/infinite(src)