A few fixes to robot organs.

- Forgot .dme
- Made sure repairs and damage only work on installed modules.
- Removed is_functioning() because it was a silly proc to have.
This commit is contained in:
cib
2013-06-22 21:41:41 +02:00
parent b58326c8fa
commit 3aa3da29be
3 changed files with 10 additions and 15 deletions

View File

@@ -16,10 +16,6 @@
// The wrapped device(e.g. radio), only set if external_type isn't null
/datum/robot_component/var/obj/item/wrapped = null
/datum/robot_component/proc/is_functioning()
return brute_damage + electronics_damage < 30
/datum/robot_component/New(mob/living/silicon/robot/R)
src.owner = R
@@ -46,8 +42,8 @@
if(brute_damage + electronics_damage > max_damage) destroy()
/datum/robot_component/proc/heal_damage(brute, electronics)
if(!is_functioning())
// If it's not functioning, it's beyond repairing without taking it out.
if(installed != 1)
// If it's not installed, can't repair it.
return 0
brute_damage = max(0, brute_damage - brute)
@@ -146,4 +142,4 @@
name = "diagnosis unit"
/obj/item/robot_parts/robot_component/radio
name = "radio"
name = "radio"

View File

@@ -2,14 +2,14 @@
var/amount = 0
for(var/V in components)
var/datum/robot_component/C = components[V]
amount += C.brute_damage
if(C.installed == 1) amount += C.brute_damage
return amount
/mob/living/silicon/robot/getFireLoss()
var/amount = 0
for(var/V in components)
var/datum/robot_component/C = components[V]
amount += C.electronics_damage
if(C.installed == 1) amount += C.electronics_damage
return amount
@@ -29,7 +29,7 @@
var/list/datum/robot_component/parts = list()
for(var/V in components)
var/datum/robot_component/C = components[V]
if((brute && C.brute_damage) || (burn && C.electronics_damage))
if(C.installed == 1) if((brute && C.brute_damage) || (burn && C.electronics_damage))
parts += C
return parts
@@ -53,16 +53,13 @@
/mob/living/silicon/robot/heal_overall_damage(var/brute, var/burn)
var/list/datum/robot_component/parts = get_damaged_components(brute,burn)
log_debug("Healing [brute] brute and [burn] burn with [parts.len] parts")
while(parts.len && (brute>0 || burn>0) )
var/datum/robot_component/picked = pick(parts)
var/brute_was = picked.brute_damage
var/burn_was = picked.electronics_damage
log_debug("Healing [picked.name]")
picked.heal_damage(brute,burn)
log_debug("[brute] brute and [burn] burn left to heal")
brute -= (brute_was-picked.brute_damage)
burn -= (burn_was-picked.electronics_damage)
@@ -83,4 +80,4 @@
brute -= (picked.brute_damage - brute_was)
burn -= (picked.electronics_damage - burn_was)
parts -= picked
parts -= picked