mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-02-07 14:50:21 +00:00
Now possible to use items other than emags on holodeck computers Blobs no longer make computers lose their density state. Holodeck computers can now be repaired (and built, but since they cannot be configured they'll be useless). Fixes #11263.
143 lines
3.0 KiB
Plaintext
143 lines
3.0 KiB
Plaintext
/obj/machinery/computer
|
|
name = "computer"
|
|
icon = 'icons/obj/computer.dmi'
|
|
density = 1
|
|
anchored = 1.0
|
|
use_power = 1
|
|
idle_power_usage = 300
|
|
active_power_usage = 300
|
|
var/circuit = null //The path to the circuit board type. If circuit==null, the computer can't be disassembled.
|
|
var/processing = 0
|
|
|
|
var/light_range_on = 3
|
|
var/light_power_on = 1
|
|
|
|
/obj/machinery/computer/Destroy()
|
|
qdel(circuit)
|
|
circuit = null
|
|
return ..()
|
|
|
|
/obj/machinery/computer/initialize()
|
|
power_change()
|
|
|
|
/obj/machinery/computer/process()
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return 0
|
|
return 1
|
|
|
|
/obj/machinery/computer/meteorhit(var/obj/O as obj)
|
|
for(var/x in verbs)
|
|
verbs -= x
|
|
set_broken()
|
|
var/datum/effect/effect/system/smoke_spread/smoke = PoolOrNew(/datum/effect/effect/system/smoke_spread)
|
|
smoke.set_up(5, 0, src)
|
|
smoke.start()
|
|
return
|
|
|
|
|
|
/obj/machinery/computer/emp_act(severity)
|
|
if(prob(20/severity)) set_broken()
|
|
..()
|
|
|
|
|
|
/obj/machinery/computer/ex_act(severity)
|
|
switch(severity)
|
|
if(1.0)
|
|
qdel(src)
|
|
return
|
|
if(2.0)
|
|
if (prob(25))
|
|
qdel(src)
|
|
return
|
|
if (prob(50))
|
|
for(var/x in verbs)
|
|
verbs -= x
|
|
set_broken()
|
|
if(3.0)
|
|
if (prob(25))
|
|
for(var/x in verbs)
|
|
verbs -= x
|
|
set_broken()
|
|
else
|
|
return
|
|
|
|
/obj/machinery/computer/bullet_act(var/obj/item/projectile/Proj)
|
|
if(!(Proj.damage_type == BRUTE || Proj.damage_type == BURN))
|
|
return
|
|
|
|
if(prob(Proj.damage))
|
|
set_broken()
|
|
..()
|
|
|
|
|
|
/obj/machinery/computer/blob_act()
|
|
if (prob(75))
|
|
for(var/x in verbs)
|
|
verbs -= x
|
|
set_broken()
|
|
|
|
/obj/machinery/computer/update_icon()
|
|
..()
|
|
icon_state = initial(icon_state)
|
|
// Broken
|
|
if(stat & BROKEN)
|
|
icon_state += "b"
|
|
|
|
// Powered
|
|
else if(stat & NOPOWER)
|
|
icon_state = initial(icon_state)
|
|
icon_state += "0"
|
|
|
|
|
|
|
|
/obj/machinery/computer/power_change()
|
|
..()
|
|
update_icon()
|
|
if(stat & NOPOWER)
|
|
set_light(0)
|
|
else
|
|
set_light(light_range_on, light_power_on)
|
|
|
|
|
|
/obj/machinery/computer/proc/set_broken()
|
|
stat |= BROKEN
|
|
update_icon()
|
|
|
|
/obj/machinery/computer/proc/decode(text)
|
|
// Adds line breaks
|
|
text = replacetext(text, "\n", "<BR>")
|
|
return text
|
|
|
|
|
|
/obj/machinery/computer/attack_ghost(user as mob)
|
|
return src.attack_hand(user)
|
|
|
|
/obj/machinery/computer/attack_hand(user as mob)
|
|
/* Observers can view computers, but not actually use them via Topic*/
|
|
if(istype(user, /mob/dead/observer)) return 0
|
|
return ..()
|
|
|
|
/obj/machinery/computer/attackby(I as obj, user as mob)
|
|
if(istype(I, /obj/item/weapon/screwdriver) && circuit)
|
|
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
|
if(do_after(user, 20))
|
|
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
|
var/obj/item/weapon/circuitboard/M = new circuit( A )
|
|
A.circuit = M
|
|
A.anchored = 1
|
|
for (var/obj/C in src)
|
|
C.loc = src.loc
|
|
if (src.stat & BROKEN)
|
|
user << "<span class='notice'>The broken glass falls out.</span>"
|
|
new /obj/item/weapon/material/shard( src.loc )
|
|
A.state = 3
|
|
A.icon_state = "3"
|
|
else
|
|
user << "<span class='notice'>You disconnect the monitor.</span>"
|
|
A.state = 4
|
|
A.icon_state = "4"
|
|
M.deconstruct(src)
|
|
qdel(src)
|
|
else
|
|
..()
|