Adds a lfwb-inspired orbiting pixel + flashing outline animation to the sprint and combat buttons (toggleable via prefs) (#11623)

* Adds a flashing effect to the sprint and combat mode toggles (toggleable via prefs)

* Adds the ability to change the color of the hud toggle flash as well
This commit is contained in:
deathride58
2020-03-26 16:51:48 +01:00
committed by GitHub
parent 9ab89ddcea
commit 0bf2cf0484
7 changed files with 50 additions and 3 deletions
+14
View File
@@ -187,6 +187,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/sprint_spacebar = FALSE var/sprint_spacebar = FALSE
var/sprint_toggle = FALSE var/sprint_toggle = FALSE
var/hud_toggle_flash = TRUE
var/hud_toggle_color = "#ffffff"
var/list/exp = list() var/list/exp = list()
var/list/menuoptions var/list/menuoptions
@@ -902,6 +905,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<b>Fit Viewport:</b> <a href='?_src_=prefs;preference=auto_fit_viewport'>[auto_fit_viewport ? "Auto" : "Manual"]</a><br>" dat += "<b>Fit Viewport:</b> <a href='?_src_=prefs;preference=auto_fit_viewport'>[auto_fit_viewport ? "Auto" : "Manual"]</a><br>"
dat += "<b>Sprint Key:</b> <a href='?_src_=prefs;preference=sprint_key'>[sprint_spacebar ? "Space" : "Shift"]</a><br>" dat += "<b>Sprint Key:</b> <a href='?_src_=prefs;preference=sprint_key'>[sprint_spacebar ? "Space" : "Shift"]</a><br>"
dat += "<b>Toggle Sprint:</b> <a href='?_src_=prefs;preference=sprint_toggle'>[sprint_toggle ? "Enabled" : "Disabled"]</a><br>" dat += "<b>Toggle Sprint:</b> <a href='?_src_=prefs;preference=sprint_toggle'>[sprint_toggle ? "Enabled" : "Disabled"]</a><br>"
dat += "<b>HUD Button Flashes:</b> <a href='?_src_=prefs;preference=hud_toggle_flash'>[hud_toggle_flash ? "Enabled" : "Disabled"]</a><br>"
dat += "<b>HUD Button Flash Color:</b> <span style='border: 1px solid #161616; background-color: [hud_toggle_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=hud_toggle_color;task=input'>Change</a><br>"
if (CONFIG_GET(flag/maprotation) && CONFIG_GET(flag/tgstyle_maprotation)) if (CONFIG_GET(flag/maprotation) && CONFIG_GET(flag/tgstyle_maprotation))
var/p_map = preferred_map var/p_map = preferred_map
@@ -2075,6 +2080,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(pickedPDASkin) if(pickedPDASkin)
pda_skin = pickedPDASkin pda_skin = pickedPDASkin
if("hud_toggle_color")
var/new_toggle_color = input(user, "Choose your HUD toggle flash color:", "Game Preference",hud_toggle_color) as color|null
if(new_toggle_color)
hud_toggle_color = new_toggle_color
else else
switch(href_list["preference"]) switch(href_list["preference"])
//CITADEL PREFERENCES EDIT - I can't figure out how to modularize these, so they have to go here. :c -Pooj //CITADEL PREFERENCES EDIT - I can't figure out how to modularize these, so they have to go here. :c -Pooj
@@ -2278,6 +2288,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("sprint_toggle") if("sprint_toggle")
sprint_toggle = !sprint_toggle sprint_toggle = !sprint_toggle
if("hud_toggle_flash")
hud_toggle_flash = !hud_toggle_flash
if("save") if("save")
save_preferences() save_preferences()
save_character() save_character()
+6 -1
View File
@@ -200,6 +200,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["auto_fit_viewport"] >> auto_fit_viewport S["auto_fit_viewport"] >> auto_fit_viewport
S["sprint_spacebar"] >> sprint_spacebar S["sprint_spacebar"] >> sprint_spacebar
S["sprint_toggle"] >> sprint_toggle S["sprint_toggle"] >> sprint_toggle
S["hud_toggle_flash"] >> hud_toggle_flash
S["hud_toggle_color"] >> hud_toggle_color
S["menuoptions"] >> menuoptions S["menuoptions"] >> menuoptions
S["enable_tips"] >> enable_tips S["enable_tips"] >> enable_tips
S["tip_delay"] >> tip_delay S["tip_delay"] >> tip_delay
@@ -239,6 +241,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
auto_fit_viewport = sanitize_integer(auto_fit_viewport, 0, 1, initial(auto_fit_viewport)) auto_fit_viewport = sanitize_integer(auto_fit_viewport, 0, 1, initial(auto_fit_viewport))
sprint_spacebar = sanitize_integer(sprint_spacebar, 0, 1, initial(sprint_spacebar)) sprint_spacebar = sanitize_integer(sprint_spacebar, 0, 1, initial(sprint_spacebar))
sprint_toggle = sanitize_integer(sprint_toggle, 0, 1, initial(sprint_toggle)) sprint_toggle = sanitize_integer(sprint_toggle, 0, 1, initial(sprint_toggle))
hud_toggle_flash = sanitize_integer(hud_toggle_flash, 0, 1, initial(hud_toggle_flash))
hud_toggle_color = sanitize_hexcolor(hud_toggle_color, 6, 1, initial(hud_toggle_color))
ghost_form = sanitize_inlist(ghost_form, GLOB.ghost_forms, initial(ghost_form)) ghost_form = sanitize_inlist(ghost_form, GLOB.ghost_forms, initial(ghost_form))
ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit)) ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit))
ghost_accs = sanitize_inlist(ghost_accs, GLOB.ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION) ghost_accs = sanitize_inlist(ghost_accs, GLOB.ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION)
@@ -248,7 +252,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
pda_style = sanitize_inlist(pda_style, GLOB.pda_styles, initial(pda_style)) pda_style = sanitize_inlist(pda_style, GLOB.pda_styles, initial(pda_style))
pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color)) pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color))
pda_skin = sanitize_inlist(pda_skin, GLOB.pda_reskins, PDA_SKIN_ALT) pda_skin = sanitize_inlist(pda_skin, GLOB.pda_reskins, PDA_SKIN_ALT)
screenshake = sanitize_integer(screenshake, 0, 800, initial(screenshake)) screenshake = sanitize_integer(screenshake, 0, 800, initial(screenshake))
damagescreenshake = sanitize_integer(damagescreenshake, 0, 2, initial(damagescreenshake)) damagescreenshake = sanitize_integer(damagescreenshake, 0, 2, initial(damagescreenshake))
widescreenpref = sanitize_integer(widescreenpref, 0, 1, initial(widescreenpref)) widescreenpref = sanitize_integer(widescreenpref, 0, 1, initial(widescreenpref))
@@ -301,6 +304,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["auto_fit_viewport"], auto_fit_viewport) WRITE_FILE(S["auto_fit_viewport"], auto_fit_viewport)
WRITE_FILE(S["sprint_spacebar"], sprint_spacebar) WRITE_FILE(S["sprint_spacebar"], sprint_spacebar)
WRITE_FILE(S["sprint_toggle"], sprint_toggle) WRITE_FILE(S["sprint_toggle"], sprint_toggle)
WRITE_FILE(S["hud_toggle_flash"], hud_toggle_flash)
WRITE_FILE(S["hud_toggle_color"], hud_toggle_color)
WRITE_FILE(S["menuoptions"], menuoptions) WRITE_FILE(S["menuoptions"], menuoptions)
WRITE_FILE(S["enable_tips"], enable_tips) WRITE_FILE(S["enable_tips"], enable_tips)
WRITE_FILE(S["tip_delay"], tip_delay) WRITE_FILE(S["tip_delay"], tip_delay)
+1 -1
View File
@@ -43,7 +43,7 @@
/// Updates the combat mode HUD icon. /// Updates the combat mode HUD icon.
/mob/living/proc/update_combat_mode_icon() /mob/living/proc/update_combat_mode_icon()
var/obj/screen/combattoggle/T = locate() in hud_used?.static_inventory var/obj/screen/combattoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state() T?.update_icon()
/// Enables intentionally being in combat mode. Please try not to use this proc for feedback whenever possible. /// Enables intentionally being in combat mode. Please try not to use this proc for feedback whenever possible.
/mob/living/proc/enable_intentional_combat_mode(silent = TRUE, visible = FALSE) /mob/living/proc/enable_intentional_combat_mode(silent = TRUE, visible = FALSE)
+1 -1
View File
@@ -4,7 +4,7 @@
/mob/living/proc/update_sprint_icon() /mob/living/proc/update_sprint_icon()
var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory
S?.update_icon_state() S?.update_icon()
/mob/living/proc/update_hud_sprint_bar() /mob/living/proc/update_hud_sprint_bar()
hud_used?.sprint_buffer?.update_to_mob(src) hud_used?.sprint_buffer?.update_to_mob(src)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 116 KiB

