-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3607 from MistakeNot4892/hallucinations
Hallucinations cleanup and move down to /mob/living.
- Loading branch information
Showing
17 changed files
with
413 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
//Hallucination effects datums | ||
////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
/datum/hallucination | ||
var/mob/living/holder | ||
var/allow_duplicates = 1 | ||
var/duration = 0 | ||
var/min_power = 0 //at what levels of hallucination power mobs should get it | ||
var/max_power = INFINITY | ||
var/activated = FALSE | ||
|
||
/datum/hallucination/proc/start() | ||
SHOULD_CALL_PARENT(TRUE) | ||
activated = TRUE | ||
|
||
/datum/hallucination/proc/end() | ||
SHOULD_CALL_PARENT(TRUE) | ||
activated = FALSE | ||
|
||
/datum/hallucination/proc/can_affect(var/mob/living/victim) | ||
if(!victim.client) | ||
return FALSE | ||
if(min_power > victim.hallucination_power) | ||
return FALSE | ||
if(max_power < victim.hallucination_power) | ||
return FALSE | ||
if(!allow_duplicates && (locate(type) in victim._hallucinations)) | ||
return FALSE | ||
return TRUE | ||
|
||
/datum/hallucination/Destroy() | ||
if(holder) | ||
LAZYREMOVE(holder._hallucinations, src) | ||
holder = null | ||
if(activated) | ||
end() | ||
return ..() | ||
|
||
/datum/hallucination/proc/activate_hallucination() | ||
set waitfor = FALSE | ||
if(!holder || !holder.client || activated) | ||
return | ||
LAZYADD(holder._hallucinations, src) | ||
start() | ||
sleep(duration) | ||
if(!QDELETED(src)) | ||
qdel(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//Fake attack | ||
/datum/hallucination/fakeattack | ||
min_power = 30 | ||
|
||
/datum/hallucination/fakeattack/can_affect(var/mob/living/victim) | ||
. = ..() && (locate(/mob/living) in oview(victim,1)) | ||
|
||
/datum/hallucination/fakeattack/start() | ||
. = ..() | ||
for(var/mob/living/assailant in oview(holder,1)) | ||
to_chat(holder, SPAN_DANGER("\The [assailant] has punched \the [holder]!")) | ||
holder.playsound_local(get_turf(holder),"punch",50) | ||
|
||
//Fake injection | ||
/datum/hallucination/fakeattack/hypo | ||
min_power = 30 | ||
|
||
/datum/hallucination/fakeattack/hypo/start() | ||
. = ..() | ||
to_chat(holder, SPAN_NOTICE("You feel a tiny prick!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//Hearing someone being shot twice | ||
/datum/hallucination/gunfire | ||
duration = 15 | ||
min_power = 30 | ||
var/gunshot | ||
var/turf/origin | ||
var/static/list/gunshot_sounds = list( | ||
'sound/weapons/gunshot/gunshot_strong.ogg', | ||
'sound/weapons/gunshot/gunshot2.ogg', | ||
'sound/weapons/gunshot/shotgun.ogg', | ||
'sound/weapons/gunshot/gunshot.ogg', | ||
'sound/weapons/Taser.ogg' | ||
) | ||
|
||
/datum/hallucination/gunfire/start() | ||
. = ..() | ||
gunshot = pick(gunshot_sounds) | ||
var/turf/holder_turf = get_turf(holder) | ||
if(isturf(holder_turf)) | ||
origin = locate(holder_turf.x + rand(4,8), holder_turf.y + rand(4,8), holder_turf.z) | ||
if(origin) | ||
holder.playsound_local(origin, gunshot, 50) | ||
|
||
/datum/hallucination/gunfire/end() | ||
. = ..() | ||
if(holder && origin) | ||
holder.playsound_local(origin, gunshot, 50) | ||
|
||
/datum/hallucination/gunfire/Destroy() | ||
origin = null | ||
return ..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
//Seeing stuff | ||
/datum/hallucination/mirage | ||
duration = 30 SECONDS | ||
max_power = 30 | ||
var/number = 1 | ||
var/list/things = list() //list of images to display | ||
var/static/list/trash_states = icon_states('icons/obj/trash.dmi') | ||
|
||
/datum/hallucination/mirage/proc/generate_mirage() | ||
return image('icons/obj/trash.dmi', pick(trash_states), layer = BELOW_TABLE_LAYER) | ||
|
||
/datum/hallucination/mirage/start() | ||
. = ..() | ||
var/list/possible_points = list() | ||
for(var/turf/simulated/floor/F in view(holder, world.view+1)) | ||
possible_points += F | ||
if(possible_points.len) | ||
for(var/i = 1 to number) | ||
var/image/thing = generate_mirage() | ||
things += thing | ||
thing.loc = pick(possible_points) | ||
if(holder?.client && length(things)) | ||
holder.client.images += things | ||
|
||
/datum/hallucination/mirage/end() | ||
if(holder?.client) | ||
holder.client.images -= things | ||
return ..() | ||
|
||
//Blood and aftermath of firefight | ||
/datum/hallucination/mirage/carnage | ||
min_power = 50 | ||
number = 10 | ||
var/static/list/carnage_states = list( | ||
"mfloor1", | ||
"mfloor2", | ||
"mfloor3", | ||
"mfloor4", | ||
"mfloor5", | ||
"mfloor6", | ||
"mfloor7" | ||
) | ||
|
||
/datum/hallucination/mirage/carnage/generate_mirage() | ||
var/image/I | ||
if(prob(50)) | ||
I = image('icons/effects/blood.dmi', pick(carnage_states), layer = BELOW_TABLE_LAYER) | ||
I.color = COLOR_BLOOD_HUMAN | ||
else | ||
I = image('icons/obj/ammo.dmi', "s-casing-spent", layer = BELOW_TABLE_LAYER) | ||
I.layer = BELOW_TABLE_LAYER | ||
I.dir = pick(global.alldirs) | ||
I.pixel_x = rand(-10,10) | ||
I.pixel_y = rand(-10,10) | ||
return I | ||
|
||
//LOADSEMONEY | ||
/datum/hallucination/mirage/money | ||
min_power = 20 | ||
max_power = 45 | ||
number = 2 | ||
var/static/obj/item/cash/cash | ||
|
||
/datum/hallucination/mirage/money/New() | ||
if(!cash) | ||
cash = new /obj/item/cash/c500 | ||
cash.update_icon() | ||
cash.compile_overlays() | ||
..() | ||
|
||
/datum/hallucination/mirage/money/generate_mirage() | ||
var/image/I = new | ||
I.appearance = cash | ||
I.layer = BELOW_TABLE_LAYER | ||
qdel(cash) | ||
return I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//Spiderling skitters | ||
/datum/hallucination/skitter/start() | ||
. = ..() | ||
to_chat(holder, SPAN_NOTICE("The spiderling skitters[pick(" away"," around","")].")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
//Playing a random sound | ||
/datum/hallucination/imagined_sound/proc/get_imagined_sounds() | ||
var/static/list/sounds = list( | ||
'sound/machines/airlock.ogg', | ||
'sound/effects/explosionfar.ogg', | ||
'sound/machines/windowdoor.ogg', | ||
'sound/machines/twobeep.ogg' | ||
) | ||
return sounds | ||
|
||
/datum/hallucination/imagined_sound/start() | ||
. = ..() | ||
var/turf/holder_turf = get_turf(holder) | ||
if(holder_turf) | ||
holder_turf = locate(holder_turf.x + rand(6,11), holder_turf.y + rand(6,11), holder_turf.z) | ||
if(holder_turf) | ||
holder.playsound_local(holder_turf, pick(get_imagined_sounds()) ,70) | ||
|
||
/datum/hallucination/imagined_sound/tools/get_imagined_sounds() | ||
var/static/list/imagined_sounds = list( | ||
'sound/items/Ratchet.ogg', | ||
'sound/items/Welder.ogg', | ||
'sound/items/Crowbar.ogg', | ||
'sound/items/Screwdriver.ogg' | ||
) | ||
return imagined_sounds | ||
|
||
/datum/hallucination/imagined_sound/danger | ||
min_power = 30 | ||
|
||
/datum/hallucination/imagined_sound/danger/get_imagined_sounds() | ||
var/static/list/imagined_sounds = list( | ||
'sound/effects/Explosion1.ogg', | ||
'sound/effects/Explosion2.ogg', | ||
'sound/effects/Glassbr1.ogg', | ||
'sound/effects/Glassbr2.ogg', | ||
'sound/effects/Glassbr3.ogg', | ||
'sound/weapons/smash.ogg' | ||
) | ||
return imagined_sounds | ||
|
||
/datum/hallucination/imagined_sound/spooky | ||
min_power = 50 | ||
|
||
/datum/hallucination/imagined_sound/spooky/get_imagined_sounds() | ||
var/static/list/imagined_sounds = list( | ||
'sound/effects/ghost.ogg', | ||
'sound/effects/ghost2.ogg', | ||
'sound/effects/Heart Beat.ogg', | ||
'sound/effects/screech.ogg', | ||
'sound/hallucinations/behind_you1.ogg', | ||
'sound/hallucinations/behind_you2.ogg', | ||
'sound/hallucinations/far_noise.ogg', | ||
'sound/hallucinations/growl1.ogg', | ||
'sound/hallucinations/growl2.ogg', | ||
'sound/hallucinations/growl3.ogg', | ||
'sound/hallucinations/im_here1.ogg', | ||
'sound/hallucinations/im_here2.ogg', | ||
'sound/hallucinations/i_see_you1.ogg', | ||
'sound/hallucinations/i_see_you2.ogg', | ||
'sound/hallucinations/look_up1.ogg', | ||
'sound/hallucinations/look_up2.ogg', | ||
'sound/hallucinations/over_here1.ogg', | ||
'sound/hallucinations/over_here2.ogg', | ||
'sound/hallucinations/over_here3.ogg', | ||
'sound/hallucinations/turn_around1.ogg', | ||
'sound/hallucinations/turn_around2.ogg', | ||
'sound/hallucinations/veryfar_noise.ogg', | ||
'sound/hallucinations/wail.ogg' | ||
) | ||
return imagined_sounds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//Spiders in your body | ||
/datum/hallucination/spiderbabies | ||
min_power = 40 | ||
|
||
/datum/hallucination/spiderbabies/start() | ||
. = ..() | ||
var/list/limbs = holder.get_external_organs() | ||
if(!LAZYLEN(limbs)) | ||
return | ||
var/obj/O = pick(limbs) | ||
to_chat(holder, SPAN_WARNING("You feel something [pick("moving","squirming","skittering")] inside of your [O.name]!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//Hearing someone talking to/about you. | ||
/datum/hallucination/talking/can_affect(var/mob/living/victim) | ||
return ..() && (locate(/mob/living) in oview(victim)) | ||
|
||
/datum/hallucination/talking/start() | ||
. = ..() | ||
var/sanity = 5 //even insanity needs some sanity | ||
for(var/mob/living/talker in oview(holder)) | ||
if(talker.stat) | ||
continue | ||
var/message | ||
if(prob(80)) | ||
var/list/names = list() | ||
var/lastname = copytext(holder.real_name, findtext(holder.real_name, " ")+1) | ||
var/firstname = copytext(holder.real_name, 1, findtext(holder.real_name, " ")) | ||
if(lastname) names += lastname | ||
if(firstname) names += firstname | ||
if(!names.len) | ||
names += holder.real_name | ||
var/add = prob(20) ? ", [pick(names)]" : "" | ||
var/list/phrases = list("[prob(50) ? "Hey, " : ""][pick(names)]!","[prob(50) ? "Hey, " : ""][pick(names)]?","Get out[add]!","Go away[add].","What are you doing[add]?","Where's your ID[add]?") | ||
if(holder.hallucination_power > 50) | ||
phrases += list("What did you come here for[add]?","Don't touch me[add].","You're not getting out of here[add].", "You are a failure, [pick(names)].","Just kill yourself already, [pick(names)].","Put on some clothes[add].","Take off your clothes[add].") | ||
message = pick(phrases) | ||
to_chat(holder,"<span class='game say'><span class='name'>[talker.name]</span> [holder.say_quote(message)], <span class='message'><span class='body'>\"[message]\"</span></span></span>") | ||
else | ||
to_chat(holder,"<B>[talker.name]</B> points at [holder.name]") | ||
to_chat(holder,"<span class='game say'><span class='name'>[talker.name]</span> says something softly.</span>") | ||
|
||
var/speech_state = holder.check_speech_punctuation_state(message) | ||
if(speech_state) | ||
var/image/speech_bubble = image('icons/mob/talk.dmi', talker, speech_state) | ||
addtimer(CALLBACK(src, PROC_REF(qdel_image), speech_bubble), 3 SECONDS) | ||
show_image(holder, speech_bubble) | ||
|
||
sanity-- //don't spam them in very populated rooms. | ||
if(!sanity) | ||
break | ||
|
||
/datum/hallucination/talking/proc/qdel_image(var/image/speech_bubble) | ||
qdel(speech_bubble) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//Fake telepathy | ||
/datum/hallucination/telepathy | ||
allow_duplicates = 0 | ||
duration = 20 MINUTES | ||
|
||
/datum/hallucination/telepathy/start() | ||
. = ..() | ||
to_chat(holder, SPAN_NOTICE("You expand your mind outwards.")) | ||
holder.verbs += /mob/living/carbon/human/proc/fakeremotesay | ||
|
||
/datum/hallucination/telepathy/end() | ||
. = ..() | ||
if(holder) | ||
holder.verbs -= /mob/living/carbon/human/proc/fakeremotesay | ||
|
||
/mob/living/carbon/human/proc/fakeremotesay() | ||
set name = "Telepathic Message" | ||
set category = "Superpower" | ||
|
||
if(!hallucination_power) | ||
src.verbs -= /mob/living/carbon/human/proc/fakeremotesay | ||
return | ||
|
||
if(stat) | ||
to_chat(usr, SPAN_WARNING("You're not in any state to use your powers right now!")) | ||
return | ||
|
||
if(has_chemical_effect(CE_MIND, 1)) | ||
to_chat(usr, SPAN_WARNING("Chemicals in your blood prevent you from using your power!")) | ||
|
||
var/list/creatures = list() | ||
for(var/mob/living/carbon/C in SSmobs.mob_list) | ||
creatures += C | ||
creatures -= usr | ||
var/mob/target = input("Who do you want to project your mind to?") as null|anything in creatures | ||
if (isnull(target)) | ||
return | ||
|
||
var/msg = sanitize(input(usr, "What do you wish to transmit")) | ||
show_message(SPAN_NOTICE("You project your mind into [target.name]: \"[msg]\"")) | ||
if(!stat && prob(20)) | ||
say(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.