Merge pull request #12834 from silicons/clickcd_experimental
Experimental hybrid clickdelay system (No seriously I'm trying my best to not call it Minecraft attack delays)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
force = 5
|
||||
item_flags = NEEDS_PERMIT
|
||||
attack_verb = list("struck", "hit", "bashed")
|
||||
attack_speed = CLICK_CD_RANGE
|
||||
|
||||
var/fire_sound = "gunshot"
|
||||
var/suppressed = null //whether or not a message is displayed when fired
|
||||
@@ -166,6 +167,8 @@
|
||||
|
||||
/obj/item/gun/afterattack(atom/target, mob/living/user, flag, params)
|
||||
. = ..()
|
||||
if(!CheckAttackCooldown(user, target))
|
||||
return
|
||||
process_afterattack(target, user, flag, params)
|
||||
|
||||
/obj/item/gun/proc/process_afterattack(atom/target, mob/living/user, flag, params)
|
||||
@@ -174,9 +177,6 @@
|
||||
if(firing)
|
||||
return
|
||||
var/stamloss = user.getStaminaLoss()
|
||||
if(stamloss >= STAMINA_NEAR_SOFTCRIT) //The more tired you are, the less damage you do.
|
||||
var/penalty = (stamloss - STAMINA_NEAR_SOFTCRIT)/(STAMINA_NEAR_CRIT - STAMINA_NEAR_SOFTCRIT)*STAM_CRIT_GUN_DELAY
|
||||
user.changeNext_move(CLICK_CD_RANGE+(CLICK_CD_RANGE*penalty))
|
||||
if(flag) //It's adjacent, is the user, or is on the user's person
|
||||
if(target in user.contents) //can't shoot stuff inside us.
|
||||
return
|
||||
@@ -218,6 +218,8 @@
|
||||
to_chat(user, "<span class='userdanger'>You need both hands free to fire \the [src]!</span>")
|
||||
return
|
||||
|
||||
user.DelayNextAction()
|
||||
|
||||
//DUAL (or more!) WIELDING
|
||||
var/bonus_spread = 0
|
||||
var/loop_counter = 0
|
||||
@@ -248,6 +250,17 @@
|
||||
to_chat(user, "<span class='notice'> [src] is lethally chambered! You don't want to risk harming anyone...</span>")
|
||||
return FALSE
|
||||
|
||||
/obj/item/gun/CheckAttackCooldown(mob/user, atom/target)
|
||||
if((user.a_intent == INTENT_HARM) && user.Adjacent(target)) //melee
|
||||
return user.CheckActionCooldown(CLICK_CD_MELEE)
|
||||
return user.CheckActionCooldown(get_clickcd())
|
||||
|
||||
/obj/item/gun/proc/get_clickcd()
|
||||
return isnull(chambered?.click_cooldown_override)? CLICK_CD_RANGE : chambered.click_cooldown_override
|
||||
|
||||
/obj/item/gun/GetEstimatedAttackSpeed()
|
||||
return get_clickcd()
|
||||
|
||||
/obj/item/gun/proc/handle_pins(mob/living/user)
|
||||
if(no_pin_required)
|
||||
return TRUE
|
||||
@@ -362,17 +375,14 @@
|
||||
if(user.a_intent == INTENT_HARM) //Flogging
|
||||
if(bayonet)
|
||||
M.attackby(bayonet, user)
|
||||
attack_delay_done = TRUE
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
attack_delay_done = TRUE //we are firing the gun, not bashing people with its butt.
|
||||
|
||||
/obj/item/gun/attack_obj(obj/O, mob/user)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(bayonet)
|
||||
O.attackby(bayonet, user)
|
||||
return TRUE
|
||||
return O.attackby(bayonet, user)
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/attackby(obj/item/I, mob/user, params)
|
||||
|
||||
Reference in New Issue
Block a user