From 695bbef4732cae21469cda4823edea3e2d83ca88 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 23 Aug 2018 03:30:33 -0400 Subject: [PATCH] makes spears require priming to explode on throw, makes it possible to rip embedded objects out instantly by pressing resist if the item is normal sized or larger (#7450) --- code/__DEFINES/combat.dm | 2 +- code/game/objects/items.dm | 3 ++ code/game/objects/items/grenades/grenade.dm | 3 ++ code/game/objects/items/twohanded.dm | 31 ++++++++------ code/modules/mob/living/carbon/human/human.dm | 41 +++++++++++++------ code/modules/mob/living/living.dm | 4 ++ 6 files changed, 58 insertions(+), 26 deletions(-) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 41383b8512..1bc601d6fd 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -108,7 +108,7 @@ #define EMBEDDED_IMPACT_PAIN_MULTIPLIER 4 //Coefficient of multiplication for the damage the item does when it first embeds (this*item.w_class) #define EMBED_THROWSPEED_THRESHOLD 4 //The minimum value of an item's throw_speed for it to embed (Unless it has embedded_ignore_throwspeed_threshold set to 1) #define EMBEDDED_UNSAFE_REMOVAL_PAIN_MULTIPLIER 8 //Coefficient of multiplication for the damage the item does when removed without a surgery (this*item.w_class) -#define EMBEDDED_UNSAFE_REMOVAL_TIME 30 //A Time in ticks, total removal time = (this*item.w_class) +#define EMBEDDED_UNSAFE_REMOVAL_TIME 150 //A Time in ticks, total removal time = (this/item.w_class) //Gun weapon weight #define WEAPON_LIGHT 1 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index dd952f5c13..65c0d8b4d6 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -794,3 +794,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if (item_flags & NODROP) return return ..() + +/obj/item/proc/grenade_prime_react(obj/item/grenade/nade) + return diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm index b627d42ab2..79c0e467a6 100644 --- a/code/game/objects/items/grenades/grenade.dm +++ b/code/game/objects/items/grenades/grenade.dm @@ -87,6 +87,9 @@ if(ismob(loc)) var/mob/M = loc M.dropItemToGround(src) + else if(isitem(loc)) + var/obj/item/I = loc + I.grenade_prime_react(src) /obj/item/grenade/attackby(obj/item/W, mob/user, params) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index f1c766e90c..096a22bd20 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -463,7 +463,7 @@ force_wielded = 18 throwforce = 20 throw_speed = 4 - embedding = list("embedded_impact_pain_multiplier" = 3) + embedding = list("embedded_impact_pain_multiplier" = 3, "embed_chance" = 90) armour_penetration = 10 materials = list(MAT_METAL=1150, MAT_GLASS=2075) hitsound = 'sound/weapons/bladeslice.ogg' @@ -478,14 +478,25 @@ . = ..() AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad. +/obj/item/twohanded/spear/attack_self(mob/user) + if(explosive) + explosive.attack_self(user) + return + . = ..() + +/obj/item/twohanded/rightclick_attack_self(mob/user) + if(wielded) //Trying to unwield it + unwield(user) + else //Trying to wield it + wield(user) + return TRUE + /obj/item/twohanded/spear/suicide_act(mob/living/carbon/user) user.visible_message("[user] begins to sword-swallow \the [src]! It looks like [user.p_theyre()] trying to commit suicide!") if(explosive) user.say("[war_cry]") - explosive.forceMove(user) explosive.prime() user.gib() - qdel(src) return BRUTELOSS return BRUTELOSS @@ -496,7 +507,7 @@ /obj/item/twohanded/spear/examine(mob/user) ..() if(explosive) - to_chat(user, "Alt-click to set your war cry.") + to_chat(user, "Use in your hands to activate the attached explosive.
Alt-click to set your war cry.
Right-click in combat mode to wield") /obj/item/twohanded/spear/update_icon() if(explosive) @@ -511,17 +522,11 @@ return if(explosive && wielded) user.say("[war_cry]") - explosive.forceMove(AM) explosive.prime() - qdel(src) - //THIS MIGHT BE UNBALANCED SO I DUNNO // it totally is. -/obj/item/twohanded/spear/throw_impact(atom/target) - . = ..() - if(!.) //not caught - if(explosive) - explosive.prime() - qdel(src) +/obj/item/twohanded/spear/grenade_prime_react(obj/item/grenade/nade) + nade.forceMove(get_turf(src)) + qdel(src) /obj/item/twohanded/spear/AltClick(mob/user) if(user.canUseTopic(src, BE_CLOSE)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 51a606792c..94801e5762 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -207,6 +207,33 @@ spreadFire(AM) +/mob/living/carbon/human/resist() + . = ..() + if(wear_suit && wear_suit.breakouttime)//added in human cuff breakout proc + return + if(.) + if(canmove && !on_fire) + for(var/obj/item/bodypart/L in bodyparts) + if(istype(L) && L.embedded_objects.len) + for(var/obj/item/I in L.embedded_objects) + if(istype(I) && I.w_class >= WEIGHT_CLASS_NORMAL) //minimum weight class to insta-ripout via resist + remove_embedded_unsafe(L, I, src, 1.5) //forcefully call the remove embedded unsafe proc but with extra pain multiplier. if you want to remove it less painfully, examine and remove it carefully. + return FALSE //Hands are occupied + return . + +/mob/living/carbon/human/proc/remove_embedded_unsafe(obj/item/bodypart/L, obj/item/I, mob/user, painmul = 1) + if(!I || !L || I.loc != src || !(I in L.embedded_objects)) + return + L.embedded_objects -= I + L.receive_damage(I.embedding.embedded_unsafe_removal_pain_multiplier*I.w_class*painmul)//It hurts to rip it out, get surgery you dingus. And if you're ripping it out quickly via resist, it's gonna hurt even more + I.forceMove(get_turf(src)) + user.put_in_hands(I) + user.emote("scream") + user.visible_message("[user] rips [I] out of [user.p_their()] [L.name]!","You remove [I] from your [L.name].") + if(!has_embedded_objects()) + clear_alert("embeddedobject") + SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "embedded") + return /mob/living/carbon/human/Topic(href, href_list) if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) @@ -217,20 +244,10 @@ var/obj/item/I = locate(href_list["embedded_object"]) in L.embedded_objects if(!I || I.loc != src) //no item, no limb, or item is not in limb or in the person anymore return - var/time_taken = I.embedding.embedded_unsafe_removal_time*I.w_class + var/time_taken = I.embedding.embedded_unsafe_removal_time/I.w_class usr.visible_message("[usr] attempts to remove [I] from [usr.p_their()] [L.name].","You attempt to remove [I] from your [L.name]... (It will take [DisplayTimeText(time_taken)].)") if(do_after(usr, time_taken, needhand = 1, target = src)) - if(!I || !L || I.loc != src || !(I in L.embedded_objects)) - return - L.embedded_objects -= I - L.receive_damage(I.embedding.embedded_unsafe_removal_pain_multiplier*I.w_class)//It hurts to rip it out, get surgery you dingus. - I.forceMove(get_turf(src)) - usr.put_in_hands(I) - usr.emote("scream") - usr.visible_message("[usr] successfully rips [I] out of [usr.p_their()] [L.name]!","You successfully remove [I] from your [L.name].") - if(!has_embedded_objects()) - clear_alert("embeddedobject") - SEND_SIGNAL(usr, COMSIG_CLEAR_MOOD_EVENT, "embedded") + remove_embedded_unsafe(L, I, usr) return if(href_list["item"]) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 24627f7eec..ba84ba2c7b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -614,6 +614,10 @@ resist_fire() //stop, drop, and roll else if(resting) //cit change - allows resisting out of resting resist_a_rest() // ditto + else if(istype(src, /mob/living/carbon)) + var/mob/living/carbon/C = src + if(!C.handcuffed && !C.legcuffed) + return TRUE else if(last_special <= world.time) resist_restraints() //trying to remove cuffs.