mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
Pig Latin Mutation (#61184)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#define ACIDFLESH /datum/mutation/human/acidflesh
|
||||
#define ANTENNA /datum/mutation/human/antenna
|
||||
#define ANTIGLOWY /datum/mutation/human/glow/anti
|
||||
#define AUTONOMY /datum/mutation/human/self_amputation
|
||||
#define BADBLINK /datum/mutation/human/badblink
|
||||
#define BADSIGHT /datum/mutation/human/nearsight
|
||||
#define BIOTECHCOMPAT /datum/mutation/human/biotechcompat
|
||||
@@ -37,9 +38,9 @@
|
||||
#define NERVOUS /datum/mutation/human/nervousness
|
||||
#define OLFACTION /datum/mutation/human/olfaction
|
||||
#define PARANOIA /datum/mutation/human/paranoia
|
||||
#define PIGLATIN /datum/mutation/human/piglatin
|
||||
#define RACEMUT /datum/mutation/human/race
|
||||
#define RADIOACTIVE /datum/mutation/human/radioactive
|
||||
#define AUTONOMY /datum/mutation/human/self_amputation
|
||||
#define SHOCKTOUCH /datum/mutation/human/shock
|
||||
#define SPACEMUT /datum/mutation/human/space_adaptation
|
||||
#define SPASTIC /datum/mutation/human/spastic
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
/**
|
||||
* Returns the text if properly formatted, or null else.
|
||||
*
|
||||
*
|
||||
* Things considered improper:
|
||||
* * Larger than max_length.
|
||||
* * Presence of non-ASCII characters if asci_only is set to TRUE.
|
||||
@@ -937,3 +937,55 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
|
||||
continue
|
||||
out += prob(replaceprob)? pick(replacementchars) : char
|
||||
return out.Join("")
|
||||
|
||||
///runs `piglatin_word()` proc on each word in a sentence. preserves caps and punctuation
|
||||
/proc/piglatin_sentence(text)
|
||||
var/text_length = length(text)
|
||||
|
||||
//remove caps since words will be shuffled
|
||||
text = lowertext(text)
|
||||
//remove punctuation for same reasons as above
|
||||
var/punctuation = ""
|
||||
var/punctuation_hit_list = list("!","?",".","-")
|
||||
for(var/letter_index in text_length to 1 step -1)
|
||||
var/letter = text[letter_index]
|
||||
if(!(letter in punctuation_hit_list))
|
||||
break
|
||||
punctuation += letter
|
||||
punctuation = reverse_text(punctuation)
|
||||
text = copytext(text, 1, ((text_length + 1) - length(punctuation)))
|
||||
|
||||
//now piglatin each word
|
||||
var/list/old_words = splittext(text, " ")
|
||||
var/list/new_words = list()
|
||||
for(var/word in old_words)
|
||||
new_words += piglatin_word(word)
|
||||
text = new_words.Join(" ")
|
||||
//replace caps and punc
|
||||
text = capitalize(text)
|
||||
text += punctuation
|
||||
return text
|
||||
|
||||
///takes "word", and returns it piglatinized.
|
||||
/proc/piglatin_word(word)
|
||||
if(length(word) == 1)
|
||||
return word
|
||||
var/first_letter = copytext(word, 1, 2)
|
||||
var/first_two_letters = copytext(word, 1, 3)
|
||||
var/first_word_is_vowel = (first_letter in list("a", "e", "i", "o", "u"))
|
||||
var/second_word_is_vowel = (copytext(word, 2, 3) in list("a", "e", "i", "o", "u"))
|
||||
//If a word starts with a vowel add the word "way" at the end of the word.
|
||||
if(first_word_is_vowel)
|
||||
return word + pick("yay", "way", "hay") //in cultures around the world it's different, so heck lets have fun and make it random. should still be readable
|
||||
//If a word starts with a consonant and a vowel, put the first letter of the word at the end of the word and add "ay."
|
||||
if(!first_word_is_vowel && second_word_is_vowel)
|
||||
word = copytext(word, 2)
|
||||
word += first_letter
|
||||
return word + "ay"
|
||||
//If a word starts with two consonants move the two consonants to the end of the word and add "ay."
|
||||
if(!first_word_is_vowel && !second_word_is_vowel)
|
||||
word = copytext(word, 3)
|
||||
word += first_two_letters
|
||||
return word + "ay"
|
||||
//otherwise unmutated
|
||||
return word
|
||||
|
||||
@@ -240,3 +240,27 @@
|
||||
message = "[chosen_starting] [message]"
|
||||
|
||||
speech_args[SPEECH_MESSAGE] = message
|
||||
|
||||
/datum/mutation/human/piglatin
|
||||
name = "Pig Latin"
|
||||
desc = "Historians say back in the 2020's humanity spoke entirely in this mystical language."
|
||||
quality = MINOR_NEGATIVE
|
||||
text_gain_indication = span_notice("Omethingsay eelsfay offyay.")
|
||||
text_lose_indication = span_notice("The off sensation passes.")
|
||||
|
||||
/datum/mutation/human/piglatin/on_acquiring(mob/living/carbon/human/owner)
|
||||
if(..())
|
||||
return
|
||||
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
|
||||
|
||||
/datum/mutation/human/piglatin/on_losing(mob/living/carbon/human/owner)
|
||||
if(..())
|
||||
return
|
||||
UnregisterSignal(owner, COMSIG_MOB_SAY)
|
||||
|
||||
/datum/mutation/human/piglatin/proc/handle_speech(datum/source, list/speech_args)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/spoken_message = speech_args[SPEECH_MESSAGE]
|
||||
spoken_message = piglatin_sentence(spoken_message)
|
||||
speech_args[SPEECH_MESSAGE] = spoken_message
|
||||
|
||||
@@ -245,6 +245,14 @@
|
||||
name = "\improper DNA injector (Wacky)"
|
||||
add_mutations = list(WACKY)
|
||||
|
||||
/obj/item/dnainjector/piglatinmut
|
||||
name = "\improper DNA injector (Pig Latin)"
|
||||
add_mutations = list(PIGLATIN)
|
||||
|
||||
/obj/item/dnainjector/antipiglatin
|
||||
name = "\improper DNA injector (Anti-Pig Latin)"
|
||||
remove_mutations = list(PIGLATIN)
|
||||
|
||||
/obj/item/dnainjector/antimute
|
||||
name = "\improper DNA injector (Anti-Mute)"
|
||||
remove_mutations = list(MUT_MUTE)
|
||||
|
||||
@@ -590,7 +590,7 @@ Basically, we fill the time between now and 2s from now with hands based off the
|
||||
var/mob/living/carbon/carbon = owner
|
||||
if(!carbon.dna)
|
||||
return
|
||||
var/list/speech_options = list(SWEDISH, UNINTELLIGIBLE, STONER, MEDIEVAL, WACKY, NERVOUS, MUT_MUTE)
|
||||
var/list/speech_options = list(SWEDISH, UNINTELLIGIBLE, STONER, MEDIEVAL, WACKY, PIGLATIN, NERVOUS, MUT_MUTE)
|
||||
speech_options = shuffle(speech_options)
|
||||
for(var/option in speech_options)
|
||||
if(carbon.dna.get_mutation(option))
|
||||
|
||||
Reference in New Issue
Block a user