This commit is contained in:
silicons
2020-07-20 11:11:12 -07:00
parent 984796b8c6
commit 924309aab8
5 changed files with 32 additions and 12 deletions

View File

@@ -7,6 +7,8 @@
#define STOP_ATTACK_PROC_CHAIN (1<<0)
/// This attack should discard last_action instead of flushing (storing) it). You should probably know what you're doing if you use this considering this is how clickdelay is enforced.
#define DISCARD_LAST_ACTION (1<<1)
/// Override automatic last_action set. There's usually a safety net in that attempting to attack a mob will set last_action even if the item itself doesn't specifically set it. If this is present, that doesn't happen.
#define MANUALLY_HANDLE_LAST_ACTION (1<<2)
// UnarmedAttack() flags
/// Attack is from a parry counterattack

View File

@@ -30,9 +30,9 @@
if(SEND_SIGNAL(src, COMSIG_MOB_CLICKON, A, params) & COMSIG_MOB_CANCEL_CLICKON)
return
if(ClickOn(A, params))
FlushLastAction()
FlushCurrentAction()
else
DiscardLastAction()
DiscardCurrentAction()
/*
@@ -49,6 +49,7 @@
* mob/RangedAttack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed
*/
/mob/proc/ClickOn( atom/A, params)
set waitfor = FALSE
if(check_click_intercept(params,A))
return
@@ -73,8 +74,7 @@
return
if(modifiers["right"]) //CIT CHANGE - allows right clicking to perform actions
RightClickOn(A,params) //CIT CHANGE - ditto
return //CIT CHANGE - ditto
return RightClickOn(A,params) //CIT CHANGE - ditto
if(incapacitated(ignore_restraints = 1))
return
@@ -111,7 +111,10 @@
//User itself, current loc, and user inventory
if(A in DirectAccess())
if(W)
. = !(W.melee_attack_chain(src, A, params) & DISCARD_LAST_ACTION)
. = W.melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
else
UnarmedAttack(A)
return
@@ -123,7 +126,10 @@
//Standard reach turf to turf or reaching inside storage
if(CanReach(A,W))
if(W)
. = !(W.melee_attack_chain(src, A, params) & DISCARD_LAST_ACTION)
. = W.melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
else
UnarmedAttack(A, 1)
else
@@ -236,8 +242,6 @@
in human click code to allow glove touches only at melee range.
*/
/mob/proc/UnarmedAttack(atom/A, proximity, intent = a_intent, flags = NONE)
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
/*
Ranged unarmed attack:

View File

@@ -7,6 +7,7 @@
*/
/mob/living/silicon/robot/ClickOn(var/atom/A, var/params)
set waitfor = FALSE
if(check_click_intercept(params,A))
return
@@ -77,7 +78,10 @@
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents)
if(A == loc || (A in loc) || (A in contents))
. = !(W.melee_attack_chain(src, A, params) & DISCARD_LAST_ACTION)
. = W.melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
return
if(!isturf(loc))
@@ -86,7 +90,10 @@
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc))
if(isturf(A) || isturf(A.loc))
if(A.Adjacent(src)) // see adjacent.dm
. = !(W.melee_attack_chain(src, A, params) & DISCARD_LAST_ACTION)
. = W.melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
return
else
W.afterattack(A, src, 0, params)

View File

@@ -36,7 +36,10 @@
//User itself, current loc, and user inventory
if(A in DirectAccess())
if(W)
W.rightclick_melee_attack_chain(src, A, params)
. = W.rightclick_melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
else
if(!AltUnarmedAttack(A))
UnarmedAttack(A)
@@ -49,7 +52,10 @@
//Standard reach turf to turf or reaching inside storage
if(CanReach(A,W))
if(W)
W.rightclick_melee_attack_chain(src, A, params)
. = W.rightclick_melee_attack_chain(src, A, params)
if(ismob(A) && !(. & MANUALLY_HANDLE_LAST_ACTION))
DelayNextAction()
. = !(. & DISCARD_LAST_ACTION)
else
if(!AltUnarmedAttack(A,1))
UnarmedAttack(A,1)