Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

james merged the last pr early, this one is finalised #3530

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ avoid code duplication. This includes items that may sometimes act as a standard
//I would prefer to rename this to attack(), but that would involve touching hundreds of files.
/obj/item/proc/resolve_attackby(atom/A, mob/user, var/click_params)
add_fingerprint(user)
if(has_melee_strike(user))
if(has_melee_strike_active())
return melee_strike.do_pre_strike(user,A,src,click_params)
return A.attackby(src, user, click_params)

Expand Down
38 changes: 17 additions & 21 deletions code/modules/halo/misc/melee_strikes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,39 @@

/obj/item/New()
if(melee_strikes)
verbs += /obj/item/proc/verb_swap_stances
melee_strikes += null //Purposefully added, so the stance-switch system can allow you to switch to no-stance for lunges and such.
for(var/type in melee_strikes)
if(isnull(type))
continue
var/strike = new type
melee_strikes -= type
melee_strikes += strike
melee_strikes += null //Purposefully added, so the stance-switch system can allow you to switch to no-stance for lunges and such.
. = ..()

/obj/item/proc/has_melee_strike_active()
return melee_strike

/obj/item/proc/has_melee_strike(var/mob/user)
if(isnull(melee_strikes))
return null
if(!melee_strikes || melee_strikes.len == 0)
return 0
if(ishuman(user))
var/mob/living/carbon/human/h = user
if(src in list(h.l_hand,h.r_hand) && has_melee_strike(user))
verbs |= /obj/item/proc/verb_swap_stances
else
verbs -= /obj/item/proc/verb_swap_stances
if(isnull(melee_strike))
melee_strike = melee_strikes[1]
if(!isnull(melee_strike))
melee_strike.strike_active(user)

return melee_strike
return 1

/obj/item/proc/verb_swap_stances()
set name = "Swap Stances"
set category = "Object"
var/mob/living/carbon/human/user = usr
var/mob/living/user = usr
if(!istype(user)) return
if(user.stat) return

Expand All @@ -70,22 +80,8 @@
melee_strike = stance_curr
if(stance_curr == null)
to_chat(user,"<span class = 'danger'>You return to your normal weapon stance.</span>")
return
stance_curr.strike_active(user)

/obj/item/equipped(var/mob/living/carbon/human/user)
. = ..()
if(src in list(user.l_hand,user.r_hand) && has_melee_strike(user))
verbs |= /obj/item/proc/verb_swap_stances
else
verbs -= /obj/item/proc/verb_swap_stances

/obj/item/dropped(mob/user as mob)
. = ..()
if(src in list(user.l_hand,user.r_hand) && has_melee_strike(user))
verbs |= /obj/item/proc/verb_swap_stances
else
verbs -= /obj/item/proc/verb_swap_stances
stance_curr.strike_active(user)

//Most elements of melee strikes should do nothing extra if set to null.
/datum/melee_strike
Expand All @@ -101,7 +97,7 @@
//These set a max timeframe on chaining, otherwise it reverts back to a base strike type.
var/chain_timeframe = 2 SECONDS
var/chain_expire_at = 0
var/chain_base_strike = null //Typepath.
var/chain_base_strike = null //Typepath.to reset a chain back to.

/datum/melee_strike/proc/strike_active(var/mob/user)
if(strike_switch_text) //Combos may want to keep this quiet.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/halo/weapons/_lunging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

/obj/item/afterattack(var/atom/target,var/mob/user,var/is_adjacent,var/click_params)
. = ..()
if(has_melee_strike() && (is_adjacent || (melee_strike.strike_range >= get_dist( get_turf(user),target))))
if(has_melee_strike_active() && (is_adjacent || (melee_strike.strike_range >= get_dist( get_turf(user),target))))
melee_strike.do_pre_strike(user,target,src,click_params)
else
do_lunge(target,user,is_adjacent,click_params)
Loading