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>
This commit is contained in:
JimKil3
2023-07-23 23:28:24 +01:00
committed by GitHub
co-authored by Henri215 Luc
parent b41d4be848
commit 86874ce415
5 changed files with 108 additions and 1 deletions
+1
View File
@@ -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.
+2 -1
View File
@@ -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,
@@ -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
@@ -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))
. += "<span class='warning'>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.</span>"
/obj/item/twohanded/push_broom/traitor/wield(mob/user)
. = ..()
ADD_TRAIT(user, TRAIT_DEFLECTS_PROJECTILES, "pushbroom")
to_chat(user, "<span class='warning'>Your sweeping stance allows you to deflect projectiles.</span>")
/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, "<span class='warning'>You stop reflecting projectiles.</span>")
/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("<span class='danger'>[user] sweeps [H] away!</span>", \
"<span class='userdanger'>[user] sweeps you away!</span>", \
"<span class='italics'>You hear sweeping.</span>")
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("<span class='danger'>[user] sweeps [H]'s legs out from under [H.p_them()]!</span>", \
"<span class='userdanger'>[user] sweeps your legs out from under you!</span>", \
"<span class='italics'>You hear sweeping.</span>")
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("<span class='danger'>[user] smacks [H] with the brush of [user.p_their()] broom!</span>", \
"<span class='userdanger'>[user] smacks you with the brush of [user.p_their()] broom!</span>", \
"<span class='italics'>You hear a smacking noise.</span>")
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
@@ -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("<span class='danger'>[src] deflects the projectile into the ground!</span>", "<span class='userdanger'>You deflect the projectile towards the ground beneath your feet!</span>")
return FALSE
visible_message("<span class='danger'>[src] deflects the projectile!</span>", "<span class='userdanger'>You deflect the projectile!</span>")
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