@@ -12,6 +12,7 @@
name = "toggle combat mode" name = "toggle combat mode"
icon = 'modular_citadel/icons/ui/screen_midnight.dmi' icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
icon_state = "combat_off" icon_state = "combat_off"
var/mutable_appearance/flashy
/obj/screen/combattoggle/Click() /obj/screen/combattoggle/Click()
if(iscarbon(usr)) if(iscarbon(usr))
@@ -29,6 +30,19 @@
else else
icon_state = "combat_off" 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 /obj/screen/voretoggle
name = "toggle vore mode" name = "toggle vore mode"
icon = 'modular_citadel/icons/ui/screen_midnight.dmi' icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
@@ -6,6 +6,7 @@
icon = 'modular_citadel/icons/ui/screen_midnight.dmi' icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
icon_state = "act_sprint" icon_state = "act_sprint"
layer = ABOVE_HUD_LAYER - 0.1 layer = ABOVE_HUD_LAYER - 0.1
var/mutable_appearance/flashy
/obj/screen/sprintbutton/Click() /obj/screen/sprintbutton/Click()
if(ishuman(usr)) if(ishuman(usr))
@@ -23,6 +24,19 @@
else else
icon_state = "act_sprint" icon_state = "act_sprint"
/obj/screen/sprintbutton/update_overlays()
. = ..()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user) || !user.client)
return
if((user.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE) && user.client.prefs.hud_toggle_flash)
if(!flashy)
flashy = mutable_appearance('icons/mob/screen_gen.dmi', "togglehalf_flash")
if(flashy.color != user.client.prefs.hud_toggle_color)
flashy.color = user.client.prefs.hud_toggle_color
. += flashy
//Sprint buffer onscreen code. //Sprint buffer onscreen code.
/datum/hud/var/obj/screen/sprint_buffer/sprint_buffer /datum/hud/var/obj/screen/sprint_buffer/sprint_buffer