Fixes borg overlays (#16744)

- Fixes borg overlays disappearing when slipping on something like ice or being stunned and never coming back until a new module is selected.

This meant things like eye overlays were in a permanent state of limbo until you selected a new module.

- Brings the file up to date with (not really new but not old) standards of not using "src."
This commit is contained in:
Cameron Lennox
2024-12-23 07:35:03 +10:00
committed by GitHub
parent d421a56cc4
commit 822d60e32d
+118 -116
View File
@@ -2,10 +2,10 @@
set invisibility = 0
set background = 1
if (src.transforming)
if (transforming)
return
src.blinded = null
blinded = null
//Status updates, death etc.
clamp_values()
@@ -19,7 +19,7 @@
handle_regular_hud_updates()
handle_vision()
update_items()
if (src.stat != DEAD) //still using power
if (stat != DEAD) //still using power
use_power()
process_killswitch()
process_locks()
@@ -45,97 +45,99 @@
var/datum/robot_component/C = components[V]
C.update_power_state()
if ( cell && is_component_functioning("power cell") && src.cell.charge > 0 )
if(src.module_state_1)
if ( cell && is_component_functioning("power cell") && cell.charge > 0 )
if(module_state_1)
cell_use_power(50) // 50W load for every enabled tool TODO: tool-specific loads
if(src.module_state_2)
if(module_state_2)
cell_use_power(50)
if(src.module_state_3)
if(module_state_3)
cell_use_power(50)
if(lights_on)
cell_use_power(30) // 30W light. Normal lights would use ~15W, but increased for balance reasons.
src.has_power = 1
has_power = 1
else
if (src.has_power)
if (has_power)
to_chat(src, span_red("You are now running on emergency backup power."))
src.has_power = 0
has_power = 0
if(lights_on) // Light is on but there is no power!
lights_on = 0
set_light(0)
/mob/living/silicon/robot/handle_regular_status_updates()
if(src.camera && !scrambledcodes)
if(src.stat == 2 || wires.is_cut(WIRE_BORG_CAMERA))
src.camera.set_status(0)
if(camera && !scrambledcodes)
if(stat == 2 || wires.is_cut(WIRE_BORG_CAMERA))
camera.set_status(0)
else
src.camera.set_status(1)
camera.set_status(1)
updatehealth()
if(src.sleeping)
if(sleeping)
Paralyse(3)
AdjustSleeping(-1)
//if(src.resting) // VOREStation edit. Our borgos would rather not.
//if(resting) // VOREStation edit. Our borgos would rather not.
// Weaken(5)
if(health < CONFIG_GET(number/health_threshold_dead) && src.stat != 2) //die only once
if(health < CONFIG_GET(number/health_threshold_dead) && stat != 2) //die only once
death()
if (src.stat != 2) //Alive.
if (src.weakened > 0) // Do not fullstun on weaken
if (stat != 2) //Alive.
if (weakened > 0) // Do not fullstun on weaken
AdjustWeakened(-1)
if (src.paralysis || src.stunned || !src.has_power) //Stunned etc.
src.set_stat(UNCONSCIOUS)
if (src.stunned > 0)
if (paralysis || stunned || !has_power) //Stunned etc.
set_stat(UNCONSCIOUS)
if (stunned > 0)
AdjustStunned(-1)
if (src.weakened > 0)
if (weakened > 0)
AdjustWeakened(-1)
if (src.paralysis > 0)
if (paralysis > 0)
AdjustParalysis(-1)
src.blinded = 1
blinded = 1
else
src.blinded = 0
blinded = 0
else //Not stunned.
src.set_stat(CONSCIOUS)
if(stat != 0) //We are just getting done with being stunned
set_stat(CONSCIOUS)
update_icon()
AdjustConfused(-1)
else //Dead or just unconscious.
src.blinded = 1
blinded = 1
if (src.stuttering) src.stuttering--
if (stuttering) stuttering--
if (src.eye_blind)
src.AdjustBlinded(-1)
src.blinded = 1
if (eye_blind)
AdjustBlinded(-1)
blinded = 1
if (src.ear_deaf > 0) src.ear_deaf--
if (src.ear_damage < 25)
src.ear_damage -= 0.05
src.ear_damage = max(src.ear_damage, 0)
if (ear_deaf > 0) ear_deaf--
if (ear_damage < 25)
ear_damage -= 0.05
ear_damage = max(ear_damage, 0)
src.density = !( src.lying )
density = !( lying )
if (src.sdisabilities & BLIND)
src.blinded = 1
if (src.sdisabilities & DEAF)
src.ear_deaf = 1
if (sdisabilities & BLIND)
blinded = 1
if (sdisabilities & DEAF)
ear_deaf = 1
if (src.eye_blurry > 0)
src.eye_blurry--
src.eye_blurry = max(0, src.eye_blurry)
if (eye_blurry > 0)
eye_blurry--
eye_blurry = max(0, eye_blurry)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
if (druggy > 0)
druggy--
druggy = max(0, druggy)
//update the state of modules and components here
if (src.stat != 0)
if (stat != 0)
uneq_all()
if(radio)
@@ -145,65 +147,65 @@
radio.on = 1
if(is_component_functioning("camera"))
src.blinded = 0
blinded = 0
else
src.blinded = 1
blinded = 1
return 1
/mob/living/silicon/robot/handle_regular_hud_updates()
var/fullbright = FALSE
var/seemeson = FALSE
var/seejanhud = src.sight_mode & BORGJAN
var/seejanhud = sight_mode & BORGJAN
var/area/A = get_area(src)
if(A?.flag_check(AREA_NO_SPOILERS))
disable_spoiler_vision()
if (src.stat == DEAD || (XRAY in mutations) || (src.sight_mode & BORGXRAY))
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_MINIMUM
else if ((src.sight_mode & BORGMESON) && (src.sight_mode & BORGTHERM))
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.see_in_dark = 8
if (stat == DEAD || (XRAY in mutations) || (sight_mode & BORGXRAY))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if ((sight_mode & BORGMESON) && (sight_mode & BORGTHERM))
sight |= SEE_TURFS
sight |= SEE_MOBS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
fullbright = TRUE
else if (src.sight_mode & BORGMESON)
src.sight |= SEE_TURFS
src.see_in_dark = 8
else if (sight_mode & BORGMESON)
sight |= SEE_TURFS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
fullbright = TRUE
seemeson = TRUE
else if (src.sight_mode & BORGMATERIAL)
src.sight |= SEE_OBJS
src.see_in_dark = 8
else if (sight_mode & BORGMATERIAL)
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
fullbright = TRUE
else if (src.sight_mode & BORGTHERM)
src.sight |= SEE_MOBS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (sight_mode & BORGTHERM)
sight |= SEE_MOBS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
fullbright = TRUE
else if (src.sight_mode & BORGANOMALOUS)
src.see_in_dark = 8
src.see_invisible = INVISIBILITY_SHADEKIN
else if (sight_mode & BORGANOMALOUS)
see_in_dark = 8
see_invisible = INVISIBILITY_SHADEKIN
fullbright = TRUE
else if (!seedarkness)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_NOLIGHTING
else if (src.stat != DEAD)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8 // see_in_dark means you can FAINTLY see in the dark, humans have a range of 3 or so, tajaran have it at 8
src.see_invisible = SEE_INVISIBLE_LIVING // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness
sight &= ~SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_NOLIGHTING
else if (stat != DEAD)
sight &= ~SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_in_dark = 8 // see_in_dark means you can FAINTLY see in the dark, humans have a range of 3 or so, tajaran have it at 8
see_invisible = SEE_INVISIBLE_LIVING // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness
// has a "invisible" value of 15
if(plane_holder)
@@ -213,54 +215,54 @@
..()
if (src.healths)
if (src.stat != 2)
if (healths)
if (stat != 2)
if(istype(src,/mob/living/silicon/robot/drone))
switch(health)
if(35 to INFINITY)
src.healths.icon_state = "health0"
healths.icon_state = "health0"
if(25 to 34)
src.healths.icon_state = "health1"
healths.icon_state = "health1"
if(15 to 24)
src.healths.icon_state = "health2"
healths.icon_state = "health2"
if(5 to 14)
src.healths.icon_state = "health3"
healths.icon_state = "health3"
if(0 to 4)
src.healths.icon_state = "health4"
healths.icon_state = "health4"
if(-35 to 0)
src.healths.icon_state = "health5"
healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
healths.icon_state = "health6"
else
if(health >= 200)
src.healths.icon_state = "health0"
healths.icon_state = "health0"
else if(health >= 150)
src.healths.icon_state = "health1"
healths.icon_state = "health1"
else if(health >= 100)
src.healths.icon_state = "health2"
healths.icon_state = "health2"
else if(health >= 50)
src.healths.icon_state = "health3"
healths.icon_state = "health3"
else if(health >= 0)
src.healths.icon_state = "health4"
healths.icon_state = "health4"
else if(health >= CONFIG_GET(number/health_threshold_dead))
src.healths.icon_state = "health5"
healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
healths.icon_state = "health6"
else
src.healths.icon_state = "health7"
healths.icon_state = "health7"
if (src.syndicate && src.client)
if (syndicate && client)
for(var/datum/mind/tra in traitors.current_antagonists)
if(tra.current)
// TODO: Update to new antagonist system.
var/I = image('icons/mob/mob.dmi', loc = tra.current, icon_state = "traitor")
src.client.images += I
src.disconnect_from_ai()
if(src.mind)
client.images += I
disconnect_from_ai()
if(mind)
// TODO: Update to new antagonist system.
if(!src.mind.special_role)
src.mind.special_role = "traitor"
traitors.current_antagonists |= src.mind
if(!mind.special_role)
mind.special_role = "traitor"
traitors.current_antagonists |= mind
update_cell()
@@ -280,8 +282,8 @@
throw_alert("temp", /obj/screen/alert/cold/robot, COLD_ALERT_SEVERITY_MODERATE)
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
// if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
// if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
// if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
if(stat != 2)
if(blinded)
@@ -292,9 +294,9 @@
set_fullscreen(eye_blurry, "blurry", /obj/screen/fullscreen/blurry)
set_fullscreen(druggy, "high", /obj/screen/fullscreen/high)
if (src.machine)
if (src.machine.check_eye(src) < 0)
src.reset_view(null)
if (machine)
if (machine.check_eye(src) < 0)
reset_view(null)
else
if(client && !client.adminobs)
reset_view(null)
@@ -342,7 +344,7 @@
if(killswitch)
killswitch_time --
if(killswitch_time <= 0)
if(src.client)
if(client)
to_chat(src, span_danger("Killswitch Activated"))
killswitch = 0
spawn(5)
@@ -353,7 +355,7 @@
uneq_all()
weaponlock_time --
if(weaponlock_time <= 0)
if(src.client)
if(client)
to_chat(src, span_danger("Weapon Lock Timed Out!"))
weapon_lock = 0
weaponlock_time = 120