From 4b6a3ddcb69607dc2061feec895efd34a48b4594 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Fri, 25 Sep 2015 13:56:33 -0700 Subject: [PATCH] -tg- SpaceMove update This commit updates the spacemove system to -tg-'s; All objects now drift in space, not just mobs. A few hardcoded space checks have been replaced with has_gravity(); So it applies to zero-G as well as space. Spacepods no longer drift, because their snowflakey shitcode just doesn't work. So they just move. --- code/game/atoms_movable.dm | 95 +++++++++-- code/game/mecha/combat/marauder.dm | 40 +---- code/game/mecha/mecha.dm | 40 ++--- code/game/objects/effects/effect_system.dm | 72 ++++----- .../objects/items/weapons/extinguisher.dm | 26 ++-- code/game/objects/structures/janicart.dm | 147 ++---------------- .../structures/stool_bed_chair_nest/bed.dm | 6 + .../structures/stool_bed_chair_nest/chairs.dm | 4 + .../transit_tubes/transit_tube_pod.dm | 22 +-- code/game/turfs/space/space.dm | 6 +- code/game/turfs/turf.dm | 47 +----- code/game/vehicles/spacepods/spacepod.dm | 40 ++--- code/modules/mob/living/carbon/alien/alien.dm | 3 - code/modules/mob/living/carbon/carbon.dm | 14 +- code/modules/mob/living/carbon/human/human.dm | 2 +- .../mob/living/carbon/human/human_movement.dm | 37 +---- .../mob/living/carbon/metroid/metroid.dm | 2 +- code/modules/mob/living/living.dm | 21 +-- .../mob/living/silicon/robot/drone/drone.dm | 16 +- .../living/silicon/robot/robot_movement.dm | 9 +- .../mob/living/simple_animal/constructs.dm | 2 +- .../mob/living/simple_animal/friendly/crab.dm | 6 +- .../mob/living/simple_animal/hostile/bear.dm | 2 +- .../mob/living/simple_animal/hostile/carp.dm | 2 +- .../living/simple_animal/hostile/faithless.dm | 2 +- .../living/simple_animal/hostile/syndicate.dm | 4 +- .../mob/living/simple_animal/simple_animal.dm | 6 +- code/modules/mob/mob_defines.dm | 2 - code/modules/mob/mob_movement.dm | 137 +++++----------- code/modules/power/singularity/singularity.dm | 2 + code/modules/projectiles/gun.dm | 3 +- code/modules/projectiles/projectile.dm | 15 +- .../reagents/reagent_containers/spray.dm | 1 + .../artifact/artifact_hoverpod.dm | 29 +--- code/modules/shuttles/shuttle.dm | 2 +- 35 files changed, 276 insertions(+), 588 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index c8c6af0161d..a38d22e6ff6 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -5,7 +5,6 @@ // var/elevation = 2 - not used anywhere var/move_speed = 10 var/l_move_time = 1 - var/m_flag = 1 var/throwing = 0 var/thrower var/turf/throw_source = null @@ -14,9 +13,10 @@ var/no_spin_thrown = 0 //set this to 1 if you don't want an item that you throw to spin, no matter what. -Fox var/moved_recently = 0 var/mob/pulledby = null + var/inertia_dir = 0 var/area/areaMaster - + var/auto_init = 1 /atom/movable/New() @@ -35,7 +35,7 @@ pulledby = null ..() return QDEL_HINT_QUEUE - + /atom/movable/proc/initialize() return @@ -44,15 +44,53 @@ /atom/movable/proc/setLoc(var/T, var/teleported=0) loc = T -/atom/movable/Move() - var/atom/A = src.loc - . = ..() - src.move_speed = world.time - src.l_move_time - src.l_move_time = world.time - src.m_flag = 1 - if ((A != src.loc && A && A.z == src.z)) - src.last_move = get_dir(A, src.loc) - return +/atom/movable/Move(atom/newloc, direct = 0) + if(!loc || !newloc) return 0 + var/atom/oldloc = loc + + if(loc != newloc) + if (!(direct & (direct - 1))) //Cardinal move + . = ..() + else //Diagonal move, split it into cardinal moves + if (direct & 1) + if (direct & 4) + if (step(src, NORTH)) + . = step(src, EAST) + else if (step(src, EAST)) + . = step(src, NORTH) + else if (direct & 8) + if (step(src, NORTH)) + . = step(src, WEST) + else if (step(src, WEST)) + . = step(src, NORTH) + else if (direct & 2) + if (direct & 4) + if (step(src, SOUTH)) + . = step(src, EAST) + else if (step(src, EAST)) + . = step(src, SOUTH) + else if (direct & 8) + if (step(src, SOUTH)) + . = step(src, WEST) + else if (step(src, WEST)) + . = step(src, SOUTH) + + + if(!loc || (loc == oldloc && oldloc != newloc)) + last_move = 0 + return + + src.move_speed = world.timeofday - src.l_move_time + src.l_move_time = world.timeofday + + last_move = direct + + + spawn(5) // Causes space drifting. /tg/station has no concept of speed, we just use 5 + if(loc && direct && last_move == direct) + if(loc == newloc) //Remove this check and people can accelerate. Not opening that can of worms just yet. + newtonian_move(last_move) + // Previously known as Crossed() // This is automatically called when something enters your square @@ -104,6 +142,37 @@ M.turf_collision(T, speed) +//Called whenever an object moves and by mobs when they attempt to move themselves through space +//And when an object or action applies a force on src, see newtonian_move() below +//Return 0 to have src start/keep drifting in a no-grav area and 1 to stop/not start drifting +//Mobs should return 1 if they should be able to move of their own volition, see client/Move() in mob_movement.dm +//movement_dir == 0 when stopping or any dir when trying to move +/atom/movable/proc/Process_Spacemove(var/movement_dir = 0) + if(has_gravity(src)) + return 1 + + if(pulledby) + return 1 + + if(locate(/obj/structure/lattice) in orange(1, get_turf(src))) //Not realistic but makes pushing things in space easier + return 1 + + return 0 + +/atom/movable/proc/newtonian_move(direction) //Only moves the object if it's under no gravity + + if(!loc || Process_Spacemove(0)) + inertia_dir = 0 + return 0 + + inertia_dir = direction + if(!direction) + return 1 + + var/old_dir = dir + . = step(src, direction) + dir = old_dir + //decided whether a movable atom being thrown can pass through the turf it is in. /atom/movable/proc/hit_check(var/speed) if(src.throwing) @@ -152,7 +221,7 @@ var/atom/step = get_step(src, dy) if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge break - src.Move(step) + src.Move(step, get_dir(loc, step)) hit_check(speed) error += dist_x dist_travelled++ diff --git a/code/game/mecha/combat/marauder.dm b/code/game/mecha/combat/marauder.dm index d5820f7d661..e4a2fbbac1e 100644 --- a/code/game/mecha/combat/marauder.dm +++ b/code/game/mecha/combat/marauder.dm @@ -93,50 +93,20 @@ return /obj/mecha/combat/marauder/relaymove(mob/user,direction) - if(user != src.occupant) //While not "realistic", this piece is player friendly. - user.loc = get_turf(src) - user << "You climb out from [src]" - return 0 - if(!can_move) - return 0 if(zoom) if(world.time - last_message > 20) src.occupant_message("Unable to move while in zoom mode.") last_message = world.time return 0 - if(connected_port) - if(world.time - last_message > 20) - src.occupant_message("Unable to move while connected to the air system port") - last_message = world.time - return 0 - if(!thrusters && src.pr_inertial_movement.active()) - return 0 - if(state || !has_charge(step_energy_drain)) - return 0 - var/tmp_step_in = step_in - var/tmp_step_energy_drain = step_energy_drain - var/move_result = 0 - if(internal_damage&MECHA_INT_CONTROL_LOST) - move_result = mechsteprand() - else if(src.dir!=direction) - move_result = mechturn(direction) - else - move_result = mechstep(direction) - if(move_result) - if(istype(src.loc, /turf/space)) - if(!src.check_for_support()) - src.pr_inertial_movement.start(list(src,direction)) - if(thrusters) - src.pr_inertial_movement.set_process_args(list(src,direction)) - tmp_step_energy_drain = step_energy_drain*2 + return ..() - can_move = 0 - spawn(tmp_step_in) can_move = 1 - use_power(tmp_step_energy_drain) +/obj/mecha/combat/marauder/Process_Spacemove(var/movement_dir = 0) + if(..()) + return 1 + if(thrusters && movement_dir && use_power(step_energy_drain)) return 1 return 0 - /obj/mecha/combat/marauder/verb/toggle_thrusters() set category = "Exosuit Interface" set name = "Toggle thrusters" diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 03d50c0abbb..f43a27d28ae 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -59,7 +59,6 @@ var/list/internals_req_access = list(access_engine,access_robotics)//required access level to open cell compartment var/datum/global_iterator/pr_int_temp_processor //normalizes internal air mixture temperature - var/datum/global_iterator/pr_inertial_movement //controls intertial movement in spesss var/datum/global_iterator/pr_give_air //moves air from tank to cabin var/datum/global_iterator/pr_internal_damage //processes internal damage @@ -136,7 +135,6 @@ /obj/mecha/proc/add_iterators() pr_int_temp_processor = new /datum/global_iterator/mecha_preserve_temp(list(src)) - pr_inertial_movement = new /datum/global_iterator/mecha_intertial_movement(null,0) pr_give_air = new /datum/global_iterator/mecha_tank_give_air(list(src)) pr_internal_damage = new /datum/global_iterator/mecha_internal_damage(list(src),0) @@ -159,13 +157,6 @@ return 1 - -/obj/mecha/proc/check_for_support() - if(locate(/obj/structure/grille, orange(1, src)) || locate(/obj/structure/lattice, orange(1, src)) || locate(/turf/simulated, orange(1, src)) || locate(/turf/unsimulated, orange(1, src))) - return 1 - else - return 0 - /obj/mecha/examine(mob/user) ..(user) var/integrity = health/initial(health)*100 @@ -289,11 +280,15 @@ //////// Movement procs //////// ////////////////////////////////// -/obj/mecha/Move() +/obj/mecha/Move(atom/newLoc, direct) . = ..() if(.) events.fireEvent("onMove",get_turf(src)) - return + +/obj/mecha/Process_Spacemove(var/movement_dir = 0) + if(occupant) + return occupant.Process_Spacemove(movement_dir) //We'll just say you used the clamp to grab the wall + return ..() /obj/mecha/relaymove(mob/user,direction) if(user != src.occupant) //While not "realistic", this piece is player friendly. @@ -316,7 +311,7 @@ /obj/mecha/proc/dyndomove(direction) if(!can_move) return 0 - if(src.pr_inertial_movement.active()) + if(!Process_Spacemove(direction)) return 0 if(!has_charge(step_energy_drain)) return 0 @@ -326,14 +321,9 @@ else if(src.dir!=direction) move_result = mechturn(direction) else - move_result = mechstep(direction) + move_result = mechstep(direction) if(move_result) can_move = 0 - use_power(step_energy_drain) - if(istype(src.loc, /turf/space)) - if(!src.check_for_support()) - src.pr_inertial_movement.start(list(src,direction)) - src.log_message("Movement control lost. Inertial movement started.") if(mecha_do_after(step_in)) can_move = 1 return 1 @@ -1070,7 +1060,7 @@ connected_port = new_port connected_port.connected_device = src connected_port.parent.reconcile_air() - + log_message("Connected to gas port.") return 1 @@ -1082,7 +1072,7 @@ connected_port = null src.log_message("Disconnected from gas port.") return 1 - + /obj/mecha/portableConnectorReturnAir() return internal_tank.return_air() @@ -1881,16 +1871,6 @@ return stop() return -/datum/global_iterator/mecha_intertial_movement //inertial movement in space - delay = 7 - - process(var/obj/mecha/mecha as obj,direction) - if(direction) - if(!step(mecha, direction)||mecha.check_for_support()) - src.stop() - else - src.stop() - return /datum/global_iterator/mecha_internal_damage // processing internal damage diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 329cbe8c152..17509ed951e 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -769,40 +769,35 @@ steam.start() -- spawns the effect var/processing = 1 var/on = 1 - set_up(atom/atom) - attach(atom) - oldposition = get_turf(atom) +/datum/effect/effect/system/ion_trail_follow/set_up(atom/atom) + attach(atom) - start() - if(!src.on) - src.on = 1 - src.processing = 1 - if(src.processing) - src.processing = 0 - spawn(0) - var/turf/T = get_turf(src.holder) - if(T != src.oldposition) - if(istype(T, /turf/space)) - var/obj/effect/effect/ion_trails/I = new /obj/effect/effect/ion_trails(src.oldposition) - src.oldposition = T - I.dir = src.holder.dir - flick("ion_fade", I) - I.icon_state = "blank" - spawn( 20 ) - if(I) I.delete() - spawn(2) - if(src.on) - src.processing = 1 - src.start() - else - spawn(2) - if(src.on) - src.processing = 1 - src.start() - - proc/stop() +/datum/effect/effect/system/ion_trail_follow/start() //Whoever is responsible for this abomination of code should become an hero + if(!src.on) + src.on = 1 + src.processing = 1 + if(src.processing) src.processing = 0 - src.on = 0 + var/turf/T = get_turf(src.holder) + if(T != src.oldposition) + if(!has_gravity(T)) + var/obj/effect/effect/ion_trails/I = new /obj/effect/effect/ion_trails(src.oldposition) + I.dir = src.holder.dir + flick("ion_fade", I) + I.icon_state = "blank" + spawn( 20 ) + if(I) + I.delete() + src.oldposition = T + spawn(2) + if(src.on) + src.processing = 1 + src.start() + +/datum/effect/effect/system/ion_trail_follow/proc/stop() + src.processing = 0 + src.on = 0 + oldposition = null /datum/effect/effect/system/ion_trail_follow/space_trail var/turf/oldloc // secondary ion trail loc @@ -850,15 +845,10 @@ steam.start() -- spawns the effect spawn( 20 ) if(I) I.delete() if(II) II.delete() - spawn(2) - if(src.on) - src.processing = 1 - src.start() - else - spawn(2) - if(src.on) - src.processing = 1 - src.start() + spawn(2) + if(src.on) + src.processing = 1 + src.start() currloc = T diff --git a/code/game/objects/items/weapons/extinguisher.dm b/code/game/objects/items/weapons/extinguisher.dm index 56115511185..d10df5735b0 100644 --- a/code/game/objects/items/weapons/extinguisher.dm +++ b/code/game/objects/items/weapons/extinguisher.dm @@ -105,27 +105,29 @@ var/obj/B = usr.buckled var/movementdirection = turn(direction,180) if(C) C.propelled = 4 - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) sleep(1) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) if(C) C.propelled = 3 sleep(1) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) sleep(1) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) if(C) C.propelled = 2 sleep(2) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) if(C) C.propelled = 1 sleep(2) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) if(C) C.propelled = 0 sleep(3) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) sleep(3) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) sleep(3) - B.Move(get_step(usr,movementdirection), movementdirection) + step(B, movementdirection) + + else user.newtonian_move(turn(direction, 180)) var/turf/T = get_turf(target) var/turf/T1 = get_step(T,turn(direction, 90)) @@ -161,9 +163,5 @@ if(W.loc == my_target) break sleep(2) - - if(!has_gravity(user)) - user.inertia_dir = get_dir(target, user) - step(user, user.inertia_dir) else - return ..() + return ..() \ No newline at end of file diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 2dae93cac5b..c9a624fad8c 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -5,9 +5,8 @@ var/empstun = 0 var/health = 100 var/destroyed = 0 - var/inertia_dir = 0 - var/allowMove = 1 - var/delay = 1 + var/move_delay = 1 + var/keytype = /obj/item/key var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread /obj/structure/stool/bed/chair/cart/process() @@ -48,96 +47,6 @@ if(istype(W, /obj/item/key)) user << "Hold [W] in one of your hands while you drive this [name]." -/obj/structure/stool/bed/chair/cart/proc/Process_Spacemove(var/check_drift = 0, mob/user) - //First check to see if we can do things - - /* - if(istype(src,/mob/living/carbon)) - if(src.l_hand && src.r_hand) - return 0 - */ - - var/dense_object = 0 - if(!user) - for(var/turf/turf in oview(1,src)) - if(istype(turf,/turf/space)) - continue - /* - if((istype(turf,/turf/simulated/floor)) - if(user) - if(user.lastarea.has_gravity == 0) - continue*/ - - - - /* - if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV)) - continue - */ - - - dense_object++ - break - - if(!dense_object && (locate(/obj/structure/lattice) in oview(1, src))) - dense_object++ - - //Lastly attempt to locate any dense objects we could push off of - //TODO: If we implement objects drifing in space this needs to really push them - //Due to a few issues only anchored and dense objects will now work. - if(!dense_object) - for(var/obj/O in oview(1, src)) - if((O) && (O.density) && (O.anchored)) - dense_object++ - break - else - for(var/turf/turf in oview(1,user)) - if(istype(turf,/turf/space)) - continue - /* - if((istype(turf,/turf/simulated/floor)) - if(user) - if(user.lastarea.has_gravity == 0) - continue*/ - - - - /* - if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV)) - continue - */ - - - dense_object++ - break - - if(!dense_object && (locate(/obj/structure/lattice) in oview(1, user))) - dense_object++ - - //Lastly attempt to locate any dense objects we could push off of - //TODO: If we implement objects drifing in space this needs to really push them - //Due to a few issues only anchored and dense objects will now work. - if(!dense_object) - for(var/obj/O in oview(1, user)) - if((O) && (O.density) && (O.anchored)) - dense_object++ - break - //Nothing to push off of so end here - if(!dense_object) - return 0 - - -/* The cart has very grippy tires and or magnets to keep it from slipping when on a good surface - //Check to see if we slipped - if(prob(Process_Spaceslipping(5))) - src << "\blue You slipped!" - src.inertia_dir = src.last_move - step(src, src.inertia_dir) - return 0 - //If not then we can reset inertia and move - */ - inertia_dir = 0 - return 1 /obj/structure/stool/bed/chair/cart/user_buckle_mob(mob/living/M, mob/user) if(user.incapacitated()) //user can't move the mob on the janicart's turf if incapacitated @@ -263,16 +172,12 @@ var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite var/obj/item/weapon/storage/bag/trash/mybag = null - - - /obj/structure/stool/bed/chair/cart/janicart/New() ..() var/datum/reagents/R = new/datum/reagents(100) reagents = R R.my_atom = src - /obj/structure/stool/bed/chair/cart/janicart/examine(mob/user) if(!..(user, 1)) return @@ -314,21 +219,15 @@ if(user) user << "\red \the [src] is unresponsive." return - if((istype(src.loc, /turf/space))) - if(!src.Process_Spacemove(0)) return - if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key)) - if(!allowMove) + if(istype(user.l_hand, keytype) || istype(user.r_hand, keytype)) + if(!Process_Spacemove(direction) || !has_gravity(src.loc) || move_delay || !isturf(loc)) return - allowMove = 0 step(src, direction) update_mob() handle_rotation() - sleep(delay) - allowMove = 1 - /* - if(istype(src.loc, /turf/space) && (!src.Process_Spacemove(0, user))) - var/turf/space/S = src.loc - S.Entered(src)*/ + move_delay = 1 + spawn(2) + move_delay = 0 else user << "You'll need the keys in one of your hands to drive this pimpin' ride." @@ -338,7 +237,7 @@ name = "ambulance" icon = 'icons/obj/vehicles.dmi' icon_state = "docwagon" - anchored = 1 + anchored = 0 density = 1 /var/brightness = 4 /var/strobe = 0 @@ -351,39 +250,19 @@ if(user) user << "\red \the [src] is unresponsive." return - if((istype(src.loc, /turf/space))) - if(!src.Process_Spacemove(0)) return - if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key)) - if(!allowMove) + if(istype(user.l_hand, keytype) || istype(user.r_hand, keytype)) + if(!Process_Spacemove(direction) || !has_gravity(src.loc) || move_delay || !isturf(loc)) return - allowMove = 0 step(src, direction) - // NEW PULLING CODE - if (istype(user.pulling, /obj/structure/stool/bed/roller)) - var/turf/T = loc - step(user.pulling, get_dir(user.pulling.loc, T)) - - // END NEW PULLING CODE update_mob() handle_rotation() - sleep(delay) - allowMove = 1 - /* - if(istype(src.loc, /turf/space) && (!src.Process_Spacemove(0, user))) - var/turf/space/S = src.loc - S.Entered(src)*/ + move_delay = 1 + spawn(2) + move_delay = 0 else user << "You'll need the keys in one of your hands to drive this ambulance." - - - - - - - - /obj/item/key name = "key" desc = "A keyring with a small steel key, and a pink fob reading \"Pussy Wagon\"." diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 1eecaa972ee..0ef6ea6f7d3 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -36,9 +36,15 @@ if(!buckled_mob.Move(loc, direct)) loc = buckled_mob.loc //we gotta go back last_move = buckled_mob.last_move + inertia_dir = last_move buckled_mob.inertia_dir = last_move . = 0 +/obj/structure/stool/bed/Process_Spacemove(movement_dir = 0) + if(buckled_mob) + return buckled_mob.Process_Spacemove(movement_dir) + return ..() + /obj/structure/stool/bed/CanPass(atom/movable/mover, turf/target, height=1.5) if(mover == buckled_mob) return 1 diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 875d1f766d8..38f67bf51be 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -14,6 +14,10 @@ handle_rotation() return +/obj/structure/stool/bed/chair/Move(atom/newloc, direct) + ..() + handle_rotation() + /obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob, params) ..() if(istype(W, /obj/item/assembly/shock_kit)) diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index bae36458f76..61459684816 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -25,6 +25,11 @@ return ..() +/obj/structure/transit_tube_pod/Process_Spacemove() + if(moving) //No drifting while moving in the tubes + return 1 + else return ..() + /obj/structure/transit_tube_pod/proc/follow_tube(var/reverse_launch) if(moving) return @@ -67,7 +72,7 @@ if(current_tube == null) dir = next_dir - Move(get_step(loc, dir)) // Allow collisions when leaving the tubes. + Move(get_step(loc, dir), dir) // Allow collisions when leaving the tubes. break last_delay = current_tube.enter_delay(src, next_dir) @@ -82,21 +87,6 @@ density = 1 - // If the pod is no longer in a tube, move in a line until stopped or slowed to a halt. - // /turf/inertial_drift appears to only work on mobs, and re-implementing some of the - // logic allows a gradual slowdown and eventual stop when passing over non-space turfs. - if(!current_tube && last_delay <= 10) - do - sleep(last_delay) - - if(!istype(loc, /turf/space)) - last_delay++ - - if(last_delay > 10) - break - - while(isturf(loc) && Move(get_step(loc, dir))) - moving = 0 diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 48f3623897a..2bd5dd0f32d 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -94,8 +94,6 @@ ..() if ((!(A) || src != A.loc)) return - inertial_drift(A) - if(transition) if(A.z > MAX_Z) return //for away missions @@ -121,8 +119,8 @@ L.pulling.loc = T //now we're on the new z_level, proceed the space drifting - if ((A && A.loc)) - A.loc.Entered(A) + sleep(0)//Let a diagonal move finish, if necessary + A.newtonian_move(A.inertia_dir) /turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj) var/cur_x diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3def899f4da..e32ebbc7687 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -109,12 +109,7 @@ var/mob/O = M if(!O.lastarea) O.lastarea = get_area(O.loc) - var/has_gravity = O.mob_has_gravity(src) - O.update_gravity(has_gravity) - if(!has_gravity) - inertial_drift(O) - else if(!istype(src, /turf/space)) - O.inertia_dir = 0 + O.update_gravity(O.mob_has_gravity(src)) var/loopsanity = 100 for(var/atom/A in range(1)) @@ -145,46 +140,6 @@ /turf/proc/return_siding_icon_state() //used for grass floors, which have siding. return 0 -/turf/proc/inertial_drift(atom/movable/A as mob|obj) - if(!(A.last_move)) return - if(istype(A, /obj/spacepod) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1)) - var/obj/spacepod/SP = A - if(SP.Process_Spacemove(1)) - SP.inertia_dir = 0 - return - spawn(5) - if((SP && (SP.loc == src))) - if(SP.inertia_dir) - step(SP, SP.inertia_dir) - return - if(istype(A, /obj/structure/stool/bed/chair/cart/) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1)) - var/obj/structure/stool/bed/chair/cart/JC = A //A bomb! - if(JC.Process_Spacemove(1)) - JC.inertia_dir = 0 - return - spawn(5) - if((JC && (JC.loc == src))) - if(JC.inertia_dir) - step(JC, JC.inertia_dir) - return - JC.inertia_dir = JC.last_move - step(JC, JC.inertia_dir) - - - if((istype(A, /mob/) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1))) - var/mob/M = A - if(M.Process_Spacemove(1)) - M.inertia_dir = 0 - return - spawn(5) - if((M && !(M.anchored) && !(M.pulledby) && (M.loc == src))) - if(M.inertia_dir) - step(M, M.inertia_dir) - return - M.inertia_dir = M.last_move - step(M, M.inertia_dir) - return - /turf/proc/levelupdate() for(var/obj/O in src) if(O.level == 1) diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index 6d087bfa3c0..fbb4a981811 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -29,7 +29,6 @@ var/datum/global_iterator/pr_give_air //moves air from tank to cabin var/datum/effect/effect/system/ion_trail_follow/space_trail/ion_trail - var/inertia_dir = 0 var/hatch_open = 0 @@ -736,25 +735,6 @@ obj/spacepod/verb/toggleLights() return stop() return -/obj/spacepod/Move(NewLoc, Dir = 0, step_x = 0, step_y = 0) - ..() - if(dir == 1 || dir == 4) - src.loc.Entered(src) - -/obj/spacepod/proc/Process_Spacemove(var/check_drift = 0, mob/user) - var/dense_object = 0 - if(!user) - for(var/direction in list(NORTH, NORTHEAST, EAST)) - var/turf/cardinal = get_step(src, direction) - if(istype(cardinal, /turf/space)) - continue - dense_object++ - break - if(!dense_object) - return 0 - inertia_dir = 0 - return 1 - /obj/spacepod/relaymove(mob/user, direction) if(!CheckIfOccupant2(user)) handlerelaymove(user, direction) @@ -764,26 +744,24 @@ obj/spacepod/verb/toggleLights() if(battery && battery.charge >= 3 && health && empcounter == 0) src.dir = direction switch(direction) - if(1) - if(inertia_dir == 2) + if(NORTH) + if(inertia_dir == SOUTH) inertia_dir = 0 moveship = 0 - if(2) - if(inertia_dir == 1) + if(SOUTH) + if(inertia_dir == NORTH) inertia_dir = 0 moveship = 0 - if(4) - if(inertia_dir == 8) + if(EAST) + if(inertia_dir == WEST) inertia_dir = 0 moveship = 0 - if(8) - if(inertia_dir == 4) + if(WEST) + if(inertia_dir == EAST) inertia_dir = 0 moveship = 0 if(moveship) - step(src, direction) - if(istype(src.loc, /turf/space)) - inertia_dir = direction + Move(get_step(src, direction), direction) else if(!battery) user << "No energy cell detected." diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 87168fcaee6..0ec7e3c8ded 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -179,9 +179,6 @@ /mob/living/carbon/alien/IsAdvancedToolUser() return has_fine_manipulation -/mob/living/carbon/alien/Process_Spaceslipping() - return 0 // Don't slip in space. - /mob/living/carbon/alien/Stat() statpanel("Status") diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 1ea6cc84bb8..c94630bdef7 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -481,19 +481,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, item.layer = initial(item.layer) src.visible_message("\red [src] has thrown [item].") - if(!src.lastarea) - src.lastarea = get_area(src.loc) - if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0)) - src.inertia_dir = get_dir(target, src) - step(src, inertia_dir) - - -/* - if(istype(src.loc, /turf/space) || (src.flags & NOGRAV)) //they're in space, move em one space in the opposite direction - src.inertia_dir = get_dir(target, src) - step(src, inertia_dir) -*/ - + newtonian_move(get_dir(target, src)) item.throw_at(target, item.throw_range, item.throw_speed, src) /* diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 3b6f6b28c6a..0e943d8c257 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -144,7 +144,7 @@ ..(new_loc, "Stok") /mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) + if ((!( yes ) || now_pushing || buckled)) return now_pushing = 1 if (ismob(AM)) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 3f0009b7ce7..f61318e09c6 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -4,7 +4,8 @@ if(species.slowdown) tally = species.slowdown - if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything + if(!has_gravity(src)) + return -1 // It's hard to be slowed down in space by... anything if(flying) return -1 @@ -62,44 +63,18 @@ return (tally+config.human_delay) -/mob/living/carbon/human/Process_Spacemove(var/check_drift = 0) - //Can we act - if(restrained()) return 0 +/mob/living/carbon/human/Process_Spacemove(movement_dir = 0) - //Are we flying? - if(flying) - inertia_dir = 0 + if(..()) return 1 //Do we have a working jetpack - if(istype(back, /obj/item/weapon/tank/jetpack)) + if(istype(back, /obj/item/weapon/tank/jetpack) && isturf(loc)) //Second check is so you can't use a jetpack in a mech var/obj/item/weapon/tank/jetpack/J = back - if(((!check_drift) || (check_drift && J.stabilization_on)) && (!lying) && (J.allow_thrust(0.01, src))) - inertia_dir = 0 + if((movement_dir || J.stabilization_on) && J.allow_thrust(0.01, src)) return 1 - //If no working jetpack or magboots then use the other checks - if(..()) return 1 return 0 - -/mob/living/carbon/human/Process_Spaceslipping(var/prob_slip = 5) - //If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such. - if(stat) - prob_slip = 0 // Changing this to zero to make it line up with the comment, and also, make more sense. - - //Do we have magboots or such on if so no slip - if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.flags & NOSLIP)) - prob_slip = 0 - - //Check hands and mod slip - if(!l_hand) prob_slip -= 2 - else if(l_hand.w_class <= 2) prob_slip -= 1 - if (!r_hand) prob_slip -= 2 - else if(r_hand.w_class <= 2) prob_slip -= 1 - - prob_slip = round(prob_slip) - return(prob_slip) - /mob/living/carbon/human/mob_has_gravity() . = ..() if(!.) diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 078305a654d..f49a2c9996d 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -152,7 +152,7 @@ step(AM, t) now_pushing = null -/mob/living/carbon/slime/Process_Spacemove() +/mob/living/carbon/slime/Process_Spacemove(var/movement_dir = 0) return 2 /mob/living/carbon/slime/Stat() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index bb797a597c1..6ead72a36f5 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -399,10 +399,10 @@ return -/mob/living/Move(a, b, flag) - if (buckled && buckled.loc != a) +/mob/living/Move(atom/newloc, direct) + if (buckled && buckled.loc != newloc) if (!buckled.anchored) - return buckled.Move(a, b) + return buckled.Move(newloc, direct) else return 0 @@ -415,7 +415,7 @@ for(var/mob/living/M in range(src, 1)) if ((M.pulling == src && M.stat == 0 && !( M.restrained() ))) t7 = null - if ((t7 && (pulling && ((get_dist(src, pulling) <= 1 || pulling.loc == loc) && (client && client.moving))))) + if(t7 && pulling && (get_dist(src, pulling) <= 1 || pulling.loc == loc)) var/turf/T = loc . = ..() @@ -463,17 +463,12 @@ var/turf/location = M.loc if (istype(location, /turf/simulated)) location.add_blood() - - - step(pulling, get_dir(pulling.loc, T)) - M.start_pulling(t) + pulling.Move(T, get_dir(pulling, T)) + if(M) + M.start_pulling(t) else if (pulling) - if (istype(pulling, /obj/structure/window/full)) - for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) - stop_pulling() - if (pulling) - step(pulling, get_dir(pulling.loc, T)) + pulling.Move(T, get_dir(pulling, T)) else stop_pulling() . = ..() diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 3d2cfc6deec..33a31d0b197 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -76,15 +76,15 @@ aiCamera = new/obj/item/device/camera/siliconcam/drone_camera(src) additional_law_channels["Drone"] = ":d" - + playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0) //Redefining some robot procs... /mob/living/silicon/robot/drone/SetName(pickedName as text) // Would prefer to call the grandparent proc but this isn't possible, so.. real_name = pickedName - name = real_name - + name = real_name + //Redefining some robot procs... /mob/living/silicon/robot/drone/updatename() real_name = "maintenance drone ([rand(100,999)])" @@ -127,13 +127,13 @@ if(!allowed(usr)) user << "\red Access denied." return - + var/delta = (world.time / 10) - last_reboot if(reboot_cooldown > delta) var/cooldown_time = round(reboot_cooldown - ((world.time / 10) - last_reboot), 1) usr << "\red The reboot system is currently offline. Please wait another [cooldown_time] seconds." return - + user.visible_message("\red \the [user] swipes \his ID card through \the [src], attempting to reboot it.", "\red You swipe your ID card through \the [src], attempting to reboot it.") last_reboot = world.time / 10 var/drones = 0 @@ -225,10 +225,6 @@ ..(gibbed) -//DRONE MOVEMENT. -/mob/living/silicon/robot/drone/Process_Spaceslipping(var/prob_slip) - //TODO: Consider making a magboot item for drones to equip. ~Z - return 0 //CONSOLE PROCS /mob/living/silicon/robot/drone/proc/law_resync() @@ -338,4 +334,4 @@ src.verbs |= silicon_subsystems /mob/living/silicon/robot/drone/remove_robot_verbs() - src.verbs -= silicon_subsystems \ No newline at end of file + src.verbs -= silicon_subsystems \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index 6f21dec6cb4..00ed6522440 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -1,9 +1,4 @@ -/mob/living/silicon/robot/Process_Spaceslipping(var/prob_slip) - if(module && (istype(module,/obj/item/weapon/robot_module/drone))) - return 0 - ..(prob_slip) - -/mob/living/silicon/robot/Process_Spacemove() +/mob/living/silicon/robot/Process_Spacemove(var/movement_dir = 0) if(module) for(var/obj/item/weapon/tank/jetpack/J in module.modules) if(J && istype(J, /obj/item/weapon/tank/jetpack)) @@ -24,7 +19,7 @@ /mob/living/silicon/robot/Move() ..() - + /mob/living/silicon/robot/mob_negates_gravity() return magpulse diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index 16c0a9cfe68..3b6e7320717 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -290,7 +290,7 @@ attack_sound = 'sound/weapons/tap.ogg' construct_spells = list(/obj/effect/proc_holder/spell/targeted/smoke/disable) -/mob/living/simple_animal/construct/harvester/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/construct/harvester/Process_Spacemove(var/movement_dir = 0) return 1 diff --git a/code/modules/mob/living/simple_animal/friendly/crab.dm b/code/modules/mob/living/simple_animal/friendly/crab.dm index a8344a69bbf..f25e44927f8 100644 --- a/code/modules/mob/living/simple_animal/friendly/crab.dm +++ b/code/modules/mob/living/simple_animal/friendly/crab.dm @@ -30,8 +30,10 @@ if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. turns_since_move++ if(turns_since_move >= turns_per_move) - Move(get_step(src,pick(4,8))) - turns_since_move = 0 + var/east_vs_west = pick(4, 8) + if(Process_Spacemove(east_vs_west)) + Move(get_step(src, east_vs_west), east_vs_west) + turns_since_move = 0 regenerate_icons() //COFFEE! SQUEEEEEEEEE! diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index 2547a04a2f1..514d2d313bd 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -119,7 +119,7 @@ target = M ..() -/mob/living/simple_animal/hostile/bear/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/hostile/bear/Process_Spacemove(var/movement_dir = 0) return 1 //No drifting in space for space bears! /mob/living/simple_animal/hostile/bear/FindTarget() diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index 4575a083827..93b90107133 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -42,7 +42,7 @@ faction = list("carp") flying = 1 -/mob/living/simple_animal/hostile/carp/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/hostile/carp/Process_Spacemove(var/movement_dir = 0) return 1 //No drifting in space for space carp! //original comments do not steal /mob/living/simple_animal/hostile/carp/FindTarget() diff --git a/code/modules/mob/living/simple_animal/hostile/faithless.dm b/code/modules/mob/living/simple_animal/hostile/faithless.dm index dbf396eb7f5..06988408c83 100644 --- a/code/modules/mob/living/simple_animal/hostile/faithless.dm +++ b/code/modules/mob/living/simple_animal/hostile/faithless.dm @@ -33,7 +33,7 @@ faction = list("faithless") -/mob/living/simple_animal/hostile/faithless/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/hostile/faithless/Process_Spacemove(var/movement_dir = 0) return 1 /mob/living/simple_animal/hostile/faithless/FindTarget() diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index bd6d0723a0e..f8c51e060ac 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -100,7 +100,7 @@ corpse = /obj/effect/landmark/mobcorpse/syndicatecommando speed = 1 -/mob/living/simple_animal/hostile/syndicate/melee/space/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/hostile/syndicate/melee/space/Process_Spacemove(var/movement_dir = 0) return /mob/living/simple_animal/hostile/syndicate/ranged @@ -132,7 +132,7 @@ corpse = /obj/effect/landmark/mobcorpse/syndicatecommando speed = 1 -/mob/living/simple_animal/hostile/syndicate/ranged/space/Process_Spacemove(var/check_drift = 0) +/mob/living/simple_animal/hostile/syndicate/ranged/space/Process_Spacemove(var/movement_dir = 0) return diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 3764e74f6ff..f2ec39553f7 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -130,8 +130,10 @@ turns_since_move++ if(turns_since_move >= turns_per_move) if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled - Move(get_step(src,pick(cardinal))) - turns_since_move = 0 + var/anydir = pick(cardinal) + if(Process_Spacemove(anydir)) + Move(get_step(src,anydir), anydir) + turns_since_move = 0 //Speaking if(!client && speak_chance && (ckey == null)) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index cee943541d3..312f9fb3ff1 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -142,8 +142,6 @@ var/emote_cd = 0 // Used to supress emote spamming. 1 if on CD, 2 if disabled by admin (manually set), else 0 - var/inertia_dir = 0 - var/music_lastplayed = "null" var/job = null//Living diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 48ddfff992b..9434359f329 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -127,41 +127,6 @@ return -/atom/movable/Move(NewLoc, direct) - if (direct & (direct - 1)) - if (direct & 1) - if (direct & 4) - if (step(src, NORTH)) - step(src, EAST) - else - if (step(src, EAST)) - step(src, NORTH) - else - if (direct & 8) - if (step(src, NORTH)) - step(src, WEST) - else - if (step(src, WEST)) - step(src, NORTH) - else - if (direct & 2) - if (direct & 4) - if (step(src, SOUTH)) - step(src, EAST) - else - if (step(src, EAST)) - step(src, SOUTH) - else - if (direct & 8) - if (step(src, SOUTH)) - step(src, WEST) - else - if (step(src, WEST)) - step(src, SOUTH) - else - . = ..() - return - /client/proc/Move_object(direct) if(mob && mob.control_object) @@ -243,14 +208,13 @@ if(!mob.lastarea) mob.lastarea = get_area(mob.loc) - if((istype(mob.loc, /turf/space)) || ((mob.lastarea.has_gravity == 0) && (!istype(mob.loc, /obj/spacepod)))) // spacepods shouldn't get affected by changes in gravity - if(!mob.Process_Spacemove(0)) return 0 - - if(isobj(mob.loc) || ismob(mob.loc))//Inside an object, tell it we moved var/atom/O = mob.loc return O.relaymove(mob, direct) + if(!mob.Process_Spacemove(direct)) + return 0 + if(isturf(mob.loc)) if(mob.restrained())//Why being pulled while cuffed prevents you from moving @@ -319,7 +283,7 @@ else if(mob.confused) step(mob, pick(cardinal)) - mob.last_movement=world.time + mob.last_movement = world.time else . = ..() mob.last_movement=world.time @@ -332,6 +296,8 @@ G.adjust_position() moving = 0 + if(mob && .) + mob.throwing = 0 return . @@ -434,62 +400,44 @@ ///Called by /client/Move() ///For moving in space ///Return 1 for movement 0 for none -/mob/proc/Process_Spacemove(var/check_drift = 0) - //First check to see if we can do things - if(restrained()) - return 0 +/mob/Process_Spacemove(var/movement_dir = 0) - /* - if(istype(src,/mob/living/carbon)) - if(src.l_hand && src.r_hand) - return 0 - */ + if(..()) + return 1 - var/dense_object = 0 - for(var/turf/turf in oview(1,src)) - if(istype(turf,/turf/space)) + var/atom/movable/dense_object_backup + for(var/atom/A in orange(1, get_turf(src))) + if(isarea(A)) continue - if(!turf.density && !mob_negates_gravity()) - continue + else if(isturf(A)) + var/turf/turf = A + if(istype(turf,/turf/space)) + continue + + if(!turf.density && !mob_negates_gravity()) + continue + + return 1 + + else + var/atom/movable/AM = A + if(AM == buckled) //Kind of unnecessary but let's just be sure + continue + if(AM.density) + if(AM.anchored) + return 1 + if(pulling == AM) + continue + dense_object_backup = AM + + if(movement_dir && dense_object_backup) + if(dense_object_backup.newtonian_move(turn(movement_dir, 180))) //You're pushing off something movable, so it moves + src << "You push off of [dense_object_backup] to propel yourself." - - /* - if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV)) - continue - */ - - - dense_object++ - break - - if(!dense_object && (locate(/obj/structure/lattice) in oview(1, src))) - dense_object++ - - //Lastly attempt to locate any dense objects we could push off of - //TODO: If we implement objects drifing in space this needs to really push them - //Due to a few issues only anchored and dense objects will now work. - if(!dense_object) - for(var/obj/O in oview(1, src)) - if((O) && (O.density) && (O.anchored)) - dense_object++ - break - - //Nothing to push off of so end here - if(!dense_object) - return 0 - - //Check to see if we slipped - if(prob(Process_Spaceslipping(5))) - src << "\blue You slipped!" - src.inertia_dir = src.last_move - step(src, src.inertia_dir) - return 0 - - //If not then we can reset inertia and move - inertia_dir = 0 - return 1 + return 1 + return 0 /mob/proc/mob_has_gravity(turf/T) return has_gravity(src, T) @@ -497,14 +445,5 @@ /mob/proc/mob_negates_gravity() return 0 -/mob/proc/Process_Spaceslipping(var/prob_slip = 5) - //Setup slipage - //If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such. - if(stat) - prob_slip = 0 // Changing this to zero to make it line up with the comment. - - prob_slip = round(prob_slip) - return(prob_slip) - /mob/proc/update_gravity() return diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index a61c4dff501..9e27818eb8b 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -268,6 +268,8 @@ step(src, movement_dir) +/obj/singularity/Process_Spacemove() //The singularity stops drifting for no man! + return 0 /obj/singularity/proc/check_turfs_in(var/direction = 0, var/step = 0) if(!direction) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 65dbae52644..2497bb89c6c 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -45,7 +45,7 @@ var/can_flashlight = 0 var/heavy_weapon = 0 var/randomspread = 0 - + var/burst_size = 1 proc/ready_to_fire() @@ -186,6 +186,7 @@ user.drop_item() break + user.newtonian_move(get_dir(target, user)) update_icon() if(user.hand) user.update_inv_l_hand() diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index aff5fbfd167..647d8d14a2c 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -89,8 +89,8 @@ return L.apply_effects(stun, weaken, paralyze, irradiate, slur, stutter, eyeblur, drowsy, agony, blocked, stamina, jitter) proc/OnFired() //if assigned, allows for code when the projectile gets fired - return 1 - + return 1 + proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not. if(!istype(target) || !istype(user)) return 0 @@ -137,7 +137,7 @@ var/mob/living/carbon/human/H = A var/obj/item/organ/external/organ = H.get_organ(check_zone(def_zone)) if(isnull(organ)) - return + return if(silenced) playsound(loc, hitsound, 5, 1, -1) M << "\red You've been shot in the [parse_zone(def_zone)] by the [src.name]!" @@ -189,6 +189,11 @@ return 1 + Process_Spacemove(var/movement_dir = 0) + return 1 //Bullets don't drift in space + + + process(var/setAngle) if(setAngle) Angle = setAngle if(!legacy) @@ -332,7 +337,7 @@ M = locate() in get_step(src,target) if(istype(M)) return 1 - + /proc/check_trajectory(atom/target as mob|obj, atom/firer as mob|obj, var/pass_flags=PASSTABLE|PASSGLASS|PASSGRILLE, flags=null) //Checks if you can hit them or not. if(!istype(target) || !istype(firer)) return 0 @@ -343,4 +348,4 @@ trace.pass_flags = pass_flags //And the pass flags to that of the real projectile... var/output = trace.process() //Test it! qdel(trace) //No need for it anymore - return output //Send it back to the gun! + return output //Send it back to the gun! diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index a0b0c7c7148..04859c66c32 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -46,6 +46,7 @@ playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) user.changeNext_move(CLICK_CD_RANGE*2) + user.newtonian_move(get_dir(A, user)) if(reagents.has_reagent("sacid")) msg_admin_attack("[key_name_admin(user)] fired sulphuric acid from \a [src].") diff --git a/code/modules/research/xenoarchaeology/artifact/artifact_hoverpod.dm b/code/modules/research/xenoarchaeology/artifact/artifact_hoverpod.dm index c1d97b7a75d..4b16c25aeea 100644 --- a/code/modules/research/xenoarchaeology/artifact/artifact_hoverpod.dm +++ b/code/modules/research/xenoarchaeology/artifact/artifact_hoverpod.dm @@ -1,36 +1,11 @@ - /obj/mecha/working/hoverpod name = "hover pod" icon_state = "engineering_pod" desc = "Stubby and round, it has a human sized access hatch on the top." wreckage = /obj/effect/decal/mecha_wreckage/hoverpod -//duplicate of parent proc, but without space drifting -/obj/mecha/working/hoverpod/dyndomove(direction) - if(!can_move) - return 0 - if(src.pr_inertial_movement.active()) - return 0 - if(!has_charge(step_energy_drain)) - return 0 - var/move_result = 0 - if(hasInternalDamage(MECHA_INT_CONTROL_LOST)) - move_result = mechsteprand() - else if(src.dir!=direction) - move_result = mechturn(direction) - else - move_result = mechstep(direction) - if(move_result) - can_move = 0 - use_power(step_energy_drain) - /*if(istype(src.loc, /turf/space)) - if(!src.check_for_support()) - src.pr_inertial_movement.start(list(src,direction)) - src.log_message("Movement control lost. Inertial movement started.")*/ - if(do_after(step_in, target = src)) - can_move = 1 - return 1 - return 0 +/obj/mecha/working/hoverpod/Process_Spacemove(var/movement_dir = 0) + return 1 // puts the hover in hoverpod //these three procs overriden to play different sounds /obj/mecha/working/hoverpod/mechturn(direction) diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 600e8d5d86b..029646c6aa7 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -94,7 +94,7 @@ for(var/turf/T in dstturfs) var/turf/D = locate(T.x, throwy - 1, 1) for(var/atom/movable/AM as mob|obj in T) - AM.Move(D) + AM.Move(D, SOUTH) if(istype(T, /turf/simulated)) qdel(T)