Skip to content

Commit

Permalink
Fix simplemobs being unable to use intent hotkeys (#10115)
Browse files Browse the repository at this point in the history
* Fix simplemobs being unable to use intent hotkeys

* Properly sort the intent comsig defines

* Fix comsig intent selection defines part 2: electric boogaloo

* Chat alert

* Add check for intent HUD in the hotkey

* Remove message

* Better code.
  • Loading branch information
Absolucy authored Nov 26, 2023
1 parent ae0b534 commit 12da339
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 69 deletions.
8 changes: 4 additions & 4 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

//Carbon
#define COMSIG_KB_CARBON_TOGGLETHROWMODE_DOWN "keybinding_carbon_togglethrowmode_down"
#define COMSIG_KB_CARBON_SELECTHELPINTENT_DOWN "keybinding_carbon_selecthelpintent_down"
#define COMSIG_KB_CARBON_SELECTDISARMINTENT_DOWN "keybinding_carbon_selectdisarmintent_down"
#define COMSIG_KB_CARBON_SELECTGRABINTENT_DOWN "keybinding_carbon_selectgrabintent_down"
#define COMSIG_KB_CARBON_SELECTHARMINTENT_DOWN "keybinding_carbon_selectharmintent_down"
#define COMSIG_KB_CARBON_HOLDTHROWMODE_DOWN "keybinding_carbon_holdthrowmode_down"
#define COMSIG_KB_CARBON_GIVEITEM_DOWN "keybinding_carbon_giveitem_down"

Expand Down Expand Up @@ -45,6 +41,10 @@
#define COMSIG_KB_LIVING_REST_DOWN "keybinding_living_rest_down"
#define COMSIG_KB_LIVING_LOOKUP_DOWN "keybinding_living_lookup_down"
#define COMSIG_KB_LIVING_LOOKDOWN_DOWN "keybinding_living_lookdown_down"
#define COMSIG_KB_LIVING_SELECTHELPINTENT_DOWN "keybinding_living_selecthelpintent_down"
#define COMSIG_KB_LIVING_SELECTDISARMINTENT_DOWN "keybinding_living_selectdisarmintent_down"
#define COMSIG_KB_LIVING_SELECTGRABINTENT_DOWN "keybinding_living_selectgrabintent_down"
#define COMSIG_KB_LIVING_SELECTHARMINTENT_DOWN "keybinding_living_selectharmintent_down"

//Mob
#define COMSIG_KB_MOB_MOVENORTH_DOWN "keybinding_mob_movenorth_down"
Expand Down
65 changes: 0 additions & 65 deletions code/datums/keybinding/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,71 +22,6 @@
return TRUE


/datum/keybinding/carbon/select_help_intent
keys = list("1")
name = "select_help_intent"
full_name = "Select help intent"
description = ""
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_SELECTHELPINTENT_DOWN

/datum/keybinding/carbon/select_help_intent/down(client/user)
. = ..()
if(.)
return
user.mob?.a_intent_change(INTENT_HELP)
return TRUE


/datum/keybinding/carbon/select_disarm_intent
keys = list("2")
name = "select_disarm_intent"
full_name = "Select disarm intent"
description = ""
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_SELECTDISARMINTENT_DOWN

/datum/keybinding/carbon/select_disarm_intent/down(client/user)
. = ..()
if(.)
return
var/mob/living/carbon/C = user.mob
C.a_intent_change(INTENT_DISARM)
return TRUE


/datum/keybinding/carbon/select_grab_intent
keys = list("3")
name = "select_grab_intent"
full_name = "Select grab intent"
description = ""
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_SELECTGRABINTENT_DOWN

/datum/keybinding/carbon/select_grab_intent/down(client/user)
. = ..()
if(.)
return
var/mob/living/carbon/C = user.mob
C.a_intent_change(INTENT_GRAB)
return TRUE


/datum/keybinding/carbon/select_harm_intent
keys = list("4")
name = "select_harm_intent"
full_name = "Select harm intent"
description = ""
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_SELECTHARMINTENT_DOWN

/datum/keybinding/carbon/select_harm_intent/down(client/user)
. = ..()
if(.)
return
user.mob?.a_intent_change(INTENT_HARM)
return TRUE

/datum/keybinding/carbon/hold_throw_mode
keys = list("Space")
name = "hold_throw_mode"
Expand Down
55 changes: 55 additions & 0 deletions code/datums/keybinding/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,58 @@
var/mob/living/L = user.mob
L.look_reset()
return TRUE


/datum/keybinding/living/select_intent
/// The intent this keybinding will switch to.
var/intent

/datum/keybinding/living/select_intent/can_use(client/user)
. = ..()
var/mob/living/user_mob = user.mob
if(!. || !istype(user_mob))
return
return !iscyborg(user_mob) && (intent in user_mob.possible_a_intents) && (locate(/atom/movable/screen/act_intent) in user_mob.hud_used?.static_inventory) // The cyborg check is because cyborgs have their own swap intent hotkey, and we don't want to mess that up.

/datum/keybinding/living/select_intent/down(client/user)
. = ..()
if(.)
return
user.mob?.a_intent_change(intent)
return TRUE


/datum/keybinding/living/select_intent/help
keys = list("1")
name = "select_help_intent"
full_name = "Select help intent"
description = ""
keybind_signal = COMSIG_KB_LIVING_SELECTHELPINTENT_DOWN
intent = INTENT_HELP


/datum/keybinding/living/select_intent/disarm
keys = list("2")
name = "select_disarm_intent"
full_name = "Select disarm intent"
description = ""
keybind_signal = COMSIG_KB_LIVING_SELECTDISARMINTENT_DOWN
intent = INTENT_DISARM


/datum/keybinding/living/select_intent/grab
keys = list("3")
name = "select_grab_intent"
full_name = "Select grab intent"
description = ""
keybind_signal = COMSIG_KB_LIVING_SELECTGRABINTENT_DOWN
intent = INTENT_GRAB


/datum/keybinding/living/select_intent/harm
keys = list("4")
name = "select_harm_intent"
full_name = "Select harm intent"
description = ""
keybind_signal = COMSIG_KB_LIVING_SELECTHARMINTENT_DOWN
intent = INTENT_HARM

0 comments on commit 12da339

Please sign in to comment.