defibrillator gets a real power cell and also replaces attackby with item_interaction (#84683)

## About The Pull Request

defibrillator gets a real power cell and also replaces attackby with
item_interaction

## Why It's Good For The Game
bug bad
attackby bad
fixes #84541
## Changelog
🆑
fix: defibrillator no longer has an abstract cell
code: defibrillator attackby replaced with item_interaction
/🆑
This commit is contained in:
jimmyl
2024-07-07 03:28:47 +02:00
committed by GitHub
parent 9f754b5510
commit 55652cd2c5
+21 -23
View File
@@ -28,7 +28,7 @@
/// If the cell can be removed via screwdriver
var/cell_removable = TRUE
var/obj/item/shockpaddles/paddles
var/obj/item/stock_parts/power_store/cell
var/obj/item/stock_parts/power_store/cell/cell
/// If true, revive through space suits, allow for combat shocking
var/combat = FALSE
/// How long does it take to recharge
@@ -155,24 +155,27 @@
update_power()
return TRUE
/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
if(W == paddles)
/obj/item/defibrillator/item_interaction(mob/living/user, obj/item/item, list/modifiers)
if(item == paddles)
toggle_paddles()
else if(istype(W, /obj/item/stock_parts/power_store/cell))
var/obj/item/stock_parts/power_store/cell/C = W
if(cell)
to_chat(user, span_warning("[src] already has a cell!"))
else
if(C.maxcharge < paddles.revivecost)
to_chat(user, span_notice("[src] requires a higher capacity cell."))
return
if(!user.transferItemToLoc(W, src))
return
cell = W
to_chat(user, span_notice("You install a cell in [src]."))
update_power()
else
return ..()
return NONE
if(!istype(item, /obj/item/stock_parts/power_store/cell))
return NONE
var/obj/item/stock_parts/power_store/cell/new_cell = item
if(!isnull(cell))
to_chat(user, span_warning("[src] already has a cell!"))
return ITEM_INTERACT_BLOCKING
if(new_cell.maxcharge < paddles.revivecost)
to_chat(user, span_notice("[src] requires a higher capacity cell."))
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(new_cell, src))
return NONE
cell = new_cell
to_chat(user, span_notice("You install a cell in [src]."))
update_power()
return ITEM_INTERACT_SUCCESS
/obj/item/defibrillator/emag_act(mob/user, obj/item/card/emag/emag_card)
@@ -314,11 +317,6 @@
cell = new /obj/item/stock_parts/power_store/cell/infinite(src)
update_power()
/obj/item/defibrillator/compact/combat/loaded/attackby(obj/item/W, mob/user, params)
if(W == paddles)
toggle_paddles()
return
/obj/item/defibrillator/compact/combat/loaded/nanotrasen
name = "elite Nanotrasen defibrillator"
desc = "A belt-equipped state-of-the-art defibrillator. Can revive through thick clothing, has an experimental self-recharging battery, and can be utilized as a weapon via applying the paddles while in a combat stance."