Skip to content

Commit

Permalink
[MIRROR] Replaces move_on_shuttle with a trait (#2749)
Browse files Browse the repository at this point in the history
* Replaces `move_on_shuttle` with a trait (#83550)

## About The Pull Request

`move_on_shuttle` was a variable that existed on `/mob` despite only
ever being used by cameras. This PR downgrades the variable to only
exist on `/mob/camera` types, but have the only thing that variable do
is add a trait that blocks movement on shuttles if not allowed. This
allows us to check the variable without casting to camera, which is what
some code was un-necessarily doing. This also retainst the ability to
add the trait later on to different mobs who we may not want to be on
shuttles that aren't `/mob/camera`.
## Why It's Good For The Game

There's no point for this variable to live on `/mob` if all it can do is
clog up the VV screen, especially if the current utilization for it is
only cameras. Let's move it off `/mob` and turn it into a trait so it
still has the similar utilization on a global level without typecasting
- as well as make it actually work since needless typecasting was
introducing a minor bug
## Changelog
Irrelevant.

---------

Co-authored-by: Time-Green <[email protected]>

* Replaces `move_on_shuttle` with a trait

---------

Co-authored-by: san7890 <[email protected]>
Co-authored-by: Time-Green <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
4 people authored and StealsThePRs committed May 30, 2024
1 parent 4ac83ea commit bc7fbd1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Allows you to hear speech through walls
#define TRAIT_XRAY_HEARING "xray_hearing"

/// This mob can not enter or move on a shuttle
#define TRAIT_BLOCK_SHUTTLE_MOVEMENT "block_shuttle_movement"

/// Lets us scan reagents
#define TRAIT_REAGENT_SCANNER "reagent_scanner"
/// Lets us scan machine parts and tech unlocks
Expand Down
3 changes: 2 additions & 1 deletion code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_BATON_RESISTANCE" = TRAIT_BATON_RESISTANCE,
"TRAIT_BEING_BLADE_SHIELDED" = TRAIT_BEING_BLADE_SHIELDED,
"TRAIT_BLOB_ALLY" = TRAIT_BLOB_ALLY,
"TRAIT_BLOCK_SHUTTLE_MOVEMENT" = TRAIT_BLOCK_SHUTTLE_MOVEMENT,
"TRAIT_BLOOD_CLANS" = TRAIT_BLOOD_CLANS,
"TRAIT_BLOODSHOT_EYES" = TRAIT_BLOODSHOT_EYES,
"TRAIT_BLOODY_MESS" = TRAIT_BLOODY_MESS,
"TRAIT_BLOOD_CLANS" = TRAIT_BLOOD_CLANS,
"TRAIT_BOMBIMMUNE" = TRAIT_BOMBIMMUNE,
"TRAIT_BONSAI" = TRAIT_BONSAI,
"TRAIT_BOOZE_SLIDER" = TRAIT_BOOZE_SLIDER,
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_BADTOUCH" = TRAIT_BADTOUCH,
"TRAIT_BALD" = TRAIT_BALD,
"TRAIT_BATON_RESISTANCE" = TRAIT_BATON_RESISTANCE,
"TRAIT_BLOCK_SHUTTLE_MOVEMENT" = TRAIT_BLOCK_SHUTTLE_MOVEMENT,
"TRAIT_BLOOD_CLANS" = TRAIT_BLOOD_CLANS,
"TRAIT_BLOODSHOT_EYES" = TRAIT_BLOODSHOT_EYES,
"TRAIT_BOMBIMMUNE" = TRAIT_BOMBIMMUNE,
Expand Down
2 changes: 0 additions & 2 deletions code/datums/brain_damage/imaginary_friend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
var/mob/living/owner
var/bubble_icon = "default"



/mob/camera/imaginary_friend/Login()
. = ..()
if(!. || !client)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/blob/overmind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
icon = 'icons/mob/silicon/cameramob.dmi'
icon_state = "marker"
mouse_opacity = MOUSE_OPACITY_ICON
move_on_shuttle = 1
move_on_shuttle = TRUE
invisibility = INVISIBILITY_OBSERVER
layer = FLY_LAYER
plane = ABOVE_GAME_PLANE
Expand Down
5 changes: 4 additions & 1 deletion code/modules/mob/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
invisibility = INVISIBILITY_ABSTRACT // No one can see us
sight = SEE_SELF
move_on_shuttle = FALSE
/// Toggles if the camera can move on shuttles
var/move_on_shuttle = FALSE
/// Toggles if the camera can use emotes
var/has_emotes = FALSE

/mob/camera/Initialize(mapload)
. = ..()
SSpoints_of_interest.make_point_of_interest(src)
if(!move_on_shuttle)
ADD_TRAIT(src, TRAIT_BLOCK_SHUTTLE_MOVEMENT, INNATE_TRAIT)

/mob/camera/experience_pressure_difference()
return
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@
/// What job does this mob have
var/job = null//Living

/// Can this mob enter shuttles
var/move_on_shuttle = 1

/// bitflags defining which status effects can be inflicted (replaces canknockdown, canstun, etc)
var/status_flags = CANSTUN|CANKNOCKDOWN|CANUNCONSCIOUS|CANPUSH

Expand Down
11 changes: 3 additions & 8 deletions code/modules/shuttle/arrivals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,9 @@
return FALSE

/obj/docking_port/mobile/arrivals/proc/PersonCheck()
for(var/V in GLOB.player_list)
var/mob/M = V
if((get_area(M) in areas) && M.stat != DEAD)
if(!iscameramob(M))
return TRUE
var/mob/camera/C = M
if(C.move_on_shuttle)
return TRUE
for(var/mob/player as anything in GLOB.player_list)
if((get_area(player) in areas) && (player.stat != DEAD) && !HAS_TRAIT(player, TRAIT_BLOCK_SHUTTLE_MOVEMENT))
return TRUE
return FALSE

/obj/docking_port/mobile/arrivals/proc/NukeDiskCheck()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/shuttle/on_move.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ All ShuttleMove procs go here
/************************************Mob move procs************************************/

/mob/onShuttleMove(turf/newT, turf/oldT, list/movement_force, move_dir, obj/docking_port/stationary/old_dock, obj/docking_port/mobile/moving_dock)
if(!move_on_shuttle)
if(HAS_TRAIT(src, TRAIT_BLOCK_SHUTTLE_MOVEMENT))
return
. = ..()

/mob/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation)
if(!move_on_shuttle)
if(HAS_TRAIT(src, TRAIT_BLOCK_SHUTTLE_MOVEMENT))
return
. = ..()
if(client && movement_force)
Expand Down

0 comments on commit bc7fbd1

Please sign in to comment.