Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better throw logic #6040

Merged
merged 2 commits into from
Apr 13, 2024
Merged
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
8 changes: 2 additions & 6 deletions code/modules/movement/launching/launching.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,17 @@

add_temp_pass_flags(pass_flags)

var/turf/start_turf = get_step_towards(src, LM.target)
var/list/turf/path = get_line(start_turf, LM.target)
var/last_loc = loc

var/early_exit = FALSE
LM.dist = 0
for (var/turf/T in path)
if (!src || !throwing || loc != last_loc || !isturf(src.loc))
break
while (src && throwing && loc == last_loc && isturf(src.loc)) // While looks scary at first but it's basically just a for until LM.dist reaches LM.range
if (!LM || QDELETED(LM))
early_exit = TRUE
break
if (LM.dist >= LM.range)
break
if (!Move(T)) // If this returns FALSE, then a collision happened
if (!Move(get_step_towards(src, LM.target))) // If this returns FALSE, then a collision happened
break
last_loc = loc
if (++LM.dist >= LM.range)
Expand Down
Loading