From 9ead492bb079458d0c24558573543caa37982225 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Mon, 16 Mar 2020 00:28:18 -0700
Subject: [PATCH] changes
---
code/datums/components/wearertargeting.dm | 2 +-
code/game/objects/items/flamethrower.dm | 19 ++++++++++---------
code/game/objects/items/grenades/grenade.dm | 14 ++++++++------
code/game/objects/items/holy_weapons.dm | 6 +++---
code/game/objects/items/melee/energy.dm | 4 ++--
code/game/objects/items/melee/misc.dm | 2 +-
code/game/objects/items/twohanded.dm | 12 ++++++------
code/modules/assembly/flash.dm | 5 +++--
.../mob/living/carbon/carbon_defense.dm | 2 +-
.../mob/living/carbon/human/species.dm | 2 +-
code/modules/mob/living/living_defense.dm | 3 ++-
.../mob/living/silicon/silicon_defense.dm | 2 +-
12 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/code/datums/components/wearertargeting.dm b/code/datums/components/wearertargeting.dm
index feaa88f934..4760757701 100644
--- a/code/datums/components/wearertargeting.dm
+++ b/code/datums/components/wearertargeting.dm
@@ -19,4 +19,4 @@
UnregisterSignal(equipper, signals)
/datum/component/wearertargeting/proc/on_drop(datum/source, mob/user)
- UnregisterSignal(user, signals)
\ No newline at end of file
+ UnregisterSignal(user, signals)
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index b0882b6e5d..450546d37e 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -234,15 +234,16 @@
/obj/item/flamethrower/full/tank
create_with_tank = TRUE
-/obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
- var/obj/item/projectile/P = hitby
- if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
- owner.visible_message("\The [attack_text] hits the fueltank on [owner]'s [name], rupturing it! What a shot!")
- var/target_turf = get_turf(owner)
- igniter.ignite_turf(src,target_turf, release_amount = 100)
- qdel(ptank)
- return 1 //It hit the flamethrower, not them
-
+/obj/item/flamethrower/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
+ if(real_attack && (attack_type == ATTACK_TYPE_PROJECTILE
+ var/obj/item/projectile/P = hitby
+ if(istype(P) && (P.damage_type != STAMINA) && damage && !P.nodamage && prob(15))
+ owner.visible_message("\The [attack_text] hits the fueltank on [owner]'s [name], rupturing it! What a shot!")
+ var/target_turf = get_turf(owner)
+ igniter.ignite_turf(src,target_turf, release_amount = 100)
+ qdel(ptank)
+ return BLOCK_SUCCESS | BLOCK_PHYSICAL_EXTERNAL | BLOCK_INTERRUPT_CHAIN
+ return ..()
/obj/item/assembly/igniter/proc/flamethrower_process(turf/open/location)
location.hotspot_expose(700,2)
diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm
index 77b4b33a8c..306cd16a7e 100644
--- a/code/game/objects/items/grenades/grenade.dm
+++ b/code/game/objects/items/grenades/grenade.dm
@@ -115,12 +115,14 @@
/obj/item/grenade/attack_paw(mob/user)
return attack_hand(user)
-/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
- var/obj/item/projectile/P = hitby
- if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
- owner.visible_message("[attack_text] hits [owner]'s [src], setting it off! What a shot!")
- prime()
- return TRUE //It hit the grenade, not them
+/obj/item/grenade/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
+ if(real_attack && (attack_type == ATTACK_TYPE_PROJECTILE))
+ var/obj/item/projectile/P = hitby
+ if(damage && !P.nodamage && (P.damage_type != STAMINA) && prob(15))
+ owner.visible_message("[attack_text] hits [owner]'s [src], setting it off! What a shot!")
+ prime()
+ return BLOCK_SUCESS | BLOCK_PHYSICAL_EXTERNAL | BLOCK_INTERRUPT_CHAIN
+ return ..()
/obj/item/proc/grenade_prime_react(obj/item/grenade/nade)
return
diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm
index e58bf5d4e4..0d7ad890e7 100644
--- a/code/game/objects/items/holy_weapons.dm
+++ b/code/game/objects/items/holy_weapons.dm
@@ -328,9 +328,9 @@
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
-/obj/item/nullrod/claymore/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/nullrod/claymore/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 NONE
return ..()
/obj/item/nullrod/claymore/darkblade
diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm
index aba07c9120..388dab4b19 100644
--- a/code/game/objects/items/melee/energy.dm
+++ b/code/game/objects/items/melee/energy.dm
@@ -148,8 +148,8 @@
tool_behaviour = TOOL_SAW
toolspeed = 0.7
-/obj/item/melee/transforming/energy/sword/cyborg/saw/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 0
+/obj/item/melee/transforming/energy/sword/cyborg/saw/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
+ return NONE
/obj/item/melee/transforming/energy/sword/saber
var/list/possible_colors = list("red" = LIGHT_COLOR_RED, "blue" = LIGHT_COLOR_LIGHT_CYAN, "green" = LIGHT_COLOR_GREEN, "purple" = LIGHT_COLOR_LAVENDER)
diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm
index 6aa77e2090..ddce728da9 100644
--- a/code/game/objects/items/melee/misc.dm
+++ b/code/game/objects/items/melee/misc.dm
@@ -277,7 +277,7 @@
return
else
if(cooldown_check < world.time)
- if(target.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS)
+ if(target.run_block(src, 0, "[user]'s [name]", ATTACK_TYPE_MELEE, 0, user) & BLOCK_SUCCESS)
playsound(target, 'sound/weapons/genhit.ogg', 50, 1)
return
if(ishuman(target))
diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm
index 8fcf6793bf..3126e5c6ba 100644
--- a/code/game/objects/items/twohanded.dm
+++ b/code/game/objects/items/twohanded.dm
@@ -752,12 +752,12 @@
armour_penetration = 100
force_on = 30
-/obj/item/twohanded/required/chainsaw/doomslayer/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)
+/obj/item/twohanded/required/chainsaw/doomslayer/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
+ if(real_attack && (attack_type == PROJECTILE_ATTACK))
owner.visible_message("Ranged attacks just make [owner] angrier!")
playsound(src, pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg'), 75, 1)
- return 1
- return 0
+ return BLOCK_SUCCESS | BLOCK_INTERRUPT_CHAIN | BLOCK_PHYSICAL_EXTERNAL
+ return ..()
//GREY TIDE
/obj/item/twohanded/spear/grey_tide
@@ -1056,7 +1056,7 @@
. = R.get_cell()
/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)))
+ if(!on || (!can_block_projectiles && (attack_type & PROJECTILE_ATTACK)))
return BLOCK_NONE
return ..()
@@ -1178,7 +1178,7 @@
if(iscyborg(target))
..()
return
- if(target.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS) //No message; check_shields() handles that
+ if(target.run_block(src, 0, "[user]'s [name]", BLOCK_TYPE_MELEE, 0, user) & BLOCK_SUCCESS) //No message; check_shields() handles that
playsound(target, 'sound/weapons/genhit.ogg', 50, 1)
return FALSE
if(user.a_intent != INTENT_HARM)
diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm
index 13ea317b9b..166cc4bea4 100644
--- a/code/modules/assembly/flash.dm
+++ b/code/modules/assembly/flash.dm
@@ -312,8 +312,9 @@
if(holder)
holder.update_icon()
-/obj/item/assembly/flash/shield/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
- activate()
+/obj/item/assembly/flash/shield/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
+ if(real_attack)
+ activate()
return ..()
//ported from tg - check to make sure it can't appear where it's not supposed to.
diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm
index 6e78924dd3..545ef9d335 100644
--- a/code/modules/mob/living/carbon/carbon_defense.dm
+++ b/code/modules/mob/living/carbon/carbon_defense.dm
@@ -89,7 +89,7 @@
totitemdamage *= 1.5
//CIT CHANGES END HERE
var/impacting_zone = (user == src)? check_zone(user.zone_selected) : ran_zone(user.zone_selected)
- if((user != src) && (run_block(I, totitemdamage, "the [I]", MELEE_ATTACK, I.armour_penetration, user, impacting_zone) & BLOCK_SUCCESS))
+ if((user != src) && (run_block(I, totitemdamage, "the [I]", ATTACK_TYPE_MELEE, I.armour_penetration, user, impacting_zone) & BLOCK_SUCCESS))
return FALSE
var/obj/item/bodypart/affecting = get_bodypart(impacting_zone)
if(!affecting) //missing limb? we select the first bodypart (you can never have zero, because of chest)
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index d4bfe90707..7c1123dbad 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1668,7 +1668,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
/datum/species/proc/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H)
// Allows you to put in item-specific reactions based on species
if(user != H)
- if(H.run_block(I, I.force, "the [I.name]", MELEE_ATTACK, I.armour_penetration, user, affecting.body_zone) & BLOCK_SUCCESS)
+ if(H.run_block(I, I.force, "the [I.name]", ATTACK_TYPE_MELEE, I.armour_penetration, user, affecting.body_zone) & BLOCK_SUCCESS)
return 0
if(H.check_block())
H.visible_message("[H] blocks [I]!")
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 4741eb321a..d0d1ccce5d 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -59,6 +59,7 @@
return FALSE
/mob/living/bullet_act(obj/item/projectile/P, def_zone)
+#warn implement blocktypes
if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself
if(reflect_bullet_check(P, def_zone))
return BULLET_ACT_FORCE_PIERCE // complete projectile permutation
@@ -99,7 +100,7 @@
I = AM
throwpower = I.throwforce
var/impacting_zone = ran_zone(BODY_ZONE_CHEST, 65)//Hits a random part of the body, geared towards the chest
- if(run_block(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK, throwningdatum.thrower, impacting_zone) & BLOCK_SUCCESS)
+ if(run_block(AM, throwpower, "\the [AM.name]", ATTACK_TYPE_THROWN, throwningdatum.thrower, impacting_zone) & BLOCK_SUCCESS)
hitpush = FALSE
skipcatch = TRUE
blocked = TRUE
diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm
index e1ad55af84..1c6784ab95 100644
--- a/code/modules/mob/living/silicon/silicon_defense.dm
+++ b/code/modules/mob/living/silicon/silicon_defense.dm
@@ -117,7 +117,7 @@
#warn implement blocktypes
if(run_block(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration) & BLOCK_SUCCESS)
P.on_hit(src, 100, def_zone)
- return BULLET_ACT_BLOCKED
+ return BULLET_ACT_BLOCK
if((P.damage_type == BRUTE || P.damage_type == BURN))
adjustBruteLoss(P.damage)
if(prob(P.damage*1.5))