Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions code/game/mecha/mecha_defense.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/obj/mecha/proc/get_armour_facing(relative_dir)
switch(relative_dir)
if(0) // BACKSTAB!
switch(abs(relative_dir))
if(180) // BACKSTAB!
return facing_modifiers[MECHA_BACK_ARMOUR]
if(45, 90, 270, 315)
return facing_modifiers[MECHA_SIDE_ARMOUR]
if(225, 180, 135)
if(0, 45)
return facing_modifiers[MECHA_FRONT_ARMOUR]
return 1 //always return non-0
return facing_modifiers[MECHA_SIDE_ARMOUR] //always return non-0

/obj/mecha/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
. = ..()
Expand Down Expand Up @@ -43,7 +41,7 @@
break

if(attack_dir)
var/facing_modifier = get_armour_facing(dir2angle(attack_dir) - dir2angle(src))
var/facing_modifier = get_armour_facing(dir2angle(attack_dir) - dir2angle(dir))
booster_damage_modifier /= facing_modifier
booster_deflection_modifier *= facing_modifier
if(prob(deflect_chance * booster_deflection_modifier))
Expand Down