diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index c750119701..be0a4d0f59 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -82,6 +82,7 @@ #define CANUNCONSCIOUS (1<<2) #define CANPUSH (1<<3) #define GODMODE (1<<4) +#define CANSTAGGER (1<<5) //Health Defines #define HEALTH_THRESHOLD_CRIT 0 diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index fe407509fe..13940e94e7 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -50,7 +50,6 @@ user.changeNext_move(CLICK_CD_MELEE) return I.attack(src, user) - /obj/item/proc/attack(mob/living/M, mob/living/user) if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_ITEM_NO_ATTACK) return @@ -117,6 +116,7 @@ if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) return FALSE send_item_attack_message(I, user) + I.do_stagger_action(src, user) if(I.force) apply_damage(totitemdamage, I.damtype) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE && !HAS_TRAIT(src, TRAIT_NOMARROW)) @@ -166,5 +166,33 @@ playsound(src, 'sound/weapons/dink.ogg', 30, 1) return 1 +/// How much stamina this takes to swing this is not for realism purposes hecc off. /obj/item/proc/getweight() return total_mass || w_class * 1.25 + +/// How long this staggers for. 0 and negatives supported. +/obj/item/proc/melee_stagger_duration() + if(!isnull(stagger_force)) + return stagger_force + /// totally not an untested, arbitrary equation. + return clamp((1.5 + (w_class/7.5)) * (force / 2), 0, 10 SECONDS) + +/obj/item/proc/do_stagger_action(mob/living/target, mob/living/user) + if(!CHECK_BITFIELD(target.status_flags, CANSTAGGER)) + return FALSE + if(target.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE) + target.do_staggered_animation() + var/duration = melee_stagger_duration() + if(!duration) //0 + return FALSE + else if(duration > 0) + target.Stagger(duration) + else //negative + target.AdjustStaggered(duration) + return TRUE + +/mob/proc/do_staggered_animation() + set waitfor = FALSE + animate(src, pixel_x = -2, pixel_y = -2, time = 1, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL) + animate(pixel_x = 4, pixel_y = 4, time = 1, flags = ANIMATION_RELATIVE) + animate(pixel_x = -2, pixel_y = -2, time = 0.5, flags = ANIMATION_RELATIVE) diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index cf10244890..5a69ebe427 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -90,6 +90,7 @@ /datum/status_effect/staggered id = "staggered" blocks_sprint = TRUE + alert_type = null /datum/status_effect/staggered/on_creation(mob/living/new_owner, set_duration) if(isnum(set_duration)) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5a215f0396..e1d6101aa5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -34,7 +34,12 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) var/usesound = null var/throwhitsound = null var/w_class = WEIGHT_CLASS_NORMAL + + /// The amount of stamina it takes to swing an item in a normal melee attack do not lie to me and say it's for realism because it ain't. If null it will autocalculate from w_class. var/total_mass //Total mass in arbitrary pound-like values. If there's no balance reasons for an item to have otherwise, this var should be the item's weight in pounds. + /// How long, in deciseconds, this staggers for, if null it will autocalculate from w_class and force. Unlike total mass this supports 0 and negatives. + var/stagger_force + var/slot_flags = 0 //This is used to determine on which slots an item can fit. pass_flags = PASSTABLE pressure_resistance = 4 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 32d8d7e605..1e87a1b88b 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -97,6 +97,7 @@ affecting = bodyparts[1] SEND_SIGNAL(I, COMSIG_ITEM_ATTACK_ZONE, src, user, affecting) send_item_attack_message(I, user, affecting.name) + I.do_stagger_action(src, user) if(I.force) apply_damage(totitemdamage, I.damtype, affecting) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE && affecting.status == BODYPART_ORGANIC) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 1fc43f0d41..f4227e390e 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -121,7 +121,6 @@ // the attacked_by code varies among species return dna.species.spec_attacked_by(I, user, affecting, a_intent, src) - /mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) . = ..(user, TRUE) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 2e5efa3105..d20c556c6c 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -8,6 +8,7 @@ mob_biotypes = MOB_ORGANIC|MOB_HUMANOID /// Enable stamina combat combat_flags = COMBAT_FLAGS_DEFAULT + status_flags = CANSTUN|CANKNOCKDOWN|CANUNCONSCIOUS|CANPUSH|CANSTAGGER //Hair colour and style var/hair_color = "000" diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 98a4e279e9..375050f964 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1695,6 +1695,8 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) H.send_item_attack_message(I, user, hit_area) + I.do_stagger_action(H, user) + if(!I.force) return 0 //item force is zero