diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index e99ca83a97..6aa77e2090 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -75,9 +75,9 @@ AddComponent(/datum/component/butchering, 30, 95, 5) //fast and effective, but as a sword, it might damage the results. AddElement(/datum/element/sword_point) -/obj/item/melee/sabre/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(attack_type == PROJECTILE_ATTACK) - final_block_chance = 0 //Don't bring a sword to a gunfight +/obj/item/melee/sabre/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + if(attack_type & ATTACK_TYPE_PROJECTILE) // Don't bring a sword to a gunfight. + return BLOCK_NONE return ..() /obj/item/melee/sabre/on_exit_storage(datum/component/storage/S) diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 07f4cb4e40..214e423172 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -182,10 +182,10 @@ w_class = WEIGHT_CLASS_NORMAL var/active = 0 -/obj/item/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(active) - return ..() - return 0 +/obj/item/shield/riot/tele/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + if(!active) + return BLOCK_NONE + return ..() /obj/item/shield/riot/tele/attack_self(mob/living/user) active = !active diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index 4e03d029a8..b019700593 100755 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -806,7 +806,8 @@ fitting_swords = list(/obj/item/melee/rapier) starting_sword = /obj/item/melee/rapier -/obj/item/storage/belt/sabre/rapier/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(attack_type == PROJECTILE_ATTACK) - final_block_chance = 0 //To thin to block bullets +/obj/item/storage/belt/sabre/rapier/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + if(attack_type & PROJECTILE_ATTACK) // No blocking bullets. + return BLOCK_NONE return ..() + diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index ba51fa3d65..8416db8965 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -454,11 +454,8 @@ total_mass_on = TOTAL_MASS_TOY_SWORD sharpness = IS_BLUNT -/obj/item/twohanded/dualsaber/toy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - return FALSE - -/obj/item/twohanded/dualsaber/toy/IsReflect()//Stops Toy Dualsabers from reflecting energy projectiles - return FALSE +/obj/item/twohanded/dualsaber/toy/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + return BLOCK_NONE /obj/item/twohanded/dualsaber/hypereutactic/toy name = "\improper DX Hyper-Euplastic LightSword" @@ -474,11 +471,8 @@ slowdown_wielded = 0 sharpness = IS_BLUNT -/obj/item/twohanded/dualsaber/hypereutactic/toy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - return FALSE - -/obj/item/twohanded/dualsaber/hypereutactic/toy/IsReflect()//Stops it from reflecting energy projectiles - return FALSE +/obj/item/twohanded/dualsaber/hypereutactic/toy/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + return BLOCK_NONE /obj/item/twohanded/dualsaber/hypereutactic/toy/rainbow name = "\improper Hyper-Euclidean Reciprocating Trigonometric Zweihander" diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index 43736e5244..8fcf6793bf 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -1055,11 +1055,9 @@ var/mob/living/silicon/robot/R = loc . = R.get_cell() -/obj/item/twohanded/electrostaff/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(!on) - return FALSE - if((attack_type == PROJECTILE_ATTACK) && !can_block_projectiles) - return FALSE +/obj/item/twohanded/electrostaff/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + if(!on) || (!can_block_projectiles && (attack_type & PROJECTILE_ATTACK))) + return BLOCK_NONE return ..() /obj/item/twohanded/electrostaff/proc/min_hitcost() diff --git a/code/modules/mob/living/living_block.dm b/code/modules/mob/living/living_block.dm index df68cb1098..1a7cf4435a 100644 --- a/code/modules/mob/living/living_block.dm +++ b/code/modules/mob/living/living_block.dm @@ -25,11 +25,11 @@ ///Check whether or not we can block, without "triggering" a block. Basically run checks without effects like depleting shields. Wrapper for do_run_block(). The arguments on that means the same as for this. /mob/living/proc/check_block(atom/object, damage, attack_text = "the attack", attack_type, armour_penetration, mob/attacker, def_zone) - return do_run_block(FALSE, object, damage, attack_Text, attack_type, armour_penetration, attacker, check_zone(def_zone)) + return do_run_block(FALSE, object, damage, attack_text, attack_type, armour_penetration, attacker, check_zone(def_zone)) /// Runs a block "sequence", effectively checking and then doing effects if necessary. Wrapper for do_run_block(). The arguments on that means the same as for this. /mob/living/proc/run_block(atom/object, damage, attack_text = "the attack", attack_type, armour_penetration, mob/attacker, def_zone) - return do_run_block(TRUE, object, damage, attack_Text, attack_type, armour_penetration, attacker, check_zone(def_zone)) + return do_run_block(TRUE, object, damage, attack_text, attack_type, armour_penetration, attacker, check_zone(def_zone)) /** The actual proc for block checks. DO NOT USE THIS DIRECTLY UNLESS YOU HAVE VERY GOOD REASON TO. To reduce copypaste for differences between handling for real attacks and virtual checks. * Automatically checks all held items for /obj/item/proc/run_block() with the same parameters. diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index cf008d019c..4741eb321a 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -268,7 +268,7 @@ /mob/living/attack_hand(mob/user) ..() //Ignoring parent return value here. SEND_SIGNAL(src, COMSIG_MOB_ATTACK_HAND, user) - if((user != src) && user.a_intent != INTENT_HELP && (run_block(user, 0, user.name, UNARMED_ATTACK | MELEE_ATTACK, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS)) + if((user != src) && user.a_intent != INTENT_HELP && (run_block(user, 0, user.name, ATTACK_TYPE_UNARMED | ATTACK_TYPE_MELEE, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS)) log_combat(user, src, "attempted to touch") visible_message("[user] attempted to touch [src]!") return TRUE @@ -279,7 +279,7 @@ to_chat(user, "You don't want to hurt [src]!") return TRUE var/hulk_verb = pick("smash","pummel") - if(user != src && (run_block(user, 15, "the [hulk_verb]ing", MELEE_ATTACK, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS)) + if(user != src && (run_block(user, 15, "the [hulk_verb]ing", ATTACK_TYPE_MELEE, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS)) return TRUE ..() return FALSE @@ -301,7 +301,7 @@ var/damage = rand(5, 35) if(M.is_adult) damage = rand(20, 40) - if(run_block(M, damage, "the [M.name]", MELEE_ATTACK, null, M, check_zone(user.zone_selected)) & BLOCK_SUCCESS) + if(run_block(M, damage, "the [M.name]", ATTACK_TYPE_MELEE, null, M, check_zone(user.zone_selected)) & BLOCK_SUCCESS) return FALSE if (stat != DEAD) @@ -320,7 +320,7 @@ if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - if(run_block(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS) + if(run_block(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", ATTACK_TYPE_MELEE, M.armour_penetration, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS) return FALSE if(M.attack_sound) playsound(loc, M.attack_sound, 50, 1, 1) @@ -338,7 +338,7 @@ if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH)) to_chat(M, "You can't bite with your mouth covered!") return FALSE - if(run_block(M, 0, "the [M.name]", MELEE_ATTACK | UNARMED_ATTACK, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS) + if(run_block(M, 0, "the [M.name]", ATTACK_TYPE_MELEE | ATTACK_TYPE_UNARMED, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS) return FALSE M.do_attack_animation(src, ATTACK_EFFECT_BITE) if (prob(75)) diff --git a/code/modules/projectiles/guns/magic/staff.dm b/code/modules/projectiles/guns/magic/staff.dm index 14b2ff0c1a..f27d2b00aa 100644 --- a/code/modules/projectiles/guns/magic/staff.dm +++ b/code/modules/projectiles/guns/magic/staff.dm @@ -90,9 +90,10 @@ . = ..() AddComponent(/datum/component/butchering, 15, 125, 0, hitsound) -/obj/item/gun/magic/staff/spellblade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(attack_type == PROJECTILE_ATTACK) - final_block_chance = 0 +/obj/item/gun/magic/staff/spellblade/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance) + // Do not block projectiles. + if(attack_type & PROJECTILE_ATTACK) + return BLOCK_NONE return ..() /obj/item/gun/magic/staff/locker