diff --git a/code/__DEFINES/~~~splurt_defines/intents.dm b/code/__DEFINES/~~~splurt_defines/intents.dm new file mode 100644 index 0000000000000..19cf156b9a63d --- /dev/null +++ b/code/__DEFINES/~~~splurt_defines/intents.dm @@ -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 diff --git a/code/__DEFINES/~~~splurt_defines/keybinding.dm b/code/__DEFINES/~~~splurt_defines/keybinding.dm new file mode 100644 index 0000000000000..c1ba3d07f388e --- /dev/null +++ b/code/__DEFINES/~~~splurt_defines/keybinding.dm @@ -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" diff --git a/code/__HELPERS/~splurt_helpers/mob.dm b/code/__HELPERS/~splurt_helpers/mob.dm new file mode 100644 index 0000000000000..5c4e5141b4ff0 --- /dev/null +++ b/code/__HELPERS/~splurt_helpers/mob.dm @@ -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" diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index cff3bd2e2991c..49edc67315c68 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -179,7 +179,12 @@ if(isliving(M)) var/mob/living/L = M + //SPLURT EDIT START + /* their_combat_mode = L.combat_mode + */ + their_combat_mode = L.combat_mode != INTENT_HELP + //SPLURT EDIT END they_can_move = L.mobility_flags & MOBILITY_MOVE //Also spread diseases for(var/thing in diseases) @@ -238,7 +243,12 @@ else if( !(HAS_TRAIT(M, TRAIT_NOMOBSWAP) || HAS_TRAIT(src, TRAIT_NOMOBSWAP)) &&\ ((HAS_TRAIT(M, TRAIT_RESTRAINED) && !too_strong) || !their_combat_mode) &&\ + //SPLURT EDIT START + /* (HAS_TRAIT(src, TRAIT_RESTRAINED) || !combat_mode) + */ + (HAS_TRAIT(src, TRAIT_RESTRAINED) || combat_mode == INTENT_HELP) + //SPLURT EDIT END ) mob_swap = TRUE if(mob_swap) @@ -281,7 +291,12 @@ //If they're a human, and they're not in help intent, block pushing if(ishuman(M)) var/mob/living/carbon/human/human = M + //SPLURT EDIT START + /* if(human.combat_mode) + */ + if(human.combat_mode != INTENT_HELP) + //SPLURT EDIT END return TRUE //if they are a cyborg, and they're alive and in combat mode, block pushing if(iscyborg(M)) diff --git a/modular_zzplurt/code/datums/keybinding/human.dm b/modular_zzplurt/code/datums/keybinding/human.dm new file mode 100644 index 0000000000000..092c37ca12775 --- /dev/null +++ b/modular_zzplurt/code/datums/keybinding/human.dm @@ -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) diff --git a/modular_zzplurt/code/modules/client/click.dm b/modular_zzplurt/code/modules/client/click.dm new file mode 100644 index 0000000000000..be1a63b3d7235 --- /dev/null +++ b/modular_zzplurt/code/modules/client/click.dm @@ -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 ..() diff --git a/modular_zzplurt/code/modules/hud/_hud.dm b/modular_zzplurt/code/modules/hud/_hud.dm new file mode 100644 index 0000000000000..8d8cd6c86278f --- /dev/null +++ b/modular_zzplurt/code/modules/hud/_hud.dm @@ -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 diff --git a/modular_zzplurt/code/modules/hud/screen_objects.dm b/modular_zzplurt/code/modules/hud/screen_objects.dm new file mode 100644 index 0000000000000..f6fff0f273162 --- /dev/null +++ b/modular_zzplurt/code/modules/hud/screen_objects.dm @@ -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) diff --git a/tgstation.dme b/tgstation.dme index e9a4e10871064..b2c2746c70efc 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -508,6 +508,8 @@ #include "code\__DEFINES\~~bubber_defines\transport.dm" #include "code\__DEFINES\~~bubber_defines\___HELPERS\global_lists.dm" #include "code\__DEFINES\~~bubber_defines\research\techweb_nodes.dm" +#include "code\__DEFINES\~~~splurt_defines\intents.dm" +#include "code\__DEFINES\~~~splurt_defines\keybinding.dm" #include "code\__DEFINES\~~~splurt_defines\traits\declarations.dm" #include "code\__HELPERS\_auxtools_api.dm" #include "code\__HELPERS\_lists.dm" @@ -626,6 +628,7 @@ #include "code\__HELPERS\~skyrat_helpers\level_traits.dm" #include "code\__HELPERS\~skyrat_helpers\logging.dm" #include "code\__HELPERS\~skyrat_helpers\unsorted.dm" +#include "code\__HELPERS\~splurt_helpers\mob.dm" #include "code\_globalvars\_regexes.dm" #include "code\_globalvars\admin.dm" #include "code\_globalvars\arcade.dm" @@ -9138,17 +9141,21 @@ #include "modular_zzplurt\code\controllers\configuration\entries\discord.dm" #include "modular_zzplurt\code\controllers\subsystem\discord.dm" #include "modular_zzplurt\code\datums\components\crafting\crafting.dm" +#include "modular_zzplurt\code\datums\keybinding\human.dm" #include "modular_zzplurt\code\game\objects\items\devices\transfer_valve.dm" #include "modular_zzplurt\code\modules\admin\player_panel.dm" #include "modular_zzplurt\code\modules\admin\playtimes.dm" #include "modular_zzplurt\code\modules\admin\transform.dm" #include "modular_zzplurt\code\modules\atmospherics\machinery\portable\canister.dm" +#include "modular_zzplurt\code\modules\client\click.dm" #include "modular_zzplurt\code\modules\client\client_procs.dm" #include "modular_zzplurt\code\modules\client\preferences\player_panel.dm" #include "modular_zzplurt\code\modules\client\verbs\looc.dm" #include "modular_zzplurt\code\modules\client\verbs\ooc.dm" #include "modular_zzplurt\code\modules\discord\tgs_commands.dm" #include "modular_zzplurt\code\modules\discord\verbs.dm" +#include "modular_zzplurt\code\modules\hud\_hud.dm" +#include "modular_zzplurt\code\modules\hud\screen_objects.dm" #include "modular_zzplurt\code\modules\mob\mob.dm" #include "modular_zzplurt\code\modules\mob\mob_defines.dm" #include "modular_zzplurt\code\modules\mob\dead\new_player\new_player.dm"