From 0f864e1390ba3ccb06d170cda2d30d39bb53d5cf Mon Sep 17 00:00:00 2001 From: HarpyEagle Date: Tue, 24 May 2016 15:36:26 -0400 Subject: [PATCH] Limits distance that mobs can be thrown based on relative size --- code/modules/mob/living/carbon/carbon.dm | 36 +++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 294b9c8669..0f1b570026 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -309,14 +309,19 @@ if(!item) return + var/throw_range = item.throw_range if (istype(item, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = item item = G.throw_held() //throw the person instead of the grab if(ismob(item)) + var/mob/M = item + + //limit throw range by relative mob size + throw_range = round(M.throw_range * min(src.mob_size/M.mob_size, 1)) + var/turf/start_T = get_turf(loc) //Get the start and target tile for the descriptors var/turf/end_T = get_turf(target) if(start_T && end_T) - var/mob/M = item var/start_T_descriptor = "tile at [start_T.x], [start_T.y], [start_T.z] in area [get_area(start_T)]" var/end_T_descriptor = "tile at [end_T.x], [end_T.y], [end_T.z] in area [get_area(end_T)]" @@ -324,31 +329,28 @@ usr.attack_log += text("\[[time_stamp()]\] Has thrown [M.name] ([M.ckey]) from [start_T_descriptor] with the target [end_T_descriptor]") msg_admin_attack("[usr.name] ([usr.ckey]) has thrown [M.name] ([M.ckey]) from [start_T_descriptor] with the target [end_T_descriptor] (JMP)") - if(!item) return //Grab processing has a chance of returning null - - - src.remove_from_mob(item) - item.loc = src.loc + src.drop_from_inventory(item) + if(!item || !isturf(item.loc)) + return //actually throw it! - if (item) - src.visible_message("\red [src] has thrown [item].") + src.visible_message("\red [src] has thrown [item].") - if(!src.lastarea) - src.lastarea = get_area(src.loc) - if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0)) - src.inertia_dir = get_dir(target, src) - step(src, inertia_dir) + if(!src.lastarea) + src.lastarea = get_area(src.loc) + if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0)) + src.inertia_dir = get_dir(target, src) + step(src, inertia_dir) /* - if(istype(src.loc, /turf/space) || (src.flags & NOGRAV)) //they're in space, move em one space in the opposite direction - src.inertia_dir = get_dir(target, src) - step(src, inertia_dir) + if(istype(src.loc, /turf/space) || (src.flags & NOGRAV)) //they're in space, move em one space in the opposite direction + src.inertia_dir = get_dir(target, src) + step(src, inertia_dir) */ - item.throw_at(target, item.throw_range, item.throw_speed, src) + item.throw_at(target, throw_range, item.throw_speed, src) /mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) ..()