Skip to content

Commit

Permalink
Added BDSM and KOTH AI cores.
Browse files Browse the repository at this point in the history
Replaces 'replacetext' and 'replacetextEx' procs with 'bay' versions.

Fixes #515
Fixes #527
  • Loading branch information
Arokha committed Apr 7, 2016
1 parent 1dfaf61 commit 9eacba6
Show file tree
Hide file tree
Showing 45 changed files with 222 additions and 189 deletions.
4 changes: 2 additions & 2 deletions code/ZAS/Variable Settings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,15 @@ var/global/vs_control/vsc = new
var/txt = vars["[V]_RANDOM"]
if(findtextEx(txt,"PROB"))
txt = text2list(txt,"/")
txt[1] = replacetext(txt[1],"PROB","")
txt[1] = bayreplacetext(txt[1],"PROB","")
var/p = text2num(txt[1])
var/r = txt[2]
if(prob(p))
newvalue = roll(r)
else
newvalue = vars[V]
else if(findtextEx(txt,"PICK"))
txt = replacetext(txt,"PICK","")
txt = bayreplacetext(txt,"PICK","")
txt = text2list(txt,",")
newvalue = pick(txt)
else
Expand Down
7 changes: 4 additions & 3 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//Removes a few problematic characters
/proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#"))
for(var/char in repl_chars)
t = replacetext(t, char, repl_chars[char])
t = bayreplacetext(t, char, repl_chars[char])
return t

/proc/readd_quotes(var/t)
Expand Down Expand Up @@ -203,10 +203,11 @@ proc/checkhtml(var/t)
/*
* Text modification
*/
/proc/replacetext(text, find, replacement)

/proc/bayreplacetext(text, find, replacement)
return list2text(text2list(text, find), replacement)

/proc/replacetextEx(text, find, replacement)
/proc/bayreplacetextEx(text, find, replacement)
return list2text(text2listEx(text, find), replacement)

//Adds 'u' number of zeros ahead of the text 't'
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
corner.density = 1
corner.anchored = 1
corner.icon = X.icon
corner.icon_state = replacetext(X.icon_state, "_s", "_f")
corner.icon_state = bayreplacetext(X.icon_state, "_s", "_f")
corner.tag = "delete me"
corner.name = "wall"

