/
minor.dm
198 lines (179 loc) · 6.11 KB
/
minor.dm
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/**
* # Hallucination - Audio
*
* Plays a random sound.
*/
/obj/effect/hallucination/audio
duration = 0
/// Associative list of sounds that may be played. Value corresponds to the volume.
var/list/sounds = list(
'sound/effects/explosionfar.ogg' = 50,
'sound/effects/pray_chaplain.ogg' = 50,
'sound/machines/alarm.ogg' = 100,
'sound/magic/summon_guns.ogg' = 50,
)
/obj/effect/hallucination/audio/Initialize(mapload, mob/living/carbon/target, atom/source = null)
. = ..()
var/snd = pick(sounds)
target.playsound_local(source, snd, sounds[snd])
/**
* # Hallucination - Audio (Localized)
*
* Plays a random sound at a random location around the target.
*/
/obj/effect/hallucination/audio/localized
sounds = list(
'sound/effects/explosion1.ogg' = 50,
'sound/effects/explosion2.ogg' = 50,
'sound/effects/glassbr1.ogg' = 50,
'sound/effects/glassbr2.ogg' = 50,
'sound/effects/glassbr3.ogg' = 50,
'sound/machines/airlock_open.ogg' = 50,
)
/obj/effect/hallucination/audio/localized/Initialize(mapload, mob/living/carbon/target)
var/list/turfs = list()
for(var/turf/T in range(world.view, target))
turfs += T
if(length(turfs))
. = ..(mapload, target, pick(turfs))
else
. = ..(mapload, target)
/**
* # Hallucination - Bolts
*
* Visually bolts a random number of airlocks around the target.
*/
/obj/effect/hallucination/bolts
duration = 15 SECONDS
/// The maximum amount of airlocks to fake bolt.
var/bolt_amount = 2
/// The duration of fake bolt in deciseconds.
var/bolt_duration = 10 SECONDS
/// Lazy list of fake bolted airlocks. Key is airlock, value is bolt overlay.
var/list/bolted
/obj/effect/hallucination/bolts/Initialize(mapload, mob/living/carbon/target)
. = ..()
var/list/airlocks = list()
for(var/obj/machinery/door/airlock/A in oview(world.view, target))
airlocks += A
var/num_bolted = 0
while(bolt_amount && length(airlocks))
var/obj/machinery/door/airlock/A = pick_n_take(airlocks)
if(A.locked)
continue
addtimer(CALLBACK(src, PROC_REF(do_bolt), A), num_bolted++ * rand(5, 7))
bolt_amount--
/**
* Called in a timer to fake bolt the given airlock.
*
* Arguments:
* * A - The airlock to fake bolt.
*/
/obj/effect/hallucination/bolts/proc/do_bolt(obj/machinery/door/airlock/A)
if(QDELETED(A) || (A.locked && A.arePowerSystemsOn()) || A.operating || !A.density)
return
var/bolt_overlay = image(get_airlock_overlay("lights_bolts", A.overlays_file), A)
add_icon(bolt_overlay)
target?.playsound_local(get_turf(A), A.boltDown, 30, FALSE, 3)
LAZYSET(bolted, A, bolt_overlay)
// Timer and signal to turn it off (only one can happen)
RegisterSignal(A, COMSIG_AIRLOCK_OPEN, PROC_REF(do_unbolt))
addtimer(CALLBACK(src, PROC_REF(do_unbolt), A, bolt_overlay), bolt_duration)
/**
* Called in a timer to fake unbolt the given airlock.
*
* Arguments:
* * A - The airlock to fake unbolt.
* * bolt_overlay - The bolt overlay image currently displayed on A.
*/
/obj/effect/hallucination/bolts/proc/do_unbolt(obj/machinery/door/airlock/A, image/bolt_overlay)
if(QDELETED(A))
return
// bolt_overlay is null if this proc is called from the signal, so use the lookup table to retrieve it
bolt_overlay = bolt_overlay || bolted[A]
if(QDELETED(bolt_overlay))
return
UnregisterSignal(A, COMSIG_AIRLOCK_CLOSE)
clear_icon(bolt_overlay)
target?.playsound_local(get_turf(A), A.boltUp, 30, FALSE, 3)
bolted[A] = null
/**
* # Hallucination - Speech
*
* Causes the target to hear a fake message from a random mob around them.
*/
/obj/effect/hallucination/speech
duration = 3 SECONDS
/// List of messages that may be heard.
var/list/messages = list(
"I'm watching you...",
"I'm going to kill you!",
"Get out!",
"Kchck-Chkck? Kchchck!",
"Did you hear that?",
"What did you do?",
"Why?",
"Give me that!",
"Honk!",
"Kill me!",
"HELP!!",
"RUN!!",
"EI NATH!!",
"O bidai nabora se'sma!",
"I have the disk!",
)
/obj/effect/hallucination/speech/Initialize(mapload, mob/living/carbon/target)
. = ..()
var/list/mobs = list()
for(var/mob/living/M in oview(world.view, target))
mobs += M
if(!length(mobs))
return
var/mob/living/M = pick(mobs)
var/message = pick(messages + "[target]!")
target.hear_say(message_to_multilingual(message, pick(target.languages)), speaker = M)
// Speech bubble
var/image/speech_bubble = image('icons/mob/talk.dmi', M, "[target.bubble_icon][say_test(message)]", layer = FLY_LAYER)
speech_bubble.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
add_icon(speech_bubble)
/**
* # Hallucination - Fake Danger
*
* Sends a random danger message to the target's chat.
*/
/obj/effect/hallucination/fake_danger
duration = 0
/// List of messages that may be displayed.
var/list/messages = list(
"The light burns you!",
"You experience a stabbing sensation and your ears begin to ring...",
"You get the feeling this is a bad idea.",
"Your blood boils in your veins!",
"You hear a loud buzz in your head, silencing your thoughts!",
"You feel an awful sense of being watched...",
"You suddenly feel very hot.",
"You feel like you could blow up at any moment!",
"You feel hotter than usual. Maybe you should lowe-wait, is that your hand melting?",
"You hear battle shouts. The tramping of boots on cold metal. Screams of agony. The rush of venting air. Are you going insane?",
)
/obj/effect/hallucination/fake_danger/Initialize(mapload, mob/living/carbon/target)
. = ..()
to_chat(target, "<span class='userdanger'>[pick(messages)]</span>")
/**
* # Hallucination - Fake Health
*
* Visually changes the target's health status to something it shouldn't be.
*/
/obj/effect/hallucination/fake_health
duration = list(10 SECONDS, 25 SECONDS)
/obj/effect/hallucination/fake_health/Initialize(mapload, mob/living/carbon/target)
. = ..()
if(target.health > HEALTH_THRESHOLD_CRIT)
target.health_hud_override = pick(HEALTH_HUD_OVERRIDE_CRIT, HEALTH_HUD_OVERRIDE_DEAD)
else
target.health_hud_override = HEALTH_HUD_OVERRIDE_HEALTHY // You think you're fine, but you're not
target.update_health_hud()
/obj/effect/hallucination/fake_health/Destroy()
target?.health_hud_override = HEALTH_HUD_OVERRIDE_NONE
target?.update_health_hud()
return ..()