diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index 8b29ba9e048e7..10be2fff885e6 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -853,6 +853,9 @@ if (isnull(user)) return + if(user.face_mouse) // DOPPLER SHIFT ADDITION + user.face_atom(src) // DOPPLER SHIFT ADDITION + // Screentips var/datum/hud/active_hud = user.hud_used if(!active_hud) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index ae987cb668f15..b53c4d1a13cf6 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -126,6 +126,9 @@ /// Example: If req_one_access = list(ACCESS_ENGINE, ACCESS_CE)- then the user must have either ACCESS_ENGINE or ACCESS_CE in order to use the object. var/list/req_one_access + /// Whether a user will face atoms on entering them with a mouse. Despite being a mob variable, it is here for performances // DOPPLER SHIFT ADDITION + var/face_mouse = FALSE // DOPPLER SHIFT ADDITION + /mutable_appearance/emissive_blocker /mutable_appearance/emissive_blocker/New() @@ -634,7 +637,7 @@ if(!direction) direction = get_dir(src, newloc) - if(set_dir_on_move && dir != direction && update_dir) + if(set_dir_on_move && dir != direction && update_dir && !face_mouse) // DOPPLER SHIFT EDIT : ORIGINAL : if(set_dir_on_move && dir != direction && update_dir) setDir(direction) var/is_multi_tile_object = is_multi_tile_object(src) @@ -761,7 +764,7 @@ moving_diagonally = SECOND_DIAG_STEP . = step(src, SOUTH) if(moving_diagonally == SECOND_DIAG_STEP) - if(!. && set_dir_on_move && update_dir) + if(!. && set_dir_on_move && update_dir && !face_mouse) // DOPPLER SHIFT EDIT : ORIGINAL : if(!. && set_dir_on_move && update_dir) setDir(first_step_dir) else if(!inertia_moving) newtonian_move(direct) @@ -808,7 +811,7 @@ last_move = direct - if(set_dir_on_move && dir != direct && update_dir) + if(set_dir_on_move && dir != direct && update_dir && !face_mouse) // DOPPLER SHIFT EDIT : ORIGINAL : if(set_dir_on_move && dir != direct && update_dir) setDir(direct) if(. && has_buckled_mobs() && !handle_buckled_mob_movement(loc, direct, glide_size_override)) //movement failed due to buckled mob(s) . = FALSE diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index a06a71262490a..99538836476d6 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -151,6 +151,7 @@ combat_mode = new_mode if(hud_used?.action_intent) hud_used.action_intent.update_appearance() + face_mouse = (client?.prefs?.read_preference(/datum/preference/toggle/face_cursor_combat_mode) && combat_mode) ? TRUE : FALSE // DOPPLER SHIFT ADDITION if(silent || !(client?.prefs.read_preference(/datum/preference/toggle/sound_combatmode))) return if(combat_mode) diff --git a/modular_doppler/face_mouse_preferences/code/face_mouse_pref.dm b/modular_doppler/face_mouse_preferences/code/face_mouse_pref.dm new file mode 100644 index 0000000000000..5046a49075b46 --- /dev/null +++ b/modular_doppler/face_mouse_preferences/code/face_mouse_pref.dm @@ -0,0 +1,4 @@ +/datum/preference/toggle/face_cursor_combat_mode + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "face_cursor_combat_mode" + savefile_identifier = PREFERENCE_PLAYER diff --git a/tgstation.dme b/tgstation.dme index 70d324b1e6898..db0ff80b7f23e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6353,4 +6353,5 @@ #include "interface\fonts\spess_font.dm" #include "interface\fonts\tiny_unicode.dm" #include "interface\fonts\vcr_osd_mono.dm" +#include "modular_doppler\face_mouse_preferences\code\face_mouse_pref.dm" // END_INCLUDE diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/face_mouse_combat.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/face_mouse_combat.tsx new file mode 100644 index 0000000000000..b0fabeeff23f2 --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/face_mouse_combat.tsx @@ -0,0 +1,9 @@ +import { CheckboxInput, FeatureToggle } from '../base'; + +export const face_cursor_combat_mode: FeatureToggle = { + name: 'Face mouse in combat mode', + category: 'GAMEPLAY', + description: + 'If your character should face towards your cursor while in combat mode.', + component: CheckboxInput, +};