Merge pull request #9133 from phil235/ClownNamePreferences

Changes clown/mime naming to use preferences.
This commit is contained in:
Jordie
2015-04-28 23:45:52 +10:00
11 changed files with 263 additions and 177 deletions
+33 -33
View File
@@ -362,44 +362,44 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Generalised helper proc for letting mobs rename themselves. Used to be clname() and ainame()
//Last modified by Carn
/mob/proc/rename_self(var/role, var/allow_numbers=0)
spawn(0)
var/oldname = real_name
var/oldname = real_name
var/newname
var/loop = 1
var/safety = 0
var/time_passed = world.time
var/newname
while(loop && safety < 5)
if(client && client.prefs.custom_names[role] && !safety)
newname = client.prefs.custom_names[role]
else
switch(role)
if("clown")
newname = pick(clown_names)
if("mime")
newname = pick(mime_names)
if("ai")
newname = pick(ai_names)
else
return
for(var/i=1,i<=3,i++) //we get 3 attempts to pick a suitable name.
newname = input(src,"You are a [role]. Would you like to change your name to something else?", "Name change",oldname) as text
if((world.time-time_passed)>300)
return //took too long
newname = reject_bad_name(newname,allow_numbers) //returns null if the name doesn't meet some basic requirements. Tidies up a few other things like bad-characters.
for(var/mob/living/M in player_list)
if(M == src)
continue
if(!newname || M.real_name == newname)
newname = null
break
if(newname)
break //That's a suitable name!
src << "Sorry, that [role]-name wasn't appropriate, please try another. It's possibly too long/short, has bad characters or is already taken."
if(!newname) //we'll stick with the oldname then
return
if(cmptext("ai",role))
if(isAI(src))
oldname = null//don't bother with the records update crap
if(cmptext("cyborg",role))
if(isrobot(src))
var/mob/living/silicon/robot/A = src
A.custom_name = newname
for(var/mob/living/M in player_list)
if(M == src)
continue
if(!newname || M.real_name == newname)
newname = null
loop++ // name is already taken so we roll again
break
loop--
safety++
if(isAI(src))
oldname = null//don't bother with the records update crap
if(newname)
fully_replace_character_name(oldname,newname)
if(isrobot(src))
var/mob/living/silicon/robot/A = src
A.custom_name = newname
//Picks a string of symbols to display as the law number for hacked or ion laws
+1
View File
@@ -8,6 +8,7 @@ var/list/first_names_male = file2list("config/names/first_male.txt")
var/list/first_names_female = file2list("config/names/first_female.txt")
var/list/last_names = file2list("config/names/last.txt")
var/list/clown_names = file2list("config/names/clown.txt")
var/list/mime_names = file2list("config/names/mime.txt")
var/list/verbs = file2list("config/names/verbs.txt")
+39 -120
View File
@@ -18,131 +18,50 @@ Chaplain
access = list(access_morgue, access_chapel_office, access_crematorium)
minimal_access = list(access_morgue, access_chapel_office, access_crematorium)
//Pretty bible names
var/global/list/biblenames = list("Bible", "Quran", "Scrapbook", "Burning Bible", "Clown Bible", "Banana Bible", "Creeper Bible", "White Bible", "Holy Light", "The God Delusion", "Tome", "The King in Yellow", "Ithaqua", "Scientology", "Melted Bible", "Necronomicon")
//Bible iconstates
var/global/list/biblestates = list("bible", "koran", "scrapbook", "burning", "honk1", "honk2", "creeper", "white", "holylight", "atheist", "tome", "kingyellow", "ithaqua", "scientology", "melted", "necronomicon")
//Bible itemstates
var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", "bible", "bible", "syringe_kit", "syringe_kit", "syringe_kit", "syringe_kit", "syringe_kit", "kingyellow", "ithaqua", "scientology", "melted", "necronomicon")
/datum/job/chaplain/proc/setupbiblespecifics(var/obj/item/weapon/storage/book/bible/B, var/mob/living/carbon/human/H)
switch(B.icon_state)
if("honk1","honk2")
new /obj/item/weapon/grown/bananapeel(B)
new /obj/item/weapon/grown/bananapeel(B)
if(B.icon_state == "honk1")
H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(H), slot_wear_mask)
if("bible")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 2
if("koran")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 4
if("scientology")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 8
if("athiest")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 10
/datum/job/chaplain/Topic(href, href_list)
if(href_list["seticon"])
var/iconi = text2num(href_list["seticon"])
var/biblename = biblenames[iconi]
var/obj/item/weapon/storage/book/bible/B = locate(href_list["bible"])
B.icon_state = biblestates[iconi]
B.item_state = bibleitemstates[iconi]
//Set biblespecific chapels
setupbiblespecifics(B, usr)
usr.put_in_hands(B) // Update inhand icon
if(ticker)
ticker.Bible_icon_state = B.icon_state
ticker.Bible_item_state = B.item_state
ticker.Bible_name = B.name
feedback_set_details("religion_book","[biblename]")
usr << browse(null, "window=editicon") // Close window
/datum/job/chaplain/equip_items(var/mob/living/carbon/human/H)
H.equip_to_slot_or_del(new /obj/item/clothing/under/rank/chaplain(H), slot_w_uniform)
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sneakers/black(H), slot_shoes)
var/obj/item/weapon/storage/book/bible/B = new /obj/item/weapon/storage/book/bible/booze(H)
spawn(0)
var/religion_name = "Christianity"
var/new_religion = copytext(sanitize(input(H, "You are the Chaplain. Would you like to change your religion? Default is Christianity, in SPACE.", "Name change", religion_name)),1,MAX_NAME_LEN)
var/new_religion = "Christianity"
if(H.client && H.client.prefs.custom_names["religion"])
new_religion = H.client.prefs.custom_names["religion"]
if (!new_religion)
new_religion = religion_name
switch(lowertext(new_religion))
if("christianity")
B.name = pick("The Holy Bible","The Dead Sea Scrolls")
if("satanism")
B.name = "The Unholy Bible"
if("cthulu")
B.name = "The Necronomicon"
if("islam")
B.name = "Quran"
if("scientology")
B.name = pick("The Biography of L. Ron Hubbard","Dianetics")
if("chaos")
B.name = "The Book of Lorgar"
if("imperium")
B.name = "Uplifting Primer"
if("toolboxia")
B.name = "Toolbox Manifesto"
if("homosexuality")
B.name = "Guys Gone Wild"
if("lol", "wtf", "gay", "penis", "ass", "poo", "badmin", "shitmin", "deadmin", "cock", "cocks")
B.name = pick("Woodys Got Wood: The Aftermath", "War of the Cocks", "Sweet Bro and Hella Jef: Expanded Edition")
H.setBrainLoss(100) // starts off retarded as fuck
if("science")
B.name = pick("Principle of Relativity", "Quantum Enigma: Physics Encounters Consciousness", "Programming the Universe", "Quantum Physics and Theology", "String Theory for Dummies", "How To: Build Your Own Warp Drive", "The Mysteries of Bluespace", "Playing God: Collector's Edition")
else
B.name = "The Holy Book of [new_religion]"
feedback_set_details("religion_name","[new_religion]")
ticker.Bible_name = B.name
switch(lowertext(new_religion))
if("christianity")
B.name = pick("The Holy Bible","The Dead Sea Scrolls")
if("satanism")
B.name = "The Unholy Bible"
if("cthulu")
B.name = "The Necronomicon"
if("islam")
B.name = "Quran"
if("scientology")
B.name = pick("The Biography of L. Ron Hubbard","Dianetics")
if("chaos")
B.name = "The Book of Lorgar"
if("imperium")
B.name = "Uplifting Primer"
if("toolboxia")
B.name = "Toolbox Manifesto"
if("homosexuality")
B.name = "Guys Gone Wild"
if("lol", "wtf", "gay", "penis", "ass", "poo", "badmin", "shitmin", "deadmin", "cock", "cocks")
B.name = pick("Woodys Got Wood: The Aftermath", "War of the Cocks", "Sweet Bro and Hella Jef: Expanded Edition")
H.setBrainLoss(100) // starts off retarded as fuck
if("science")
B.name = pick("Principle of Relativity", "Quantum Enigma: Physics Encounters Consciousness", "Programming the Universe", "Quantum Physics and Theology", "String Theory for Dummies", "How To: Build Your Own Warp Drive", "The Mysteries of Bluespace", "Playing God: Collector's Edition")
else
B.name = "The Holy Book of [new_religion]"
feedback_set_details("religion_name","[new_religion]")
var/new_deity = "Space Jesus"
if(H.client && H.client.prefs.custom_names["deity"])
new_deity = H.client.prefs.custom_names["deity"]
B.deity_name = new_deity
spawn(1)
var/deity_name = "Space Jesus"
var/new_deity = copytext(sanitize(input(H, "Would you like to change your deity? Default is Space Jesus.", "Name change", deity_name)),1,MAX_NAME_LEN)
if ((length(new_deity) == 0) || (new_deity == "Space Jesus") )
new_deity = deity_name
B.deity_name = new_deity
if(ticker)
ticker.Bible_deity_name = B.deity_name
feedback_set_details("religion_deity","[new_deity]")
//Open bible selection
var/dat = "<html><head><title>Pick Bible Style</title></head><body><center><h2>Pick a bible style</h2></center><table>"
var/i
for(i = 1, i < biblestates.len, i++)
var/icon/bibleicon = icon('icons/obj/storage.dmi', biblestates[i])
var/nicename = biblenames[i]
H << browse_rsc(bibleicon, nicename)
dat += {"<tr><td><img src="[nicename]"></td><td><a href="?src=\ref[src];seticon=[i];bible=\ref[B]">[nicename]</a></td></tr>"}
dat += "</table></body></html>"
H << browse(dat, "window=editicon;can_close=0;can_minimize=0;size=250x650")
if(ticker)
ticker.Bible_deity_name = B.deity_name
feedback_set_details("religion_deity","[new_deity]")
H.equip_to_slot_or_del(B, slot_in_backpack)
+1 -3
View File
@@ -180,9 +180,7 @@
user << "<span class='notice'>You connect the monitor.</span>"
if(!laws.inherent.len) //If laws isn't set to null but nobody supplied a board, the AI would normally be created lawless. We don't want that.
laws = null
var/mob/living/silicon/ai/A = new /mob/living/silicon/ai (loc, laws, brain)
if(A) //if there's no brain, the mob is deleted and a structure/AIcore is created
A.rename_self("ai", 1)
new /mob/living/silicon/ai (loc, laws, brain)
feedback_inc("cyborg_ais_created",1)
qdel(src)
@@ -35,8 +35,85 @@
new /obj/item/stack/spacecash(src)
new /obj/item/stack/spacecash(src)
/obj/item/weapon/storage/book/bible/attack_self(mob/user)
return
//Pretty bible names
var/global/list/biblenames = list("Bible", "Quran", "Scrapbook", "Burning Bible", "Clown Bible", "Banana Bible", "Creeper Bible", "White Bible", "Holy Light", "The God Delusion", "Tome", "The King in Yellow", "Ithaqua", "Scientology", "Melted Bible", "Necronomicon")
//Bible iconstates
var/global/list/biblestates = list("bible", "koran", "scrapbook", "burning", "honk1", "honk2", "creeper", "white", "holylight", "atheist", "tome", "kingyellow", "ithaqua", "scientology", "melted", "necronomicon")
//Bible itemstates
var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", "bible", "bible", "syringe_kit", "syringe_kit", "syringe_kit", "syringe_kit", "syringe_kit", "kingyellow", "ithaqua", "scientology", "melted", "necronomicon")
/obj/item/weapon/storage/book/bible/attack_self(mob/living/carbon/human/H)
if(!istype(H))
return
if(ticker && !ticker.Bible_icon_state && H.job == "Chaplain")
//Open bible selection
var/dat = "<html><head><title>Pick Bible Style</title></head><body><center><h2>Pick a bible style</h2></center><table>"
var/i
for(i = 1, i < biblestates.len, i++)
var/icon/bibleicon = icon('icons/obj/storage.dmi', biblestates[i])
var/nicename = biblenames[i]
H << browse_rsc(bibleicon, nicename)
dat += {"<tr><td><img src="[nicename]"></td><td><a href="?src=\ref[src];seticon=[i]">[nicename]</a></td></tr>"}
dat += "</table></body></html>"
H << browse(dat, "window=editicon;can_close=0;can_minimize=0;size=250x650")
/obj/item/weapon/storage/book/bible/proc/setupbiblespecifics(var/obj/item/weapon/storage/book/bible/B, var/mob/living/carbon/human/H)
switch(B.icon_state)
if("honk1","honk2")
new /obj/item/weapon/grown/bananapeel(B)
new /obj/item/weapon/grown/bananapeel(B)
if(B.icon_state == "honk1")
H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(H), slot_wear_mask)
if("bible")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 2
if("koran")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 4
if("scientology")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 8
if("athiest")
for(var/area/chapel/main/A in world)
for(var/turf/T in A.contents)
if(T.icon_state == "carpetsymbol")
T.dir = 10
/obj/item/weapon/storage/book/bible/Topic(href, href_list)
if(href_list["seticon"])
var/iconi = text2num(href_list["seticon"])
var/biblename = biblenames[iconi]
var/obj/item/weapon/storage/book/bible/B = locate(href_list["src"])
B.icon_state = biblestates[iconi]
B.item_state = bibleitemstates[iconi]
//Set biblespecific chapels
setupbiblespecifics(B, usr)
if(ticker)
ticker.Bible_icon_state = B.icon_state
ticker.Bible_item_state = B.item_state
feedback_set_details("religion_book","[biblename]")
usr << browse(null, "window=editicon") // Close window
/obj/item/weapon/storage/book/bible/proc/bless(mob/living/carbon/M as mob)
if(ishuman(M))
+62 -5
View File
@@ -62,6 +62,7 @@ datum/preferences
var/eye_color = "000" //Eye color
var/datum/species/pref_species = new /datum/species/human() //Mutant race
var/mutant_color = "FFF" //Mutant race skin color
var/list/custom_names = list("clown", "mime", "ai", "cyborg", "religion", "deity")
//Mob preview
var/icon/preview_icon_front = null
@@ -94,6 +95,10 @@ datum/preferences
/datum/preferences/New(client/C)
blood_type = random_blood_type()
ooccolor = normal_ooc_colour
custom_names["ai"] = pick(ai_names)
custom_names["cyborg"] = pick(ai_names)
custom_names["clown"] = pick(clown_names)
custom_names["mime"] = pick(mime_names)
if(istype(C))
if(!IsGuestKey(C.key))
load_path(C.ckey)
@@ -158,10 +163,18 @@ datum/preferences
dat += "<a href='?_src_=prefs;preference=name;task=input'>[real_name]</a><BR>"
dat += "<b>Gender:</b> <a href='?_src_=prefs;preference=gender'>[gender == MALE ? "Male" : "Female"]</a><BR>"
dat += "<b>Age:</b> <a href='?_src_=prefs;preference=age;task=input'>[age]</a>"
dat += "<b>Age:</b> <a href='?_src_=prefs;preference=age;task=input'>[age]</a><BR>"
dat += "<b>Special Names:</b><BR>"
dat += "<a href ='?_src_=prefs;preference=clown_name;task=input'><b>Clown:</b> [custom_names["clown"]]</a> "
dat += "<a href ='?_src_=prefs;preference=mime_name;task=input'><b>Mime:</b>[custom_names["mime"]]</a><BR>"
dat += "<a href ='?_src_=prefs;preference=ai_name;task=input'><b>AI:</b> [custom_names["ai"]]</a> "
dat += "<a href ='?_src_=prefs;preference=cyborg_name;task=input'><b>Cyborg:</b> [custom_names["cyborg"]]</a><BR>"
dat += "<a href ='?_src_=prefs;preference=religion_name;task=input'><b>Chaplain religion:</b> [custom_names["religion"]] </a>"
dat += "<a href ='?_src_=prefs;preference=deity_name;task=input'><b>Chaplain deity:</b> [custom_names["deity"]]</a><BR></td>"
dat += "</td><td valign='center'>"
dat += "<td valign='center'>"
dat += "<div class='statusDisplay'><center><img src=previewicon.png height=64 width=64><img src=previewicon2.png height=64 width=64></center></div>"
@@ -182,11 +195,11 @@ datum/preferences
dat += "<b>Underwear:</b><BR><a href ='?_src_=prefs;preference=underwear;task=input'>[underwear]</a><BR>"
dat += "<b>Undershirt:</b><BR><a href ='?_src_=prefs;preference=undershirt;task=input'>[undershirt]</a><BR>"
dat += "<b>Socks:</b><BR><a href ='?_src_=prefs;preference=socks;task=input'>[socks]</a><BR>"
dat += "<b>Backpack:</b><BR><a href ='?_src_=prefs;preference=bag;task=input'>[backbaglist[backbag]]</a><BR>"
dat += "<b>Backpack:</b><BR><a href ='?_src_=prefs;preference=bag;task=input'>[backbaglist[backbag]]</a><BR></td>"
if(pref_species.use_skintones)
dat += "</td><td valign='top' width='21%'>"
dat += "<td valign='top' width='21%'>"
dat += "<h3>Skin Tone</h3>"
@@ -304,7 +317,7 @@ datum/preferences
dat += "</center>"
//user << browse(dat, "window=preferences;size=560x560")
var/datum/browser/popup = new(user, "preferences", "<div align='center'>Character Setup</div>", 640, 680)
var/datum/browser/popup = new(user, "preferences", "<div align='center'>Character Setup</div>", 640, 750)
popup.set_content(dat)
popup.open(0)
@@ -752,6 +765,50 @@ datum/preferences
var/new_backbag = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in backbaglist
if(new_backbag)
backbag = backbaglist.Find(new_backbag)
if("clown_name")
var/new_clown_name = reject_bad_name( input(user, "Choose your character's clown name:", "Character Preference") as text|null )
if(new_clown_name)
custom_names["clown"] = new_clown_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>"
if("mime_name")
var/new_mime_name = reject_bad_name( input(user, "Choose your character's mime name:", "Character Preference") as text|null )
if(new_mime_name)
custom_names["mime"] = new_mime_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>"
if("ai_name")
var/new_ai_name = reject_bad_name( input(user, "Choose your character's AI name:", "Character Preference") as text|null, 1 )
if(new_ai_name)
custom_names["ai"] = new_ai_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, 0-9, -, ' and .</font>"
if("cyborg_name")
var/new_cyborg_name = reject_bad_name( input(user, "Choose your character's cyborg name:", "Character Preference") as text|null, 1 )
if(new_cyborg_name)
custom_names["cyborg"] = new_cyborg_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, 0-9, -, ' and .</font>"
if("religion_name")
var/new_religion_name = reject_bad_name( input(user, "Choose your character's mime name:", "Character Preference") as text|null )
if(new_religion_name)
custom_names["religion"] = new_religion_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>"
if("deity_name")
var/new_deity_name = reject_bad_name( input(user, "Choose your character's mime name:", "Character Preference") as text|null )
if(new_deity_name)
custom_names["deity"] = new_deity_name
else
user << "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>"
else
switch(href_list["preference"])
if("publicity")
@@ -187,6 +187,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["socks"] >> socks
S["backbag"] >> backbag
S["mutant_color"] >> mutant_color
S["clown_name"] >> custom_names["clown"]
S["mime_name"] >> custom_names["mime"]
S["ai_name"] >> custom_names["ai"]
S["cyborg_name"] >> custom_names["cyborg"]
S["religion_name"] >> custom_names["religion"]
S["deity_name"] >> custom_names["deity"]
//Jobs
S["userandomjob"] >> userandomjob
@@ -274,6 +280,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["backbag"] << backbag
S["species"] << pref_species.name
S["mutant_color"] << mutant_color
S["clown_name"] << custom_names["clown"]
S["mime_name"] << custom_names["mime"]
S["ai_name"] << custom_names["ai"]
S["cyborg_name"] << custom_names["cyborg"]
S["religion_name"] << custom_names["religion"]
S["deity_name"] << custom_names["deity"]
//Jobs
S["userandomjob"] << userandomjob
+1 -11
View File
@@ -63,17 +63,7 @@ var/list/ai_list = list()
var/apc_override = 0 //hack for letting the AI use its APC even when visionless
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
var/pickedName = null
while(!pickedName)
pickedName = pick(ai_names)
for (var/mob/living/silicon/ai/A in mob_list)
if (A.real_name == pickedName && possibleNames.len > 1) //fixing the theoretically possible infinite loop
possibleNames -= pickedName
pickedName = null
real_name = pickedName
rename_self("ai", 1)
name = real_name
anchored = 1
canmove = 0
+3 -3
View File
@@ -308,9 +308,6 @@
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot( loc )
if (config.rename_cyborg)
O.rename_self("cyborg", 1)
// cyborgs produced by Robotize get an automatic power cell
O.cell = new(O)
O.cell.maxcharge = 7500
@@ -330,6 +327,9 @@
O.update_pipe_vision()
if (config.rename_cyborg)
O.rename_self("cyborg", 1)
O.loc = loc
O.job = "Cyborg"
O.notify_ai(1)