From 3b3a3ad44ed14102421be87aa3696c3acfb517df Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Mon, 29 Jun 2020 23:37:51 -0700 Subject: [PATCH] nayser --- code/__DEFINES/dcs/signals.dm | 5 ++++ .../modules/mob/living/living_active_block.dm | 6 +++++ .../modules/mob/living/living_active_parry.dm | 24 +++++++++++++++---- code/modules/surgery/organs/augments_arms.dm | 21 ++++++++++++++-- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index c6b008329a..0619c4569b 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -222,6 +222,11 @@ #define COMSIG_LIVING_RUN_BLOCK "living_do_run_block" //from base of mob/living/do_run_block(): (real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone) #define COMSIG_LIVING_GET_BLOCKING_ITEMS "get_blocking_items" //from base of mob/living/get_blocking_items(): (list/items) +#define COMSIG_LIVING_ACTIVE_BLOCK_START "active_block_start" //from base of mob/living/keybind_start_active_blocking(): (obj/item/blocking_item, list/backup_items) + #define COMPONENT_PREVENT_BLOCK_START 1 +#define COMSIG_LIVING_ACTIVE_PARRY_START "active_parry_start" //from base of mob/living/initiate_parry_sequence(): (parrying_method, datum/parrying_item_mob_or_art, list/backup_items) + #define COMPONENT_PREVENT_PARRY_START 1 + //ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS! #define COMSIG_LIVING_STATUS_STUN "living_stun" //from base of mob/living/Stun() (amount, update, ignore) #define COMSIG_LIVING_STATUS_KNOCKDOWN "living_knockdown" //from base of mob/living/Knockdown() (amount, update, ignore) diff --git a/code/modules/mob/living/living_active_block.dm b/code/modules/mob/living/living_active_block.dm index e1b90716b6..892b105616 100644 --- a/code/modules/mob/living/living_active_block.dm +++ b/code/modules/mob/living/living_active_block.dm @@ -83,6 +83,12 @@ return FALSE // QOL: Instead of trying to just block with held item, grab first available item. var/obj/item/I = find_active_block_item() + var/list/other_items = list() + if(SEND_SIGNAL(src, COMSIG_LIVING_START_ACTIVE_BLOCKING, I, other_items) & COMPONENT_PREVENT_BLOCK_START) + to_chat(src, "Something is preventing you from blocking!") + return + if(!I && length(other_items)) + I = other_items[1] if(!I) to_chat(src, "You can't block with your bare hands!") return diff --git a/code/modules/mob/living/living_active_parry.dm b/code/modules/mob/living/living_active_parry.dm index 50b51d4d95..4994479d16 100644 --- a/code/modules/mob/living/living_active_parry.dm +++ b/code/modules/mob/living/living_active_parry.dm @@ -24,25 +24,39 @@ // yanderedev else if time var/obj/item/using_item = get_active_held_item() var/datum/block_parry_data/data + var/datum/tool var/method if(using_item?.can_active_parry()) data = using_item.block_parry_data method = ITEM_PARRY + tool = using_item else if(mind?.martial_art?.can_martial_parry) data = mind.martial_art.block_parry_data method = MARTIAL_PARRY + tool = mind.martial_art else if(combat_flags & COMBAT_FLAG_UNARMED_PARRY) data = block_parry_data method = UNARMED_PARRY + tool = src else // QOL: If none of the above work, try to find another item. var/obj/item/backup = find_backup_parry_item() - if(!backup) - to_chat(src, "You have nothing to parry with!") - return FALSE - data = backup.block_parry_data - using_item = backup + if(backup) + tool = backup + data = backup.block_parry_data + using_item = backup + method = ITEM_PARRY + var/list/other_items = list() + if(SEND_SIGNAL(src, COMSIG_LIVING_START_ACTIVE_PARRYING, method, tool, other_items) & COMPONENT_PREVENT_PARRY_START) + to_chat(src, "Something is preventing you from parrying!") + return + if(!using_item && !method && length(other_items)) + using_item = other_items[1] method = ITEM_PARRY + data = using_item.block_parry_data + if(!method) + to_chat(src, "You have nothing to parry with!") + return FALSE //QOL: Try to enable combat mode if it isn't already SEND_SIGNAL(src, COMSIG_ENABLE_COMBAT_MODE) if(!SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE)) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index b7dfa3eb88..840020b149 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -273,12 +273,29 @@ desc = "A deployable riot shield to help deal with civil unrest." contents = newlist(/obj/item/shield/riot/implant) -/obj/item/organ/cyberimp/arm/shield/Extend(obj/item/I) +/obj/item/organ/cyberimp/arm/shield/Extend(obj/item/I, silent = FALSE) if(I.obj_integrity == 0) //that's how the shield recharge works - to_chat(owner, "[I] is still too unstable to extend. Give it some time!") + if(!silent) + to_chat(owner, "[I] is still too unstable to extend. Give it some time!") return FALSE return ..() +/obj/item/organ/cyberimp/arm/shield/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = TRUE) + . = ..() + if(.) + RegisterSignal(M, COMSIG_LIVING_START_ACTIVE_BLOCKING, .proc/on_signal) + +/obj/item/organ/cyberimp/arm/shield/Remove(special = FALSE) + UnregisterSignal(owner, COMSIG_LIVING_START_ACTIVE_BLOCKING) + return ..() + +/obj/item/organ/cyberimp/arm/shield/proc/on_signal(datum/source, obj/item/blocking_item, list/other_items = list()) + if(!blocking_item) //if they don't have something + var/obj/item/shield/S = locate() in contents + if(!Extend(S, TRUE)) + return + other_items += S + /obj/item/organ/cyberimp/arm/shield/emag_act() . = ..() if(obj_flags & EMAGGED)