From f001d63314bf70da11f27e0558aa867ec57386b6 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Wed, 19 Jul 2023 22:55:04 +1000 Subject: [PATCH] Semiport of Allow_Spacemove from Bay. --- .../mob/living/carbon/human/human_movement.dm | 18 ---------- .../living/silicon/robot/robot_movement.dm | 18 +--------- .../subtypes/humanoid/mercs/mercs.dm | 2 +- .../mechanical/drones/combat_drone.dm | 3 ++ .../mechanical/drones/mining_drone.dm | 5 ++- .../subtypes/mechanical/mecha/hoverpod.dm | 5 ++- .../subtypes/occult/constructs/_construct.dm | 9 +++-- .../simple_mob/subtypes/occult/faithless.dm | 5 ++- .../living/simple_mob/subtypes/slime/slime.dm | 2 +- code/modules/mob/mob_movement.dm | 34 ++++++++++++++----- 10 files changed, 50 insertions(+), 51 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 865de0b8e6d..e7b19f4be8b 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -173,24 +173,6 @@ for(var/obj/item/rig_module/maneuvering_jets/module in rig.installed_modules) return module.jets -/mob/living/carbon/human/Process_Spacemove(var/check_drift = 0) - //Can we act? - if(restrained()) return 0 - - if(..()) //Can move due to other reasons, don't use jetpack fuel - return 1 - - //Do we have a working jetpack? - var/obj/item/tank/jetpack/thrust = get_jetpack() - - if(thrust) - if(((!check_drift) || (check_drift && thrust.stabilization_on)) && (!lying) && (thrust.do_thrust(0.01, src))) - inertia_dir = 0 - 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. diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index a554176536f..90508c9fda8 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -7,23 +7,7 @@ return module && module.no_slip /mob/living/silicon/robot/Process_Spaceslipping(var/prob_slip) - var/obj/item/tank/jetpack/thrust = get_jetpack() - if(thrust?.can_thrust(0.01)) - return 0 - if(module && module.no_slip) - return 0 - ..(prob_slip) - -/mob/living/silicon/robot/Process_Spacemove(var/check_drift = 0) - if(..())//Can move due to other reasons, don't use jetpack fuel - return 1 - - var/obj/item/tank/jetpack/thrust = get_jetpack() - if(thrust && (!check_drift || (check_drift && thrust.stabilization_on)) && thrust.do_thrust(0.01)) - inertia_dir = 0 - return 1 - - return 0 + return ..(module?.no_slip ? 0 : prob_slip) //No longer needed, but I'll leave it here incase we plan to re-use it. /mob/living/silicon/robot/movement_delay() diff --git a/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm b/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm index c28c4907892..c055da140fb 100644 --- a/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm +++ b/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm @@ -430,4 +430,4 @@ /obj/random/projectile/scrapped_grenadelauncher = 100, /obj/item/grenade/spawnergrenade/manhacks/mercenary = 50, /obj/item/grenade/spawnergrenade/manhacks/mercenary = 30 - ) \ No newline at end of file + ) diff --git a/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/combat_drone.dm b/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/combat_drone.dm index 7a1e66df3b1..00504280557 100644 --- a/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/combat_drone.dm +++ b/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/combat_drone.dm @@ -79,6 +79,9 @@ ..(null,"suddenly breaks apart.") qdel(src) +/mob/living/simple_mob/mechanical/combat_drone/Allow_Spacemove(var/dense_object, check_drift = 0) + return TRUE + /mob/living/simple_mob/mechanical/combat_drone/Process_Spacemove(var/check_drift = 0) return TRUE diff --git a/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/mining_drone.dm b/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/mining_drone.dm index f0f5647ce0f..d8304ef27a7 100644 --- a/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/mining_drone.dm +++ b/code/modules/mob/living/simple_mob/subtypes/mechanical/drones/mining_drone.dm @@ -88,6 +88,9 @@ ..(null,"suddenly breaks apart.") qdel(src) +/mob/living/simple_mob/mechanical/mining_drone/Allow_Spacemove(var/dense_object, check_drift = 0) + return TRUE + /mob/living/simple_mob/mechanical/mining_drone/Process_Spacemove(var/check_drift = 0) return TRUE @@ -150,4 +153,4 @@ /decl/mob_organ_names/miningdrone - hit_zones = list("chassis", "comms array", "sensor suite", "left excavator module", "right excavator module", "maneuvering thruster") \ No newline at end of file + hit_zones = list("chassis", "comms array", "sensor suite", "left excavator module", "right excavator module", "maneuvering thruster") diff --git a/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/hoverpod.dm b/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/hoverpod.dm index cf8dc16ae7f..6dcfae4864a 100644 --- a/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/hoverpod.dm +++ b/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/hoverpod.dm @@ -40,8 +40,11 @@ ion_trail.start() return ..() +/mob/living/simple_mob/mechanical/mecha/hoverpod/Allow_Spacemove(var/dense_object, check_drift = 0) + return TRUE + /mob/living/simple_mob/mechanical/mecha/hoverpod/Process_Spacemove(var/check_drift = 0) return TRUE /decl/mob_organ_names/hoverpod - hit_zones = list("central chassis", "control module", "hydraulics", "left manipulator", "right manipulator", "left landing strut", "right landing strut", "maneuvering thruster", "sensor suite", "radiator", "power supply") \ No newline at end of file + hit_zones = list("central chassis", "control module", "hydraulics", "left manipulator", "right manipulator", "left landing strut", "right landing strut", "maneuvering thruster", "sensor suite", "radiator", "power supply") diff --git a/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm b/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm index 3a3c95042aa..98ac3dcb09f 100644 --- a/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm +++ b/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm @@ -142,8 +142,11 @@ . += "It looks severely dented!" //Constructs levitate, can fall from a shuttle with no harm, and are piloted by either damned spirits or some otherworldly entity. Let 'em float in space. -/mob/living/simple_mob/construct/Process_Spacemove() - return 1 +/mob/living/simple_mob/construct/Allow_Spacemove(var/dense_object, check_drift = 0) + return TRUE + +/mob/living/simple_mob/construct/Process_Spacemove(var/check_drift = 0) + return TRUE /* // Glowing Procs @@ -155,4 +158,4 @@ /mob/living/simple_mob/construct/proc/remove_glow() overlays.Cut() -*/ \ No newline at end of file +*/ diff --git a/code/modules/mob/living/simple_mob/subtypes/occult/faithless.dm b/code/modules/mob/living/simple_mob/subtypes/occult/faithless.dm index daca3721dac..37c24787587 100644 --- a/code/modules/mob/living/simple_mob/subtypes/occult/faithless.dm +++ b/code/modules/mob/living/simple_mob/subtypes/occult/faithless.dm @@ -42,8 +42,11 @@ max_n2 = 0 minbodytemp = 0 +/mob/living/simple_mob/faithless/Allow_Spacemove(var/dense_object, check_drift = 0) + return TRUE + /mob/living/simple_mob/faithless/Process_Spacemove(var/check_drift = 0) - return 1 + return TRUE /mob/living/simple_mob/faithless/apply_melee_effects(var/atom/A) if(isliving(A)) diff --git a/code/modules/mob/living/simple_mob/subtypes/slime/slime.dm b/code/modules/mob/living/simple_mob/subtypes/slime/slime.dm index 48efc9e9e11..984dafb0dcd 100644 --- a/code/modules/mob/living/simple_mob/subtypes/slime/slime.dm +++ b/code/modules/mob/living/simple_mob/subtypes/slime/slime.dm @@ -238,4 +238,4 @@ var/global/list/_slime_default_emotes = list( visible_message("\The [src] squishes!") /decl/mob_organ_names/slime - hit_zones = list("cytoplasmic membrane") \ No newline at end of file + hit_zones = list("cytoplasmic membrane") diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 9e4aa252d0e..497112ddc0b 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -395,6 +395,21 @@ /mob/proc/get_jetpack() return +// Checks whether this mob is allowed to move in space +// Return 1 for movement, 0 for none, +// check_drift indicates this is an inertial move and can ignore other requirements. +/mob/proc/Allow_Spacemove(var/dense_object, check_drift = 0) + if(check_drift) + return TRUE + if(restrained()) + return FALSE + var/obj/item/tank/jetpack/J = get_jetpack() + if(J?.can_thrust(0.01)) + return TRUE + if(!dense_object) //Nothing to push off of so end here + return FALSE + return TRUE + ///Process_Spacemove ///Called by /client/Move() ///For moving in space @@ -404,24 +419,27 @@ if(is_incorporeal()) return - if(!Check_Dense_Object()) //Nothing to push off of so end here - update_floating(0) - return 0 + var/dense_object = Check_Dense_Object() + if(!Allow_Spacemove(dense_object, check_drift)) + update_floating(dense_object) + return FALSE - update_floating(1) + update_floating(TRUE) - if(restrained()) //Check to see if we can do things - return 0 + var/obj/item/tank/jetpack/thrust = get_jetpack() + if((!check_drift || (thrust && (check_drift && thrust.stabilization_on)) && !lying && thrust.do_thrust(0.01, src))) + inertia_dir = 0 + return TRUE //Check to see if we slipped if(prob(Process_Spaceslipping(5)) && !buckled) to_chat(src, "You slipped!") inertia_dir = last_move step(src, src.inertia_dir) // Not using Move for smooth glide here because this is a 'slip' so should be sudden. - return 0 + return FALSE //If not then we can reset inertia and move inertia_dir = 0 - return 1 + return TRUE /mob/proc/Check_Dense_Object() //checks for anything to push off in the vicinity. also handles magboots on gravity-less floors tiles