From 4ea1379b331488831b929ea569a74811e30a61ab Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 18 Jul 2015 23:27:09 -0400 Subject: [PATCH] Fixes #10230 Moves throw mode procs up to /mob level, clicking on a non-turf or an atom that is not in a turf cancels throw mode. --- code/_onclick/click.dm | 6 ++++-- code/modules/mob/living/carbon/carbon.dm | 16 ---------------- code/modules/mob/mob.dm | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index b8caa45399..56af5949f7 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -80,8 +80,10 @@ return if(in_throw_mode) - throw_item(A) - return + if(isturf(A) || isturf(A.loc)) + throw_item(A) + return + throw_mode_off() if(!istype(A,/obj/item/weapon/gun) && !isturf(A) && !istype(A,/obj/screen)) last_target_click = world.time diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index ab97fb12c0..ac0093ad45 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -315,22 +315,6 @@ //Throwing stuff -/mob/living/carbon/proc/toggle_throw_mode() - if (src.in_throw_mode) - throw_mode_off() - else - throw_mode_on() - -/mob/living/carbon/proc/throw_mode_off() - src.in_throw_mode = 0 - if(src.throw_icon) //in case we don't have the HUD and we use the hotkey - src.throw_icon.icon_state = "act_throw_off" - -/mob/living/carbon/proc/throw_mode_on() - src.in_throw_mode = 1 - if(src.throw_icon) - src.throw_icon.icon_state = "act_throw_on" - /mob/proc/throw_item(atom/target) return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 49e02b6e79..6c601c419e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1009,3 +1009,21 @@ mob/proc/yank_out_object() /mob/verb/westfaceperm() set hidden = 1 set_face_dir(WEST) + +//Throwing stuff + +/mob/proc/toggle_throw_mode() + if (src.in_throw_mode) + throw_mode_off() + else + throw_mode_on() + +/mob/proc/throw_mode_off() + src.in_throw_mode = 0 + if(src.throw_icon) //in case we don't have the HUD and we use the hotkey + src.throw_icon.icon_state = "act_throw_off" + +/mob/proc/throw_mode_on() + src.in_throw_mode = 1 + if(src.throw_icon) + src.throw_icon.icon_state = "act_throw_on" \ No newline at end of file