Skip to content

Commit

Permalink
[MIRROR] Kicks Martial Arts out of the attack chain (yippee), makes i…
Browse files Browse the repository at this point in the history
…t use signals, plus a large clean up of existing martial arts (#1799)

* [MIRROR] Kicks Martial Arts out of the attack chain (yippee), makes it use signals, plus a large clean up of existing martial arts (#734)

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Mal <[email protected]>
Co-authored-by: Iajret <[email protected]>
  • Loading branch information
5 people authored Feb 7, 2024
1 parent 1730d73 commit 219d741
Show file tree
Hide file tree
Showing 37 changed files with 1,167 additions and 702 deletions.
6 changes: 3 additions & 3 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ GLOBAL_LIST_INIT(arm_zones, list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
#define COMPONENT_AUTOFIRE_SHOT_SUCCESS (1<<0)

/// Martial arts attack requested but is not available, allow a check for a regular attack.
#define MARTIAL_ATTACK_INVALID -1
#define MARTIAL_ATTACK_INVALID NONE

/// Martial arts attack happened but failed, do not allow a check for a regular attack.
#define MARTIAL_ATTACK_FAIL FALSE
#define MARTIAL_ATTACK_FAIL COMPONENT_SKIP_ATTACK

/// Martial arts attack happened and succeeded, do not allow a check for a regular attack.
#define MARTIAL_ATTACK_SUCCESS TRUE
#define MARTIAL_ATTACK_SUCCESS COMPONENT_CANCEL_ATTACK_CHAIN

/// IF an object is weak against armor, this is the value that any present armor is multiplied by
#define ARMOR_WEAKENED_MULTIPLIER 2
Expand Down
8 changes: 6 additions & 2 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,9 @@

/// Sent from a mob to their loc when starting to remove cuffs on itself
#define COMSIG_MOB_REMOVING_CUFFS "living_removing_cuffs"
/// Sent as a reply to above from any atom that wishs to stop self-cuff removal
#define COMSIG_MOB_BLOCK_CUFF_REMOVAL (1<<0)
/// Sent as a reply to above from any atom that wishs to stop self-cuff removal
#define COMSIG_MOB_BLOCK_CUFF_REMOVAL (1<<0)

/// Sent to a mob grabbing another mob: (mob/living/grabbing)
#define COMSIG_LIVING_GRAB "living_grab"
// Return COMPONENT_CANCEL_ATTACK_CHAIN / COMPONENT_SKIP_ATTACK_CHAIN to stop the grab
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

///from mind/transfer_to. Sent to the receiving mob.
#define COMSIG_MOB_MIND_TRANSFERRED_INTO "mob_mind_transferred_into"
///from mind/transfer_from. Sent to the mob the mind is being transferred out of.
#define COMSIG_MOB_MIND_TRANSFERRED_OUT_OF "mob_mind_transferred_out_of"
/// From /mob/proc/ghostize() Called when a mob sucessfully ghosts
#define COMSIG_MOB_GHOSTIZED "mob_ghostized"

Expand Down
1 change: 0 additions & 1 deletion code/__DEFINES/melee.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#define MARTIALART_BOXING "boxing"
#define MARTIALART_CQC "CQC"
#define MARTIALART_HUGS_OF_THE_GONDOLA "hugs of the gondola"
#define MARTIALART_KRAVMAGA "krav maga"
#define MARTIALART_MUSHPUNCH "mushroom punch"
#define MARTIALART_PLASMAFIST "plasma fist"
Expand Down
28 changes: 4 additions & 24 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -358,46 +358,26 @@
/atom/proc/CtrlClick(mob/user)
SEND_SIGNAL(src, COMSIG_CLICK_CTRL, user)
SEND_SIGNAL(user, COMSIG_MOB_CTRL_CLICKED, src)

var/mob/living/ML = user
if(istype(ML))
ML.pulled(src)
if(!can_interact(user))
return FALSE

/mob/living/CtrlClick(mob/user)
/mob/living/CtrlClick(mob/living/user)
if(!isliving(user) || !user.CanReach(src) || user.incapacitated())
return ..()

if(world.time < user.next_move)
return FALSE

var/mob/living/user_living = user
if(user_living.apply_martial_art(src, null, is_grab=TRUE) == MARTIAL_ATTACK_SUCCESS)
user_living.changeNext_move(CLICK_CD_MELEE)
if(user.grab(src))
user.changeNext_move(CLICK_CD_MELEE)
return TRUE

return ..()


/mob/living/carbon/human/CtrlClick(mob/user)
if(!iscarbon(user) || !user.CanReach(src) || user.incapacitated())
return ..()

if(world.time < user.next_move)
return FALSE

if (ishuman(user))
var/mob/living/carbon/human/human_user = user
if(human_user.dna.species.grab(human_user, src, human_user.mind.martial_art))
human_user.changeNext_move(CLICK_CD_MELEE)
return TRUE
else if(isalien(user))
var/mob/living/carbon/alien/adult/alien_boy = user
if(alien_boy.grab(src))
alien_boy.changeNext_move(CLICK_CD_MELEE)
return TRUE
return ..()

/mob/proc/CtrlMiddleClickOn(atom/A)
if(check_rights_for(client, R_ADMIN))
client.toggle_tag_datum(A)
Expand Down
5 changes: 3 additions & 2 deletions code/datums/brain_damage/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,15 @@

/datum/brain_trauma/special/psychotic_brawling/on_gain()
..()
psychotic_brawling = new(null)
psychotic_brawling = new()
psychotic_brawling.allow_temp_override = FALSE
if(!psychotic_brawling.teach(owner, TRUE))
to_chat(owner, span_notice("But your martial knowledge keeps you grounded."))
qdel(src)

/datum/brain_trauma/special/psychotic_brawling/on_lose()
..()
psychotic_brawling.remove(owner)
psychotic_brawling.fully_remove(owner)
QDEL_NULL(psychotic_brawling)

/datum/brain_trauma/special/psychotic_brawling/bath_salts
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/tackle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
target.Knockdown(3 SECONDS)
target.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH * 2, 10 SECONDS)
if(ishuman(target) && ishuman(user))
INVOKE_ASYNC(human_sacker.dna.species, TYPE_PROC_REF(/datum/species, grab), human_sacker, human_target)
INVOKE_ASYNC(human_sacker, TYPE_PROC_REF(/mob/living, grab), human_sacker, human_target)
human_sacker.setGrabState(GRAB_PASSIVE)

if(50 to INFINITY) // absolutely BODIED
Expand All @@ -260,7 +260,7 @@
target.Knockdown(3 SECONDS)
target.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH * 3, 10 SECONDS)
if(ishuman(target) && ishuman(user))
INVOKE_ASYNC(human_sacker.dna.species, TYPE_PROC_REF(/datum/species, grab), human_sacker, human_target)
INVOKE_ASYNC(human_sacker, TYPE_PROC_REF(/mob/living, grab), human_sacker, human_target)
human_sacker.setGrabState(GRAB_AGGRESSIVE)

/**
Expand Down
Loading

0 comments on commit 219d741

Please sign in to comment.