forked from yogstation13/Yogstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimplant_psi.dm
More file actions
113 lines (95 loc) · 3.79 KB
/
Copy pathimplant_psi.dm
File metadata and controls
113 lines (95 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/obj/item/implant/psi_control
name = "psi dampener implant"
desc = "A safety implant for registered psi-operants."
implant_color = "n"
activated = FALSE
var/overload = 0
var/max_overload = 100
var/psi_mode = PSI_IMPLANT_AUTOMATIC
/obj/item/implant/psi_control/get_data()
var/dat = {"<b>Implant Specifications:</b><BR>
<b>Name:</b> Nanotrasen Psionic Mitigation Implant<BR>
<b>Life:</b> Ten years.<BR>
<b>Important Notes:</b> Psionic personel injected with this device can have their psionic potental di.<BR>
<HR>
<b>Implant Details:</b><BR>
<b>Function:</b> Contains a small pod of nanobots that protects the host's mental functions from manipulation.<BR>
<b>Special Features:</b> Will prevent and cure most forms of brainwashing.<BR>
<b>Integrity:</b> Implant will last so long as the nanobots are inside the bloodstream."}
return dat
/obj/item/implant/psi_control/Initialize()
. = ..()
SSpsi.psi_dampeners += src
/obj/item/implant/psi_control/Destroy()
SSpsi.psi_dampeners -= src
. = ..()
/obj/item/implant/psi_control/disrupts_psionics()
var/use_psi_mode = get_psi_mode()
return ((use_psi_mode == PSI_IMPLANT_SHOCK || use_psi_mode == PSI_IMPLANT_WARN)) ? src : FALSE
/obj/item/implant/psi_control/removed()
var/mob/living/M = imp_in
if(disrupts_psionics() && istype(M) && M.psi)
to_chat(M, span_notice("You feel the chilly shackles around your psionic faculties fade away."))
. = ..()
/obj/item/implant/psi_control/proc/update_functionality(var/silent)
var/mob/living/M = imp_in
if(silent || !M || !M.psi)
return
if(get_psi_mode() == PSI_IMPLANT_DISABLED)
to_chat(M, span_notice("You feel the chilly shackles around your psionic faculties fade away."))
else
to_chat(M, span_notice("Bands of hollow ice close themselves around your psionic faculties."))
/obj/item/implant/psi_control/proc/meltdown()
overload = 100
if(imp_in)
SSpsi.report_failure(src)
psi_mode = PSI_IMPLANT_DISABLED
update_functionality()
/obj/item/implant/psi_control/proc/get_psi_mode()
if(psi_mode == PSI_IMPLANT_AUTOMATIC)
switch(get_security_level())
if("green")
return PSI_IMPLANT_SHOCK
if("blue")
return PSI_IMPLANT_WARN
else
return PSI_IMPLANT_DISABLED
return psi_mode
/obj/item/implant/psi_control/withstand_psi_stress(var/stress, var/atom/source)
var/use_psi_mode = get_psi_mode()
if(use_psi_mode == PSI_IMPLANT_DISABLED)
return stress
. = 0
if(stress > 0)
// If we're disrupting psionic attempts at the moment, we might overload.
if(disrupts_psionics())
var/overload_amount = FLOOR(stress, 10)
if(overload_amount > 0)
overload += overload_amount
if(overload >= 100)
if(imp_in)
to_chat(imp_in, span_danger("Your psi dampener overloads violently!"))
meltdown()
update_functionality()
return
if(imp_in)
if(overload >= 75 && overload < 100)
to_chat(imp_in, span_danger("Your psi dampener is searing hot!"))
else if(overload >= 50 && overload < 75)
to_chat(imp_in, span_warning("Your psi dampener is uncomfortably hot..."))
else if(overload >= 25 && overload < 50)
to_chat(imp_in, span_warning("You feel your psi dampener heating up..."))
// If all we're doing is logging the incident then just pass back stress without changing it.
if(source && source == imp_in)
SSpsi.report_violation(src, stress)
if(use_psi_mode == PSI_IMPLANT_LOG)
return stress
else if(use_psi_mode == PSI_IMPLANT_SHOCK)
to_chat(imp_in, span_danger("Your psi dampener punishes you with a violent neural shock!"))
imp_in.electrocute_act(5, src)
if(isliving(imp_in))
var/mob/living/M = imp_in
if(M.psi) M.psi.stunned(5)
else if(use_psi_mode == PSI_IMPLANT_WARN)
to_chat(imp_in, span_warning("Your psi dampener primly informs you it has reported this violation."))
// /obj/item/implant/nullglass