From 53d30995822e080e294a6f07af6a95acebd0056b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 2 Jul 2024 12:01:16 +0200 Subject: [PATCH] [MIRROR] Moves tool use back higher in the chain, but makes it so tool acts are only called on non-combat-mode (#28457) Moves tool use back higher in the chain, but makes it so tool acts are only called on non-combat-mode Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com> --- code/__HELPERS/atoms.dm | 11 -- code/datums/components/crafting/robot.dm | 16 +-- code/datums/components/lockable_storage.dm | 13 +-- code/game/atom/atom_tool_acts.dm | 54 ++++++++- code/game/machinery/launch_pad.dm | 18 +-- code/game/objects/items.dm | 9 -- .../objects/items/devices/laserpointer.dm | 6 +- .../objects/items/storage/boxes/food_boxes.dm | 18 +-- .../objects/items/storage/boxes/job_boxes.dm | 28 ++--- .../items/storage/boxes/service_boxes.dm | 14 +-- code/game/objects/items/storage/lockbox.dm | 106 ++++++++---------- code/game/objects/items/storage/medkit.dm | 64 ++++++----- code/game/objects/items/storage/toolbox.dm | 16 +-- code/game/objects/structures/false_walls.dm | 4 +- code/game/objects/structures/reflector.dm | 4 +- code/game/objects/structures/tables_racks.dm | 11 -- code/game/objects/structures/window.dm | 4 +- code/game/turfs/open/floor/plating.dm | 4 +- code/modules/bitrunning/objects/loot_box.dm | 1 + .../food_and_drinks/machinery/microwave.dm | 4 +- code/modules/holodeck/turfs.dm | 3 + code/modules/mod/mod_control.dm | 45 ++++---- code/modules/mod/mod_core.dm | 84 +++++++++----- .../projectiles/guns/energy/dueling.dm | 11 +- code/modules/research/server.dm | 6 +- .../clothing/back/antigravityharness.dm | 14 +-- .../modules/hyposprays/code/hypospray_kits.dm | 25 ++--- 27 files changed, 294 insertions(+), 299 deletions(-) diff --git a/code/__HELPERS/atoms.dm b/code/__HELPERS/atoms.dm index cb1e2a87f76..406ea75143c 100644 --- a/code/__HELPERS/atoms.dm +++ b/code/__HELPERS/atoms.dm @@ -325,14 +325,3 @@ rough example of the "cone" made by the 3 dirs checked "x" = icon_width > world.icon_size && pixel_x != 0 ? (icon_width - world.icon_size) * 0.5 : 0, "y" = icon_height > world.icon_size && pixel_y != 0 ? (icon_height - world.icon_size) * 0.5 : 0, ) - -/** - * Called before an item is put into this atom's storage datum via the item clicking on this atom - * - * This can be used to add item-atom interactions that you want handled before inserting something into storage - * (But it's also fairly snowflakey) - * - * Returning FALSE will block that item from being put into our storage - */ -/atom/proc/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - return TRUE diff --git a/code/datums/components/crafting/robot.dm b/code/datums/components/crafting/robot.dm index d3f7a349e12..09c8455a77b 100644 --- a/code/datums/components/crafting/robot.dm +++ b/code/datums/components/crafting/robot.dm @@ -75,21 +75,7 @@ var/obj/item/storage/medkit/medkit = bot.contents[3] bot.medkit_type = medkit bot.health_analyzer = bot.contents[4] - - ///if you add a new one don't forget to update /obj/item/storage/medkit/attackby() - if (istype(medkit, /obj/item/storage/medkit/fire)) - bot.skin = "ointment" - else if (istype(medkit, /obj/item/storage/medkit/toxin)) - bot.skin = "tox" - else if (istype(medkit, /obj/item/storage/medkit/o2)) - bot.skin = "o2" - else if (istype(medkit, /obj/item/storage/medkit/brute)) - bot.skin = "brute" - else if (istype(medkit, /obj/item/storage/medkit/advanced)) - bot.skin = "advanced" - else if (istype(src, /obj/item/storage/medkit/tactical)) - bot.skin = "bezerk" - + bot.skin = medkit.get_medbot_skin() bot.damage_type_healer = initial(medkit.damagetype_healed) ? initial(medkit.damagetype_healed) : BRUTE bot.update_appearance() diff --git a/code/datums/components/lockable_storage.dm b/code/datums/components/lockable_storage.dm index c559c008c79..482cb134159 100644 --- a/code/datums/components/lockable_storage.dm +++ b/code/datums/components/lockable_storage.dm @@ -47,7 +47,6 @@ if(can_hack_open) RegisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_SCREWDRIVER), PROC_REF(on_screwdriver_act)) RegisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_MULTITOOL), PROC_REF(on_multitool_act)) - RegisterSignal(parent, COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT, PROC_REF(block_insert)) RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) RegisterSignal(parent, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_requesting_context_from_item)) @@ -117,6 +116,7 @@ return NONE panel_open = !panel_open + tool.play_tool_sound(source) source.balloon_alert(user, "panel [panel_open ? "opened" : "closed"]") return ITEM_INTERACT_SUCCESS @@ -137,20 +137,11 @@ ///Does a do_after to hack the storage open, takes a long time cause idk. /datum/component/lockable_storage/proc/hack_open(atom/source, mob/user, obj/item/tool) - if(!tool.use_tool(parent, user, 40 SECONDS)) + if(!tool.use_tool(parent, user, 40 SECONDS, volume = 50)) return source.balloon_alert(user, "hacked") lock_code = null -/// Stops you from shoving your tools into the storage if you're trying to hack it -/datum/component/lockable_storage/proc/block_insert(atom/source, obj/item/inserting, mob/living/user) - SIGNAL_HANDLER - if(!can_hack_open || !source.atom_storage.locked) - return NONE // allow insert - if(inserting.tool_behaviour == TOOL_MULTITOOL || inserting.tool_behaviour == TOOL_SCREWDRIVER) - return BLOCK_STORAGE_INSERT // block insert - return NONE - ///Updates the icon state depending on if we're locked or not. /datum/component/lockable_storage/proc/on_update_icon_state(obj/source) SIGNAL_HANDLER diff --git a/code/game/atom/atom_tool_acts.dm b/code/game/atom/atom_tool_acts.dm index fb4dfcd1df7..f1383c675c5 100644 --- a/code/game/atom/atom_tool_acts.dm +++ b/code/game/atom/atom_tool_acts.dm @@ -9,6 +9,11 @@ SHOULD_CALL_PARENT(TRUE) PROTECTED_PROC(TRUE) + if(!user.combat_mode) + var/tool_return = tool_act(user, tool, modifiers) + if(tool_return) + return tool_return + var/is_right_clicking = LAZYACCESS(modifiers, RIGHT_CLICK) var/is_left_clicking = !is_right_clicking var/early_sig_return = NONE @@ -45,10 +50,36 @@ if(interact_return) return interact_return + return NONE + +/** + * + * ## Tool Act + * + * Handles using specific tools on this atom directly. + * Only called when combat mode is off. + * + * Handles the tool_acts in particular, such as wrenches and screwdrivers. + * + * This can be overriden to handle unique "tool interactions" + * IE using an item like a tool (when it's not actually one) + * This is particularly useful for things that shouldn't be inserted into storage + * (because tool acting runs before storage checks) + * but otherwise does nothing that [item_interaction] doesn't already do. + * + * In other words, use sparingly. It's harder to use (correctly) than [item_interaction]. + */ +/atom/proc/tool_act(mob/living/user, obj/item/tool, list/modifiers) + SHOULD_CALL_PARENT(TRUE) + PROTECTED_PROC(TRUE) + var/tool_type = tool.tool_behaviour - if(!tool_type) // here on only deals with ... tools + if(!tool_type) return NONE + var/is_right_clicking = LAZYACCESS(modifiers, RIGHT_CLICK) + var/is_left_clicking = !is_right_clicking + var/list/processing_recipes = list() var/signal_result = is_left_clicking \ ? SEND_SIGNAL(src, COMSIG_ATOM_TOOL_ACT(tool_type), user, tool, processing_recipes) \ @@ -57,6 +88,7 @@ return signal_result if(length(processing_recipes)) process_recipes(user, tool, processing_recipes) + return ITEM_INTERACT_SUCCESS if(QDELETED(tool)) return ITEM_INTERACT_SUCCESS // Safe-ish to assume that if we deleted our item something succeeded @@ -301,3 +333,23 @@ /// Called on an object when a tool with analyzer capabilities is used to right click an object /atom/proc/analyzer_act_secondary(mob/living/user, obj/item/tool) return + +/** + * Called before this item is placed into a storage container + * via the item clicking on the target atom + * + * Returning FALSE will prevent the item from being stored. + */ +/obj/item/proc/storage_insert_on_interaction(datum/storage, atom/storage_holder, mob/user) + return TRUE + +/** + * Called before an item is put into this atom's storage datum via the item clicking on this atom + * + * This can be used to add item-atom interactions that you want handled before inserting something into storage + * (But it's also fairly snowflakey) + * + * Returning FALSE will block that item from being put into our storage. + */ +/atom/proc/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) + return TRUE diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index f8dc9887758..444e44125c8 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -351,15 +351,15 @@ user.transferItemToLoc(src, pad, TRUE) atom_storage.close_all() -/obj/item/storage/briefcase/launchpad/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(istype(inserted, /obj/item/launchpad_remote)) - var/obj/item/launchpad_remote/remote = inserted - if(remote.pad == WEAKREF(src.pad)) - return TRUE - remote.pad = WEAKREF(src.pad) - to_chat(user, span_notice("You link [pad] to [remote].")) - return FALSE // no insert - return TRUE +/obj/item/storage/briefcase/launchpad/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/launchpad_remote)) + return ..() + var/obj/item/launchpad_remote/remote = tool + if(remote.pad == WEAKREF(src.pad)) + return ..() + remote.pad = WEAKREF(src.pad) + to_chat(user, span_notice("You link [pad] to [remote].")) + return ITEM_INTERACT_BLOCKING /obj/item/launchpad_remote name = "folder" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 2f41aed8078..bcb9409d3d7 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1571,15 +1571,6 @@ SHOULD_CALL_PARENT(TRUE) SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED_AS_OUTFIT, outfit_wearer, visuals_only, item_slot) -/** - * Called before this item is placed into a storage container - * via the item clicking on the target atom - * - * Returning FALSE will prevent the item from being stored - */ -/obj/item/proc/storage_insert_on_interaction(datum/storage, atom/storage_holder, mob/user) - return TRUE - /obj/item/proc/do_pickup_animation(atom/target, turf/source) if(!source) if(!istype(loc, /turf)) diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 94ba4d14c8e..cdd814b4e64 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -80,11 +80,11 @@ diode = null return TRUE -/obj/item/laser_pointer/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/item/laser_pointer/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(isnull(crystal_lens)) - return NONE + return ..() if(tool_behaviour != TOOL_WIRECUTTER && tool_behaviour != TOOL_HEMOSTAT) - return NONE + return ..() tool.play_tool_sound(src) balloon_alert(user, "removed crystal lens") crystal_lens.forceMove(drop_location()) diff --git a/code/game/objects/items/storage/boxes/food_boxes.dm b/code/game/objects/items/storage/boxes/food_boxes.dm index bab60320c95..bccb04f14d0 100644 --- a/code/game/objects/items/storage/boxes/food_boxes.dm +++ b/code/game/objects/items/storage/boxes/food_boxes.dm @@ -94,27 +94,27 @@ desc = "A paper sack with a crude smile etched onto the side." return ..() -/obj/item/storage/box/papersack/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(IS_WRITING_UTENSIL(inserted)) - var/choice = show_radial_menu(user, src , papersack_designs, custom_check = CALLBACK(src, PROC_REF(check_menu), user, inserted), radius = 36, require_near = TRUE) +/obj/item/storage/box/papersack/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(IS_WRITING_UTENSIL(tool)) + var/choice = show_radial_menu(user, src , papersack_designs, custom_check = CALLBACK(src, PROC_REF(check_menu), user, tool), radius = 36, require_near = TRUE) if(!choice || choice == design_choice) - return FALSE + return ITEM_INTERACT_BLOCKING design_choice = choice balloon_alert(user, "modified") update_appearance() - return FALSE - if(inserted.get_sharpness() && !contents.len) + return ITEM_INTERACT_SUCCESS + if(tool.get_sharpness() && !contents.len) if(design_choice == "None") user.show_message(span_notice("You cut eyeholes into [src]."), MSG_VISUAL) new /obj/item/clothing/head/costume/papersack(drop_location()) qdel(src) - return FALSE + return ITEM_INTERACT_SUCCESS else if(design_choice == "SmileyFace") user.show_message(span_notice("You cut eyeholes into [src] and modify the design."), MSG_VISUAL) new /obj/item/clothing/head/costume/papersack/smiley(drop_location()) qdel(src) - return FALSE - return TRUE + return ITEM_INTERACT_SUCCESS + return ..() /** * check_menu: Checks if we are allowed to interact with a radial menu diff --git a/code/game/objects/items/storage/boxes/job_boxes.dm b/code/game/objects/items/storage/boxes/job_boxes.dm index b19e82f39f4..ac09b5fbe20 100644 --- a/code/game/objects/items/storage/boxes/job_boxes.dm +++ b/code/game/objects/items/storage/boxes/job_boxes.dm @@ -178,20 +178,20 @@ desc = "A colorful cardboard box for the clown" illustration = "clown" -/obj/item/storage/box/clown/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(istype(inserted, /obj/item/bodypart/arm/left/robot) || istype(inserted, /obj/item/bodypart/arm/right/robot)) - if(contents.len) //prevent accidently deleting contents - balloon_alert(user, "items inside!") - return FALSE - if(!user.temporarilyRemoveItemFromInventory(inserted)) - return FALSE - qdel(inserted) - loc.balloon_alert(user, "wheels added, honk!") - var/obj/item/bot_assembly/honkbot/A = new - qdel(src) - user.put_in_hands(A) - return FALSE - return TRUE +/obj/item/storage/box/clown/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/bodypart/arm/left/robot) && !istype(tool, /obj/item/bodypart/arm/right/robot)) + return ..() + if(contents.len) //prevent accidently deleting contents + balloon_alert(user, "items inside!") + return ITEM_INTERACT_BLOCKING + if(!user.temporarilyRemoveItemFromInventory(tool)) + return ITEM_INTERACT_BLOCKING + qdel(tool) + loc.balloon_alert(user, "wheels added, honk!") + var/obj/item/bot_assembly/honkbot/A = new + qdel(src) + user.put_in_hands(A) + return ITEM_INTERACT_SUCCESS /obj/item/storage/box/clown/suicide_act(mob/living/user) user.visible_message(span_suicide("[user] opens [src] and gets consumed by [p_them()]! It looks like [user.p_theyre()] trying to commit suicide!")) diff --git a/code/game/objects/items/storage/boxes/service_boxes.dm b/code/game/objects/items/storage/boxes/service_boxes.dm index e4d6a86553f..ee558d863da 100644 --- a/code/game/objects/items/storage/boxes/service_boxes.dm +++ b/code/game/objects/items/storage/boxes/service_boxes.dm @@ -92,19 +92,17 @@ atom_storage.max_slots = 10 atom_storage.set_holdable(/obj/item/match) -/obj/item/storage/box/matches/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - return !istype(inserted, /obj/item/match) +/obj/item/storage/box/matches/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/match)) + var/obj/item/match/match = tool + match.matchignite() + return ITEM_INTERACT_SUCCESS + return ..() /obj/item/storage/box/matches/PopulateContents() for(var/i in 1 to 10) new /obj/item/match(src) -/obj/item/storage/box/matches/item_interaction(mob/living/user, obj/item/match/match, list/modifiers) - if(istype(match)) - match.matchignite() - return ITEM_INTERACT_SUCCESS - return NONE - /obj/item/storage/box/matches/update_icon_state() . = ..() switch(length(contents)) diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 0aa1b325c90..387d8c22554 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -12,6 +12,7 @@ var/open = FALSE var/icon_locked = "lockbox+l" var/icon_closed = "lockbox" + var/icon_open = "lockbox" var/icon_broken = "lockbox+b" /obj/item/storage/lockbox/Initialize(mapload) @@ -19,48 +20,54 @@ atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL atom_storage.max_total_storage = 14 atom_storage.max_slots = 4 - atom_storage.locked = TRUE + atom_storage.locked = STORAGE_FULLY_LOCKED register_context() + update_appearance() -/obj/item/storage/lockbox/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - var/locked = atom_storage.locked - if(inserted.GetID()) - if(broken) - balloon_alert(user, "broken!") - return FALSE - if(allowed(user)) - if(atom_storage.locked) - atom_storage.locked = STORAGE_NOT_LOCKED - else - atom_storage.locked = STORAGE_FULLY_LOCKED - locked = atom_storage.locked - if(locked) - icon_state = icon_locked - atom_storage.close_all() - else - icon_state = icon_closed +/obj/item/storage/lockbox/tool_act(mob/living/user, obj/item/tool, list/modifiers) + var/obj/item/card/card = tool.GetID() + if(isnull(card)) + return ..() - balloon_alert(user, locked ? "locked" : "unlocked") - return FALSE + if(can_unlock(user, card)) + if(atom_storage.locked) + atom_storage.locked = STORAGE_NOT_LOCKED + else + atom_storage.locked = STORAGE_FULLY_LOCKED + atom_storage.close_all() + balloon_alert(user, atom_storage.locked ? "locked" : "unlocked") + update_appearance() + return ITEM_INTERACT_SUCCESS - balloon_alert(user, "access denied!") - return FALSE + return ITEM_INTERACT_BLOCKING - if(locked) - balloon_alert(user, "locked!") - return FALSE +/obj/item/storage/lockbox/proc/can_unlock(mob/living/user, obj/item/card/id/id_card) + if(check_access(id_card)) + return TRUE - return TRUE + balloon_alert(user, "access denied!") + return FALSE + +/obj/item/storage/lockbox/update_icon_state() + . = ..() + if(broken) + icon_state = icon_broken + else if(atom_storage?.locked) + icon_state = icon_locked + else if(open) + icon_state = icon_open + else + icon_state = icon_closed /obj/item/storage/lockbox/emag_act(mob/user, obj/item/card/emag/emag_card) if(!broken) broken = TRUE atom_storage.locked = STORAGE_NOT_LOCKED - icon_state = src.icon_broken balloon_alert(user, "lock destroyed") if (emag_card && user) user.visible_message(span_warning("[user] swipes [emag_card] over [src], breaking it!")) + update_appearance() return TRUE return FALSE @@ -109,6 +116,7 @@ icon_locked = "medalbox+l" icon_closed = "medalbox" icon_broken = "medalbox+b" + icon_open = "medalboxopen" /obj/item/storage/lockbox/medal/Initialize(mapload) . = ..() @@ -124,7 +132,7 @@ /obj/item/storage/lockbox/medal/click_alt(mob/user) if(!atom_storage.locked) - open = (open ? FALSE : TRUE) + open = !open update_appearance() return CLICK_ACTION_SUCCESS @@ -139,18 +147,6 @@ for(var/i in 1 to 3) new /obj/item/clothing/accessory/medal/conduct(src) -/obj/item/storage/lockbox/medal/update_icon_state() - if(atom_storage?.locked) - icon_state = "medalbox+l" - return ..() - - icon_state = "medalbox" - if(open) - icon_state += "open" - if(broken) - icon_state += "+b" - return ..() - /obj/item/storage/lockbox/medal/update_overlays() . = ..() if(!contents || !open) @@ -240,13 +236,13 @@ icon_state = "secure" icon_closed = "secure" icon_locked = "secure_locked" - icon_broken = "secure+b" + icon_broken = "secure_locked" + icon_open = "secure" inhand_icon_state = "sec-case" lefthand_file = 'icons/mob/inhands/equipment/briefcase_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/briefcase_righthand.dmi' w_class = WEIGHT_CLASS_HUGE var/datum/bank_account/buyer_account - var/privacy_lock = TRUE /obj/item/storage/lockbox/order/Initialize(mapload, datum/bank_account/_buyer_account) . = ..() @@ -259,26 +255,16 @@ department_account = buyer_account //SKYRAT EDIT END -/obj/item/storage/lockbox/order/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - var/obj/item/card/id/id_card = inserted.GetID() - if(!id_card) - return ..() +/obj/item/storage/lockbox/order/can_unlock(mob/living/user, obj/item/card/id/id_card) + if(id_card.registered_account == buyer_account) + return TRUE - if(id_card.registered_account != buyer_account) - balloon_alert(user, "incorrect bank account!") - return FALSE + //SKYRAT EDIT ADDITION START - private department orders + if(department_purchase && id_card.registered_account?.account_job?.paycheck_department == department_account.department_id) + return TRUE + //SKYRAT EDIT ADDITION END - if(privacy_lock) - atom_storage.locked = STORAGE_NOT_LOCKED - icon_state = icon_locked - else - atom_storage.locked = STORAGE_FULLY_LOCKED - icon_state = icon_closed - privacy_lock = atom_storage.locked - user.visible_message( - span_notice("[user] [privacy_lock ? "" : "un"]locks [src]'s privacy lock."), - span_notice("You [privacy_lock ? "" : "un"]lock [src]'s privacy lock."), - ) + balloon_alert(user, "incorrect bank account!") return FALSE ///screentips for lockboxes diff --git a/code/game/objects/items/storage/medkit.dm b/code/game/objects/items/storage/medkit.dm index b1ca307e939..944289598d1 100644 --- a/code/game/objects/items/storage/medkit.dm +++ b/code/game/objects/items/storage/medkit.dm @@ -171,6 +171,9 @@ inhand_icon_state = "medkit-ointment" damagetype_healed = BURN +/obj/item/storage/medkit/fire/get_medbot_skin() + return "ointment" + /obj/item/storage/medkit/fire/suicide_act(mob/living/carbon/user) user.visible_message(span_suicide("[user] begins rubbing \the [src] against [user.p_them()]self! It looks like [user.p_theyre()] trying to start a fire!")) return FIRELOSS @@ -192,6 +195,9 @@ inhand_icon_state = "medkit-toxin" damagetype_healed = TOX +/obj/item/storage/medkit/toxin/get_medbot_skin() + return "tox" + /obj/item/storage/medkit/toxin/suicide_act(mob/living/carbon/user) user.visible_message(span_suicide("[user] begins licking the lead paint off \the [src]! It looks like [user.p_theyre()] trying to commit suicide!")) return TOXLOSS @@ -216,6 +222,9 @@ inhand_icon_state = "medkit-o2" damagetype_healed = OXY +/obj/item/storage/medkit/o2/get_medbot_skin() + return "o2" + /obj/item/storage/medkit/o2/suicide_act(mob/living/carbon/user) user.visible_message(span_suicide("[user] begins hitting [user.p_their()] neck with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!")) return OXYLOSS @@ -237,6 +246,9 @@ inhand_icon_state = "medkit-brute" damagetype_healed = BRUTE +/obj/item/storage/medkit/brute/get_medbot_skin() + return "brute" + /obj/item/storage/medkit/brute/suicide_act(mob/living/carbon/user) user.visible_message(span_suicide("[user] begins beating [user.p_them()]self over the head with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!")) return BRUTELOSS @@ -261,6 +273,9 @@ custom_premium_price = PAYCHECK_COMMAND * 6 damagetype_healed = HEAL_ALL_DAMAGE +/obj/item/storage/medkit/advanced/get_medbot_skin() + return "advanced" + /obj/item/storage/medkit/advanced/PopulateContents() if(empty) return @@ -277,6 +292,9 @@ inhand_icon_state = "medkit-tactical" damagetype_healed = HEAL_ALL_DAMAGE +/obj/item/storage/medkit/tactical_lite/get_medbot_skin() + return "bezerk" + /obj/item/storage/medkit/tactical_lite/PopulateContents() if(empty) return @@ -399,35 +417,28 @@ generate_items_inside(items_inside,src) //medibot assembly -/obj/item/storage/medkit/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(!istype(inserted, /obj/item/bodypart/arm/left/robot) && !istype(inserted, /obj/item/bodypart/arm/right/robot)) - return TRUE +/obj/item/storage/medkit/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/bodypart/arm/left/robot) && !istype(tool, /obj/item/bodypart/arm/right/robot)) + return ..() //Making a medibot! if(contents.len >= 1) balloon_alert(user, "items inside!") - return FALSE + return ITEM_INTERACT_BLOCKING - ///if you add a new one don't forget to update /datum/crafting_recipe/medbot/on_craft_completion() - var/obj/item/bot_assembly/medbot/medbot_assembly = new - if (istype(src, /obj/item/storage/medkit/fire)) - medbot_assembly.set_skin("ointment") - else if (istype(src, /obj/item/storage/medkit/toxin)) - medbot_assembly.set_skin("tox") - else if (istype(src, /obj/item/storage/medkit/o2)) - medbot_assembly.set_skin("o2") - else if (istype(src, /obj/item/storage/medkit/brute)) - medbot_assembly.set_skin("brute") - else if (istype(src, /obj/item/storage/medkit/advanced)) - medbot_assembly.set_skin("advanced") - else if (istype(src, /obj/item/storage/medkit/tactical)) - medbot_assembly.set_skin("bezerk") + var/obj/item/bot_assembly/medbot/medbot_assembly = new() + medbot_assembly.set_skin(get_medbot_skin()) user.put_in_hands(medbot_assembly) medbot_assembly.balloon_alert(user, "arm added") - medbot_assembly.robot_arm = inserted.type + medbot_assembly.robot_arm = tool.type medbot_assembly.medkit_type = type - qdel(inserted) + qdel(tool) qdel(src) - return FALSE + return ITEM_INTERACT_SUCCESS + +/// Gets what skin (icon_state) this medkit uses for a medbot +/obj/item/storage/medkit/proc/get_medbot_skin() + // The skin var is nullsafe so returning nothing is A-OK + return /* * Pill Bottles @@ -733,14 +744,7 @@ icon_state = "[base_icon_state][cooling ? "-working" : null]" return ..() -/obj/item/storage/organbox/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(is_reagent_container(inserted) && inserted.is_open_container()) - return FALSE - if(istype(inserted, /obj/item/plunger)) - return FALSE - return TRUE - -/obj/item/storage/organbox/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/item/storage/organbox/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(is_reagent_container(tool) && tool.is_open_container()) var/obj/item/reagent_containers/RC = tool var/units = RC.reagents.trans_to(src, RC.amount_per_transfer_from_this, transferred_by = user) @@ -754,7 +758,7 @@ balloon_alert(user, "plunged") reagents.clear_reagents() return ITEM_INTERACT_SUCCESS - return NONE + return ..() /obj/item/storage/organbox/suicide_act(mob/living/carbon/user) if(HAS_TRAIT(user, TRAIT_RESISTCOLD)) //if they're immune to cold, just do the box suicide diff --git a/code/game/objects/items/storage/toolbox.dm b/code/game/objects/items/storage/toolbox.dm index 77f0f2cb8b2..ab3dc930aa8 100644 --- a/code/game/objects/items/storage/toolbox.dm +++ b/code/game/objects/items/storage/toolbox.dm @@ -275,9 +275,9 @@ new /obj/item/gun_maintenance_supplies(src) //floorbot assembly -/obj/item/storage/toolbox/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(!istype(inserted, /obj/item/stack/tile/iron)) - return TRUE +/obj/item/storage/toolbox/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/stack/tile/iron)) + return ..() var/static/list/allowed_toolbox = list( /obj/item/storage/toolbox/artistic, /obj/item/storage/toolbox/electrical, @@ -287,11 +287,11 @@ ) if(!is_type_in_list(src, allowed_toolbox) && (type != /obj/item/storage/toolbox)) - return TRUE + return ITEM_INTERACT_BLOCKING if(contents.len >= 1) balloon_alert(user, "not empty!") - return FALSE - if(inserted.use(10)) + return ITEM_INTERACT_BLOCKING + if(tool.use(10)) var/obj/item/bot_assembly/floorbot/B = new B.toolbox = type switch(B.toolbox) @@ -309,9 +309,9 @@ B.update_appearance() B.balloon_alert(user, "tiles added") qdel(src) - return FALSE + return ITEM_INTERACT_BLOCKING balloon_alert(user, "needs 10 tiles!") - return FALSE + return ITEM_INTERACT_SUCCESS /obj/item/storage/toolbox/haunted name = "old toolbox" diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index cace64a7101..0564223a7c7 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -91,9 +91,9 @@ qdel(src) return T -/obj/structure/falsewall/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/structure/falsewall/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(!opening || !tool.tool_behaviour) - return NONE + return ..() to_chat(user, span_warning("You must wait until the door has stopped moving!")) return ITEM_INTERACT_BLOCKING diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index 0700f19818a..e27f5fcf42b 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -79,10 +79,10 @@ P.decayedRange = max(P.decayedRange--, 0) return BULLET_ACT_FORCE_PIERCE -/obj/structure/reflector/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/structure/reflector/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(admin && tool.tool_behaviour) return ITEM_INTERACT_BLOCKING - return NONE + return ..() /obj/structure/reflector/screwdriver_act(mob/living/user, obj/item/tool) can_rotate = !can_rotate diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 4d60386c3ff..43ebb5ae53e 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -225,11 +225,6 @@ return ITEM_INTERACT_SUCCESS /obj/structure/table/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers) - if(tool.tool_behaviour == TOOL_SCREWDRIVER || tool.tool_behaviour == TOOL_WRENCH) - // continue to tool act - // ...we need a better way to do this natively. - // maybe flag to call tool acts before item interaction specifically? - return NONE if(istype(tool, /obj/item/construction/rcd)) return NONE @@ -868,12 +863,6 @@ deconstruct(TRUE) return ITEM_INTERACT_SUCCESS -/obj/structure/rack/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers) - if(tool.tool_behaviour == TOOL_WRENCH) - return NONE - - return item_interaction(user, tool, modifiers) - /obj/structure/rack/item_interaction(mob/living/user, obj/item/tool, list/modifiers) if((tool.item_flags & ABSTRACT) || user.combat_mode) return NONE diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 169c0cc5b15..8808c0338e2 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -188,11 +188,11 @@ return return ..() -/obj/structure/window/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/structure/window/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(!can_be_reached(user)) return ITEM_INTERACT_SKIP_TO_ATTACK // Guess you get to hit it add_fingerprint(user) - return NONE + return ..() /obj/structure/window/welder_act(mob/living/user, obj/item/tool) if(atom_integrity >= max_integrity) diff --git a/code/game/turfs/open/floor/plating.dm b/code/game/turfs/open/floor/plating.dm index b5f1e38faae..6e4834773c3 100644 --- a/code/game/turfs/open/floor/plating.dm +++ b/code/game/turfs/open/floor/plating.dm @@ -176,8 +176,8 @@ ScrapeAway(flags = CHANGETURF_INHERIT_AIR) return TRUE -/turf/open/floor/plating/foam/item_interaction(mob/living/user, obj/item/tool, list/modifiers) - return user.combat_mode ? ITEM_INTERACT_SKIP_TO_ATTACK : ITEM_INTERACT_BLOCKING // Fuck you +/turf/open/floor/plating/foam/welder_act(mob/living/user, obj/item/I) + return NONE // Fuck you //reinforced plating deconstruction states #define PLATE_INTACT 0 diff --git a/code/modules/bitrunning/objects/loot_box.dm b/code/modules/bitrunning/objects/loot_box.dm index 39209c33d97..200e0b259fb 100644 --- a/code/modules/bitrunning/objects/loot_box.dm +++ b/code/modules/bitrunning/objects/loot_box.dm @@ -8,6 +8,7 @@ icon_locked = "bitrunning+l" icon_closed = "bitrunning" icon_broken = "bitrunning+b" + icon_open = "bitrunning" /obj/item/storage/lockbox/bitrunning/encrypted name = "encrypted curiosity" diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index b3233386f97..88256eaf1d2 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -365,7 +365,7 @@ update_appearance() return ITEM_INTERACT_SUCCESS -/obj/machinery/microwave/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/machinery/microwave/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(operating) return ITEM_INTERACT_SKIP_TO_ATTACK // Don't use tools if we're dirty if(dirty >= MAX_MICROWAVE_DIRTINESS) @@ -373,7 +373,7 @@ if(panel_open && is_wire_tool(tool)) wires.interact(user) return ITEM_INTERACT_SUCCESS - return NONE + return ..() /obj/machinery/microwave/attackby(obj/item/item, mob/living/user, params) if(operating) diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index 3def5be49c3..0eb05fcdc30 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -11,6 +11,9 @@ /turf/open/floor/holofloor/item_interaction(mob/living/user, obj/item/tool, list/modifiers) return ITEM_INTERACT_BLOCKING // Fuck you +/turf/open/floor/holofloor/crowbar_act(mob/living/user, obj/item/I) + return NONE // Fuck you + /turf/open/floor/holofloor/burn_tile() return //you can't burn a hologram! diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index e57e383ebb7..3cd8042582f 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -129,8 +129,6 @@ wearer.visible_message(span_danger("[src] fall[p_s()] apart, completely destroyed!"), vision_distance = COMBAT_MESSAGE_RANGE) clean_up() for(var/obj/item/mod/module/module as anything in modules) - for(var/obj/item/item in module) - item.forceMove(drop_location()) uninstall(module) if(ai_assistant) if(ispAI(ai_assistant)) @@ -147,9 +145,6 @@ if(active) . += span_notice("Charge: [core ? "[get_charge_percent()]%" : "No core"].") . += span_notice("Selected module: [selected_module || "None"].") - if(atom_storage) - . += span_notice("While the suit's panel is open, \ - being on combat mode will prevent you from inserting items into it when clicking on it.") if(!open && !active) if(!wearer) . += span_notice("You could equip it to turn it on.") @@ -291,7 +286,6 @@ return ITEM_INTERACT_SUCCESS /obj/item/mod/control/crowbar_act(mob/living/user, obj/item/crowbar) - . = ..() if(!open) balloon_alert(user, "open the cover first!") playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) @@ -322,32 +316,32 @@ return ITEM_INTERACT_BLOCKING /obj/item/mod/control/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user) - if(user.combat_mode) - // Block all item-click-inserts when we're open - // Other form of insertion will still function (mousedrop, hotkey) - if(open) - return FALSE - // ...You have to open it up somehow though - if(inserted.tool_behaviour == TOOL_SCREWDRIVER) - return FALSE + // Hack. revisit later + if(istype(inserted, /obj/item/aicard)) + var/obj/item/aicard/ai_card = inserted + if(ai_card.AI) + return FALSE // we want to get an AI assistant, try uploading instead of insertion + if(ai_assistant) + return FALSE // we already have an AI assistant, try withdrawing instead of insertion return TRUE -/obj/item/mod/control/item_interaction(mob/living/user, obj/item/attacking_item, list/modifiers) - if(istype(attacking_item, /obj/item/pai_card)) +// Makes use of tool act to prevent shoving stuff into our internal storage +/obj/item/mod/control/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/pai_card)) if(!open) balloon_alert(user, "open the cover first!") return ITEM_INTERACT_BLOCKING - insert_pai(user, attacking_item) + insert_pai(user, tool) return ITEM_INTERACT_SUCCESS - if(istype(attacking_item, /obj/item/mod/module)) + if(istype(tool, /obj/item/mod/module)) if(!open) balloon_alert(user, "open the cover first!") playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) return ITEM_INTERACT_BLOCKING - install(attacking_item, user) + install(tool, user) SEND_SIGNAL(src, COMSIG_MOD_MODULE_ADDED, user) return ITEM_INTERACT_SUCCESS - if(istype(attacking_item, /obj/item/mod/core)) + if(istype(tool, /obj/item/mod/core)) if(!open) balloon_alert(user, "open the cover first!") playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) @@ -356,19 +350,20 @@ balloon_alert(user, "core already installed!") playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) return ITEM_INTERACT_BLOCKING - var/obj/item/mod/core/attacking_core = attacking_item + var/obj/item/mod/core/attacking_core = tool attacking_core.install(src) balloon_alert(user, "core installed") playsound(src, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE) return ITEM_INTERACT_SUCCESS if(open) - if(is_wire_tool(attacking_item)) + if(is_wire_tool(tool)) wires.interact(user) return ITEM_INTERACT_SUCCESS - if(attacking_item.GetID()) - update_access(user, attacking_item.GetID()) + var/obj/item/id = tool.GetID() + if(id) + update_access(user, id) return ITEM_INTERACT_SUCCESS - return NONE + return ..() /obj/item/mod/control/get_cell() var/obj/item/stock_parts/power_store/cell = get_charge_source() diff --git a/code/modules/mod/mod_core.dm b/code/modules/mod/mod_core.dm index 70f95297b94..0c13efa1b95 100644 --- a/code/modules/mod/mod_core.dm +++ b/code/modules/mod/mod_core.dm @@ -97,7 +97,8 @@ install_cell(cell) RegisterSignal(mod, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) RegisterSignal(mod, COMSIG_ATOM_ATTACK_HAND, PROC_REF(on_attack_hand)) - RegisterSignal(mod, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby)) + RegisterSignal(mod, COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT, PROC_REF(on_mod_storage_insert)) + RegisterSignal(mod, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_mod_interaction)) RegisterSignal(mod, COMSIG_MOD_WEARER_SET, PROC_REF(on_wearer_set)) if(mod.wearer) on_wearer_set(mod, mod.wearer) @@ -105,7 +106,13 @@ /obj/item/mod/core/standard/uninstall() if(!QDELETED(cell)) cell.forceMove(drop_location()) - UnregisterSignal(mod, list(COMSIG_ATOM_EXAMINE, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACKBY, COMSIG_MOD_WEARER_SET)) + UnregisterSignal(mod, list( + COMSIG_ATOM_EXAMINE, + COMSIG_ATOM_ATTACK_HAND, + COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT, + COMSIG_ATOM_ITEM_INTERACTION, + COMSIG_MOD_WEARER_SET, + )) if(mod.wearer) on_wearer_unset(mod, mod.wearer) return ..() @@ -206,23 +213,37 @@ cell_to_move.forceMove(drop_location()) user.put_in_hands(cell_to_move) -/obj/item/mod/core/standard/proc/on_attackby(datum/source, obj/item/attacking_item, mob/user) +/obj/item/mod/core/standard/proc/on_mod_storage_insert(datum/source, obj/item/thing, mob/living/user) SIGNAL_HANDLER - if(istype(attacking_item, /obj/item/stock_parts/power_store/cell)) - if(!mod.open) - mod.balloon_alert(user, "open the cover first!") - playsound(mod, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) - return NONE - if(cell) - mod.balloon_alert(user, "cell already installed!") - playsound(mod, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) - return COMPONENT_NO_AFTERATTACK - install_cell(attacking_item) - mod.balloon_alert(user, "cell installed") - playsound(mod, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE) - return COMPONENT_NO_AFTERATTACK - return NONE + return replace_cell(thing, user) ? BLOCK_STORAGE_INSERT : NONE + +/obj/item/mod/core/standard/proc/on_mod_interaction(datum/source, mob/living/user, obj/item/thing) + SIGNAL_HANDLER + + if(mod.atom_storage) // handled by the storage signal + return NONE + + return item_interaction(user, thing) + +/obj/item/mod/core/standard/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + return replace_cell(tool, user) ? ITEM_INTERACT_SUCCESS : NONE + +/obj/item/mod/core/standard/proc/replace_cell(obj/item/attacking_item, mob/user) + if(!istype(attacking_item, /obj/item/stock_parts/power_store/cell)) + return FALSE + if(!mod.open) + mod.balloon_alert(user, "open the cover first!") + playsound(mod, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) + return FALSE + if(cell) + mod.balloon_alert(user, "cell already installed!") + playsound(mod, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) + return FALSE + install_cell(attacking_item) + mod.balloon_alert(user, "cell installed") + playsound(mod, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE) + return TRUE /obj/item/mod/core/standard/proc/on_wearer_set(datum/source, mob/user) SIGNAL_HANDLER @@ -303,15 +324,11 @@ /obj/item/mod/core/plasma/install(obj/item/mod/control/mod_unit) . = ..() - RegisterSignal(mod, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby)) + RegisterSignal(mod, COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT, PROC_REF(on_mod_storage_insert)) + RegisterSignal(mod, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_mod_interaction)) /obj/item/mod/core/plasma/uninstall() - UnregisterSignal(mod, COMSIG_ATOM_ATTACKBY) - return ..() - -/obj/item/mod/core/plasma/attackby(obj/item/attacking_item, mob/user, params) - if(charge_plasma(attacking_item, user)) - return TRUE + UnregisterSignal(mod, list(COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT, COMSIG_ATOM_ITEM_INTERACTION)) return ..() /obj/item/mod/core/plasma/charge_source() @@ -350,19 +367,28 @@ return "empty" -/obj/item/mod/core/plasma/proc/on_attackby(datum/source, obj/item/attacking_item, mob/user) +/obj/item/mod/core/plasma/proc/on_mod_storage_insert(datum/source, obj/item/thing, mob/living/user) SIGNAL_HANDLER - if(charge_plasma(attacking_item, user)) - return COMPONENT_NO_AFTERATTACK - return NONE + return charge_plasma(thing, user) ? BLOCK_STORAGE_INSERT : NONE + +/obj/item/mod/core/plasma/proc/on_mod_interaction(datum/source, mob/living/user, obj/item/thing) + SIGNAL_HANDLER + + if(mod.atom_storage) // handled by the storage signal + return NONE + + return item_interaction(thing, user) + +/obj/item/mod/core/plasma/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + return charge_plasma(tool, user) ? ITEM_INTERACT_SUCCESS : NONE /obj/item/mod/core/plasma/proc/charge_plasma(obj/item/stack/plasma, mob/user) var/charge_given = is_type_in_list(plasma, charger_list, zebra = TRUE) if(!charge_given) return FALSE var/uses_needed = min(plasma.amount, ROUND_UP((max_charge_amount() - charge_amount()) / charge_given)) - if(!plasma.use(uses_needed)) + if(uses_needed <= 0 || !plasma.use(uses_needed)) return FALSE add_charge(uses_needed * charge_given) balloon_alert(user, "core refueled") diff --git a/code/modules/projectiles/guns/energy/dueling.dm b/code/modules/projectiles/guns/energy/dueling.dm index f35769e663c..9a7fa9aa78b 100644 --- a/code/modules/projectiles/guns/energy/dueling.dm +++ b/code/modules/projectiles/guns/energy/dueling.dm @@ -365,6 +365,7 @@ icon_closed = "medalbox" icon_broken = "medalbox+b" base_icon_state = "medalbox" + icon_open = "medalboxopen" /obj/item/storage/lockbox/dueling/Initialize(mapload) . = ..() @@ -372,16 +373,6 @@ atom_storage.max_slots = 2 atom_storage.set_holdable(/obj/item/gun/energy/dueling) -/obj/item/storage/lockbox/dueling/update_icon_state() - if(atom_storage?.locked) - icon_state = icon_locked - return ..() - if(broken) - icon_state = icon_broken - return ..() - icon_state = open ? "[base_icon_state]open" : icon_closed - return ..() - /obj/item/storage/lockbox/dueling/PopulateContents() . = ..() var/obj/item/gun/energy/dueling/gun_A = new(src) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 1bd0d3560be..79a97b40a6b 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -154,16 +154,16 @@ if(HDD_OVERLOADED) . += "The front panel is dangling open. The hdd inside is destroyed and the wires are all burned." -/obj/machinery/rnd/server/master/item_interaction(mob/living/user, obj/item/tool, list/modifiers) +/obj/machinery/rnd/server/master/tool_act(mob/living/user, obj/item/tool, list/modifiers) if(!tool.tool_behaviour) - return NONE + return ..() // Only antags are given the training and knowledge to disassemble this thing. if(!is_special_character(user)) if(user.combat_mode) return ITEM_INTERACT_SKIP_TO_ATTACK balloon_alert(user, "you can't find an obvious maintenance hatch!") return ITEM_INTERACT_BLOCKING - return NONE + return ..() /obj/machinery/rnd/server/master/attackby(obj/item/attacking_item, mob/user, params) if(istype(attacking_item, /obj/item/computer_disk/hdd_theft)) diff --git a/modular_skyrat/master_files/code/modules/clothing/back/antigravityharness.dm b/modular_skyrat/master_files/code/modules/clothing/back/antigravityharness.dm index 96c1906801f..b82146de02b 100644 --- a/modular_skyrat/master_files/code/modules/clothing/back/antigravityharness.dm +++ b/modular_skyrat/master_files/code/modules/clothing/back/antigravityharness.dm @@ -185,6 +185,7 @@ // If we got here, the gravity field is on. If there's no cell, turn that shit off if(!current_cell) change_mode(MODE_GRAVOFF) + return // cell.use will return FALSE if charge is lower than GRAVITY_FIELD_COST if(!current_cell.use(GRAVITY_FIELD_COST)) @@ -195,14 +196,6 @@ if(cell_cover_open) return current_cell -/obj/item/gravity_harness/Exited(atom/movable/gone, direction) - . = ..() - if(gone == current_cell) - change_mode(MODE_GRAVOFF) - current_cell = null - - return ..() - // Show the status of the harness and cell /obj/item/gravity_harness/examine(mob/user) . = ..() @@ -232,8 +225,8 @@ cell_cover_open = !cell_cover_open return TRUE -/obj/item/gravity_harness/attack_hand(mob/user) - if(!cell_cover_open) +/obj/item/gravity_harness/attack_hand(mob/user, list/modifiers) + if(!cell_cover_open || loc != user) return ..() if(!current_cell) @@ -245,6 +238,7 @@ balloon_alert(user, "interrupted!") return + change_mode(MODE_GRAVOFF) balloon_alert(user, "cell removed") playsound(src, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE) if(!user.put_in_hands(current_cell)) diff --git a/modular_skyrat/modules/hyposprays/code/hypospray_kits.dm b/modular_skyrat/modules/hyposprays/code/hypospray_kits.dm index cb0f3a401b5..ac1bfa53b07 100644 --- a/modular_skyrat/modules/hyposprays/code/hypospray_kits.dm +++ b/modular_skyrat/modules/hyposprays/code/hypospray_kits.dm @@ -102,19 +102,18 @@ var/mutable_appearance/hypo_overlay = mutable_appearance(initial(icon), attached_hypo.icon_state) . += hypo_overlay -/obj/item/storage/hypospraykit/attackby_secondary(obj/item/weapon, mob/user, params) - if(istype(weapon, /obj/item/hypospray/mkii)) - if(attached_hypo != null) - balloon_alert(user, "Mount point full! Remove [attached_hypo] first!") - else - weapon.moveToNullspace() - attached_hypo = weapon - RegisterSignal(weapon, COMSIG_QDELETING, PROC_REF(on_attached_hypo_qdel)) - balloon_alert(user, "Attached [attached_hypo].") - update_appearance() - // This stops atom_storage from hogging your right-click and opening the inventory. - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - return ..() +/obj/item/storage/hypospraykit/tool_act(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/hypospray/mkii) || !LAZYACCESS(modifiers, RIGHT_CLICK)) + return ..() + if(!isnull(attached_hypo)) + balloon_alert(user, "Mount point full! Remove [attached_hypo] first!") + return ITEM_INTERACT_BLOCKING + tool.moveToNullspace() + attached_hypo = tool + RegisterSignal(tool, COMSIG_QDELETING, PROC_REF(on_attached_hypo_qdel)) + balloon_alert(user, "Attached [attached_hypo].") + update_appearance() + return ITEM_INTERACT_SUCCESS /obj/item/storage/hypospraykit/click_alt_secondary(mob/user) if(attached_hypo != null)