Implement AZERTY and numpad targetting options

This commit is contained in:
Couls
2019-04-26 03:33:29 -04:00
parent 69cbb67b3d
commit 5903ad2dfd
9 changed files with 144 additions and 63 deletions
+3 -2
View File
@@ -30,8 +30,9 @@
#define DISABLE_KARMA 262144
#define CHAT_NO_MENTORTICKETLOGS 524288
#define TYPING_ONCE 1048576
#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|MEMBER_PUBLIC|DONATOR_PUBLIC)
#define NUMPAD_TARGET 2097512
#define AZERTY 4194304
#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|MEMBER_PUBLIC|DONATOR_PUBLIC|NUMPAD_TARGET)
// Admin attack logs filter system, see /proc/add_attack_logs and /proc/msg_admin_attack
#define ATKLOG_ALL 0
+6 -1
View File
@@ -8,6 +8,7 @@ SUBSYSTEM_DEF(input)
var/list/macro_sets
var/list/movement_keys
var/list/alt_movement_keys
/datum/controller/subsystem/input/Initialize()
setup_default_macro_sets()
@@ -98,8 +99,12 @@ SUBSYSTEM_DEF(input)
"W" = NORTH, "A" = WEST, "S" = SOUTH, "D" = EAST, // WASD
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
)
var/static/list/azerty_movement_keys = list(
"Z" = NORTH, "Q" = WEST, "S" = SOUTH, "D" = EAST, // WASD
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
)
movement_keys = default_movement_keys.Copy()
alt_movement_keys = azerty_movement_keys.Copy()
// Badmins just wanna have fun ♪
/datum/controller/subsystem/input/proc/refresh_client_macro_sets()
@@ -55,7 +55,7 @@
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 4194304, initial(toggles))
toggles = sanitize_integer(toggles, 0, 8388608, initial(toggles))
sound = sanitize_integer(sound, 0, 65535, initial(sound))
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
@@ -242,4 +242,28 @@
to_chat(usr, "<span class='notice'>You have enabled text popup limiting.")
else
to_chat(usr, "<span class='notice'>You have disabled text popup limiting.")
return
/client/verb/numpad_target()
set name = "Toggle Numpad targetting"
set category = "Preferences"
set desc = "This button will allow you to enable or disable Numpad Targetting"
prefs.toggles ^= NUMPAD_TARGET
prefs.save_preferences(src)
if (prefs.toggles & NUMPAD_TARGET)
to_chat(usr, "<span class='notice'>You have enabled Numpad Targetting.")
else
to_chat(usr, "<span class='notice'>You have disabled Numpad Targetting.")
return
/client/verb/azerty_toggle()
set name = "Toggle QWERTY/AZERTY"
set category = "Preferences"
set desc = "This button will switch you between QWERTY and AZERTY control sets"
prefs.toggles ^= AZERTY
prefs.save_preferences(src)
if (prefs.toggles & AZERTY)
to_chat(usr, "<span class='notice'>You are now in AZERTY mode.")
else
to_chat(usr, "<span class='notice'>You are now in QWERTY mode.")
return
+3 -1
View File
@@ -4,8 +4,10 @@
/atom/movable/keyLoop(client/user)
if(!user.keys_held["Ctrl"])
var/movement_dir = NONE
var/list/movement = SSinput.movement_keys
if (user.prefs.toggles & AZERTY) movement = SSinput.alt_movement_keys
for(var/_key in user.keys_held)
movement_dir = movement_dir | SSinput.movement_keys[_key]
movement_dir = movement_dir | movement[_key]
if(user.next_move_dir_add)
movement_dir |= user.next_move_dir_add
if(user.next_move_dir_sub)
@@ -5,6 +5,7 @@
set hidden = TRUE
keys_held[_key] = world.time
var/movement = SSinput.movement_keys[_key]
if (prefs.toggles & AZERTY) movement = SSinput.alt_movement_keys[_key]
if(!(next_move_dir_sub & movement) && !keys_held["Ctrl"])
next_move_dir_add |= movement
@@ -35,6 +36,7 @@
set hidden = TRUE
keys_held -= _key
var/movement = SSinput.movement_keys[_key]
if (prefs.toggles & AZERTY) movement = SSinput.alt_movement_keys[_key]
if(!(next_move_dir_add & movement))
next_move_dir_sub |= movement
+104 -54
View File
@@ -3,62 +3,112 @@
// Or we can have NPC's send actual keypresses and detect that by seeing no client
/mob/key_down(_key, client/user)
switch(_key)
if("Delete", "H")
if(!pulling)
to_chat(src, "<span class='notice'>You are not pulling anything.</span>")
else
stop_pulling()
return
if("Insert", "G")
a_intent_change(INTENT_HOTKEY_RIGHT)
return
if("F")
a_intent_change(INTENT_HOTKEY_LEFT)
return
if("X", "Northeast") // Northeast is Page-up
swap_hand()
return
if("Y", "Z", "Southeast") // Southeast is Page-down
mode() // attack_self(). No idea who came up with "mode()"
return
if("Q", "Northwest") // Northwest is Home
var/obj/item/I = get_active_hand()
if(!I)
to_chat(src, "<span class='warning'>You have nothing to drop in your hand!</span>")
else
drop_item(I)
return
if("E")
quick_equip()
return
if("Alt")
toggle_move_intent()
return
if(user.prefs.toggles & AZERTY)
switch(_key)
if("Delete", "H")
if(!pulling)
to_chat(src, "<span class='notice'>You are not pulling anything.</span>")
else
stop_pulling()
return
if("Insert", "G")
a_intent_change(INTENT_HOTKEY_RIGHT)
return
if("F")
a_intent_change(INTENT_HOTKEY_LEFT)
return
if("X", "Northeast") // Northeast is Page-up
swap_hand()
return
if("Y", "W", "Southeast") // Southeast is Page-down
mode() // attack_self(). No idea who came up with "mode()"
return
if("A", "Northwest") // Northwest is Home
var/obj/item/I = get_active_hand()
if(!I)
to_chat(src, "<span class='warning'>You have nothing to drop in your hand!</span>")
else
drop_item(I)
return
if("E")
quick_equip()
return
if("Alt")
toggle_move_intent()
return
else
switch(_key)
if("Delete", "H")
if(!pulling)
to_chat(src, "<span class='notice'>You are not pulling anything.</span>")
else
stop_pulling()
return
if("Insert", "G")
a_intent_change(INTENT_HOTKEY_RIGHT)
return
if("F")
a_intent_change(INTENT_HOTKEY_LEFT)
return
if("X", "Northeast") // Northeast is Page-up
swap_hand()
return
if("Y", "Z", "Southeast") // Southeast is Page-down
mode() // attack_self(). No idea who came up with "mode()"
return
if("Q", "Northwest") // Northwest is Home
var/obj/item/I = get_active_hand()
if(!I)
to_chat(src, "<span class='warning'>You have nothing to drop in your hand!</span>")
else
drop_item(I)
return
if("E")
quick_equip()
return
if("Alt")
toggle_move_intent()
return
//Bodypart selections
if("Numpad8")
user.body_toggle_head()
return
if("Numpad4")
user.body_r_arm()
return
if("Numpad5")
user.body_chest()
return
if("Numpad6")
user.body_l_arm()
return
if("Numpad1")
user.body_r_leg()
return
if("Numpad2")
user.body_groin()
return
if("Numpad3")
user.body_l_leg()
return
if(client.prefs.toggles & NUMPAD_TARGET)
switch(_key)
if("Numpad8")
user.body_toggle_head()
return
if("Numpad4")
user.body_r_arm()
return
if("Numpad5")
user.body_chest()
return
if("Numpad6")
user.body_l_arm()
return
if("Numpad1")
user.body_r_leg()
return
if("Numpad2")
user.body_groin()
return
if("Numpad3")
user.body_l_leg()
return
if(client.keys_held["Ctrl"])
if(client.keys_held["Ctrl"] && client.prefs.toggles & AZERTY)
switch(SSinput.alt_movement_keys[_key])
if(NORTH)
northface()
return
if(SOUTH)
southface()
return
if(WEST)
westface()
return
if(EAST)
eastface()
return
else if(client.keys_held["Ctrl"])
switch(SSinput.movement_keys[_key])
if(NORTH)
northface()
@@ -2,6 +2,3 @@
..()
regenerate_icons()
show_laws(0)
var/datum/hotkey_mode/cyborg/C = new(src)
C.set_winset_values()
+1 -1
View File
@@ -304,7 +304,7 @@
for(var/obj/item/grab/G in mob.grabbed_by)
G.adjust_position()
if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully
delay *= 2
delay = mob.movement_delay() * 2
move_delay += delay
moving = 0
if(mob && .)