forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In favour of a better json based solution This overhauls: -AI ion laws -NPC chatter text The system is extended to support further splitting of a chosen line where a line is picked and then searched for subkey's in the form of @pick(\D+) - sub keys are then picked from the appropriate list that matches the \D+ key and replaced over top of the placeholder This is used to add braindamage gibbering messages to the system
- Loading branch information
1 parent
3a2a614
commit 2311102
Showing
9 changed files
with
1,275 additions
and
91 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 |
---|---|---|
@@ -1,27 +1,41 @@ | ||
#define pick_list(FILE, KEY) (pick(strings(FILE, KEY))) | ||
#define pick_list_replacements(FILE, KEY) (strings_replacement(FILE, KEY)) | ||
#define json_load(FILE) (json_decode(file2text(FILE))) | ||
|
||
var/global/list/string_cache | ||
var/global/list/string_filename_current_key | ||
|
||
|
||
/proc/strings_replacement(filename, key) | ||
load_strings_file(filename) | ||
|
||
if((filename in string_cache) && (key in string_cache[filename])) | ||
var/response = pick(string_cache[filename][key]) | ||
var/regex/r = regex("@pick\\((\\D+?)\\)", "g") | ||
response = r.Replace(response, /proc/strings_subkey_lookup) | ||
return response | ||
else | ||
CRASH("strings list not found: strings/[filename], index=[key]") | ||
|
||
/proc/strings(filename as text, key as text) | ||
var/list/fileList | ||
if(!string_cache) | ||
string_cache = new | ||
if(!(filename in string_cache)) | ||
if(fexists("strings/[filename]")) | ||
string_cache[filename] = list() | ||
var/list/stringsList = list() | ||
fileList = file2list("strings/[filename]") | ||
for(var/s in fileList) | ||
stringsList = splittext(s, "@=") | ||
if(stringsList.len != 2) | ||
CRASH("Invalid string list in strings/[filename]") | ||
if(findtext(stringsList[2], "@,")) | ||
string_cache[filename][stringsList[1]] = splittext(stringsList[2], "@,") | ||
else | ||
string_cache[filename][stringsList[1]] = stringsList[2] // Its a single string! | ||
else | ||
CRASH("file not found: strings/[filename]") | ||
load_strings_file(filename) | ||
if((filename in string_cache) && (key in string_cache[filename])) | ||
return string_cache[filename][key] | ||
else | ||
CRASH("strings list not found: strings/[filename], index=[key]") | ||
|
||
/proc/strings_subkey_lookup(match, group1) | ||
return pick_list(string_filename_current_key, group1) | ||
|
||
/proc/load_strings_file(filename) | ||
string_filename_current_key = filename | ||
if(filename in string_cache) | ||
return //no work to do | ||
|
||
if(!string_cache) | ||
string_cache = new | ||
|
||
if(fexists("strings/[filename]")) | ||
string_cache[filename] = json_load("strings/[filename]") | ||
else | ||
CRASH("file not found: strings/[filename]") |
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
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
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
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,117 @@ | ||
{ | ||
"brain_damage": [ | ||
"IM A PONY NEEEEEEIIIIIIIIIGH", | ||
"without oxigen blob don't evoluate?", | ||
"CAPTAINS A COMDOM", | ||
"@pick(faggot_traitor) @pick(george) @pick(mellens) is grifing me HALP!!!", | ||
"can u give me @pick(mutations)?", | ||
"THe saiyans screwed", | ||
"Bi is THE BEST OF BOTH WORLDS>", | ||
"I WANNA PET TEH monkeyS", | ||
"stop grifing me!!!!", | ||
"SOTP IT#", | ||
"shiggey diggey!!", | ||
"A PIRATE APPEAR", | ||
"FUS RO DAH", | ||
"fucking 4rries!", | ||
"stat me", | ||
">my face", | ||
"roll it easy!", | ||
"waaaaaagh!!!", | ||
"red wonz go fasta", | ||
"FOR TEH EMPRAH", | ||
"lol2cat", | ||
"dem dwarfs man, dem dwarfs", | ||
"SPESS MAHREENS", | ||
"hwee did eet fhor khayosss", | ||
"lifelike texture ;_;", | ||
"luv can bloooom", | ||
"PACKETS!!!", | ||
"port ba@pick(y_replacements) med!!!!", | ||
"REVIRT GON CHEM!!!!!!!!", | ||
"youed call her a toeugh bithc", | ||
"closd for merbegging", | ||
"pray can u @pick(create_verbs) @pick(create_nouns)???", | ||
"GEY AWAY FROM ME U GREIFING PRICK!!!!", | ||
"ur a fuckeing autist!", | ||
";HELP SHITECIRTY MURDERIN MEE!!!", | ||
"hwat dose tha @pick(random_gibberish) mean?????", | ||
"CAL; TEH SHUTTLE!!!!!", | ||
"wearnig siNGUARLTY IS .... FIne xDDDDDDDDD", | ||
"AI laW 22 Open door", | ||
"this SI mY stATIon......", | ||
"who the HELL do u thenk u r?!!!!", | ||
"geT THE FUCK OUTTTT", | ||
"H U G B O X", | ||
"CRASHING THIS STTAYTION WITH NIO SURVIVROS", | ||
"@pick(servers) is down!!", | ||
"PSHOOOM", | ||
"REMOVE SINGULARITY", | ||
"INSTLL TEG", | ||
"TURBIN IS BEST ENGIENE", | ||
"SOLIRS CAN POWER THE HOLE STATION ANEWAY", | ||
"parasteng was best", | ||
"Tajaran has warrrres, if you have coin" | ||
], | ||
|
||
"mutations": [ | ||
"telikesis", | ||
"halk", | ||
"eppilapse", | ||
"kamelien", | ||
"eksrey", | ||
"glowey skin", | ||
"fungal tb" | ||
], | ||
|
||
"george": [ | ||
"joerge", | ||
"george", | ||
"gorge", | ||
"gdoruge" | ||
], | ||
|
||
"mellens": [ | ||
"mellens", | ||
"melons", | ||
"mwrlins" | ||
], | ||
|
||
"faggot_traitor": [ | ||
"", | ||
"that faggot traitor" | ||
], | ||
|
||
"random_gibberish": [ | ||
"g", | ||
"squid", | ||
"r" | ||
], | ||
|
||
"y_replacements": [ | ||
"y", | ||
"i", | ||
"e" | ||
], | ||
|
||
"servers": [ | ||
"bager", | ||
"sybl", | ||
"mrs sybil", | ||
"mr basil" | ||
], | ||
|
||
"create_verbs": [ | ||
"spawn", | ||
"MAke me", | ||
"creat" | ||
], | ||
|
||
"create_nouns": [ | ||
"zenomorfs", | ||
"ayleins", | ||
"treaitors", | ||
"sheadow lings", | ||
"abdoocters" | ||
] | ||
} |
Oops, something went wrong.