Files
Paradise/code/game/machinery/camera/presets.dm
Krausus c4d59070f6 Fixes camera upgrades not working properly
Important updates were being done in the malf AI's Upgrade Camera proc,
instead of in the actual upgrade procs
2015-05-11 08:17:08 -04:00

93 lines
2.1 KiB
Plaintext

// PRESETS
// EMP
/obj/machinery/camera/emp_proof/New()
..()
upgradeEmpProof()
// X-RAY
/obj/machinery/camera/xray
icon_state = "xraycam" // Thanks to Krutchen for the icons.
/obj/machinery/camera/xray/New()
..()
upgradeXRay()
// MOTION
/obj/machinery/camera/motion/New()
..()
upgradeMotion()
// ALL UPGRADES
/obj/machinery/camera/all/New()
..()
upgradeEmpProof()
upgradeXRay()
upgradeMotion()
// AUTONAME
/obj/machinery/camera/autoname
var/number = 0 //camera number in area
//This camera type automatically sets it's name to whatever the area that it's in is called.
/obj/machinery/camera/autoname/New()
..()
spawn(10)
number = 1
var/area/A = get_area(src)
if(A)
for(var/obj/machinery/camera/autoname/C in world)
if(C == src) continue
var/area/CA = get_area(C)
if(CA.type == A.type)
if(C.number)
number = max(number, C.number+1)
c_tag = "[A.name] #[number]"
// CHECKS
/obj/machinery/camera/proc/isEmpProof()
var/O = locate(/obj/item/stack/sheet/mineral/plasma) in assembly.upgrades
return O
/obj/machinery/camera/proc/isXRay()
var/O = locate(/obj/item/device/analyzer) in assembly.upgrades
return O
/obj/machinery/camera/proc/isMotion()
var/O = locate(/obj/item/device/assembly/prox_sensor) in assembly.upgrades
return O
// UPGRADE PROCS
/obj/machinery/camera/proc/upgradeEmpProof()
assembly.upgrades.Add(new /obj/item/stack/sheet/mineral/plasma(assembly))
setPowerUsage()
/obj/machinery/camera/proc/upgradeXRay()
assembly.upgrades.Add(new /obj/item/device/analyzer(assembly))
setPowerUsage()
//Update what it can see.
cameranet.updateVisibility(src, 0)
// If you are upgrading Motion, and it isn't in the camera's New(), add it to the machines list.
/obj/machinery/camera/proc/upgradeMotion()
assembly.upgrades.Add(new /obj/item/device/assembly/prox_sensor(assembly))
setPowerUsage()
// Add it to machines that process
machines |= src
/obj/machinery/camera/proc/setPowerUsage()
var/mult = 1
if (isXRay())
mult++
if (isMotion())
mult++
active_power_usage = mult*initial(active_power_usage)