mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 19:13:30 +01:00
ec88636e6c
* Adding defines * More signals for external power * Gets the reboot working * renaming a proc * config stuff * Working on cyborg movement * Update code/modules/mob/living/silicon/robot/robot_damage.dm Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> * Update code/modules/mob/living/silicon/robot/robot_damage.dm Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> * Update code/modules/mob/living/silicon/robot/robot_damage.dm Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> * IOSYS where'd you come from * begon return 0 * VTEC caps slowdown * Adjusting EMPs * Funny arm is GONE * Oh yeah regenerating stamina might be a good thing * Forgot you could uninstall vtec * icon machine broke * Cell-less borgs can enter chargers to stay powered * oh that was almost bad * Fixes some logic * its a surprise tool that will help us later * Adjusting some numbers * Adds a sound to go along with the text alarm * dead things can still charge * Another logic error * Xenos too * sorry linter * fixes CL * Slightly more slowdown on stam damage * neurotoxin won't stun * SOUNDS! * 3 flashes to stun instead of 4 * Slightly longer stun * SPEEDING UP BORGS JUST FOR THE TM SINCE CONFIG DONT WORK * Keep borgs stunned forever * Power loss is more dangerous * Adds a stamina hud to borgs * Cyborgs now heal up properly * Removes an outdated comment * Replacing parts works better now * EMPs disable components for a brief time * More missed rebalances * When you forget to remove debug messages * WHAT * Cult magic works + borgs can be silenced * 2 flashes to stun, flashes confuse now * Update code/game/objects/items/devices/flash.dm Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * Abductors can stun borgs * Watcher/cyro rays deal stam to brog * Fixes a rounding error when healing borgs back to full HP * Fixed span Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * Fixed whitespace Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * Guard clausify * Indents a message * Update code/modules/mob/living/silicon/robot/robot_damage.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * Update code/modules/mob/living/silicon/robot/component.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * Update code/modules/mob/living/silicon/robot/robot_damage.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> * that's not what stat does * No more hardcoded speed, don't TM this branch --------- Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
209 lines
7.4 KiB
Plaintext
209 lines
7.4 KiB
Plaintext
/mob/living/silicon/robot/updatehealth(reason = "none given")
|
|
..(reason)
|
|
check_module_damage()
|
|
|
|
/mob/living/silicon/robot/getBruteLoss(repairable_only = FALSE)
|
|
var/amount = 0
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
if(C.installed || (!repairable_only && C.is_destroyed())) // Installed ones only and if repair only remove the borked ones
|
|
amount += C.brute_damage
|
|
return amount
|
|
|
|
/mob/living/silicon/robot/getFireLoss(repairable_only = FALSE)
|
|
var/amount = 0
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
if(C.installed || (!repairable_only && C.is_destroyed())) // Installed ones only and if repair only remove the borked ones
|
|
amount += C.electronics_damage
|
|
return amount
|
|
|
|
/mob/living/silicon/robot/adjustBruteLoss(amount, updating_health = TRUE)
|
|
if(amount > 0)
|
|
take_overall_damage(amount, 0, updating_health)
|
|
else
|
|
heal_overall_damage(-amount, 0, updating_health)
|
|
return STATUS_UPDATE_HEALTH
|
|
|
|
/mob/living/silicon/robot/adjustFireLoss(amount, updating_health = TRUE)
|
|
if(amount > 0)
|
|
take_overall_damage(0, amount, updating_health)
|
|
else
|
|
heal_overall_damage(0, -amount, updating_health)
|
|
return STATUS_UPDATE_HEALTH
|
|
|
|
/mob/living/silicon/robot/update_stamina()
|
|
if(rebooting)
|
|
return
|
|
var/current_stam_damage = getStaminaLoss()
|
|
if(current_stam_damage > DAMAGE_PRECISION && (maxHealth - current_stam_damage) <= HEALTH_THRESHOLD_CRIT && stat == CONSCIOUS)
|
|
start_emergency_reboot()
|
|
|
|
/mob/living/silicon/robot/handle_status_effects()
|
|
..()
|
|
if(stam_regen_start_time <= world.time)
|
|
update_stamina()
|
|
if(staminaloss && !rebooting)
|
|
setStaminaLoss(0, FALSE)
|
|
update_stamina_hud()
|
|
|
|
/mob/living/silicon/robot/proc/get_damaged_components(get_brute, get_burn, get_borked = FALSE, get_missing = FALSE)
|
|
var/list/datum/robot_component/parts = list()
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
if((C.installed || (get_borked && C.is_destroyed()) || (get_missing && C.is_missing())) && ((get_brute && C.brute_damage) || (get_burn && C.electronics_damage)))
|
|
parts += C
|
|
return parts
|
|
|
|
/mob/living/silicon/robot/proc/get_missing_components()
|
|
var/list/datum/robot_component/parts = list()
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
if(C.is_missing())
|
|
parts += C
|
|
return parts
|
|
|
|
/mob/living/silicon/robot/proc/get_damageable_components()
|
|
var/list/rval = list()
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
if(C.installed)
|
|
rval += C
|
|
return rval
|
|
///Returns the armour component for a borg, or false if its missing or broken
|
|
/mob/living/silicon/robot/proc/get_armour()
|
|
if(!LAZYLEN(components))
|
|
return FALSE
|
|
var/datum/robot_component/C = components["armour"]
|
|
if(C && C.installed)
|
|
return C
|
|
return FALSE
|
|
///Returns the power cell component for a borg, or false if its missing or broken
|
|
/mob/living/silicon/robot/proc/get_cell_component()
|
|
if(!LAZYLEN(components))
|
|
return FALSE
|
|
var/datum/robot_component/C = components["power cell"]
|
|
if(C?.installed)
|
|
return C
|
|
return FALSE
|
|
|
|
/mob/living/silicon/robot/proc/get_total_component_slowdown()
|
|
var/total_slowdown = 0
|
|
for(var/V in components)
|
|
var/datum/robot_component/C = components[V]
|
|
total_slowdown += C.get_movement_delay()
|
|
return total_slowdown
|
|
|
|
/mob/living/silicon/robot/proc/get_stamina_slowdown()
|
|
return round((staminaloss / 40), 0.125)
|
|
|
|
/mob/living/silicon/robot/heal_organ_damage(brute, burn, updating_health = TRUE)
|
|
var/list/datum/robot_component/parts = get_damaged_components(brute, burn)
|
|
if(!LAZYLEN(parts))
|
|
return
|
|
var/datum/robot_component/picked = pick(parts)
|
|
picked.heal_damage(brute, burn, updating_health)
|
|
|
|
/mob/living/silicon/robot/take_organ_damage(brute = 0, burn = 0, updating_health = TRUE, sharp = FALSE, edge = 0)
|
|
var/list/components = get_damageable_components()
|
|
if(!LAZYLEN(components))
|
|
return
|
|
|
|
var/datum/robot_component/armour/A = get_armour()
|
|
if(A)
|
|
A.take_damage(brute, burn, sharp, updating_health)
|
|
return
|
|
|
|
var/datum/robot_component/C = pick(components)
|
|
C.take_damage(brute, burn, sharp, updating_health)
|
|
|
|
/mob/living/silicon/robot/heal_overall_damage(brute, burn, updating_health = TRUE)
|
|
var/list/datum/robot_component/parts = get_damaged_components(brute, burn)
|
|
|
|
while(LAZYLEN(parts) && (brute > 0 || burn > 0))
|
|
var/datum/robot_component/picked = pick(parts)
|
|
|
|
var/brute_was = picked.brute_damage
|
|
var/burn_was = picked.electronics_damage
|
|
|
|
picked.heal_damage(brute,burn, updating_health)
|
|
|
|
brute -= (brute_was - picked.brute_damage)
|
|
burn -= (burn_was - picked.electronics_damage)
|
|
|
|
parts -= picked
|
|
|
|
if(updating_health)
|
|
updatehealth("heal overall damage")
|
|
|
|
/mob/living/silicon/robot/take_overall_damage(brute = 0, burn = 0, updating_health = TRUE, used_weapon = null, sharp = FALSE)
|
|
if(status_flags & GODMODE)
|
|
return
|
|
|
|
brute = max((brute - damage_protection) * brute_mod, 0)
|
|
burn = max((burn - damage_protection) * burn_mod, 0)
|
|
|
|
var/list/datum/robot_component/parts = get_damageable_components()
|
|
|
|
var/datum/robot_component/armour/A = get_armour()
|
|
if(A)
|
|
A.take_damage(brute, burn, sharp)
|
|
updatehealth()
|
|
return
|
|
|
|
while(LAZYLEN(parts) && (brute > 0 || burn > 0))
|
|
var/datum/robot_component/picked = pick(parts)
|
|
|
|
var/brute_was = picked.brute_damage
|
|
var/burn_was = picked.electronics_damage
|
|
|
|
picked.take_damage(brute, burn, sharp, FALSE)
|
|
|
|
brute -= (picked.brute_damage - brute_was)
|
|
burn -= (picked.electronics_damage - burn_was)
|
|
|
|
parts -= picked
|
|
updatehealth()
|
|
|
|
/*
|
|
Begins the stamcrit reboot process for borgs. Stuns them, and warns people if the borg has no power source.
|
|
*/
|
|
/mob/living/silicon/robot/proc/start_emergency_reboot()
|
|
rebooting = TRUE
|
|
playsound(src, 'sound/machines/shut_down.ogg', 100, FALSE, SOUND_RANGE_SET(10))
|
|
if(!has_power_source())
|
|
visible_message(
|
|
"<span class='warning'>[src]'s system sounds an alarm, \"ERROR: NO POWER SOURCE DETECTED. SYSTEM SHUTDOWN IMMINENT.\"</span>",
|
|
"<span class='warning'>EMERGENCY: FULL SYSTEM SHUTDOWN IMMINENT.</span>")
|
|
playsound(src, 'sound/machines/buzz-two.ogg' , 50, FALSE, SOUND_RANGE_SET(10))
|
|
else
|
|
visible_message(
|
|
"<span class='notice'>[src]'s lights suddenly go dark and [p_they()] seem to shut down.</span>",
|
|
"<span class='notice'>A critical neural connection error has occurred. Beginning emergency reboot...</span>"
|
|
)
|
|
var/stun_time = rand(13 SECONDS, 18 SECONDS) //Slightly longer than old flash timer
|
|
setStaminaLoss(0) //Have you tried turning it off and on again?
|
|
Weaken(stun_time)
|
|
addtimer(CALLBACK(src, PROC_REF(end_emergency_reboot)), stun_time)
|
|
/*
|
|
Finishes the stamcrit process. If the borg doesn't have a power source for the reboot, they die.
|
|
*/
|
|
/mob/living/silicon/robot/proc/end_emergency_reboot()
|
|
if(!has_power_source()) //Can't turn itself back on
|
|
rebooting = FALSE
|
|
death()
|
|
return
|
|
if(getStaminaLoss()) //If someone has been chain-flashing a borg then the ride never ends
|
|
var/restun_time = rand(7 SECONDS, 10 SECONDS)
|
|
to_chat(src, "<span class='warning'>Error: Continual sensor overstimulation resulted in faulty reboot. Retrying in [restun_time / 10] seconds.</span>")
|
|
setStaminaLoss(0) //Just keep trying to turn it off and on again, surely it'll work eventually
|
|
Weaken(restun_time)
|
|
addtimer(CALLBACK(src, PROC_REF(end_emergency_reboot)), restun_time)
|
|
return
|
|
rebooting = FALSE
|
|
if(stat != CONSCIOUS)
|
|
return
|
|
playsound(src, 'sound/machines/reboot_chime.ogg' , 100, FALSE, SOUND_RANGE_SET(10))
|
|
update_stamina_hud()
|
|
to_chat(src, "<span class='notice'>Reboot complete, neural interface operational.</span>")
|