Melee Stagger (#11443)
* combat refactoring * i hate this * mobility flags part 2 time xd * whew * stuff * a * ok * changes * Wew * k * add flags * FUCKYOUVORE * fixes * typo * no using this in hard stamcrit * update icon * woopsy * . = ..() * sigh * Update living_combat.dm * wew * wups * fix * wack * animation is now shorter * linter save me * i hate you * k * k * k * i hate you * wrong button * k * ok * bet * bet * bet * Update item_attack.dm * k * Update code/modules/mob/living/living_combat.dm Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com> * Update code/modules/mob/living/living_combat.dm Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com> * Update code/modules/mob/living/living_combat.dm Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com> * early returns * skreee * agony * k * k * k * k * wack * compile * wack * fix Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user