Skip to content

Commit

Permalink
Thrown mobs cant move until the throw ends (ParadiseSS13#23775)
Browse files Browse the repository at this point in the history
* if you being throwed, you're not moving

* throw block_movement variable

* forgot arg here

* tether might keep movement

* Update code/controllers/subsystem/SSthrowing.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

---------

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
  • Loading branch information
HMBGERDO and lewcc authored Jan 28, 2024
1 parent 11596a7 commit f9f82fd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions code/controllers/subsystem/SSthrowing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ SUBSYSTEM_DEF(throwing)
var/last_move = 0
///When this variable is false, non dense mobs will be hit by a thrown item. useful for things that you dont want to be cheesed by crawling, EG. gravitational anomalies
var/dodgeable = TRUE
/// Can a thrown mob move themselves to stop the throw?
var/block_movement = TRUE

/datum/thrownthing/proc/tick()
var/atom/movable/AM = thrownthing
Expand Down
3 changes: 2 additions & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@
step(src, AM.dir)
..()

/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = INFINITY, dodgeable = TRUE)
/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = INFINITY, dodgeable = TRUE, block_movement = TRUE)
if(!target || (flags & NODROP) || speed <= 0)
return 0

Expand Down Expand Up @@ -435,6 +435,7 @@
TT.diagonals_first = diagonals_first
TT.callback = callback
TT.dodgeable = dodgeable
TT.block_movement = block_movement

var/dist_x = abs(target.x - src.x)
var/dist_y = abs(target.y - src.y)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@
if("lighting_alpha")
sync_lighting_plane_alpha()

/mob/living/throw_at(atom/target, range, speed, mob/thrower, spin, diagonals_first, datum/callback/callback, force, dodgeable)
/mob/living/throw_at(atom/target, range, speed, mob/thrower, spin, diagonals_first, datum/callback/callback, force, dodgeable, block_movement)
stop_pulling()
return ..()

Expand Down
8 changes: 5 additions & 3 deletions code/modules/mob/mob_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
if(mob.notransform)
return 0 //This is sota the goto stop mobs from moving var

if(mob.throwing && mob.throwing.block_movement)
return

if(mob.control_object)
return Move_object(direct)

Expand Down Expand Up @@ -182,9 +185,8 @@
mob.setDir(get_dir(mob, mob.pulling)) // Face welding tanks and stuff when pulling

moving = 0
if(mob && .)
if(mob.throwing)
mob.throwing.finalize(FALSE)
if(mob && . && mob.throwing)
mob.throwing.finalize(FALSE)

for(var/obj/O in mob)
O.on_mob_move(direct, mob)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mod/modules/modules_engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
if(firer && isliving(firer))
var/mob/living/L = firer
L.apply_status_effect(STATUS_EFFECT_IMPACT_IMMUNE)
L.throw_at(target, 15, 1, L, FALSE, FALSE, callback = CALLBACK(L, TYPE_PROC_REF(/mob/living, remove_status_effect), STATUS_EFFECT_IMPACT_IMMUNE))
L.throw_at(target, 15, 1, L, FALSE, FALSE, callback = CALLBACK(L, TYPE_PROC_REF(/mob/living, remove_status_effect), STATUS_EFFECT_IMPACT_IMMUNE), block_movement = FALSE)

/obj/item/projectile/tether/Destroy()
QDEL_NULL(chain)
Expand Down

0 comments on commit f9f82fd

Please sign in to comment.