Merge pull request #10212 from Ghommie/Ghommie-cit471

Ports some hud and update_icon code updates.
This commit is contained in:
Lin
2019-12-28 04:07:03 +00:00
committed by GitHub
56 changed files with 423 additions and 264 deletions
@@ -18,10 +18,11 @@
var/mob/living/carbon/C = usr
C.toggle_combat_mode()
/obj/screen/combattoggle/proc/rebasetointerbay(mob/living/carbon/C)
if(!C)
/obj/screen/combattoggle/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if(C.combatmode)
if(user.combatmode)
icon_state = "combat"
else
icon_state = "combat_off"
@@ -36,10 +37,11 @@
var/mob/living/carbon/C = usr
C.toggle_vore_mode()
/obj/screen/voretoggle/proc/rebaseintomygut(mob/living/carbon/C)
if(!C)
/obj/screen/voretoggle/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if(C.voremode && !C.combatmode)
if(user.voremode && !user.combatmode)
icon_state = "nom"
else
icon_state = "nom_off"
+4 -3
View File
@@ -12,10 +12,11 @@
var/mob/living/carbon/human/H = usr
H.togglesprint()
/obj/screen/sprintbutton/proc/insert_witty_toggle_joke_here(mob/living/carbon/human/H)
if(!H)
/obj/screen/sprintbutton/update_icon_state()
var/mob/living/user = hud?.mymob
if(istype(user))
return
if(H.sprinting)
if(user.sprinting)
icon_state = "act_sprint_on"
else
icon_state = "act_sprint"
+33 -50
View File
@@ -13,31 +13,16 @@
var/mob/living/L = usr
to_chat(L, "<span class='notice'>You have <b>[L.getStaminaLoss()]</b> stamina loss.<br>Your stamina buffer can take <b>[L.stambuffer]</b> stamina loss, and will use <b>50%</b> of that stamina loss when recharging.<br>Your stamina buffer is <b>[(L.stambuffer*(100/L.stambuffer))-(L.bufferedstam*(100/L.stambuffer))]%</b> full.</span>")
/mob/living/carbon/human/proc/staminahudamount()
if(stat == DEAD || recoveringstam)
return "staminacrit"
/obj/screen/staminas/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!user)
return
if(user.stat == DEAD || user.recoveringstam || (user.hal_screwyhud in 1 to 2))
icon_state = "staminacrit"
else if(user.hal_screwyhud == 5)
icon_state = "stamina0"
else
switch(hal_screwyhud)
if(1 to 2)
return "staminacrit"
if(5)
return "stamina0"
else
switch(100 - getStaminaLoss())
if(100 to INFINITY)
return "stamina0"
if(80 to 100)
return "stamina1"
if(60 to 80)
return "stamina2"
if(40 to 60)
return "stamina3"
if(20 to 40)
return "stamina4"
if(0 to 20)
return "stamina5"
else
return "stamina6"
icon_state = "stamina[max(FLOOR(user.getStaminaLoss() /20, 1), 0, 6)]"
//stam buffer
/obj/screen/staminabuffer
@@ -48,31 +33,29 @@
layer = ABOVE_HUD_LAYER + 0.1
mouse_opacity = 0
/mob/living/carbon/human/proc/staminabufferhudamount()
if(stat == DEAD || recoveringstam)
return "stambuffer7"
/obj/screen/staminabuffer/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!user)
return
if(user.stat == DEAD || user.recoveringstam || (user.hal_screwyhud in 1 to 2))
icon_state = "stambuffer7"
else if(user.hal_screwyhud == 5)
icon_state = "stambuffer0"
else
switch(hal_screwyhud)
if(1 to 2)
return "stambuffer7"
if(5)
return "stambuffer0"
switch(user.bufferedstam / user.stambuffer)
if(0.95 to INFINITY)
icon_state = "stambuffer7"
if(0.9 to 0.95)
icon_state = "stambuffer6"
if(0.8 to 0.9)
icon_state = "stambuffer5"
if(0.6 to 0.8)
icon_state = "stambuffer4"
if(0.4 to 0.6)
icon_state = "stambuffer3"
if(0.2 to 0.4)
icon_state = "stambuffer2"
if(0.05 to 0.2)
icon_state = "stambuffer1"
else
var/percentmult = 100/stambuffer
switch(stambuffer*percentmult - bufferedstam*percentmult)
if(95 to INFINITY)
return "stambuffer0"
if(90 to 95)
return "stambuffer1"
if(80 to 90)
return "stambuffer2"
if(60 to 80)
return "stambuffer3"
if(40 to 60)
return "stambuffer4"
if(20 to 40)
return "stambuffer5"
if(5 to 20)
return "stambuffer6"
else
return "stambuffer7"
icon_state = "stambuffer0"
@@ -41,18 +41,16 @@
playsound_local(src, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the above!
if(client)
client.show_popup_menus = !combatmode // So we can right-click for alternate actions and all that other good shit. Also moves examine to shift+rightclick to make it possible to attack while sprinting
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/combattoggle/selector in hud_used.static_inventory)
selector.rebasetointerbay(src)
var/obj/screen/combattoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()
combatmessagecooldown = 10 SECONDS + world.time //This is set 100% of the time to make sure squeezing regen out of process cycles doesn't result in the combat mode message getting spammed
SEND_SIGNAL(src, COMSIG_COMBAT_TOGGLED, src, combatmode)
return TRUE
mob/living/carbon/proc/toggle_vore_mode()
voremode = !voremode
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/voretoggle/selector in hud_used.static_inventory)
selector.rebaseintomygut(src)
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()
if(combatmode)
return FALSE //let's not override the main draw of the game these days
SEND_SIGNAL(src, COMSIG_VORE_TOGGLED, src, voremode)
@@ -1,6 +1,3 @@
/mob/living/carbon/human
var/sprinting = FALSE
/mob/living/carbon/human/Move(NewLoc, direct)
var/oldpseudoheight = pseudo_z_axis
. = ..()
@@ -28,9 +25,8 @@
playsound_local(src, 'sound/misc/sprintactivate.ogg', 50, FALSE, pressure_affected = FALSE)
else
playsound_local(src, 'sound/misc/sprintdeactivate.ogg', 50, FALSE, pressure_affected = FALSE)
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/sprintbutton/selector in hud_used.static_inventory)
selector.insert_witty_toggle_joke_here(src)
var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory
S?.update_icon_state()
return TRUE
/mob/living/carbon/human/proc/sprint_hotkey(targetstatus)
@@ -1,4 +1,5 @@
/mob/living
var/sprinting = FALSE
var/recoveringstam = FALSE
var/incomingstammult = 1
var/bufferedstam = 0
@@ -1,6 +1,3 @@
/mob/living/silicon/robot
var/sprinting = FALSE
/mob/living/silicon/robot/Move(NewLoc, direct)
. = ..()
if(. && sprinting && !(movement_type & FLYING) && canmove && !resting)
@@ -24,9 +21,8 @@
if(shutdown)
playsound_local(src, 'sound/effects/light_flicker.ogg', 50, FALSE, pressure_affected = FALSE)
playsound_local(src, 'sound/misc/sprintdeactivate.ogg', 50, FALSE, pressure_affected = FALSE)
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/sprintbutton/selector in hud_used.static_inventory)
selector.insert_witty_toggle_joke_here(src)
var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory
S?.update_icon_state()
return TRUE
/mob/living/silicon/robot/proc/sprint_hotkey(targetstatus)