From 86874ce415f3da8b4b93dec1682b8e3f6a21baee Mon Sep 17 00:00:00 2001 From: JimKil3 <47290811+JimKil3@users.noreply.github.com> Date: Sun, 23 Jul 2023 17:28:24 -0500 Subject: [PATCH] Adds the titanium push broom, a janitor-exclusive traitor item (#21496) * adds it * fixes the thing * !! scope size increasing !! * trait rename * surplus removing * Apply suggestions from code review Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * code review commit 2 * fixes a minor issue * check_grep please have mercy * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --------- Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --- code/__HELPERS/trait_helpers.dm | 1 + code/_globalvars/traits.dm | 3 +- code/datums/uplink_items/uplink_traitor.dm | 10 +++ code/game/objects/items/weapons/twohanded.dm | 78 +++++++++++++++++++ .../mob/living/carbon/human/human_defense.dm | 17 ++++ 5 files changed, 108 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index 5b2dac17aed..aa5fe7629fe 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -204,6 +204,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_FLATTENED "flattened" #define SM_HALLUCINATION_IMMUNE "supermatter_hallucination_immune" #define TRAIT_CONTORTED_BODY "contorted_body" +#define TRAIT_DEFLECTS_PROJECTILES "trait_deflects_projectiles" //***** ITEM AND MOB TRAITS *****// /// Show what machine/door wires do when held. diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 96a02b3ec8a..ab5000d45d0 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -76,7 +76,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_CAN_BE_EATEN_BY_LIZARDS" = TRAIT_EDIBLE_BUG, "TRAIT_FLATTENED" = TRAIT_FLATTENED, "TRAIT_SM_HALLUCINATION_IMMUNE" = SM_HALLUCINATION_IMMUNE, - "TRAIT_CONTORTED_BODY" = TRAIT_CONTORTED_BODY + "TRAIT_CONTORTED_BODY" = TRAIT_CONTORTED_BODY, + "TRAIT_DEFLECTS_PROJECTILES" = TRAIT_DEFLECTS_PROJECTILES ), /obj/item = list( "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO, diff --git a/code/datums/uplink_items/uplink_traitor.dm b/code/datums/uplink_items/uplink_traitor.dm index 4e49bd1795d..0074cc88fab 100644 --- a/code/datums/uplink_items/uplink_traitor.dm +++ b/code/datums/uplink_items/uplink_traitor.dm @@ -124,6 +124,16 @@ cost = 2 job = list("Janitor") +/datum/uplink_item/jobspecific/titaniumbroom + name = "Titanium Push Broom" + desc = "A push broom with a reinforced handle and a metal wire brush, perfect for giving yourself more work by beating up assistants. \ + When wielded, you will reflect projectiles, and hitting people will have different effects based on your intent." + reference = "TPBR" + item = /obj/item/twohanded/push_broom/traitor + cost = 12 + job = list("Janitor") + surplus = 0 //no reflect memes + //Virology /datum/uplink_item/jobspecific/viral_injector diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 1e75a72ebd9..9dced8ee527 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -1048,4 +1048,82 @@ cart.mybroom = src cart.put_in_cart(src, user) +/obj/item/twohanded/push_broom/traitor + name = "titanium push broom" + desc = "This is my BROOMSTICK! All of the functionality of a normal broom, but at least half again more robust." + attack_verb = list("smashed", "slammed", "whacked", "thwacked", "swept") + force = 10 + force_unwielded = 10 + force_wielded = 25 + +/obj/item/twohanded/push_broom/traitor/Initialize(mapload) + . = ..() + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = NON_PROJECTILE_ATTACKS) + +/obj/item/twohanded/push_broom/traitor/examine(mob/user) + . = ..() + if(isAntag(user)) + . += "When wielded, the broom has different effects depending on your intent, similar to a martial art. \ + Help intent will sweep foes away from you, disarm intent sweeps their legs from under them, grab intent confuses \ + and minorly fatigues them, and harm intent hits them normally." + +/obj/item/twohanded/push_broom/traitor/wield(mob/user) + . = ..() + ADD_TRAIT(user, TRAIT_DEFLECTS_PROJECTILES, "pushbroom") + to_chat(user, "Your sweeping stance allows you to deflect projectiles.") + +/obj/item/twohanded/push_broom/traitor/unwield(mob/user) + . = ..() + if(HAS_TRAIT_FROM(user, TRAIT_DEFLECTS_PROJECTILES, "pushbroom")) //this check is needed because obj/item/twohanded calls unwield() on drop and you'd get the message even if you weren't wielding it before + REMOVE_TRAIT(user, TRAIT_DEFLECTS_PROJECTILES, "pushbroom") + to_chat(user, "You stop reflecting projectiles.") + +/obj/item/twohanded/push_broom/traitor/attack(mob/target, mob/living/user) + if(!wielded || !ishuman(target)) + return ..() + + var/mob/living/carbon/human/H = target + + switch(user.a_intent) + if(INTENT_HELP) + H.visible_message("[user] sweeps [H] away!", \ + "[user] sweeps you away!", \ + "You hear sweeping.") + playsound(loc, 'sound/weapons/sweeping.ogg', 70, TRUE, -1) + + var/atom/throw_target = get_edge_target_turf(H, get_dir(src, get_step_away(H, src))) + H.throw_at(throw_target, 3, 1) + + add_attack_logs(user, H, "Swept away with titanium push broom", ATKLOG_ALL) + + if(INTENT_DISARM) + if(H.stat || IS_HORIZONTAL(H)) + return ..() + + H.visible_message("[user] sweeps [H]'s legs out from under [H.p_them()]!", \ + "[user] sweeps your legs out from under you!", \ + "You hear sweeping.") + + user.do_attack_animation(H, ATTACK_EFFECT_KICK) + playsound(get_turf(user), 'sound/effects/hit_kick.ogg', 50, TRUE, -1) + H.apply_damage(5, BRUTE) + H.KnockDown(4 SECONDS) + + add_attack_logs(user, H, "Leg swept with titanium push broom", ATKLOG_ALL) + + if(INTENT_GRAB) + H.visible_message("[user] smacks [H] with the brush of [user.p_their()] broom!", \ + "[user] smacks you with the brush of [user.p_their()] broom!", \ + "You hear a smacking noise.") + + user.do_attack_animation(H, ATTACK_EFFECT_DISARM) + playsound(get_turf(user), 'sound/effects/woodhit.ogg', 50, TRUE, -1) + H.AdjustConfused(4 SECONDS, 0, 4 SECONDS) //no stacking infinitely + H.adjustStaminaLoss(15) + + add_attack_logs(user, H, "Swept with the brush of the titanium push broom", ATKLOG_ALL) + + if(INTENT_HARM) + return ..() + #undef BROOM_PUSH_LIMIT diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 3666867b05a..a31869366f3 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -60,6 +60,23 @@ emp_act else return FALSE + if(HAS_TRAIT(src, TRAIT_DEFLECTS_PROJECTILES)) + add_attack_logs(P.firer, src, "Hit by [P.type], but deflected by something other than martial arts") + playsound(src, pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg'), 75, TRUE) + + if(HAS_TRAIT(src, TRAIT_PACIFISM) || !P.is_reflectable(REFLECTABILITY_PHYSICAL)) + // Pacifism and unreflectables hitting the ground logic. Copied from above + var/turf/T = get_turf(src) + P.firer = src + T.bullet_act(P) + visible_message("[src] deflects the projectile into the ground!", "You deflect the projectile towards the ground beneath your feet!") + return FALSE + + visible_message("[src] deflects the projectile!", "You deflect the projectile!") + P.firer = src + P.set_angle(rand(0, 360)) + return -1 + var/obj/item/organ/external/organ = get_organ(check_zone(def_zone)) if(isnull(organ)) return bullet_act(P, "chest") //act on chest instead