Files
Bubberstation/code/datums/elements/disarm_attack.dm
Ghom 68677dc721 Disarm refactor, plus shoving people with shields (#80123)
## About The Pull Request
I wanted to add the ability to shove people with shields by
right-clicking your target, just like how it works barehanded.

This also required a solid refactor of disarm code, effectively bringing
down the core of it to `mob/living` from `mob/living/carbon` or
`mob/living/carbon/human`. This also means you can shove simple mobs
inside closets, bins and on tables.

Xenos and borgs are pretty much immune to regular disarms, but using a
shield will work (borgs and royal xenos are immune to the knockdown).

The riot shield armor has been balanced. It now tanks melee attacks
pretty well, but will break against bullets in just about 2 to 4 hits
depending on the bullet damage. I've always found the lack of sturdiness
of the riot shields for what they're supposed to be good for a bit
detrimental.

Because I've refactored an item flag into a trait, I've had to add a new
MOD module that grants protection from shove knockdown and staggering;
found pre-installed in the administrative MODsuit, but I've also added
it to the black market to make it cooler.

You can bash people with the strobe shield on combat mode.

## Why It's Good For The Game
Currently, shields are simply items that take a held slot in return of
some block chance without being anything special, save for the strobe
shield's integrated flash I guess, but are also a botherance as most
crumple under the duress of less than half a dozen attacks. Meanwhile
swords and other weapons with blok chance just don't care.
TL;DR, I want them a bit more remarkable, and flexible as a tool.

Of course, this ended up in a larger refactor because the right-click /
disarm code was inconsistent.

## Changelog

🆑
add: Shields (and pillows) can be used to shove people around the same
way barehanded right-clicking does. Xenos and borgs can actually be
moved this way.
add: Added a new MODsuit module, the bulwark module, which prevents
knockdown and staggering from shoving, and getting pushed away by thrown
objects. Inbuilt for the safeguard MODsuit, but one might also it in the
black market.
refactor: Disarming has been refactored. You can now shove simple
critters onto tables and into bins and closets
balance: Shields now take their own armor values and the armor
penetration of the attack they blocked when damaged. This means shields
are a bit sturdier now.
balance: Riot shields can tank a lot more damage against melee weapons,
but less against bullets.
qol: strobe shields can now be used to bash people while combat mode is
on.
/🆑
2024-01-16 19:35:56 -06:00

36 lines
1.6 KiB
Plaintext

///An element that allows items to be used to shove people around just like right-clicking would.
/datum/element/disarm_attack
/datum/element/disarm_attack/Attach(datum/target)
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ITEM_ATTACK_SECONDARY, PROC_REF(secondary_attack))
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(examine))
/datum/element/disarm_attack/Detach(datum/source)
UnregisterSignal(source, list(COMSIG_ATOM_EXAMINE, COMSIG_ITEM_ATTACK_SECONDARY))
return ..()
/datum/element/disarm_attack/proc/secondary_attack(obj/item/source, mob/living/victim, mob/living/user, params)
SIGNAL_HANDLER
if(!user.can_disarm(victim) || !can_disarm_attack(source, victim, user))
return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN
if(victim.check_block(source, 0, "the [source.name]", MELEE_ATTACK, 0))
return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN
user.disarm(victim, source)
user.changeNext_move(source.secondary_attack_speed || source.attack_speed)
return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN
///check if the item conditions for the disarm action are met.
/datum/element/disarm_attack/proc/can_disarm_attack(obj/item/source, mob/living/victim, mob/living/user, message = TRUE)
if(SEND_SIGNAL(source, COMSIG_ITEM_CAN_DISARM_ATTACK, victim, user, message) & COMPONENT_BLOCK_ITEM_DISARM_ATTACK)
return FALSE
return TRUE
/datum/element/disarm_attack/proc/examine(obj/item/source, mob/user, list/examine_list)
SIGNAL_HANDLER
if(can_disarm_attack(source, user, user, FALSE))
examine_list += span_notice("You can use it to <b>shove</b> people with <b>right-click</b>.")