Skip to content

Commit 8aae426

Browse files
authored
1029204smallbugs (#1109)
* Fix people marked by the flock seeing the marker * Cleanup directional block code and fix a bug
1 parent a94c4c5 commit 8aae426

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

code/__DEFINES/maths.dm

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@
123123
/// Gets shift x that would be required the bitflag (1<<x)
124124
#define TOBITSHIFT(bit) (round(log(2, bit), 1))
125125

126+
/// Reverse an angle. 45 -> 225, 0 -> 180, etc
127+
#define REVERSE_ANGLE(angle) (floor((angle) + 180) % 360)
128+
126129
// Will filter out extra rotations and negative rotations
127130
// E.g: 540 becomes 180. -180 becomes 180.
128131
#define SIMPLIFY_DEGREES(degrees) (MODULUS((degrees), 360))

code/__HELPERS/combat_helpers.dm

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
/// Returns an angle between 0 and 180, where 0 is the attacker is directly infront of the defender, 180 for directly behind.
22
/proc/get_relative_attack_angle(mob/living/carbon/human/defender, atom/movable/hitby)
3-
var/attack_dir = defender.dir // Default to the defender's dir so that the attack angle is 0 by default
3+
/// Null is the value that will consider angles to match the defender's dir
4+
var/attack_angle = null
5+
46
var/turf/defender_turf = get_turf(defender)
7+
var/turf/attack_turf = get_turf(hitby)
8+
var/attack_dir = get_dir(defender_turf, attack_turf)
59

610
if(isprojectile(hitby))
711
var/obj/projectile/P = hitby
812
if(P.starting != defender_turf)
9-
attack_dir = REVERSE_DIR(angle2dir(P.Angle))
13+
attack_angle = REVERSE_ANGLE(P.Angle)
1014

1115
else if(isitem(hitby))
1216
if(ismob(hitby.loc))
13-
attack_dir = get_dir(defender, hitby.loc)
17+
attack_angle = dir2angle(get_dir(defender, get_turf(hitby.loc)))
1418
else
15-
attack_dir = get_dir(defender, hitby)
19+
attack_angle = dir2angle(attack_dir)
1620

1721
else
18-
attack_dir = get_dir(defender, hitby)
22+
attack_angle = dir2angle(attack_dir)
23+
24+
if(attack_angle == null)
25+
return 0
1926

20-
var/attack_angle = dir2angle(attack_dir) || 0 // If attack_dir == 0, dir2angle returns null
2127
var/facing_angle = dir2angle(defender.dir) || 0
2228
var/delta = abs(attack_angle - facing_angle)
2329
if(delta > 180)

code/game/objects/items.dm

+6-1
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,13 @@ DEFINE_INTERACTABLE(/obj/item)
706706
var/sig_return = SEND_SIGNAL(src, COMSIG_ITEM_CHECK_BLOCK)
707707
var/block_result = sig_return & COMPONENT_CHECK_BLOCK_BLOCKED
708708

709+
var/attack_armor_pen = 0
710+
if(isitem(hitby))
711+
var/obj/item/hitby_item = hitby
712+
attack_armor_pen = hitby_item.armor_penetration
713+
709714
if(!block_result && can_block_attack(wielder, hitby, attack_type))
710-
block_result = prob(get_block_chance(wielder, hitby, damage, attack_type, armor_penetration))
715+
block_result = prob(get_block_chance(wielder, hitby, damage, attack_type, attack_armor_pen))
711716

712717
var/list/reaction_args = args.Copy()
713718
if(block_result)

code/modules/flockmind/flock_controller/_flock_controller.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320

321321
/datum/flock/proc/add_notice(atom/target, notice_type)
322322
var/image/I = image(notice_images[notice_type], loc = target)
323-
return target.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/flock, notice_type, I, null, src)
323+
return target.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/flock, notice_type, I, NONE, src)
324324

325325
/datum/flock/proc/remove_notice(atom/target, notice_type)
326326
target.remove_alt_appearance(notice_type)

code/modules/flockmind/flock_structure/flock_turret.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
active_compute_cost = 50
1212

1313
var/range = 8
14+
var/projectile_count = 4
1415
var/projectile_type = /obj/projectile/bullet/dart/piercing/gnesis
1516

1617
var/mob/current_target
@@ -54,7 +55,7 @@
5455

5556
fire()
5657

57-
/obj/structure/flock/gnesis_turret/proc/fire(bullets = 4)
58+
/obj/structure/flock/gnesis_turret/proc/fire(bullets = src.projectile_count)
5859
if(isnull(current_target))
5960
return
6061

0 commit comments

Comments
 (0)