From a52092b294d46ef85537c9b51a621191aacfc396 Mon Sep 17 00:00:00 2001 From: Ryan784 Date: Fri, 24 Feb 2017 12:30:09 -0500 Subject: [PATCH] Fixes #1789 and most alt-clicking related bugs (#1808) Fix for the alt-clicking related bugs; users being able to alt-click and have it work regardless of distance. --- code/defines/obj/weapon.dm | 23 ++++++++++--------- code/game/machinery/computer/medical.dm | 4 ++-- code/game/machinery/computer/security.dm | 2 +- code/game/machinery/computer/skills.dm | 2 +- .../kitchen/cooking_machines/oven.dm | 3 ++- code/game/objects/items/devices/PDA/PDA.dm | 1 + code/game/objects/structures/janicart.dm | 1 + code/modules/economy/ATM.dm | 3 +++ code/modules/mob/living/silicon/pai/pai.dm | 1 + .../reagents/reagent_containers/spray.dm | 3 ++- 10 files changed, 26 insertions(+), 17 deletions(-) diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 716fc6a2a81..07a75c1284a 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -173,7 +173,7 @@ throw_range = 5 w_class = 2.0 attack_verb = list("warned", "cautioned", "smashed") - + /obj/item/weapon/caution/attack_self(mob/user as mob) if(src.icon_state == "caution") src.icon_state = "caution_blinking" @@ -181,14 +181,15 @@ else src.icon_state = "caution" user << "You turn the sign off." - + /obj/item/weapon/caution/AltClick() - if(src.icon_state == "caution") - src.icon_state = "caution_blinking" - usr << "You turn the sign on." - else - src.icon_state = "caution" - usr << "You turn the sign off." + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return + if(src.icon_state == "caution") + src.icon_state = "caution_blinking" + usr << "You turn the sign on." + else + src.icon_state = "caution" + usr << "You turn the sign off." /obj/item/weapon/caution/cone desc = "This cone is trying to warn you of something!" @@ -197,10 +198,10 @@ item_state = "cone" contained_sprite = 1 slot_flags = SLOT_HEAD - + /obj/item/weapon/caution/cone/attack_self(mob/user as mob) return - + /obj/item/weapon/caution/cone/AltClick() return @@ -427,7 +428,7 @@ icon = 'icons/obj/stock_parts.dmi' w_class = 2.0 var/rating = 1 - + /obj/item/weapon/stock_parts/New() src.pixel_x = rand(-5.0, 5) src.pixel_y = rand(-5.0, 5) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 7de4693d3ff..ac7b363a36b 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -26,7 +26,7 @@ set name = "Eject ID Card" set src in oview(1) - if(!usr || usr.stat || usr.lying) return + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return if(scan) usr << "You remove \the [scan] from \the [src]." @@ -499,7 +499,7 @@ record1 = active1 if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2))) record2 = active2 - + var/obj/item/weapon/paper/P = new /obj/item/weapon/paper() var/info = "
Medical Record

" var/rname diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 68591da2499..3a1589860d9 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -33,7 +33,7 @@ set name = "Eject ID Card" set src in oview(1) - if(!usr || usr.stat || usr.lying) return + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return if(scan) usr << "You remove \the [scan] from \the [src]." diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index 35bb5918d8e..713ad039f11 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -42,7 +42,7 @@ set name = "Eject ID Card" set src in oview(1) - if(!usr || usr.stat || usr.lying) return + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return if(scan) usr << "You remove \the [scan] from \the [src]." diff --git a/code/game/machinery/kitchen/cooking_machines/oven.dm b/code/game/machinery/kitchen/cooking_machines/oven.dm index 6e4c92d20e1..24218b9f4c2 100644 --- a/code/game/machinery/kitchen/cooking_machines/oven.dm +++ b/code/game/machinery/kitchen/cooking_machines/oven.dm @@ -49,6 +49,7 @@ /obj/machinery/appliance/cooker/oven/AltClick(var/mob/user) + if(user.stat || user.restrained()) return user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)//No spamming the door, it makes a sound toggle_door() @@ -107,4 +108,4 @@ combination_cook(CI) return else - ..() \ No newline at end of file + ..() diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 7d3f316b825..2913130654c 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -343,6 +343,7 @@ var/global/list/obj/item/device/pda/PDAs = list() return id /obj/item/device/pda/AltClick(var/mob/user) + if(!user || user.stat || user.lying || user.restrained() || !Adjacent(user)) return if (ismob(src.loc)) verb_remove_id() diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 103f0d496f6..f2ad59d0cdf 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -48,6 +48,7 @@ //Altclick the cart with a mop to stow the mop away //Altclick the cart with a reagent container to pour things into the bucket without putting the bottle in trash /obj/structure/janitorialcart/AltClick() + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return var/obj/I = usr.get_active_hand() if(istype(I, /obj/item/weapon/mop)) if(!mymop) diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm index f9283a2b0b1..3c211144a71 100644 --- a/code/modules/economy/ATM.dm +++ b/code/modules/economy/ATM.dm @@ -483,12 +483,15 @@ log transactions // put the currently held id on the ground or in the hand of the user /obj/machinery/atm/proc/release_held_id(mob/living/carbon/human/human_user as mob) + if (!ishuman(human_user)) return if(!held_card) return + if(human_user.stat || human_user.lying || human_user.restrained() || !Adjacent(human_user)) return + held_card.loc = src.loc authenticated_account = null diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index c3abba6c950..e73e71cbe42 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -426,6 +426,7 @@ return /mob/living/silicon/pai/AltClick(mob/user as mob) + if(!user || user.stat || user.lying || user.restrained() || !Adjacent(user)) return visible_message("[user.name] boops [src] on the head.") close_up() diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 7e72222ae13..ebb346dc6e8 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -23,6 +23,7 @@ src.verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT /obj/item/weapon/reagent_containers/spray/AltClick() + if(!usr || usr.stat || usr.lying || usr.restrained() || !Adjacent(usr)) return safety = !safety playsound(src.loc, 'sound/weapons/empty.ogg', 50, 1) usr << "You twist the locking cap on the end of the nozzle, the spraybottle is now [safety ? "locked" : "unlocked"]." @@ -224,4 +225,4 @@ if(istype(A, /obj/effect/blob)) // blob damage in blob code return - ..() \ No newline at end of file + ..()