Skip to content

Commit

Permalink
fix runners sticking on some things while dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 17, 2023
1 parent 36d4a68 commit d55cfcb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
31 changes: 31 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
var/list/flags_pass_temp
var/list/temp_flag_counter

var/list/flags_pass_temp_negative
var/list/negative_temp_flag_counter

// Temporary flags for what can pass through an atom
var/list/flags_can_pass_all_temp
var/list/flags_can_pass_front_temp
Expand Down Expand Up @@ -460,6 +463,34 @@ Parameters are passed from New.
temp_flag_counter -= flag_str
flags_pass_temp &= ~flag

/atom/proc/add_temp_negative_pass_flags(flags_to_add)
if (isnull(negative_temp_flag_counter))
negative_temp_flag_counter = list()

for (var/flag in GLOB.bitflags)
if(!(flags_to_add & flag))
continue
var/flag_str = "[flag]"
if (negative_temp_flag_counter[flag_str])
negative_temp_flag_counter[flag_str]++
else
negative_temp_flag_counter[flag_str] = 1
flags_pass_temp_negative |= flag

/atom/proc/remove_temp_negative_pass_flags(flags_to_remove)
if (isnull(negative_temp_flag_counter))
return

for (var/flag in GLOB.bitflags)
if(!(flags_to_remove & flag))
continue
var/flag_str = "[flag]"
if (negative_temp_flag_counter[flag_str])
negative_temp_flag_counter[flag_str]--
if (negative_temp_flag_counter[flag_str] == 0)
negative_temp_flag_counter -= flag_str
flags_pass_temp_negative &= ~flag

// This proc is for initializing pass flags (allows for inheriting pass flags and list-based pass flags)
/atom/proc/initialize_pass_flags(datum/pass_flags_container/PF)
return
Expand Down
10 changes: 10 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/castes/Runner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@
pull_direction &= (EAST|WEST)
return ..()

/mob/living/carbon/xenomorph/runner/start_pulling(atom/movable/AM, lunge, no_msg)
. = ..()

add_temp_negative_pass_flags(PASS_FLAGS_CRAWLER)

/mob/living/carbon/xenomorph/runner/stop_pulling()
. = ..()

remove_temp_negative_pass_flags(PASS_FLAGS_CRAWLER)

/mob/living/carbon/xenomorph/runner/init_movement_handler()
var/datum/xeno_ai_movement/linger/linger_movement = new(src)
linger_movement.linger_range = linger_range
Expand Down
4 changes: 2 additions & 2 deletions code/modules/movement/movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if(!mover || !mover.pass_flags)
return NO_BLOCKED_MOVEMENT

var/mover_flags_pass = mover.pass_flags.flags_pass|mover.flags_pass_temp
var/mover_flags_pass = (mover.pass_flags.flags_pass|mover.flags_pass_temp) & ~mover.flags_pass_temp_negative

if (!density || (flags_can_pass & mover_flags_pass))
return NO_BLOCKED_MOVEMENT
Expand Down Expand Up @@ -48,7 +48,7 @@
if(!mover || !mover.pass_flags)
return NO_BLOCKED_MOVEMENT

var/mover_flags_pass = mover.pass_flags.flags_pass|mover.flags_pass_temp
var/mover_flags_pass = (mover.pass_flags.flags_pass|mover.flags_pass_temp) & ~mover.flags_pass_temp_negative

if(flags_atom & ON_BORDER && density && !(flags_can_pass & mover_flags_pass))
return target_dir & dir
Expand Down

0 comments on commit d55cfcb

Please sign in to comment.