diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index ef909b93c85..f1498862540 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -194,7 +194,7 @@
var/datum/robot_component/CO = borg.get_component("radio")
if(!CO)
continue //No radio component (Shouldn't happen)
- if(!borg.is_component_functioning("radio") || !borg.use_power(CO.energy_consumption))
+ if(!borg.is_component_functioning("radio"))
continue //No power.
var/turf/speaker = get_turf(R)
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index c0ce5e0cb61..d96f4124459 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -324,14 +324,13 @@ Class Procs:
////////////////////////////////////////////////////////////////////////////////////////////
-/obj/machinery/attack_ai(var/mob/user as mob)
- if(isrobot(user))
- // For some reason attack_robot doesn't work
- // This is to stop robots from using cameras to remotely control machines.
- if(user.client && user.client.eye == user)
- return src.attack_hand(user)
+/obj/machinery/attack_ai(mob/user)
+ if(isrobot(user))// For some reason attack_robot doesn't work
+ var/mob/living/silicon/robot/R = user
+ if(R.client && R.client.eye == R && !R.low_power_mode)// This is to stop robots from using cameras to remotely control machines; and from using machines when the borg has no power.
+ return attack_hand(user)
else
- return src.attack_hand(user)
+ return attack_hand(user)
/obj/machinery/attack_hand(mob/user as mob)
if(user.lying || user.stat)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index c841f46276a..d74d831deb5 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -247,10 +247,12 @@
/obj/item/attack_ai(mob/user as mob)
if(istype(src.loc, /obj/item/weapon/robot_module))
//If the item is part of a cyborg module, equip it
- if(!isrobot(user)) return
+ if(!isrobot(user))
+ return
var/mob/living/silicon/robot/R = user
- R.activate_module(src)
- R.hud_used.update_robot_modules_display()
+ if(!R.low_power_mode) //can't equip modules with an empty cell.
+ R.activate_module(src)
+ R.hud_used.update_robot_modules_display()
// Due to storage type consolidation this should get used more now.
// I have cleaned it up a little, but it could probably use more. -Sayu
diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm
index 4ceea60dc67..d1e9bb2cdef 100644
--- a/code/game/objects/items/devices/radio/radio.dm
+++ b/code/game/objects/items/devices/radio/radio.dm
@@ -631,13 +631,6 @@ var/global/list/default_medbay_channels = list(
..()
set_frequency(DTH_FREQ)
-/obj/item/device/radio/borg/talk_into()
- . = ..()
- if(isrobot(src.loc))
- var/mob/living/silicon/robot/R = src.loc
- var/datum/robot_component/C = R.components["radio"]
- R.use_power(C.energy_consumption)
-
/obj/item/device/radio/borg/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
// ..()
user.set_machine(src)
diff --git a/code/modules/mob/language.dm b/code/modules/mob/language.dm
index c7565c9252b..2888be2e9cc 100644
--- a/code/modules/mob/language.dm
+++ b/code/modules/mob/language.dm
@@ -530,12 +530,6 @@
continue
M.show_message("synthesised voice beeps, \"beep beep beep\"",2)
- //robot binary xmitter component power usage
- if(isrobot(speaker))
- var/mob/living/silicon/robot/R = speaker
- var/datum/robot_component/C = R.components["comms"]
- R.use_power(C.energy_consumption)
-
/datum/language/binary/drone
name = "Drone Talk"
desc = "A heavily encoded damage control coordination stream."
diff --git a/code/modules/mob/living/silicon/robot/component.dm b/code/modules/mob/living/silicon/robot/component.dm
index 51a22a48d61..f51325f546b 100644
--- a/code/modules/mob/living/silicon/robot/component.dm
+++ b/code/modules/mob/living/silicon/robot/component.dm
@@ -7,7 +7,6 @@
var/toggled = 1
var/brute_damage = 0
var/electronics_damage = 0
- var/energy_consumption = 0
var/max_damage = 30
var/component_disabled = 0
var/mob/living/silicon/robot/owner
@@ -52,28 +51,22 @@
electronics_damage = max(0, electronics_damage - electronics)
/datum/robot_component/proc/is_powered()
- return (installed == 1) && (brute_damage + electronics_damage < max_damage) && (!energy_consumption || powered)
+ return (installed == 1) && (brute_damage + electronics_damage < max_damage) && (powered)
/datum/robot_component/proc/consume_power()
if(toggled == 0)
powered = 0
return
- if(owner.cell.charge >= energy_consumption)
- owner.cell.use(energy_consumption)
- powered = 1
- else
- powered = 0
+ powered = 1
/datum/robot_component/armour
name = "armour plating"
- energy_consumption = 0
external_type = /obj/item/robot_parts/robot_component/armour
max_damage = 100
/datum/robot_component/actuator
name = "actuator"
- energy_consumption = 1
external_type = /obj/item/robot_parts/robot_component/actuator
max_damage = 50
@@ -88,24 +81,20 @@
/datum/robot_component/radio
name = "radio"
external_type = /obj/item/robot_parts/robot_component/radio
- energy_consumption = 1
max_damage = 40
/datum/robot_component/binary_communication
name = "binary communication device"
external_type = /obj/item/robot_parts/robot_component/binary_communication_device
- energy_consumption = 0
max_damage = 30
/datum/robot_component/camera
name = "camera"
external_type = /obj/item/robot_parts/robot_component/camera
- energy_consumption = 1
max_damage = 40
/datum/robot_component/diagnosis_unit
name = "self-diagnosis unit"
- energy_consumption = 1
external_type = /obj/item/robot_parts/robot_component/diagnosis_unit
max_damage = 30
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm
index 071eef98e14..b6a932a52ec 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm
@@ -344,7 +344,7 @@
/mob/living/silicon/robot/drone/use_power()
..()
- if(!src.has_power || !decompiler)
+ if(low_power_mode || !decompiler)
return
//The decompiler replenishes drone stores from hoovered-up junk each tick.
diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm
index 5687cf9e81d..bf7f413708f 100644
--- a/code/modules/mob/living/silicon/robot/emote.dm
+++ b/code/modules/mob/living/silicon/robot/emote.dm
@@ -160,4 +160,15 @@
if("help")
to_chat(src, "salute, bow-(none)/mob, clap, flap, aflap, twitch, twitches, nod, deathgasp, glare-(none)/mob, stare-(none)/mob, look,\n law, halt")
- ..(act, m_type, message)
\ No newline at end of file
+ ..(act, m_type, message)
+
+/mob/living/silicon/robot/verb/powerwarn()
+ set category = "Robot Commands"
+ set name = "Power Warning"
+
+ if(!is_component_functioning("power cell") || !cell || !cell.charge)
+ visible_message("The power warning light on [src] flashes urgently.",\
+ "You announce you are operating in low power mode.")
+ playsound(loc, 'sound/machines/buzz-two.ogg', 50, 0)
+ else
+ to_chat(src, "You can only use this emote when you're out of charge.")
\ No newline at end of file
diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm
index e8e160ccc96..cb207932a9a 100644
--- a/code/modules/mob/living/silicon/robot/examine.dm
+++ b/code/modules/mob/living/silicon/robot/examine.dm
@@ -7,35 +7,40 @@
if(act_module)
msg += "It is holding [bicon(act_module)] \a [act_module].\n"
msg += ""
- if(src.getBruteLoss())
- if(src.getBruteLoss() < 75)
+ if(getBruteLoss())
+ if(getBruteLoss() < maxHealth*0.5)
msg += "It looks slightly dented.\n"
else
msg += "It looks severely dented!\n"
- if(src.getFireLoss())
- if(src.getFireLoss() < 75)
+ if(getFireLoss())
+ if(getFireLoss() < maxHealth*0.5)
msg += "It looks slightly charred.\n"
else
msg += "It looks severely burnt and heat-warped!\n"
- if(src.fire_stacks < 0)
+ if(health < -maxHealth*0.5)
+ msg += "It looks barely operational.\n"
+ if(fire_stacks < 0)
msg += "It's covered in water.\n"
- if(src.fire_stacks > 0)
+ else if(fire_stacks > 0)
msg += "It's coated in something flammable.\n"
msg += ""
if(opened)
msg += "Its cover is open and the power cell is [cell ? "installed" : "missing"].\n"
else
- msg += "Its cover is closed.\n"
+ msg += "Its cover is closed[locked ? "" : ", and looks unlocked"].\n"
- if(!has_power)
- msg += "It appears to be running on backup power.\n"
+ if(cell && cell.charge <= 0)
+ msg += "Its battery indicator is blinking red!\n"
- switch(src.stat)
+ switch(stat)
if(CONSCIOUS)
- if(!src.client) msg += "It appears to be in stand-by mode.\n" //afk
- if(UNCONSCIOUS) msg += "It doesn't seem to be responding.\n"
- if(DEAD) msg += "It looks completely unsalvageable.\n"
+ if(!client)
+ msg += "It appears to be in stand-by mode.\n" //afk
+ if(UNCONSCIOUS)
+ msg += "It doesn't seem to be responding.\n"
+ if(DEAD)
+ msg += "It looks like its system is corrupted and requires a reset.\n"
msg += "*---------*"
if(print_flavor_text()) msg += "\n[print_flavor_text()]\n"
diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm
index e0d7c651844..90dc2a059ac 100644
--- a/code/modules/mob/living/silicon/robot/life.dm
+++ b/code/modules/mob/living/silicon/robot/life.dm
@@ -9,7 +9,7 @@
clamp_values()
if(..())
- use_power()
+ handle_robot_cell()
process_locks()
process_queued_alarms()
@@ -20,57 +20,32 @@
sleeping = 0
ear_deaf = 0
+/mob/living/silicon/robot/proc/handle_robot_cell()
+ if(stat != DEAD)
+ if(!is_component_functioning("power cell") || !cell)
+ Paralyse(2)
+ uneq_all()
+ low_power_mode = 1
+ update_headlamp()
+ diag_hud_set_borgcell()
+ return
+ if(low_power_mode)
+ if(is_component_functioning("power cell") && cell && cell.charge)
+ low_power_mode = 0
+ update_headlamp()
+ else if(stat == CONSCIOUS)
+ use_power()
/mob/living/silicon/robot/proc/use_power()
- if(stat == DEAD)
- return
- else if(is_component_functioning("power cell") && cell)
- if(module)
- for(var/obj/item/borg/B in get_all_slots())
- if(B.powerneeded)
- if((cell.charge * 100 / cell.maxcharge) < B.powerneeded)
- to_chat(src, "Deactivating [B.name] due to lack of power!")
- uneq_module(B)
- if(cell.charge <= 0)
+ if(is_component_functioning("power cell") && cell && cell.charge)
+ if(cell.charge <= 100)
uneq_all()
- update_headlamp(1)
- stat = UNCONSCIOUS
- has_power = 0
- for(var/V in components)
- var/datum/robot_component/C = components[V]
- if(C.name == "actuator") // Let drained robots move, disable the rest
- continue
- C.consume_power()
- else if(cell.charge <= 100)
- uneq_all()
- cell.use(1)
- else
- if(module_state_1)
- cell.use(4)
- if(module_state_2)
- cell.use(4)
- if(module_state_3)
- cell.use(4)
-
- for(var/V in components)
- var/datum/robot_component/C = components[V]
- C.consume_power()
-
- var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
- cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
-
- if(!is_component_functioning("actuator"))
- Paralyse(3)
- eye_blind = 0
- // Please, PLEASE be careful with statements like this - make sure they're not
- // dead beforehand, for example -- Crazylemon
- stat = CONSCIOUS
- has_power = 1
+ var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
+ cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
else
uneq_all()
- stat = UNCONSCIOUS
- update_headlamp(1)
- Paralyse(3)
+ low_power_mode = 1
+ update_headlamp()
diag_hud_set_borgcell()
/mob/living/silicon/robot/handle_regular_status_updates()
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index be7e2e302a5..cc586d37bb7 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -61,7 +61,7 @@ var/list/robot_verbs_default = list(
var/datum/effect/system/ion_trail_follow/ion_trail = null
var/datum/effect/system/spark_spread/spark_system//So they can initialize sparks whenever/N
var/jeton = 0
- var/has_power = 1
+ var/low_power_mode = 0 //whether the robot has no charge left.
var/weapon_lock = 0
var/weaponlock_time = 120
var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default
@@ -231,8 +231,6 @@ var/list/robot_verbs_default = list(
/mob/living/silicon/robot/binarycheck()
if(is_component_functioning("comms"))
- var/datum/robot_component/RC = get_component("comms")
- use_power(RC.energy_consumption)
return 1
return 0
@@ -413,7 +411,7 @@ var/list/robot_verbs_default = list(
var/dat = "
[src.name] Self-Diagnosis Report\n"
for(var/V in components)
var/datum/robot_component/C = components[V]
- dat += "[C.name]
| Power consumption | [C.energy_consumption] |
| Brute Damage: | [C.brute_damage] |
| Electronics Damage: | [C.electronics_damage] |
| Powered: | [(!C.energy_consumption || C.is_powered()) ? "Yes" : "No"] |
| Toggled: | [ C.toggled ? "Yes" : "No"] |
"
+ dat += "[C.name]
| Brute Damage: | [C.brute_damage] |
| Electronics Damage: | [C.electronics_damage] |
| Powered: | [C.is_powered() ? "Yes" : "No"] |
| Toggled: | [ C.toggled ? "Yes" : "No"] |
"
return dat
@@ -992,7 +990,7 @@ var/list/robot_verbs_default = list(
/mob/living/silicon/robot/update_icons()
overlays.Cut()
- if(stat != DEAD && !(paralysis || stunned || weakened)) //Not dead, not stunned.
+ if(stat != DEAD && !(paralysis || stunned || weakened || low_power_mode)) //Not dead, not stunned.
overlays += "eyes-[icon_state]"
else
overlays -= "eyes"
@@ -1130,7 +1128,7 @@ var/list/robot_verbs_default = list(
radio.interact(src)//Just use the radio's Topic() instead of bullshit special-snowflake code
/mob/living/silicon/robot/proc/control_headlamp()
- if(stat || lamp_recharging)
+ if(stat || lamp_recharging || low_power_mode)
to_chat(src, "This function is currently offline.")
return
@@ -1142,7 +1140,7 @@ var/list/robot_verbs_default = list(
/mob/living/silicon/robot/proc/update_headlamp(var/turn_off = 0, var/cooldown = 100)
set_light(0)
- if(lamp_intensity && (turn_off || stat))
+ if(lamp_intensity && (turn_off || stat || low_power_mode))
to_chat(src, "Your headlamp has been deactivated.")
lamp_intensity = 0
lamp_recharging = 1
@@ -1477,4 +1475,4 @@ var/list/robot_verbs_default = list(
if(1)
disable_component("comms", 160)
if(2)
- disable_component("comms", 60)
+ disable_component("comms", 60)
\ No newline at end of file