mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Converts autosurgeons/robot bodyparts/dissection notes to item_interaction (#95401)
## About The Pull Request I'm just going by categories and bundling up whichever ones are relevant, more attackby()s gone ## Changelog 🆑 refactor: Converted autosurgeons/robot bodyparts/dissection notes to item_interaction /🆑
This commit is contained in:
@@ -295,28 +295,29 @@
|
||||
TRAIT_RESISTHIGHPRESSURE,
|
||||
), AUGMENTATION_TRAIT)
|
||||
|
||||
/obj/item/bodypart/chest/robot/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers)
|
||||
if(istype(weapon, /obj/item/stock_parts/power_store/cell))
|
||||
/obj/item/bodypart/chest/robot/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
if(istype(tool, /obj/item/stock_parts/power_store/cell))
|
||||
if(cell)
|
||||
to_chat(user, span_warning("You have already inserted a cell!"))
|
||||
return
|
||||
else
|
||||
if(!user.transferItemToLoc(weapon, src))
|
||||
return
|
||||
cell = weapon
|
||||
to_chat(user, span_notice("You insert the cell."))
|
||||
else if(istype(weapon, /obj/item/stack/cable_coil))
|
||||
to_chat(user, span_warning("A cell is already present in [src]!"))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
if(!user.transferItemToLoc(tool, src))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
cell = tool
|
||||
to_chat(user, span_notice("You insert [cell] into [src]."))
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
if(istype(tool, /obj/item/stack/cable_coil))
|
||||
if(wired)
|
||||
to_chat(user, span_warning("You have already inserted wire!"))
|
||||
return
|
||||
var/obj/item/stack/cable_coil/coil = weapon
|
||||
if (coil.use(1))
|
||||
wired = TRUE
|
||||
to_chat(user, span_notice("You insert the wire."))
|
||||
else
|
||||
to_chat(user, span_warning("[src] is already wired up!"))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
var/obj/item/stack/cable_coil/coil = tool
|
||||
if (!coil.use(1))
|
||||
to_chat(user, span_warning("You need one length of coil to wire it!"))
|
||||
else
|
||||
return ..()
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
wired = TRUE
|
||||
to_chat(user, span_notice("You wire the cell inside of [src]."))
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
return NONE
|
||||
|
||||
/obj/item/bodypart/chest/robot/wirecutter_act(mob/living/user, obj/item/cutter)
|
||||
. = ..()
|
||||
@@ -440,25 +441,28 @@
|
||||
. += "It has two eye sockets occupied by flashes."
|
||||
. += span_notice("You can remove the seated flash[single_flash ? "":"es"] with a <b>crowbar</b>.")
|
||||
|
||||
/obj/item/bodypart/head/robot/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers)
|
||||
if(istype(weapon, /obj/item/assembly/flash/handheld))
|
||||
var/obj/item/assembly/flash/handheld/flash = weapon
|
||||
if(flash1 && flash2)
|
||||
to_chat(user, span_warning("You have already inserted the eyes!"))
|
||||
return
|
||||
else if(flash.burnt_out)
|
||||
to_chat(user, span_warning("You can't use a broken flash!"))
|
||||
return
|
||||
else
|
||||
if(!user.transferItemToLoc(flash, src))
|
||||
return
|
||||
if(flash1)
|
||||
flash2 = flash
|
||||
else
|
||||
flash1 = flash
|
||||
to_chat(user, span_notice("You insert the flash into the eye socket."))
|
||||
return
|
||||
return ..()
|
||||
/obj/item/bodypart/head/robot/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
if(!istype(tool, /obj/item/assembly/flash/handheld))
|
||||
return NONE
|
||||
|
||||
var/obj/item/assembly/flash/handheld/flash = tool
|
||||
if(flash1 && flash2)
|
||||
to_chat(user, span_warning("[src] already has both flash-eyes present!"))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
if(flash.burnt_out)
|
||||
to_chat(user, span_warning("You can't use a broken flash!"))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
if(!user.transferItemToLoc(flash, src))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
if(flash1)
|
||||
flash2 = flash
|
||||
else
|
||||
flash1 = flash
|
||||
to_chat(user, span_notice("You insert the flash into the eye socket."))
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/obj/item/bodypart/head/robot/crowbar_act(mob/living/user, obj/item/prytool)
|
||||
..()
|
||||
|
||||
@@ -115,14 +115,14 @@
|
||||
. = ..()
|
||||
. += span_notice("It is worth [value] research points.")
|
||||
|
||||
/obj/item/research_notes/attackby(obj/item/attacking_item, mob/living/user, list/modifiers, list/attack_modifiers)
|
||||
if(istype(attacking_item, /obj/item/research_notes))
|
||||
var/obj/item/research_notes/notes = attacking_item
|
||||
value = value + notes.value
|
||||
change_vol()
|
||||
qdel(notes)
|
||||
return
|
||||
return ..()
|
||||
/obj/item/research_notes/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
if(!istype(tool, /obj/item/research_notes))
|
||||
return NONE
|
||||
var/obj/item/research_notes/notes = tool
|
||||
value = value + notes.value
|
||||
change_vol()
|
||||
qdel(notes)
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/// proc that changes name and icon depending on value
|
||||
/obj/item/research_notes/proc/change_vol()
|
||||
|
||||
@@ -122,11 +122,11 @@
|
||||
add_fingerprint(user)
|
||||
use_autosurgeon(target, user, 8 SECONDS)
|
||||
|
||||
/obj/item/autosurgeon/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers)
|
||||
if(isorgan(attacking_item))
|
||||
load_organ(attacking_item, user)
|
||||
else
|
||||
return ..()
|
||||
/obj/item/autosurgeon/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
if(isorgan(tool))
|
||||
load_organ(tool, user)
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
return NONE
|
||||
|
||||
/obj/item/autosurgeon/screwdriver_act(mob/living/user, obj/item/screwtool)
|
||||
if(..())
|
||||
|
||||
Reference in New Issue
Block a user