diff --git a/code/__DEFINES/~~~splurt_defines/hud.dm b/code/__DEFINES/~~~splurt_defines/hud.dm new file mode 100644 index 0000000000000..ce1cfce1a8e80 --- /dev/null +++ b/code/__DEFINES/~~~splurt_defines/hud.dm @@ -0,0 +1,12 @@ +//redefines +#undef ui_combat_toggle +#undef ui_crafting +#undef ui_building +#undef ui_language_menu +#undef ui_navigate_menu + +#define ui_combat_toggle "EAST-4:24,SOUTH:5" +#define ui_crafting "EAST-5:22,SOUTH:5" +#define ui_building "EAST-5:22,SOUTH:21" +#define ui_language_menu "EAST-5:6,SOUTH:21" +#define ui_navigate_menu "EAST-5:22,SOUTH:5" diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 375d82f5b69e6..63d2d20ab9000 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -160,6 +160,8 @@ set_combat_indicator(TRUE) else set_combat_indicator(FALSE) + //SPLURT EDIT START + /* face_mouse = (client?.prefs?.read_preference(/datum/preference/toggle/face_cursor_combat_mode) && combat_mode) ? TRUE : FALSE //SKYRAT EDIT ADDITION END @@ -169,6 +171,8 @@ SEND_SOUND(src, sound('sound/misc/ui_togglecombat.ogg', volume = 25)) //Sound from interbay! else SEND_SOUND(src, sound('sound/misc/ui_toggleoffcombat.ogg', volume = 25)) //Slightly modified version of the above + */ + //SPLURT EDIT END /mob/living/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum) if(!isitem(AM)) diff --git a/modular_zzplurt/code/datums/keybinding/living.dm b/modular_zzplurt/code/datums/keybinding/living.dm new file mode 100644 index 0000000000000..490fc2ab3ffc9 --- /dev/null +++ b/modular_zzplurt/code/datums/keybinding/living.dm @@ -0,0 +1,6 @@ +/datum/keybinding/living/combat_indicator/down(client/user) + . = ..() + var/mob/living/carbon/human/humie = user.mob + if(. && istype(humie)) + return + humie.set_combat_focus(!humie.combat_focus) diff --git a/modular_zzplurt/code/modules/hud/_hud.dm b/modular_zzplurt/code/modules/hud/_hud.dm index 8d8cd6c86278f..9d33c74413385 100644 --- a/modular_zzplurt/code/modules/hud/_hud.dm +++ b/modular_zzplurt/code/modules/hud/_hud.dm @@ -1,3 +1,6 @@ +/datum/hud + var/atom/movable/screen/focus_toggle + /datum/hud/human/New(mob/living/carbon/human/owner) . = ..() var/index = static_inventory.Find(action_intent) @@ -6,3 +9,8 @@ action_intent = new /atom/movable/screen/intent_toggle(null, src) static_inventory[index] = action_intent + + focus_toggle = new /atom/movable/screen/focus_toggle(null, src) + focus_toggle.icon = ui_style + focus_toggle.update_appearance() + static_inventory += focus_toggle diff --git a/modular_zzplurt/code/modules/hud/screen_objects.dm b/modular_zzplurt/code/modules/hud/screen_objects.dm index f6fff0f273162..aa64e4eeebc61 100644 --- a/modular_zzplurt/code/modules/hud/screen_objects.dm +++ b/modular_zzplurt/code/modules/hud/screen_objects.dm @@ -1,7 +1,8 @@ + /atom/movable/screen/intent_toggle name = "intent" icon_state = "help" - screen_loc = ui_acti + screen_loc = ui_combat_toggle /atom/movable/screen/intent_toggle/update_icon_state() . = ..() @@ -24,3 +25,30 @@ target_mob.set_combat_mode(INTENT_GRAB, silent = TRUE) else target_mob.set_combat_mode(INTENT_DISARM, silent = TRUE) + + +/atom/movable/screen/focus_toggle + name = "toggle combat mode" + icon = 'icons/hud/screen_midnight.dmi' + icon_state = "combat_off" + screen_loc = "EAST-3:24,SOUTH:5" + +/atom/movable/screen/focus_toggle/Initialize(mapload, datum/hud/hud_owner) + . = ..() + update_appearance() + +/atom/movable/screen/focus_toggle/Click() + if(!ishuman(usr)) + return + + var/mob/living/carbon/human/owner = usr + owner.set_combat_focus(!owner.combat_focus, FALSE) + update_appearance() + +/atom/movable/screen/focus_toggle/update_icon_state() + var/mob/living/carbon/human/user = hud?.mymob + if(!istype(user) || !user.client) + return ..() + + icon_state = user.combat_focus ? "combat" : "combat_off" + return ..() diff --git a/modular_zzplurt/code/modules/mob/living/carbon/human/human.dm b/modular_zzplurt/code/modules/mob/living/carbon/human/human.dm new file mode 100644 index 0000000000000..7992e19f25052 --- /dev/null +++ b/modular_zzplurt/code/modules/mob/living/carbon/human/human.dm @@ -0,0 +1,3 @@ +/mob/living/carbon/human + /// Are we currently in combat focus? + var/combat_focus = FALSE diff --git a/modular_zzplurt/code/modules/mob/living/carbon/human/human_defense.dm b/modular_zzplurt/code/modules/mob/living/carbon/human/human_defense.dm new file mode 100644 index 0000000000000..11916604722dc --- /dev/null +++ b/modular_zzplurt/code/modules/mob/living/carbon/human/human_defense.dm @@ -0,0 +1,20 @@ +/mob/living/carbon/human/proc/set_combat_focus(new_mode, silent = TRUE) + if(combat_focus == new_mode) + return + + . = combat_focus + combat_focus = new_mode + hud_used?.focus_toggle?.update_appearance() + + var/focus_sound = client?.prefs.read_preference(/datum/preference/toggle/sound_combatmode) + if(combat_focus) + face_mouse = !!client?.prefs?.read_preference(/datum/preference/toggle/face_cursor_combat_mode) + set_combat_indicator(TRUE) + if(focus_sound) + SEND_SOUND(src, sound('sound/misc/ui_togglecombat.ogg', volume = 25)) //Sound from interbay! + else + face_mouse = FALSE + set_combat_indicator(FALSE) + if(focus_sound) + SEND_SOUND(src, sound('sound/misc/ui_toggleoffcombat.ogg', volume = 25)) //Slightly modified version of the above + diff --git a/tgstation.dme b/tgstation.dme index 904fee360345f..38833a19ac089 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -509,6 +509,7 @@ #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\hud.dm" #include "code\__DEFINES\~~~splurt_defines\intents.dm" #include "code\__DEFINES\~~~splurt_defines\keybinding.dm" #include "code\__DEFINES\~~~splurt_defines\traits\declarations.dm" @@ -9212,6 +9213,7 @@ #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\datums\keybinding\living.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" @@ -9231,6 +9233,8 @@ #include "modular_zzplurt\code\modules\mob\dead\new_player\new_player.dm" #include "modular_zzplurt\code\modules\mob\living\living.dm" #include "modular_zzplurt\code\modules\mob\living\living_defines.dm" +#include "modular_zzplurt\code\modules\mob\living\carbon\human\human.dm" +#include "modular_zzplurt\code\modules\mob\living\carbon\human\human_defense.dm" #include "modular_zzplurt\code\modules\reagents\chemistry\machinery\chem_dispenser.dm" #include "modular_zzplurt\code\modules\wiremod\core\integrated_circuit.dm" // END_INCLUDE