Files
Aurora.3/code/modules/shareddream/brainghost.dm
William Lemon d9450e5dab Adds Skrell Shared Dreaming (#5707)
Implements skrell shared dreaming.

Whilst Unconscious and alive, skrell will enter the Srom, aka Dream, in which they telepathically link to one another.
In game, they will appear in a custom area, able to communicate with one another.
Whilst in Srom, skrell find it very hard to keep their own secrets, if not impossible, and will often 'mumble' important information.
2018-12-11 11:44:28 +02:00

65 lines
2.2 KiB
Plaintext

/mob/living/brain_ghost
name = "Brain Ghost"
desc = "A Telepathic connection."
alpha = 200
var/image/ghostimage = null
var/mob/living/carbon/human/body = null
/mob/living/brain_ghost/Initialize()
. = ..()
var/mob/living/carbon/human/form = loc
if(!istype(form))
qdel(src)
return
overlays += image(form.icon,form,form.icon_state)
overlays += form.overlays
name = form.real_name
loc = pick(dream_entries)
body = form
/mob/living/brain_ghost/verb/awaken()
set name = "Awaken"
set category = "IC"
if(body.willfully_sleeping)
body.sleeping = max(body.sleeping - 5, 0)
body.willfully_sleeping = 0
src << "<span class='notice'>You release your concentration on sleep, allowing yourself to awake.</span>"
else
src << "<span class='warning'>You've already released concentration. Wait to wake up naturally.</span>"
/mob/living/brain_ghost/Life()
..()
// Out body was probs gibbed or somefin
if(!istype(body))
show_message("<span class='danger'>[src] suddenly pops from the Srom.</span>")
src << "<span class='danger'>Your body was destroyed!</span>"
qdel(src)
return
if(body.stat == DEAD) // Body is dead, and won't get a life tick.
body.handle_shared_dreaming()
/mob/living/brain_ghost/say(var/message, var/datum/language/speaking = null, var/verb="says", var/alt_name="")
if(!istype(body) || body.stat!=UNCONSCIOUS)
return
if(prob(20)) // 1/5 chance to mumble out anything you say in the dream.
var/list/words = text2list(replacetext(message, "\[^a-zA-Z]*$", ""), " ")
var/word_count = rand(1, words.len) // How many words to mumble out from within the sentance
var/words_start = rand(1, words.len - (word_count - 1)) // Where the chunk of said words should start.
var/mumble_into = words_start == 1 ? "" : "..." // Text to show if we start mumbling after the start of a sentance
words = words.Copy(words_start, word_count + words_start) // Copy the chunk of the message we mumbled.
var/mumble_message = "[mumble_into][words.Join(" ")]..."
body.stat = CONSCIOUS // FILTHY hack to get the sleeping person to say something.
body.say(mumble_message) // Mumble in Nral Malic
body.stat = UNCONSCIOUS // Toggled before anything else can happen. Ideally.
..(message, speaking, verb="says", alt_name="")