Expand All @@ -895,7 +895,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
// Reset the shuttle corners
if(O.tag == "delete me")
X.icon = 'icons/turf/shuttle.dmi'
X.icon_state = replacetext(O.icon_state, "_f", "_s") // revert the turf to the old icon_state
X.icon_state = bayreplacetext(O.icon_state, "_f", "_s") // revert the turf to the old icon_state
X.name = "wall"
del(O) // prevents multiple shuttle corners from stacking
continue
Expand Down Expand Up @@ -1348,7 +1348,7 @@ var/list/WALLITEMS = list(
return 0

/proc/format_text(text)
return replacetext(replacetext(text,"\proper ",""),"\improper ","")
return bayreplacetext(bayreplacetext(text,"\proper ",""),"\improper ","")

/proc/topic_link(var/datum/D, var/arglist, var/content)
if(istype(arglist,/list))
Expand Down
4 changes: 2 additions & 2 deletions code/datums/spell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
if(prob(50))//Auto-mute? Fuck that noise
usr.say(invocation)
else
usr.say(replacetext(invocation," ","`"))
usr.say(bayreplacetext(invocation," ","`"))
if(usr.gender==MALE)
playsound(usr.loc, pick('sound/misc/null.ogg','sound/misc/null.ogg'), 100, 1)
else
Expand All @@ -110,7 +110,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
if(prob(50))
usr.whisper(invocation)
else
usr.whisper(replacetext(invocation," ","`"))
usr.whisper(bayreplacetext(invocation," ","`"))

/obj/effect/proc_holder/spell/New()
..()
Expand Down
4 changes: 2 additions & 2 deletions code/defines/obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@
even = !even

dat += "</table>"
dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
dat = replacetext(dat, "\t", "")
dat = bayreplacetext(dat, "\n", "") // so it can be placed on paper correctly
dat = bayreplacetext(dat, "\t", "")
return dat


Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/arcade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
name_part1 = pick("the Automatic ", "Farmer ", "Lord ", "Professor ", "the Cuban ", "the Evil ", "the Dread King ", "the Space ", "Lord ", "the Great ", "Duke ", "General ")
name_part2 = pick("Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon", "Uhangoid", "Vhakoid", "Peteoid", "slime", "Griefer", "ERPer", "Lizard Man", "Unicorn")

src.enemy_name = replacetext((name_part1 + name_part2), "the ", "")
src.enemy_name = bayreplacetext((name_part1 + name_part2), "the ", "")
src.name = (name_action + name_part1 + name_part2)


Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/computer/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
var/list/formatted = list()
for(var/job in jobs)
formatted.Add(list(list(
"display_name" = replacetext(job, " ", "&nbsp"),
"display_name" = bayreplacetext(job, " ", "&nbsp"),
"target_rank" = get_target_rank(),
"job" = job)))

Expand Down Expand Up @@ -108,7 +108,7 @@
var/list/all_centcom_access = list()
for(var/access in get_all_centcom_access())
all_centcom_access.Add(list(list(
"desc" = replacetext(get_centcom_access_desc(access), " ", "&nbsp"),
"desc" = bayreplacetext(get_centcom_access_desc(access), " ", "&nbsp"),
"ref" = access,
"allowed" = (access in modify.access) ? 1 : 0)))

Expand All @@ -120,7 +120,7 @@
for(var/access in get_region_accesses(i))
if (get_access_desc(access))
accesses.Add(list(list(
"desc" = replacetext(get_access_desc(access), " ", "&nbsp"),
"desc" = bayreplacetext(get_access_desc(access), " ", "&nbsp"),
"ref" = access,
"allowed" = (access in modify.access) ? 1 : 0)))

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

/obj/machinery/computer/proc/decode(text)
// Adds line breaks
text = replacetext(text, "\n", "<BR>")
text = bayreplacetext(text, "\n", "<BR>")
return text


Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
reqform.info += "RANK: [idrank]<br>"
reqform.info += "REASON: [reason]<br>"
reqform.info += "SUPPLY CRATE TYPE: [P.name]<br>"
reqform.info += "ACCESS RESTRICTION: [replacetext(get_access_desc(P.access))]<br>"
reqform.info += "ACCESS RESTRICTION: [bayreplacetext(get_access_desc(P.access))]<br>"
reqform.info += "CONTENTS:<br>"
reqform.info += P.manifest
reqform.info += "<hr>"
Expand Down Expand Up @@ -311,7 +311,7 @@
reqform.info += "RANK: [idrank]<br>"
reqform.info += "REASON: [reason]<br>"
reqform.info += "SUPPLY CRATE TYPE: [P.name]<br>"
reqform.info += "ACCESS RESTRICTION: [replacetext(get_access_desc(P.access))]<br>"
reqform.info += "ACCESS RESTRICTION: [bayreplacetext(get_access_desc(P.access))]<br>"
reqform.info += "CONTENTS:<br>"
reqform.info += P.manifest
reqform.info += "<hr>"
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer3/computers/arcade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
name_part1 = pick("the Automatic ", "Farmer ", "Lord ", "Professor ", "the Cuban ", "the Evil ", "the Dread King ", "the Space ", "Lord ", "the Great ", "Duke ", "General ")
name_part2 = pick("Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon", "Uhangoid", "Vhakoid", "Peteoid", "slime", "Griefer", "ERPer", "Lizard Man", "Unicorn")

enemy_name = replacetext(name_part1, "the ", "") + name_part2
enemy_name = bayreplacetext(name_part1, "the ", "") + name_part2
name = (name_action + name_part1 + name_part2)


Expand Down
18 changes: 9 additions & 9 deletions code/game/machinery/computer3/computers/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if(counter >= 6)
jobs_all += "</tr><tr height='20'><td></td><td></td>"
counter = 0
jobs_all += "<td height='20' weight='100'><a href='?src=\ref[src];assign=[job]'>[replacetext(job, " ", "&nbsp")]</a></td>"
jobs_all += "<td height='20' weight='100'><a href='?src=\ref[src];assign=[job]'>[bayreplacetext(job, " ", "&nbsp")]</a></td>"

counter = 0
jobs_all += "</tr><tr><td><font color='#FFA500'><b>Engineering</b></font></td>"//Orange
Expand All @@ -55,7 +55,7 @@
if(counter >= 6)
jobs_all += "</tr><tr height='20'><td></td><td></td>"
counter = 0
jobs_all += "<td height='20' weight='100'><a href='?src=\ref[src];assign=[job]'>[replacetext(job, " ", "&nbsp")]</a></td>"
jobs_all += "<td height='20' weight='100'><a href='?src=\ref[src];assign=[job]'>[bayreplacetext(job, " ", "&nbsp")]</a></td>"

counter = 0
jobs_all += "</tr><tr height='20'><td><font color='#008000'><b>Medical</b></font></td>"//Green
Expand All @@ -64,7 +64,7 @@
if(counter >= 6)
jobs_all += "</tr><tr height='20'><td></td><td></td>"
counter = 0
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[replacetext(job, " ", "&nbsp")]</a></td>"
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[bayreplacetext(job, " ", "&nbsp")]</a></td>"

counter = 0
jobs_all += "</tr><tr height='20'><td><font color='#800080'><b>Science</b></font></td>"//Purple
Expand All @@ -73,7 +73,7 @@
if(counter >= 6)
jobs_all += "</tr><tr height='20'><td></td><td></td>"
counter = 0
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[replacetext(job, " ", "&nbsp")]</a></td>"
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[bayreplacetext(job, " ", "&nbsp")]</a></td>"

counter = 0
jobs_all += "</tr><tr height='20'><td><font color='#808080'><b>Civilian</b></font></td>"//Grey
Expand All @@ -82,7 +82,7 @@
if(counter >= 6)
jobs_all += "</tr><tr height='20'><td></td><td></td>"
counter = 0
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[replacetext(job, " ", "&nbsp")]</a></td>"
jobs_all += "<td weight='100'><a href='?src=\ref[src];assign=[job]'>[bayreplacetext(job, " ", "&nbsp")]</a></td>"

dat = {"<script type="text/javascript">
function markRed(){
Expand Down Expand Up @@ -124,9 +124,9 @@
accesses += "<td style='width:14%' valign='top'>"
for(var/A in get_region_accesses(i))
if(A in writer.access)
accesses += topic_link(src,"access=[A]","<font color='red'>[replacetext(get_access_desc(A), " ", "&nbsp")]</font>") + " "
accesses += topic_link(src,"access=[A]","<font color='red'>[bayreplacetext(get_access_desc(A), " ", "&nbsp")]</font>") + " "
else
accesses += topic_link(src,"access=[A]",replacetext(get_access_desc(A), " ", "&nbsp")) + " "
accesses += topic_link(src,"access=[A]",bayreplacetext(get_access_desc(A), " ", "&nbsp")) + " "
accesses += "<br>"
accesses += "</td>"
accesses += "</tr></table>"
Expand Down Expand Up @@ -336,9 +336,9 @@
var/accesses = "<h5>Central Command:</h5>"
for(var/A in get_all_centcom_access())
if(A in writer.access)
accesses += topic_link(src,"access=[A]","<font color='red'>[replacetext(get_centcom_access_desc(A), " ", "&nbsp")]</font>") + " "
accesses += topic_link(src,"access=[A]","<font color='red'>[bayreplacetext(get_centcom_access_desc(A), " ", "&nbsp")]</font>") + " "
else
accesses += topic_link(src,"access=[A]",replacetext(get_centcom_access_desc(A), " ", "&nbsp")) + " "
accesses += topic_link(src,"access=[A]",bayreplacetext(get_centcom_access_desc(A), " ", "&nbsp")) + " "
return accesses

authenticate()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer3/program.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Programs are a file that can be executed

/datum/file/program/proc/decode(text)
//adds line breaks
text = replacetext(text, "\n","<BR>")
text = bayreplacetext(text, "\n","<BR>")
return text


Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/requests_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
dat += "[msg]<BR>"
var/obj/item/weapon/paper/R = new(src.loc)
R.name = "[department] Messages"
R.info = replacetext(dat, " href=", " nothref=") // Try and make links inoperative
R.info = bayreplacetext(dat, " href=", " nothref=") // Try and make links inoperative

if(reject_bad_text(href_list["write"]))
dpt = ckey(href_list["write"]) //write contains the string of the receiving department's name
Expand Down
10 changes: 5 additions & 5 deletions code/game/machinery/telecomms/traffic_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

if(length(viewingcode))
// This piece of code is very important - it escapes quotation marks so string aren't cut off by the input element
var/showcode = replacetext(storedcode, "\\\"", "\\\\\"")
showcode = replacetext(storedcode, "\"", "\\\"")
var/showcode = bayreplacetext(storedcode, "\\\"", "\\\\\"")
showcode = bayreplacetext(storedcode, "\"", "\\\"")

for(var/mob/M in viewingcode)

Expand Down Expand Up @@ -171,8 +171,8 @@
winshow(editingcode, "Telecomms IDE", 1) // show the IDE
winset(editingcode, "tcscode", "is-disabled=false")
winset(editingcode, "tcscode", "text=\"\"")
var/showcode = replacetext(storedcode, "\\\"", "\\\\\"")
showcode = replacetext(storedcode, "\"", "\\\"")
var/showcode = bayreplacetext(storedcode, "\\\"", "\\\\\"")
showcode = bayreplacetext(storedcode, "\"", "\\\"")
winset(editingcode, "tcscode", "text=\"[showcode]\"")
spawn()
update_ide()
Expand All @@ -182,7 +182,7 @@
winshow(usr, "Telecomms IDE", 1) // show the IDE
winset(usr, "tcscode", "is-disabled=true")
winset(editingcode, "tcscode", "text=\"\"")
var/showcode = replacetext(storedcode, "\"", "\\\"")
var/showcode = bayreplacetext(storedcode, "\"", "\\\"")
winset(usr, "tcscode", "text=\"[showcode]\"")

if("togglerun")
Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/items/blueprints.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,19 @@ move an amendment</a> to the drawing.</p>


/obj/item/blueprints/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle)
if (!oldtitle) // or replacetext goes to infinite loop
if (!oldtitle) // or bayreplacetext goes to infinite loop
return
for(var/area/RA in A.related)
for(var/obj/machinery/alarm/M in RA)
M.name = replacetext(M.name,oldtitle,title)
M.name = bayreplacetext(M.name,oldtitle,title)
for(var/obj/machinery/power/apc/M in RA)
M.name = replacetext(M.name,oldtitle,title)
M.name = bayreplacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in RA)
M.name = replacetext(M.name,oldtitle,title)
M.name = bayreplacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_pump/M in RA)
M.name = replacetext(M.name,oldtitle,title)
M.name = bayreplacetext(M.name,oldtitle,title)
for(var/obj/machinery/door/M in RA)
M.name = replacetext(M.name,oldtitle,title)
M.name = bayreplacetext(M.name,oldtitle,title)
//TODO: much much more. Unnamed airlocks, cameras, etc.

