From 44898a9b9ee18ab9945d240771cef093a07bb22f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 21 Apr 2017 18:27:37 -0400 Subject: [PATCH] Conveyor movement refactor/fix (#26408) * Refactors conveyor movement * Fixes effects being affected by conveyors * Fixes jetpacks not stopping conveyors * Fixes /mob/dead being affected by conveyors * Fixes butterflys being affected by conveyors --- code/game/atoms_movable.dm | 5 +++++ code/game/objects/effects/effects.dm | 3 +++ code/game/objects/items/weapons/tanks/jetpack.dm | 8 +++++++- code/modules/mob/dead/dead.dm | 3 +++ code/modules/mob/living/living.dm | 5 +++++ .../mob/living/simple_animal/friendly/butterfly.dm | 2 +- code/modules/recycling/conveyor2.dm | 6 ++---- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 96d219b6def..9c12f5d6712 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -623,3 +623,8 @@ highest_priority = pri . = chosen_langtype + +/atom/movable/proc/ConveyorMove(movedir) + set waitfor = FALSE + if(!anchored && has_gravity()) + step(src, movedir) \ No newline at end of file diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index 365d7f1c263..d38b33671d6 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -47,6 +47,9 @@ qdel(src) return 0 +/obj/effect/ConveyorMove() + return + /obj/effect/abstract/ex_act(severity, target) return diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm index 32e7537652c..fa17cf89c73 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -191,7 +191,7 @@ //Return a jetpack that the mob can use //Back worn jetpacks, hardsuit internal packs, and so on. -//Used in Process_Spacemove() and wherever you want to check for/get a jetpack +//Used in Process_Spacemove() and wherever you want to check for/get a jetpack /mob/proc/get_jetpack() return @@ -207,3 +207,9 @@ var/obj/item/clothing/suit/space/hardsuit/C = wear_suit J = C.jetpack return J + +/mob/has_gravity(turf/T) + var/obj/item/weapon/tank/jetpack/J = get_jetpack() + if(J && J.on) + return FALSE + return ..() \ No newline at end of file diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index d218d32b055..c3441cc16c9 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -10,3 +10,6 @@ /mob/dead/gib() //ghosts can't be gibbed. return + +/mob/dead/ConveyorMove() //lol + return \ No newline at end of file diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 7c26ab2cda0..d77c3fff863 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -923,3 +923,8 @@ if(riding_datum) riding_datum.handle_vehicle_offsets() riding_datum.handle_vehicle_layer() + +/mob/living/ConveyorMove() + if((movement_type & FLYING) && !stat) + return + ..() \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/friendly/butterfly.dm b/code/modules/mob/living/simple_animal/friendly/butterfly.dm index 36ad869b051..0b0b46c259e 100644 --- a/code/modules/mob/living/simple_animal/friendly/butterfly.dm +++ b/code/modules/mob/living/simple_animal/friendly/butterfly.dm @@ -27,4 +27,4 @@ /mob/living/simple_animal/butterfly/Initialize() ..() var/newcolor = rgb(rand(0, 255), rand(0, 255), rand(0, 255)) - add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) + add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) \ No newline at end of file diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 71b73de0e14..060e3e98704 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -108,10 +108,8 @@ affecting = loc.contents - src // moved items will be all in loc sleep(1) for(var/atom/movable/A in affecting) - if(!A.anchored) - if(A.loc == src.loc) // prevents the object from being affected if it's not currently here. - step(A,movedir) - CHECK_TICK + if(A.loc == loc) + A.ConveyorMove(movedir) // attack with item, place item on conveyor /obj/machinery/conveyor/attackby(obj/item/I, mob/user, params)