Skip to content

Commit

Permalink
Added some fun stuff to chat simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJP committed Jan 29, 2024
1 parent 5d4f1fd commit 5511384
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Catfluencer/singleton/chat_global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ const NAME_PARTS = [
"lurba",
"nana",
"sion",
"max",
"janis",
"meret",
"pablo",
]
const RARE_LINES = [
"Anna Rosenwasser: hoi büüüsi!",
"PewDiePie: How did this get more followers than me!?",
"Ninja: wanna collab?",
"Dream: play minecraft next!!",
"MrBeast: Keep this stream live for 100 days and I will donate $500.000",
"Anthony Padilla: can I interview you on my show?"
]
var chat_lines: int = 11
var chat: Array[String] = []
Expand All @@ -56,18 +68,25 @@ func generate_chatters():

func add_chat():
await get_tree().create_timer(randf_range(0.2, 4.0), false).timeout
chat.push_back("%s: %s" % [generate_name(), generate_message()])
chat.push_back(generate_chat_line())
while len(chat) > chat_lines:
chat.pop_front()
chat_changed.emit()
add_chat()


func generate_name():
func generate_chat_line() -> String:
if randf() <= 0.01:
return RARE_LINES[randi() % len(RARE_LINES)]
else:
return "%s: %s" % [generate_name(), generate_message()]


func generate_name() -> String:
return chatters[randi() % len(chatters)]


func generate_message():
func generate_message() -> String:
if not _is_web and randf() < 0.6:
return CHAT_EMOJIS[randi() % len(CHAT_EMOJIS)].repeat(randi_range(1, 3))

Expand Down

0 comments on commit 5511384

Please sign in to comment.