forked from Bubberstation/Bubberstation
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from SPLURT-Station/intento
[MODULAR] adds intents
- Loading branch information
Showing
9 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//INTENT VOODOO SHIT, ABANDON ALL HOPE YE WHO ENTER. | ||
|
||
//all different flavors of "falsey" | ||
#define INTENT_HELP 0 | ||
#define INTENT_DISARM null | ||
#define INTENT_GRAB "" | ||
//except harm which needs to be the only one that passes if(combat_mode) checks | ||
#define INTENT_HARM TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#define COMSIG_KB_HUMAN_SET_INTENT_HELP_DOWN "keybinding_human_set_intent_help_down" | ||
#define COMSIG_KB_HUMAN_SET_INTENT_DISARM_DOWN "keybinding_human_set_intent_disarm_down" | ||
#define COMSIG_KB_HUMAN_SET_INTENT_GRAB_DOWN "keybinding_human_set_intent_grab_down" | ||
#define COMSIG_KB_HUMAN_SET_INTENT_HARM_DOWN "keybinding_human_set_intent_harm_down" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/proc/resolve_intent_name(intent) | ||
switch(intent) | ||
if(INTENT_HELP) | ||
return "help" | ||
if(INTENT_DISARM) | ||
return "disarm" | ||
if(INTENT_GRAB) | ||
return "grab" | ||
if(INTENT_HARM) | ||
return "harm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/datum/keybinding/human/set_intent | ||
var/set_intent = NONE | ||
|
||
/datum/keybinding/human/set_intent/down(client/user) | ||
. = ..() | ||
if(.) | ||
return | ||
|
||
var/mob/living/carbon/human/human = user.mob | ||
human.set_combat_mode(set_intent, silent = TRUE) | ||
return TRUE | ||
|
||
/datum/keybinding/human/set_intent/help | ||
name = "set_intent_help" | ||
full_name = "Set intent to Help" | ||
hotkey_keys = list("1") | ||
keybind_signal = COMSIG_KB_HUMAN_SET_INTENT_HELP_DOWN | ||
set_intent = INTENT_HELP | ||
|
||
/datum/keybinding/human/set_intent/disarm | ||
name = "set_intent_disarm" | ||
full_name = "Set intent to Disarm" | ||
hotkey_keys = list("2") | ||
keybind_signal = COMSIG_KB_HUMAN_SET_INTENT_DISARM_DOWN | ||
set_intent = INTENT_DISARM | ||
|
||
/datum/keybinding/human/set_intent/grab | ||
name = "set_intent_grab" | ||
full_name = "Set intent to Grab" | ||
hotkey_keys = list("3") | ||
keybind_signal = COMSIG_KB_HUMAN_SET_INTENT_GRAB_DOWN | ||
set_intent = INTENT_GRAB | ||
|
||
/datum/keybinding/human/set_intent/harm | ||
name = "set_intent_harm" | ||
full_name = "Set intent to Harm" | ||
hotkey_keys = list("4") | ||
keybind_signal = COMSIG_KB_HUMAN_SET_INTENT_HARM_DOWN | ||
set_intent = INTENT_HARM | ||
|
||
|
||
/datum/keybinding/living/disable_combat_mode/can_use(client/user) | ||
return ..() && !ishuman(user.mob) | ||
|
||
/datum/keybinding/living/enable_combat_mode/can_use(client/user) | ||
return ..() && !ishuman(user.mob) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/mob/living/carbon/human | ||
var/_last_next_move = 0 | ||
|
||
/mob/living/carbon/human/ClickOn(atom/A, params) | ||
if(world.time <= next_click) | ||
return | ||
_last_next_move = next_move | ||
return ..() | ||
|
||
/mob/living/carbon/human/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers) | ||
if(isliving(attack_target)) | ||
switch(combat_mode) | ||
if(INTENT_DISARM) | ||
modifiers -= LEFT_CLICK | ||
modifiers[RIGHT_CLICK] = TRUE | ||
if(INTENT_GRAB) | ||
//CtrlClickOn checks for next_move.. which ClickOn has just set right before calling this. | ||
next_move = _last_next_move | ||
CtrlClickOn(attack_target) | ||
return | ||
return ..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/datum/hud/human/New(mob/living/carbon/human/owner) | ||
. = ..() | ||
var/index = static_inventory.Find(action_intent) | ||
static_inventory[index] = null | ||
qdel(action_intent) | ||
|
||
action_intent = new /atom/movable/screen/intent_toggle(null, src) | ||
static_inventory[index] = action_intent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/atom/movable/screen/intent_toggle | ||
name = "intent" | ||
icon_state = "help" | ||
screen_loc = ui_acti | ||
|
||
/atom/movable/screen/intent_toggle/update_icon_state() | ||
. = ..() | ||
var/mob/living/owner = hud?.mymob | ||
if(owner) | ||
icon_state = resolve_intent_name(owner.combat_mode) | ||
|
||
/atom/movable/screen/intent_toggle/Click(location, control, params) | ||
var/list/modifiers = params2list(params) | ||
var/_x = text2num(modifiers["icon-x"]) | ||
var/_y = text2num(modifiers["icon-y"]) | ||
var/mob/living/target_mob = usr | ||
|
||
if(_x <= 16) | ||
if(_y <= 16) | ||
target_mob.set_combat_mode(INTENT_HARM, silent = TRUE) | ||
else | ||
target_mob.set_combat_mode(INTENT_HELP, silent = TRUE) | ||
else if(_y <= 16) | ||
target_mob.set_combat_mode(INTENT_GRAB, silent = TRUE) | ||
else | ||
target_mob.set_combat_mode(INTENT_DISARM, silent = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters