Skip to content

Commit

Permalink
a little bit of fixfoolery and define changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xDanilcusx committed Nov 14, 2023
1 parent 0705e57 commit 380f97d
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions code/modules/mob/living/carbon/xenomorph/ai/movement/crusher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

RegisterSignal(parent, COMSIG_XENO_STOPPED_CHARGING, PROC_REF(stopped_charging))

#define MIN_TARGETS_TO_CHARGE 2
#define MIN_TARGETS_TO_CHARGE 3
#define MAX_CHARGE_DISTANCE 30
#define MIN_CHARGE_DISTANCE 3
#define FLOCK_SCAN_RADIUS 4
#define MIN_CHARGE_DISTANCE 2
#define FLOCK_SCAN_RADIUS 3
#define CHARGE_DEVIATION 1

/datum/xeno_ai_movement/crusher/ai_move_target(delta_time)
Expand Down Expand Up @@ -39,26 +39,23 @@

var/turf/next_turf = get_step(moving_xeno, charging_dir)
if(LinkBlocked(moving_xeno, get_turf(moving_xeno), next_turf))
if(moving_xeno.Move(next_turf, 0))
if(moving_xeno.Move(next_turf, 0)) // So we croosh into it and not just go away
return TRUE

toggle_charging(FALSE)
return TRUE

if(get_dist(moving_xeno, target) <= MIN_CHARGE_DISTANCE)
return ..()

var/humans_x = 0
var/humans_y = 0
var/humans_count = 0

/// Now we getting medium coordinates from all humans standing around our target
for(var/mob/living/carbon/human/humie in view(FLOCK_SCAN_RADIUS, target))
if(humie.stat)
for(var/mob/living/carbon/human/hooman in view(FLOCK_SCAN_RADIUS, target))
if(!moving_xeno.check_mob_target(hooman))
continue

humans_x += humie.x
humans_y += humie.y
humans_x += hooman.x
humans_y += hooman.y
humans_count++

if(humans_count < MIN_TARGETS_TO_CHARGE)
Expand All @@ -75,8 +72,8 @@
var/list/possible_blocked_turfs = list(WE_move_variant, NS_move_variant)
var/list/non_blocked_turfs = list()

/// Checking which one of two ways is non-blocked in distance of MIN_CHARGE_DISTANCE
for(var/i=1 to LAZYLEN(possible_blocked_turfs))
/// Checking which one of two ways is non-blocked by MIN_CHARGE_DISTANCE closest turfs in direction of middle turf
for(var/i = 1 to LAZYLEN(possible_blocked_turfs))
var/turf/next_turf = possible_blocked_turfs[i]
var/blocked = FALSE

Expand All @@ -85,8 +82,8 @@
next_turf = get_step(next_turf, get_dir(next_turf, middle))

var/list/ignore = list()
for(var/mob/living/carbon/xenomorph/xeno_blocker in next_turf)
ignore += xeno_blocker
for(var/mob/mob_blocker in next_turf)
ignore += mob_blocker

if(LinkBlocked(moving_xeno, last_turf, next_turf, ignore))
blocked = TRUE
Expand Down Expand Up @@ -116,7 +113,7 @@

/// When we eventially get to our move_variant - get an edge_turf in direction of middle, and then toggle our charging ability
var/step_dir = get_dir(to_move, middle)
var/turf/edge_turf = get_step(moving_xeno, step_dir)
var/turf/edge_turf = get_turf(moving_xeno)

for(var/i = 1 to MAX_CHARGE_DISTANCE)
edge_turf = get_step(edge_turf, step_dir)
Expand Down Expand Up @@ -147,7 +144,7 @@
/datum/xeno_ai_movement/crusher/proc/stopped_charging()
SIGNAL_HANDLER

charge_turf = null
toggle_charging(FALSE)

/mob/living/carbon/xenomorph/crusher/Move(NewLoc, direct)
if(direct == 0)
Expand Down

0 comments on commit 380f97d

Please sign in to comment.