[NO GBP] Makes jetpack movement much smoother and prevents pushing off objects while using one (#87020)

## About The Pull Request
Jetpacks will now prevent you from attempting to interact with objects
near you in zero G, preventing you from pushing lockers and people
around. This also makes jetpack movement ***much*** more smooth, as they
will activate at your first move, preventing jerky movement when pushing
off walls. Same applies to all wings which should help moth players with
new spacemove.

Thanks to iusedtoplayxbox on discord for providing details regarding the
issue.

## Why It's Good For The Game

Less jank = happier players

## Changelog
🆑
qol: Jetpack movement is now much smoother
/🆑
This commit is contained in:
SmArtKar
2024-11-11 00:43:36 -08:00
committed by Majkl-J
parent d658634152
commit 7038297aeb
3 changed files with 37 additions and 6 deletions
@@ -63,7 +63,7 @@
///Check if we're still eligible for flight (wings covered, atmosphere too thin, etc)
/obj/item/organ/external/wings/functional/proc/can_fly(mob/living/carbon/human/human)
if(human.stat || human.body_position == LYING_DOWN)
if(human.stat || human.body_position == LYING_DOWN || isnull(human.client))
return FALSE
//Jumpsuits have tail holes, so it makes sense they have wing holes too
if(!cant_hide && human.wear_suit && ((human.wear_suit.flags_inv & HIDEJUMPSUIT) && (!human.wear_suit.species_exception || !is_type_in_list(src, human.wear_suit.species_exception))))
@@ -111,6 +111,7 @@
human.AddElement(/datum/element/forced_gravity, 0)
passtable_on(human, SPECIES_FLIGHT_TRAIT)
RegisterSignal(human, COMSIG_MOB_CLIENT_MOVE_NOGRAV, PROC_REF(on_client_move))
RegisterSignal(human, COMSIG_MOB_ATTEMPT_HALT_SPACEMOVE, PROC_REF(on_pushoff))
START_PROCESSING(SSnewtonian_movement, src)
open_wings()
to_chat(human, span_notice("You beat your wings and begin to hover gently above the ground..."))
@@ -123,7 +124,7 @@
human.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/wings)
human.RemoveElement(/datum/element/forced_gravity, 0)
passtable_off(human, SPECIES_FLIGHT_TRAIT)
UnregisterSignal(human, COMSIG_MOB_CLIENT_MOVE_NOGRAV)
UnregisterSignal(human, list(COMSIG_MOB_CLIENT_MOVE_NOGRAV, COMSIG_MOB_ATTEMPT_HALT_SPACEMOVE))
STOP_PROCESSING(SSnewtonian_movement, src)
to_chat(human, span_notice("You settle gently back onto the ground..."))
close_wings()
@@ -139,6 +140,17 @@
source.newtonian_move(dir2angle(source.client.intended_direction), instant = TRUE, drift_force = FUNCTIONAL_WING_FORCE, controlled_cap = max_drift_force)
source.setDir(source.client.intended_direction)
/obj/item/organ/external/wings/functional/proc/on_pushoff(mob/source, movement_dir, continuous_move, atom/backup)
SIGNAL_HANDLER
if (get_dir(source, backup) == movement_dir || source.loc == backup.loc)
return
if (!can_fly(source) || !source.client.intended_direction)
return
return COMPONENT_PREVENT_SPACEMOVE_HALT
/obj/item/organ/external/wings/functional/process(seconds_per_tick)
if (!owner || !can_fly(owner) || isnull(owner.drift_handler))
return
+13 -1
View File
@@ -21,11 +21,12 @@
RegisterSignal(receiver, COMSIG_HUMAN_BURNING, PROC_REF(try_burn_wings))
RegisterSignal(receiver, COMSIG_LIVING_POST_FULLY_HEAL, PROC_REF(heal_wings))
RegisterSignal(receiver, COMSIG_MOB_CLIENT_MOVE_NOGRAV, PROC_REF(on_client_move))
RegisterSignal(receiver, COMSIG_MOB_ATTEMPT_HALT_SPACEMOVE, PROC_REF(on_pushoff))
START_PROCESSING(SSnewtonian_movement, src)
/obj/item/organ/external/wings/moth/on_mob_remove(mob/living/carbon/organ_owner)
. = ..()
UnregisterSignal(organ_owner, list(COMSIG_HUMAN_BURNING, COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_MOB_CLIENT_MOVE_NOGRAV))
UnregisterSignal(organ_owner, list(COMSIG_HUMAN_BURNING, COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_MOB_CLIENT_MOVE_NOGRAV, COMSIG_MOB_ATTEMPT_HALT_SPACEMOVE))
STOP_PROCESSING(SSnewtonian_movement, src)
/obj/item/organ/external/wings/moth/make_flap_sound(mob/living/carbon/wing_owner)
@@ -75,6 +76,17 @@
source.newtonian_move(dir2angle(source.client.intended_direction), instant = TRUE, drift_force = MOTH_WING_FORCE, controlled_cap = max_drift_force)
source.setDir(source.client.intended_direction)
/obj/item/organ/external/wings/moth/proc/on_pushoff(mob/source, movement_dir, continuous_move, atom/backup)
SIGNAL_HANDLER
if (get_dir(source, backup) == movement_dir || source.loc == backup.loc)
return
if (!allow_flight() || !source.client.intended_direction)
return
return COMPONENT_PREVENT_SPACEMOVE_HALT
///check if our wings can burn off ;_;
/obj/item/organ/external/wings/moth/proc/try_burn_wings(mob/living/carbon/human/human)
SIGNAL_HANDLER