From 280fc659385c8275e5b2d60280ee7be53dffa992 Mon Sep 17 00:00:00 2001 From: Tastyfish Date: Mon, 30 Nov 2015 22:30:57 -0500 Subject: [PATCH] added cancel to more powers, hand tele, cleanups to others --- code/_onclick/hud/screen_objects.dm | 3 ++- code/game/dna/genes/goon_powers.dm | 10 ++++++--- code/game/dna/genes/vg_powers.dm | 22 +++++++++++++------ .../objects/items/weapons/teleportation.dm | 4 ++-- code/modules/admin/verbs/adminhelp.dm | 2 +- code/modules/economy/EFTPOS.dm | 4 ++-- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 5ac8bdb15fc..27fdd64cd75 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -496,7 +496,8 @@ if(isAI(usr)) var/mob/living/silicon/ai/AI = usr var/target_name = input(AI) as null|anything in AI.trackable_mobs() - AI.ai_camera_track(target_name) + if(target_name) + AI.ai_camera_track(target_name) if("Toggle Camera Light") if(isAI(usr)) diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index 8e3542ef6c8..e9e07437350 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -288,9 +288,9 @@ if(is_type_in_list(O,types_allowed)) possible_targets += O - targets += input("Choose the target of your hunger.", "Targeting") as anything in possible_targets + targets += input("Choose the target of your hunger.", "Targeting") as null|anything in possible_targets - if(!targets.len) //doesn't waste the spell + if(!targets.len || !targets[1]) //doesn't waste the spell revert_cast(user) return @@ -529,7 +529,11 @@ /obj/effect/proc_holder/spell/targeted/empath/choose_targets(mob/user = usr) var/list/targets = new /list() - targets += input("Choose the target to spy on.", "Targeting") as mob in range(7,usr) + targets += input("Choose the target to spy on.", "Targeting") as null|mob in range(7,usr) + + if(!targets.len || !targets[1]) //doesn't waste the spell + revert_cast(user) + return perform(targets) diff --git a/code/game/dna/genes/vg_powers.dm b/code/game/dna/genes/vg_powers.dm index a830e80fe6c..b34f2108560 100644 --- a/code/game/dna/genes/vg_powers.dm +++ b/code/game/dna/genes/vg_powers.dm @@ -128,25 +128,25 @@ Obviously, requires DNA2. return var/mob/living/carbon/human/M=usr - var/new_facial = input("Please select facial hair color.", "Character Generation",rgb(M.r_facial,M.g_facial,M.b_facial)) as color + var/new_facial = input("Please select facial hair color.", "Character Generation",rgb(M.r_facial,M.g_facial,M.b_facial)) as null|color if(new_facial) M.r_facial = hex2num(copytext(new_facial, 2, 4)) M.g_facial = hex2num(copytext(new_facial, 4, 6)) M.b_facial = hex2num(copytext(new_facial, 6, 8)) - var/new_hair = input("Please select hair color.", "Character Generation",rgb(M.r_hair,M.g_hair,M.b_hair)) as color + var/new_hair = input("Please select hair color.", "Character Generation",rgb(M.r_hair,M.g_hair,M.b_hair)) as null|color if(new_facial) M.r_hair = hex2num(copytext(new_hair, 2, 4)) M.g_hair = hex2num(copytext(new_hair, 4, 6)) M.b_hair = hex2num(copytext(new_hair, 6, 8)) - var/new_eyes = input("Please select eye color.", "Character Generation",rgb(M.r_eyes,M.g_eyes,M.b_eyes)) as color + var/new_eyes = input("Please select eye color.", "Character Generation",rgb(M.r_eyes,M.g_eyes,M.b_eyes)) as null|color if(new_eyes) M.r_eyes = hex2num(copytext(new_eyes, 2, 4)) M.g_eyes = hex2num(copytext(new_eyes, 4, 6)) M.b_eyes = hex2num(copytext(new_eyes, 6, 8)) - var/new_tone = input("Please select skin tone level: 1-220 (1=albino, 35=caucasian, 150=black, 220='very' black)", "Character Generation", "[35-M.s_tone]") as text + var/new_tone = input("Please select skin tone level: 1-220 (1=albino, 35=caucasian, 150=black, 220='very' black)", "Character Generation", "[35-M.s_tone]") as null|text if (!new_tone) new_tone = 35 @@ -234,14 +234,18 @@ Obviously, requires DNA2. start_recharge() return - targets += input("Choose the target to talk to.", "Targeting") as mob in validtargets + targets += input("Choose the target to talk to.", "Targeting") as null|mob in validtargets + + if(!targets.len || !targets[1]) //doesn't waste the spell + revert_cast(user) + return perform(targets) /obj/effect/proc_holder/spell/targeted/remotetalk/cast(list/targets) if(!ishuman(usr)) return var/say = input("What do you wish to say") as text|null - if(say == null || length(say) == 0) + if(!say) return say = strip_html(say) @@ -295,7 +299,11 @@ Obviously, requires DNA2. start_recharge() return - targets += input("Choose the target to spy on.", "Targeting") as mob in validtargets + targets += input("Choose the target to spy on.", "Targeting") as null|mob in validtargets + + if(!targets.len || !targets[targets.len]) //doesn't waste the spell + revert_cast(user) + return perform(targets) diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 637e882bdbb..d079ecd47dd 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -127,8 +127,8 @@ Frequency: turfs += T if(turfs.len) L["None (Dangerous)"] = pick(turfs) - var/t1 = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") in L - if ((user.get_active_hand() != src || user.stat || user.restrained())) + var/t1 = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") as null|anything in L + if (!t1 || (user.get_active_hand() != src || user.stat || user.restrained())) return if(active_portals >= 3) user.show_message("\The [src] is recharging!") diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index e90adf458ca..4cc914fb9e4 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -21,7 +21,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," msg = input("Please enter your message.", "Admin Help", null, null) as text|null //clean the input msg - if(msg == null || length(msg) == 0) + if(!msg) return if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm index 41cfc2bb8e6..30a1cb82af0 100644 --- a/code/modules/economy/EFTPOS.dm +++ b/code/modules/economy/EFTPOS.dm @@ -134,7 +134,7 @@ var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code")) if(attempt_code == access_code) var name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") as text|null - if(name && length(name) > 0) + if(name) eftpos_name = name + " EFTPOS scanner" print_reference() else @@ -150,7 +150,7 @@ usr << "\icon[src]Unable to connect to accounts database." if("trans_purpose") var/purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose") as text|null - if(purpose && length(purpose) > 0) + if(purpose) transaction_purpose = purpose if("trans_value") var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num