refactoring this whole thing again
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
if(hit_atom)
|
||||
if(isliving(hit_atom))
|
||||
var/mob/living/L = hit_atom
|
||||
if(L.run_block(src, 0, "the [name]", attack_type = LEAP_ATTACK, 0, src) & BLOCK_SUCCESS)
|
||||
if(L.run_block(src, 0, "the [name]", attack_type = ATTACK_TYPE_TACKLE, 0, src) & BLOCK_SUCCESS)
|
||||
DefaultCombatKnockdown(40, 1, 1)
|
||||
else
|
||||
L.visible_message("<span class ='danger'>[src] pounces on [L]!</span>", "<span class ='userdanger'>[src] pounces on you!</span>")
|
||||
|
||||
@@ -76,9 +76,15 @@
|
||||
/// Block priority, higher means we check this higher in the "chain".
|
||||
var/block_priority = BLOCK_PRIORITY_DEFAULT
|
||||
|
||||
/// Runs block and returns flag for do_run_block to process.
|
||||
/obj/item/proc/run_block(mob/living/owner, real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_RUN_BLOCK, args)
|
||||
if(prob(final_block_chance))
|
||||
owner.visible_message("<span class='danger'>[owner] blocks [attack_text] with [src]!</span>")
|
||||
return BLOCK_SUCCESS | BLOCK_PHYSICAL_EXTERNAL
|
||||
return BLOCK_NONE
|
||||
|
||||
/// Returns block information using list/block_return. Used for check_block() on mobs.
|
||||
/obj/item/proc/check_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_CHECK_BLOCK, args)
|
||||
block_return[BLOCK_RETURN_NORMAL_BLOCK_CHANCE] = final_block_chance
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
if(reflect_bullet_check(P, def_zone))
|
||||
return -1 // complete projectile permutation
|
||||
#warn implement blocktypes
|
||||
if(run_block(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration) & BLOCK_SUCCESS)
|
||||
if(run_block(P, P.damage, "the [P.name]", ATTACK_TYPE_PROJECTILE, P.armour_penetration) & BLOCK_SUCCESS)
|
||||
P.on_hit(src, 100, def_zone)
|
||||
return BULLET_ACT_BLOCK
|
||||
if((P.damage_type == BRUTE || P.damage_type == BURN))
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
var/blocked = FALSE
|
||||
if(hasmatchingsummoner(hit_atom)) //if the summoner matches don't hurt them
|
||||
blocked = TRUE
|
||||
if(L.run_block(src, 90, "[name]", attack_type = ATTACK_TYPE_LEAP, 0, src) & BLOCK_SUCCESS)
|
||||
if(L.run_block(src, 90, "[name]", attack_type = ATTACK_TYPE_TACKLE, 0, src) & BLOCK_SUCCESS)
|
||||
blocked = TRUE
|
||||
if(!blocked)
|
||||
L.drop_all_held_items()
|
||||
|
||||
Reference in New Issue
Block a user