Skip to content

Commit

Permalink
Merge pull request #32 from SPLURT-Station/FUCKUS
Browse files Browse the repository at this point in the history
[MODULAR] adds combat mode
  • Loading branch information
MosleyTheMalO authored Aug 6, 2024
2 parents 5d7cd1e + 488f6cb commit eb758c5
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 1 deletion.
12 changes: 12 additions & 0 deletions code/__DEFINES/~~~splurt_defines/hud.dm
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down
6 changes: 6 additions & 0 deletions modular_zzplurt/code/datums/keybinding/living.dm
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions modular_zzplurt/code/modules/hud/_hud.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
30 changes: 29 additions & 1 deletion modular_zzplurt/code/modules/hud/screen_objects.dm
Original file line number Diff line number Diff line change
@@ -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()
. = ..()
Expand All @@ -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 ..()
3 changes: 3 additions & 0 deletions modular_zzplurt/code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/mob/living/carbon/human
/// Are we currently in combat focus?
var/combat_focus = FALSE
Original file line number Diff line number Diff line change
@@ -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

4 changes: 4 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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

0 comments on commit eb758c5

Please sign in to comment.