Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combat modda mouseye bakıyo olmak #452

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#define COMSIG_KB_LIVING_TOGGLEMOVEINTENT_DOWN "keybinding_mob_togglemoveintent_down"
#define COMSIG_KB_LIVING_TOGGLEMOVEINTENTALT_DOWN "keybinding_mob_togglemoveintentalt_down"
#define COMSIG_KB_LIVING_VIEW_PET_COMMANDS "keybinding_living_view_pet_commands"
#define COMSIG_KB_LIVING_FACECURSOR_DOWN "keybinding_living_facecursor_down"

//Mob
#define COMSIG_KB_MOB_FACENORTH_DOWN "keybinding_mob_facenorth_down"
Expand Down
21 changes: 21 additions & 0 deletions code/datums/keybinding/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,24 @@
var/mob/living/M = user.mob
M.toggle_move_intent()
return TRUE

/datum/keybinding/living/face_cursor
hotkey_keys = list("Unbound")
name = "face_cursor"
full_name = "Face Cursor"
description = "Hold for face to cursor."
keybind_signal = COMSIG_KB_LIVING_FACECURSOR_DOWN

/datum/keybinding/living/face_cursor/down(client/user)
. = ..()
if(.)
return
var/mob/M = user.mob
M.face_mouse = TRUE

/datum/keybinding/living/face_cursor/up(client/user)
. = ..()
if(.)
return
var/mob/M = user.mob
M.face_mouse = FALSE
4 changes: 4 additions & 0 deletions code/game/atom/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@

SEND_SIGNAL(user, COMSIG_ATOM_MOUSE_ENTERED, src)

// Face directions on combat mode. No procs, no typechecks, just a var for speed
if(user.face_mouse)
user.face_atom(src)

// Screentips
var/datum/hud/active_hud = user.hud_used
if(!active_hud)
Expand Down
9 changes: 6 additions & 3 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,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 performance reasons
var/face_mouse = FALSE

/mutable_appearance/emissive_blocker

/mutable_appearance/emissive_blocker/New()
Expand Down Expand Up @@ -644,7 +647,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)
setDir(direction)

var/is_multi_tile_object = is_multi_tile_object(src)
Expand Down Expand Up @@ -771,7 +774,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)
setDir(first_step_dir)
else if(!inertia_moving)
newtonian_move(dir2angle(direct))
Expand Down Expand Up @@ -818,7 +821,7 @@

last_move = direct

if(set_dir_on_move && dir != direct && update_dir)
if(set_dir_on_move && dir != direct && update_dir && !face_mouse)
setDir(direct)
if(. && has_buckled_mobs() && !handle_buckled_mob_movement(loc, direct, glide_size_override)) //movement failed due to buckled mob(s)
. = FALSE
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
return
. = combat_mode
combat_mode = new_mode

if(hud_used?.action_intent)
hud_used.action_intent.update_appearance()
if(silent || !(client?.prefs.read_preference(/datum/preference/toggle/sound_combatmode)))
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/mob_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@

//We are now going to move
var/add_delay = mob.cached_multiplicative_slowdown
if(mob.face_mouse && mob.dir != direct && !(mob.movement_type & FLYING))
if((NSCOMPONENT(mob.dir) && NSDIRFLIP(mob.dir) == direct) || (EWCOMPONENT(mob.dir) && EWDIRFLIP(mob.dir) == direct)) // If we're waling backwards
add_delay += /datum/movespeed_modifier/backward_walk::multiplicative_slowdown
else //Otherwise
add_delay += /datum/movespeed_modifier/side_walk::multiplicative_slowdown
var/new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? sqrt(2) : 1 ) )
mob.set_glide_size(new_glide_size) // set it now in case of pulled objects
//If the move was recent, count using old_move_delay
Expand Down
6 changes: 6 additions & 0 deletions code/modules/movespeed/modifiers/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,9 @@
/datum/movespeed_modifier/fish_on_water
blacklisted_movetypes = MOVETYPES_NOT_TOUCHING_GROUND
multiplicative_slowdown = - /turf/open/water::slowdown

/datum/movespeed_modifier/backward_walk
multiplicative_slowdown = 1.5

/datum/movespeed_modifier/side_walk
multiplicative_slowdown = 0.75
Loading