Skip to content

Commit 0ffd79d

Browse files
authored
Revert "adds directional blocking (#1103)" (#1104)
This reverts commit b689005.
1 parent 94caa78 commit 0ffd79d

File tree

18 files changed

+42
-84
lines changed

18 files changed

+42
-84
lines changed

code/__HELPERS/combat_helpers.dm

-27
This file was deleted.

code/__HELPERS/_type2type.dm code/__HELPERS/type2type.dm

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
return SOUTHEAST
6363
if("SOUTHWEST")
6464
return SOUTHWEST
65+
else
66+
return
6567

6668
//Converts an angle (degrees) into a ss13 direction
6769
GLOBAL_LIST_INIT(modulo_angle_to_dir, list(NORTH,NORTHEAST,EAST,SOUTHEAST,SOUTH,SOUTHWEST,WEST,NORTHWEST))

code/datums/martial/sleeping_carp.dm

+4-4
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
else
230230
return ..()
231231

232-
/obj/item/staff/bostaff/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
233-
if(!wielded)
234-
return FALSE
235-
return ..()
232+
/obj/item/staff/bostaff/get_block_chance(atom/movable/hitby, damage, attack_type, armor_penetration)
233+
if(wielded)
234+
return ..()
235+
return FALSE

code/game/objects/items.dm

+1-13
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ DEFINE_INTERACTABLE(/obj/item)
239239

240240
/// The baseline chance to block **ANY** attack, projectiles included
241241
var/block_chance = 0
242-
/// The angle infront of the defender that is a valid block range.
243-
var/block_angle = 45 // Infront and infront + sides, but not direct sides
244-
245242
/// The type of effect to create on a successful block
246243
var/obj/effect/temp_visual/block_effect = /obj/effect/temp_visual/block
247244

@@ -706,8 +703,7 @@ DEFINE_INTERACTABLE(/obj/item)
706703
var/sig_return = SEND_SIGNAL(src, COMSIG_ITEM_CHECK_BLOCK)
707704
var/block_result = sig_return & COMPONENT_CHECK_BLOCK_BLOCKED
708705

709-
if(!block_result && can_block_attack(wielder, hitby, attack_type))
710-
block_result = prob(get_block_chance(wielder, hitby, damage, attack_type, armor_penetration))
706+
block_result ||= prob(get_block_chance(wielder, hitby, damage, attack_type, armor_penetration))
711707

712708
var/list/reaction_args = args.Copy()
713709
if(block_result)
@@ -724,14 +720,6 @@ DEFINE_INTERACTABLE(/obj/item)
724720

725721
return block_result
726722

727-
/// Checks if this item can block an incoming attack.
728-
/obj/item/proc/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
729-
var/angle = get_relative_attack_angle(wielder, hitby)
730-
if(angle <= block_angle)
731-
return TRUE
732-
733-
return FALSE
734-
735723
/// Returns a number to feed into prob() to determine if the attack was blocked.
736724
/obj/item/proc/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
737725
var/block_chance_modifier = round(damage / -3)

code/game/objects/items/dualsaber.dm

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@
138138
else
139139
user.stamina.adjust(-25)
140140

141-
/obj/item/dualsaber/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
142-
if(!wielded)
143-
return FALSE
144-
return ..()
141+
/obj/item/dualsaber/get_block_chance(atom/movable/hitby, damage, attack_type, armor_penetration)
142+
if(wielded)
143+
return ..()
144+
return FALSE
145145

146146
/obj/item/dualsaber/process()
147147
if(!wielded)

code/game/objects/items/grenades/_grenade.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@
214214
/obj/item/grenade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
215215
var/obj/projectile/hit_projectile = hitby
216216
if(!istype(hitby))
217-
return 0
217+
return FALSE
218218

219219
if(damage && attack_type == PROJECTILE_ATTACK && hit_projectile.damage_type != STAMINA && prob(15))
220-
return 100
220+
return TRUE
221221

222222
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK, block_success = TRUE)
223223
. = ..()

code/game/objects/items/holy_weapons.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
attack_verb_simple = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
249249
menu_description = "A sharp claymore which provides a low chance of blocking incoming melee attacks. Can be worn on the back or belt."
250250

