Combat mode component. (#12338)

* Combat mode component.

* Whoops.

* test.

* Oh

* refs begone, and documentation.
This commit is contained in:
Ghom
2020-05-28 03:00:32 +02:00
committed by GitHub
parent 93a168d8a8
commit 968426fd48
38 changed files with 325 additions and 296 deletions

View File

@@ -1,53 +1,22 @@
/obj/screen/combattoggle
name = "toggle combat mode"
icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
icon_state = "combat_off"
var/mutable_appearance/flashy
/obj/screen/combattoggle/Click()
if(iscarbon(usr))
var/mob/living/carbon/C = usr
C.user_toggle_intentional_combat_mode()
/obj/screen/combattoggle/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if((user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
icon_state = "combat"
else if(HAS_TRAIT(user, TRAIT_COMBAT_MODE_LOCKED))
icon_state = "combat_locked"
else
icon_state = "combat_off"
/obj/screen/combattoggle/update_overlays()
. = ..()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user) || !user.client)
return
if((user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && user.client.prefs.hud_toggle_flash)
if(!flashy)
flashy = mutable_appearance('icons/mob/screen_gen.dmi', "togglefull_flash")
if(flashy.color != user.client.prefs.hud_toggle_color)
flashy.color = user.client.prefs.hud_toggle_color
. += flashy //TODO - beg lummox jr for the ability to force mutable appearances or images to be created rendering from their first frame of animation rather than being based entirely around the client's frame count
/obj/screen/voretoggle
name = "toggle vore mode"
icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
icon_state = "nom_off"
/obj/screen/voretoggle/Click()
if(iscarbon(usr))
var/mob/living/carbon/C = usr
C.toggle_vore_mode()
if(usr != hud.mymob)
return
var/mob/living/carbon/C = usr
if(SEND_SIGNAL(usr, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE))
to_chat(usr, "<span class='warning'>Disable combat mode first.</span>")
return
C.toggle_vore_mode()
/obj/screen/voretoggle/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if(user.voremode && !(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
if(user.voremode)
icon_state = "nom"
else
icon_state = "nom_off"

View File

@@ -1,29 +1,16 @@
/mob/living/carbon
var/lastmousedir
var/wrongdirmovedelay
//oh no vore time
var/voremode = FALSE
/mob/living/carbon/proc/toggle_vore_mode()
if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_TOGGLED))
return FALSE //let's not override the main draw of the game these days
voremode = !voremode
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()
if(combat_flags & COMBAT_FLAG_COMBAT_TOGGLED)
return FALSE //let's not override the main draw of the game these days
SEND_SIGNAL(src, COMSIG_VORE_TOGGLED, src, voremode)
return TRUE
/mob/living/carbon/Move(atom/newloc, direct = 0)
. = ..()
wrongdirmovedelay = FALSE
if((combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && client && lastmousedir)
if(lastmousedir != dir)
wrongdirmovedelay = TRUE
setDir(lastmousedir, ismousemovement = TRUE)
/mob/living/carbon/onMouseMove(object, location, control, params)
if(!(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
return
face_atom(object, TRUE)
lastmousedir = dir
/mob/living/carbon/proc/disable_vore_mode()
voremode = FALSE
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()

View File

@@ -37,7 +37,7 @@
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health >= STAMINA_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
set_resting(TRUE, FALSE, FALSE)
disable_intentional_combat_mode(TRUE, FALSE)
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT)
filters += CIT_FILTER_STAMINACRIT
update_mobility()