Skip to content

Commit

Permalink
Merge pull request tgstation#33958 from XDTM/Morpheus
Browse files Browse the repository at this point in the history
Dreaming Improvements
  • Loading branch information
optimumtact authored Jan 13, 2018
2 parents 217ad3e + b7bcfee commit 618f4dc
Show file tree
Hide file tree
Showing 5 changed files with 1,158 additions and 70 deletions.
2 changes: 2 additions & 0 deletions code/_globalvars/lists/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ GLOBAL_LIST_INIT(megacarp_first_names, world.file2list("strings/names/megacarp1.
GLOBAL_LIST_INIT(megacarp_last_names, world.file2list("strings/names/megacarp2.txt"))

GLOBAL_LIST_INIT(verbs, world.file2list("strings/names/verbs.txt"))
GLOBAL_LIST_INIT(ing_verbs, world.file2list("strings/names/ing_verbs.txt"))
GLOBAL_LIST_INIT(adverbs, world.file2list("strings/names/adverbs.txt"))
GLOBAL_LIST_INIT(adjectives, world.file2list("strings/names/adjectives.txt"))
GLOBAL_LIST_INIT(dream_strings, world.file2list("strings/dreamstrings.txt"))
//loaded on startup because of "
Expand Down
73 changes: 56 additions & 17 deletions code/modules/flufftext/Dreaming.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
/mob/living/carbon/proc/dream()
set waitfor = 0
var/list/dreams = GLOB.dream_strings.Copy()
for(var/obj/item/bedsheet/sheet in loc)
dreams += sheet.dream_messages
var/list/dream_images = list()
for(var/i in 1 to rand(3, rand(5, 10)))
dream_images += pick_n_take(dreams)
dreaming++
for(var/i in 1 to dream_images.len)
addtimer(CALLBACK(src, .proc/experience_dream, dream_images[i]), ((i - 1) * rand(30,60)))
return 1

/mob/living/carbon/proc/handle_dreams()
if(prob(5) && !dreaming)
if(prob(10) && !dreaming)
dream()

/mob/living/carbon/proc/experience_dream(dream_image)
dreaming--
/mob/living/carbon/proc/dream()
set waitfor = FALSE
var/list/dream_fragments = list()
var/fragment = ""

dream_fragments += "you see"

//Subject
fragment += pick(GLOB.dream_strings)
if(prob(50))
fragment = replacetext(fragment, "%ADJECTIVE%", pick(GLOB.adjectives))
else
fragment = replacetext(fragment, "%ADJECTIVE% ", "")
if(findtext(fragment, "%A% "))
fragment = "\a [replacetext(fragment, "%A% ", "")]"
dream_fragments += fragment

//Verb
fragment = ""
if(prob(50))
if(prob(35))
fragment += "[pick(GLOB.adverbs)] "
fragment += pick(GLOB.ing_verbs)
else
fragment += "will "
fragment += pick(GLOB.verbs)
dream_fragments += fragment

if(prob(25))
dream_sequence(dream_fragments)
return

//Object
fragment = ""
fragment += pick(GLOB.dream_strings)
if(prob(50))
fragment = replacetext(fragment, "%ADJECTIVE%", pick(GLOB.adjectives))
else
fragment = replacetext(fragment, "%ADJECTIVE% ", "")
if(findtext(fragment, "%A% "))
fragment = "\a [replacetext(fragment, "%A% ", "")]"
dream_fragments += fragment

dreaming = TRUE
dream_sequence(dream_fragments)

/mob/living/carbon/proc/dream_sequence(list/dream_fragments)
if(stat != UNCONSCIOUS || InCritical())
dreaming = FALSE
return
to_chat(src, "<span class='notice'><i>... [dream_image] ...</i></span>")
var/next_message = dream_fragments[1]
dream_fragments.Cut(1,2)
to_chat(src, "<span class='notice'><i>... [next_message] ...</i></span>")
if(LAZYLEN(dream_fragments))
addtimer(CALLBACK(src, .proc/dream_sequence, dream_fragments), rand(10,30))
else
dreaming = FALSE
89 changes: 36 additions & 53 deletions strings/dreamstrings.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,44 @@
a familiar face
a crewmember
a security officer
a doctor
an engineer
a miner
a slime
an alien
a traitor
an ally
a scientist
a monkey
a loved one
a monster
the captain
a hat
an ID card
a bottle
a toolbox
a gun
%A% %ADJECTIVE% familiar face
%A% %ADJECTIVE% crewmember
%A% %ADJECTIVE% security officer
%A% %ADJECTIVE% doctor
%A% %ADJECTIVE% engineer
%A% %ADJECTIVE% miner
%A% %ADJECTIVE% slime
%A% %ADJECTIVE% alien
%A% %ADJECTIVE% traitor
%A% %ADJECTIVE% ally
%A% %ADJECTIVE% scientist
%A% %ADJECTIVE% monkey
%A% %ADJECTIVE% loved one
%A% %ADJECTIVE% monster
the %ADJECTIVE% captain
%A% %ADJECTIVE% hat
%A% %ADJECTIVE% ID card
%A% %ADJECTIVE% bottle
%A% %ADJECTIVE% toolbox
%A% %ADJECTIVE% gun
the sun
the engine
the station
a planet
%A% %ADJECTIVE% planet
the medical bay
the bridge
the brig
a shuttle
a laboratory
the %ADJECTIVE% bridge
the %ADJECTIVE% brig
%A% %ADJECTIVE% shuttle
%A% %ADJECTIVE% laboratory
Nanotrasen
the Syndicate
the Wizard Federation
blood
plasma
air
warmth
freezing
wind
darkness
light
life
death
blinking lights
healing
power
respect
riches
space
time
deep space
a crash
a catastrophe
happiness
pride
a fall
%ADJECTIVE% blood
%ADJECTIVE% plasma
%ADJECTIVE% wind
%ADJECTIVE% darkness
%ADJECTIVE% light
%ADJECTIVE% death
%ADJECTIVE% blinking lights
%ADJECTIVE% power
%ADJECTIVE% riches
water
flames
ice
melons
flying
voices from all around
%ADJECTIVE% flames
some %ADJECTIVE% melons
135 changes: 135 additions & 0 deletions strings/names/adverbs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
accidentally
angrily
annually
anxiously
awkwardly
badly
blindly
boastfully
boldly
bravely
briefly
brightly
busily
calmly
carefully
carelessly
cautiously
cheerfully
clearly
correctly
courageously
crossly
cruelly
daily
defiantly
deliberately
doubtfully
easily
elegantly
enormously
enthusiastically
equally
eventually
exactly
faithfully
fatally
fiercely
fondly
foolishly
fortunately
frantically
gently
gladly
gracefully
greedily
happily
hastily
honestly
hourly
hungrily
innocently
inquisitively
irritably
irritatingly
joyously
justly
kindly
laughingly
lazily
loosely
loudly
madly
merrily
monthly
mortally
mysteriously
nakedly
nearly
neatly
nervously
never
noisily
obediently
obnoxiously
obnoxiously
often
painfully
perfectly
politely
poorly
powerfully
promptly
punctually
quickly
quietly
rapidly
rarely
really
recklessly
regularly
reluctantly
repeatedly
rightfully
roughly
rudely
sadly
safely
seldom
selfishly
seriously
shakily
sharply
shrilly
shyly
silently
sleepily
slowly
smoothly
softly
solemnly
sometimes
soon
speedily
stealthily
sternly
successfully
suddenly
suspiciously
swiftly
tenderly
tensely
thoughtfully
tightly
tomorrow
truthfully
underhandedly
unexpectedly
victoriously
violently
vivaciously
warmly
weakly
wearily
wildly
yearly
Loading

0 comments on commit 618f4dc

Please sign in to comment.