251-
/obj/item/nullrod/claymore/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
251+
/obj/item/nullrod/claymore/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
252252
if(attack_type == PROJECTILE_ATTACK)
253253
return FALSE
254254
return ..()

code/game/objects/items/melee/energy.dm

+5-5
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@
179179
block_chance = 50
180180
embedding = list("embed_chance" = 75, "impact_pain_mult" = 10)
181181

182-
/obj/item/melee/energy/sword/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
183-
if(!blade_active)
184-
return FALSE
185-
return ..()
182+
/obj/item/melee/energy/sword/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
183+
if(blade_active)
184+
return ..()
185+
return FALSE
186186

187187
/obj/item/melee/energy/sword/cyborg
188188
name = "cyborg energy sword"
@@ -223,7 +223,7 @@
223223
active_force = 30
224224
sword_color_icon = null // Stops icon from breaking when turned on.
225225

226-
/obj/item/melee/energy/sword/cyborg/saw/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
226+
/obj/item/melee/energy/sword/cyborg/saw/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
227227
return FALSE
228228

229229
// The colored energy swords we all know and love.

code/game/objects/items/melee/misc.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
. = ..()
7777
AddComponent(/datum/component/butchering, 30, 95, 5) //fast and effective, but as a sword, it might damage the results.
7878

79-
/obj/item/melee/sabre/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
79+
/obj/item/melee/sabre/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
8080
if(attack_type == PROJECTILE_ATTACK)
81-
return FALSE
81+
return FALSE //Don't bring a sword to a gunfight
8282
return ..()
8383

8484
/obj/item/melee/sabre/on_exit_storage(datum/storage/container)

code/game/objects/items/shields.dm

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@
2828
max_integrity = 75
2929

3030

31-
/obj/item/shield/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
31+
/obj/item/shield/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
3232
if(transparent && (hitby.pass_flags & PASSGLASS))
3333
return FALSE
34-
return ..()
35-
36-
/obj/item/shield/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
3734
. = ..()
3835
if(attack_type == THROWN_PROJECTILE_ATTACK)
3936
. += 30
@@ -272,10 +269,10 @@
272269
attack_verb_simple_on = list("smack", "strike", "crack", "beat"))
273270
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
274271

275-
/obj/item/shield/riot/tele/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
276-
if(!extended)
277-
return FALSE
278-
return ..()
272+
/obj/item/shield/riot/tele/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
273+
if(extended)
274+
return ..()
275+
return FALSE
279276