/obj/item/blueprints/proc/check_tile_is_border(var/turf/T2,var/dir)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/PDA/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(FM.img)
usr << browse_rsc(FM.img, "pda_news_tmp_photo_[feed["channel"]]_[index].png")
// News stories are HTML-stripped but require newline replacement to be properly displayed in NanoUI
var/body = replacetext(FM.body, "\n", "<br>")
var/body = bayreplacetext(FM.body, "\n", "<br>")
messages[++messages.len] = list("author" = FM.author, "body" = body, "message_type" = FM.message_type, "time_stamp" = FM.time_stamp, "has_image" = (FM.img != null), "caption" = FM.caption, "index" = index)
feed["messages"] = messages

Expand Down Expand Up @@ -693,7 +693,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (mode == 1)
note = html_decode(n)
notehtml = note
note = replacetext(note, "\n", "<br>")
note = bayreplacetext(note, "\n", "<br>")
else
ui.close()
if("Toggle Messenger")
Expand Down
10 changes: 5 additions & 5 deletions code/game/objects/items/devices/floor_painter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@
mode_nice = design
return
mode_nice = design
mode = "[replacetext(design, "-", "")]full"
mode = "[bayreplacetext(design, "-", "")]full"
if("corner")
var/design = input("Which design?", "Floor painter") in list("black", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-red", "white-blue", "white-green", "white-yellow", "white-purple")
mode_nice = "[design] corner"
mode = "[replacetext(design, "-", "")]corner"
mode = "[bayreplacetext(design, "-", "")]corner"
tile_dir_mode = 2
if("opposite corners")
var/design = input("Which design?", "Floor painter") in list("bar", "cmo", "yellowpatch", "cafeteria", "red-yellow", "red-blue", "red-green", "green-yellow", "green-blue", "blue-yellow")
mode_nice = design
if(design == "bar" || design == "cmo" || design == "yellowpatch" || design == "cafeteria")
mode = design
else
mode = "[replacetext(design, "-", "")]full"
mode = "[bayreplacetext(design, "-", "")]full"
if(design == "yellowpatch")
tile_dir_mode = 5
else
Expand All @@ -133,7 +133,7 @@
mode_nice = design
else
mode_nice = design
mode = replacetext(design, "-", "")
mode = bayreplacetext(design, "-", "")
tile_dir_mode = 1
if("special")
var/design = input("Which design?", "Floor painter") in list("arrival", "escape", "caution", "warning", "white-warning", "white-blue-green", "loadingarea", "delivery", "bot", "white-delivery", "white-bot")
Expand All @@ -143,7 +143,7 @@
tile_dir_mode = 2
else if(design == "delivery" || design == "bot" || design == "white-delivery" || design == "white-bot")
mode_nice = design
mode = replacetext(design, "-", "")
mode = bayreplacetext(design, "-", "")
tile_dir_mode = 0
else if(design == "loadingarea")
mode_nice = design
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/uplinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ datum/uplink_item/proc/description()
if(!description)
// Fallback description
var/obj/temp = src.path
description = replacetext(initial(temp.desc), "\n", "<br>")
description = bayreplacetext(initial(temp.desc), "\n", "<br>")
return description

/datum/uplink_item/proc/generate_item(var/newloc)
Expand Down Expand Up @@ -273,7 +273,7 @@ datum/nano_item_lists
// We trade off being able to automatically add shit for more control over what gets passed to json
// and if it's sanitized for html.
nanoui_data["exploit"]["nanoui_exploit_record"] = html_encode(L.fields["exploit_record"]) // Change stuff into html
nanoui_data["exploit"]["nanoui_exploit_record"] = replacetext(nanoui_data["exploit"]["nanoui_exploit_record"], "\n", "<br>") // change line breaks into <br>
nanoui_data["exploit"]["nanoui_exploit_record"] = bayreplacetext(nanoui_data["exploit"]["nanoui_exploit_record"], "\n", "<br>") // change line breaks into <br>
nanoui_data["exploit"]["name"] = html_encode(L.fields["name"])
nanoui_data["exploit"]["sex"] = html_encode(L.fields["sex"])
nanoui_data["exploit"]["age"] = html_encode(L.fields["age"])
Expand Down
Loading

0 comments on commit 9eacba6

Please sign in to comment.