280277
/*
281278
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].

code/game/objects/items/toys.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@
520520
attack_verb_continuous = list("attacks", "strikes", "hits")
521521
attack_verb_simple = list("attack", "strike", "hit")
522522

523-
/obj/item/dualsaber/toy/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
523+
/obj/item/dualsaber/toy/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
524524
return FALSE
525525

526526
/obj/item/dualsaber/toy/IsReflect() //Stops Toy Dualsabers from reflecting energy projectiles

code/game/objects/items/weaponry.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
780780

781781
/obj/item/highfrequencyblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
782782
if((attack_type == PROJECTILE_ATTACK) && wielded)
783-
return 100
783+
return TRUE
784784

785785
. = ..()
786786

code/game/objects/structures/beds_chairs/chair.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0)
368368
/obj/item/chair/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
369369
. = ..()
370370
if(prob(50) && ((attack_type == UNARMED_ATTACK) || (attack_type == LEAP_ATTACK)))
371-
return 100
371+
return TRUE
372372

373373
/obj/item/chair/block_feedback(mob/living/carbon/human/wielder, attack_text, attack_type, do_message = TRUE, do_sound = TRUE)
374374
if(do_message)

code/modules/antagonists/cult/cult_items.dm

+8-7
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ Striking a noncultist, however, will tear their flesh."}
3737

3838
AddComponent(/datum/component/cult_ritual_item, span_cult(examine_text))
3939

40-
/obj/item/melee/cultblade/dagger/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
41-
if(attack_type == PROJECTILE_ATTACK)
42-
return FALSE
43-
return ..()
40+
/obj/item/melee/cultblade/dagger/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
41+
if(IS_CULTIST(wielder) && attack_type != PROJECTILE_ATTACK)
42+
return ..()
43+
44+
return FALSE
4445

4546
/obj/item/melee/cultblade/dagger/block_feedback(mob/living/carbon/human/wielder, attack_text, attack_type, do_message = TRUE, do_sound = TRUE)
4647
if(do_message)
@@ -77,7 +78,7 @@ Striking a noncultist, however, will tear their flesh."}
7778
. = ..()
7879
AddComponent(/datum/component/butchering, 40, 100)
7980

80-
/obj/item/melee/cultblade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
81+
/obj/item/melee/cultblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
8182
if(IS_CULTIST(wielder))
8283
return ..()
8384

@@ -277,15 +278,13 @@ Striking a noncultist, however, will tear their flesh."}
277278
holder.apply_status_effect(/datum/status_effect/sword_spin)
278279
sword.spinning = TRUE
279280
sword.block_chance = 100
280-
sword.block_angle = 180
281281
sword.slowdown += 1.5
282282
addtimer(CALLBACK(src, PROC_REF(stop_spinning)), 50)
283283
holder?.update_mob_action_buttons()
284284

285285
/datum/action/innate/cult/spin2win/proc/stop_spinning()
286286
sword.spinning = FALSE
287287
sword.block_chance = 50
288-
sword.block_angle = 45
289288
sword.slowdown -= 1.5
290289
sleep(sword.spin_cooldown)
291290
holder?.update_mob_action_buttons()
@@ -776,6 +775,8 @@ Striking a noncultist, however, will tear their flesh."}
776775
qdel(src)
777776

778777
/obj/item/melee/cultblade/halberd/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
778+
if(!IS_CULTIST(wielder))
779+
return FALSE
779780
. = ..()
780781
if(wielded)
781782
. *= 2

code/modules/clothing/suits/reactive_armour.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
update_icon()
6868
add_fingerprint(user)
6969

70-
/obj/item/clothing/suit/armor/reactive/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
70+
/obj/item/clothing/suit/armor/reactive/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
7171
if(!active)
7272
return FALSE
7373

code/modules/projectiles/guns/magic/staff.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
. = ..()
183183
AddComponent(/datum/component/butchering, 15, 125, 0, hitsound)
184184

185-
/obj/item/gun/magic/staff/spellblade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
185+
/obj/item/gun/magic/staff/spellblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
186186
if(attack_type == PROJECTILE_ATTACK)
187187
return FALSE
188188

code/modules/religion/sparring/ceremonial_gear.dm

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@
4242
force = old_force
4343
throwforce = old_throwforce
4444

45-
/obj/item/ceremonial_blade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
45+
/obj/item/ceremonial_blade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
4646
if(attack_type != MELEE_ATTACK || !ishuman(hitby.loc))
47-
return FALSE
48-
return ..()
47+
return ..()
4948

50-
/obj/item/ceremonial_blade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
5149
. = ..()
5250
if(HAS_TRAIT(hitby.loc, TRAIT_SPARRING))
5351
//becomes 30 block

daedalus.dme

+1-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@
342342
#include "code\__HELPERS\_lists.dm"
343343
#include "code\__HELPERS\_logging.dm"
344344
#include "code\__HELPERS\_string_lists.dm"
345-
#include "code\__HELPERS\_type2type.dm"
346345
#include "code\__HELPERS\admin.dm"
347346
#include "code\__HELPERS\ai.dm"
348347
#include "code\__HELPERS\areas.dm"
@@ -356,7 +355,6 @@
356355
#include "code\__HELPERS\clients.dm"
357356
#include "code\__HELPERS\cmp.dm"
358357
#include "code\__HELPERS\colors.dm"
359-
#include "code\__HELPERS\combat_helpers.dm"
360358
#include "code\__HELPERS\config.dm"
361359
#include "code\__HELPERS\construction.dm"
362360
#include "code\__HELPERS\dates.dm"
@@ -410,6 +408,7 @@
410408
#include "code\__HELPERS\time.dm"
411409
#include "code\__HELPERS\traits.dm"
412410
#include "code\__HELPERS\turfs.dm"
411+
#include "code\__HELPERS\type2type.dm"
413412
#include "code\__HELPERS\type_processing.dm"
414413
#include "code\__HELPERS\typelists.dm"
415414
#include "code\__HELPERS\varset_callback.dm"

0 commit comments

Comments
 (0)