diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index e75e9cc04e..91e35e2cdb 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -244,67 +244,73 @@ /area/Entered(A) - - var/sound = null var/musVolume = 25 - sound = 'sound/ambience/ambigen1.ogg' + var/sound = 'sound/ambience/ambigen1.ogg' + if(!istype(A,/mob/living)) return - if (ismob(A)) + var/mob/living/L = A + if(!L.ckey) return - if (istype(A, /mob/dead/observer)) return - if (!A:ckey) - return + if(!L.lastarea) + L.lastarea = get_area(L.loc) + var/area/newarea = get_area(L.loc) + var/area/oldarea = L.lastarea + if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together. + thunk(L) - if(istype(A,/mob/living)) - if(!A:lastarea) - A:lastarea = get_area(A:loc) - //world << "Entered new area [get_area(A:loc)]" - var/area/newarea = get_area(A:loc) - var/area/oldarea = A:lastarea - if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (A:m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together. - thunk(A) + L.lastarea = newarea - A:lastarea = newarea + // Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch + if(!(L && L.client && (L.client.prefs.toggles & SOUND_AMBIENCE))) return - //if (A:ear_deaf) return - - if (A && A:client && !A:client:ambience_playing && !A:client:no_ambi) // Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch - A:client:ambience_playing = 1 - A << sound('sound/ambience/shipambience.ogg', repeat = 1, wait = 0, volume = 35, channel = 2) + if(!L.client.ambience_playing) + L.client.ambience_playing = 1 + L << sound('sound/ambience/shipambience.ogg', repeat = 1, wait = 0, volume = 35, channel = 2) + if(prob(35)) switch(src.name) - if ("Chapel") sound = pick('sound/ambience/ambicha1.ogg','sound/ambience/ambicha2.ogg','sound/ambience/ambicha3.ogg','sound/ambience/ambicha4.ogg') - if ("Morgue") sound = pick('sound/ambience/ambimo1.ogg','sound/ambience/ambimo2.ogg','sound/ambience/title2.ogg') - if ("Space") sound = pick('sound/ambience/ambispace.ogg','sound/ambience/title2.ogg',) - if ("Engine Control", "Engineering", "Engineering SMES") sound = pick('sound/ambience/ambisin1.ogg','sound/ambience/ambisin2.ogg','sound/ambience/ambisin3.ogg','sound/ambience/ambisin4.ogg') - if ("AI Satellite Teleporter Room") sound = pick('sound/ambience/ambimalf.ogg') - if ("AI Upload Foyer") sound = pick('sound/ambience/ambimalf.ogg') - if ("AI Upload Chamber") sound = pick('sound/ambience/ambimalf.ogg') - if ("Mine") + if("Chapel") + sound = pick('sound/ambience/ambicha1.ogg','sound/ambience/ambicha2.ogg','sound/ambience/ambicha3.ogg','sound/ambience/ambicha4.ogg') + if("Morgue") + sound = pick('sound/ambience/ambimo1.ogg','sound/ambience/ambimo2.ogg','sound/ambience/title2.ogg') + if("Space") + sound = pick('sound/ambience/ambispace.ogg','sound/ambience/title2.ogg',) + if("Engine Control", "Engineering", "Engineering SMES") + sound = pick('sound/ambience/ambisin1.ogg','sound/ambience/ambisin2.ogg','sound/ambience/ambisin3.ogg','sound/ambience/ambisin4.ogg') + if("AI Satellite Teleporter Room") + sound = pick('sound/ambience/ambimalf.ogg') + if("AI Upload Foyer") + sound = pick('sound/ambience/ambimalf.ogg') + if("AI Upload Chamber") + sound = pick('sound/ambience/ambimalf.ogg') + if("Mine") sound = pick('sound/ambience/ambimine.ogg') musVolume = 25 - - if("Telecoms Teleporter") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecoms Central Compartment") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecoms Satellite") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecoms Foyer") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecommunications Satellite West Wing") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecommunications Satellite East Wing") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecoms Control Room") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - if("Telecommunications Satellite Lounge") sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') - + if("Telecoms Teleporter") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecoms Central Compartment") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecoms Satellite") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecoms Foyer") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecommunications Satellite West Wing") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecommunications Satellite East Wing") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecoms Control Room") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') + if("Telecommunications Satellite Lounge") + sound = pick('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg') else sound = pick('sound/ambience/ambigen1.ogg','sound/ambience/ambigen3.ogg','sound/ambience/ambigen4.ogg','sound/ambience/ambigen5.ogg','sound/ambience/ambigen6.ogg','sound/ambience/ambigen7.ogg','sound/ambience/ambigen8.ogg','sound/ambience/ambigen9.ogg','sound/ambience/ambigen10.ogg','sound/ambience/ambigen11.ogg','sound/ambience/ambigen12.ogg','sound/ambience/ambigen14.ogg') - - - if (prob(35)) - if(A && A:client && !A:client:played && !A:client:no_ambi) - A << sound(sound, repeat = 0, wait = 0, volume = musVolume, channel = 1) - A:client:played = 1 - spawn(600) - if(A && A:client) - A:client:played = 0 + if(!L.client.played) + L << sound(sound, repeat = 0, wait = 0, volume = musVolume, channel = 1) + L.client.played = 1 + spawn(600) //ewww - this is very very bad + if(L.&& L.client) + L.client.played = 0 /area/proc/gravitychange(var/gravitystate = 0, var/area/A) diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index ca5da37944..6eb7e175ed 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -38,6 +38,8 @@ var/global/datum/controller/gameticker/ticker /datum/controller/gameticker/proc/pregame() login_music = pick('sound/ambience/title2.ogg') // choose title music! + for(var/mob/new_player/M in mob_list) + if(M.client) M.client.playtitlemusic() do pregame_timeleft = 90 diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm index 77498e8a53..d7d549d661 100644 --- a/code/game/machinery/telecomms/broadcaster.dm +++ b/code/game/machinery/telecomms/broadcaster.dm @@ -279,7 +279,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept /* --- Loop through the receivers and categorize them --- */ - if (R.client && R.client.STFU_radio) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. + if (R.client && !(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. continue if(istype(M, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes. @@ -563,7 +563,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept /* --- Loop through the receivers and categorize them --- */ - if (R.client && R.client.STFU_radio) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. + if (R.client && !(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. continue diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 13712cd441..2109831608 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -447,7 +447,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use var/list/heard_garbled = list() // garbled message for (var/mob/R in receive) - if (R.client && R.client.STFU_radio) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. + if (R.client && !(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. continue if (R.say_understands(M)) if (ishuman(M) && M.GetVoice() != M.real_name) diff --git a/code/game/sound.dm b/code/game/sound.dm index 35d80594ac..6adcac736e 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -78,14 +78,14 @@ client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful set category = "Special Verbs" set name = "Toggle Ambience" - - usr:client:no_ambi = !usr:client:no_ambi - - if(usr:client:no_ambi) - usr << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1) - usr << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2) - - usr << "Toggled ambient sound [usr:client:no_ambi?"off":"on"]." + prefs.toggles ^= SOUND_AMBIENCE + prefs.save_preferences() + if(prefs.toggles & SOUND_AMBIENCE) + src << "You will now hear ambient sounds." + else + src << "You will no longer hear ambient sounds." + src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1) + src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2) return diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm index ade068ed63..e2e4a86cef 100644 --- a/code/game/verbs/ooc.dm +++ b/code/game/verbs/ooc.dm @@ -1,20 +1,15 @@ -/mob/verb/listen_ooc() +/client/verb/listen_ooc() set name = "Un/Mute OOC" set category = "OOC" - - if (src.client) - src.client.listen_ooc = !src.client.listen_ooc - if (src.client.listen_ooc) - src << "\blue You are now listening to messages on the OOC channel." - else - src << "\blue You are no longer listening to messages on the OOC channel." + prefs.toggles ^= CHAT_OOC + prefs.save_preferences() + src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel." /client/verb/ooc(msg as text) set name = "OOC" //Gave this shit a shorter name so you only have to time out "ooc" rather than "ooc message" to use it --NeoFite set category = "OOC" if(!mob) return - if(IsGuestKey(key)) src << "Guests may not use OOC." return @@ -22,7 +17,7 @@ msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) if(!msg) return - if(!listen_ooc) + if(!(prefs.toggles & CHAT_OOC)) src << "\red You have OOC muted." return @@ -30,7 +25,7 @@ if(!ooc_allowed) src << "\red OOC is globally muted" return - if(!dooc_allowed && deadchat != 0) + if(!dooc_allowed && (mob.stat == DEAD)) usr << "\red OOC for dead mobs has been turned off." return if(prefs.muted & MUTE_OOC) @@ -47,11 +42,11 @@ log_ooc("[mob.name]/[key] : [msg]") for(var/client/C in clients) - if(C.listen_ooc) + if(C.prefs.toggles & CHAT_OOC) if(holder) if(!holder.fakekey || C.holder) if(holder.rights & R_ADMIN) - C << "OOC: [key][holder.fakekey ? "/([holder.fakekey])" : ""]: [msg]" + C << "OOC: [key][holder.fakekey ? "/([holder.fakekey])" : ""]: [msg]" else C << "OOC: [key][holder.fakekey ? "/([holder.fakekey])" : ""]: [msg]" else diff --git a/code/game/verbs/sound.dm b/code/game/verbs/sound.dm index 11d0205dea..1ed35e1d9b 100644 --- a/code/game/verbs/sound.dm +++ b/code/game/verbs/sound.dm @@ -2,25 +2,33 @@ set category = "Special Verbs" set name = "Toggle Midis" set desc = "This will prevent further admin midis from playing, as well as cut off the current one." - - midis = !midis - if(!midis) + prefs.toggles ^= SOUND_MIDI + prefs.save_preferences() + if(prefs.toggles & SOUND_MIDI) + src << "You will now hear any sounds uploaded by admins." var/sound/break_sound = sound(null, repeat = 0, wait = 0, channel = 777) break_sound.priority = 250 src << break_sound //breaks the client's sound output on channel 777 - - src << "You will now [midis? "start":"stop"] receiving any sounds uploaded by admins[midis? "":", and any current midis playing have been disabled"]." + else + src << "You will no longer hear sounds uploaded by admins; any currently playing midis have been disabled." -/mob/verb/toggletitlemusic() +/client/verb/toggletitlemusic() set category = "Special Verbs" set name = "Toggle Pregame Music" set desc = "Stops the pregame lobby music from playing." + prefs.toggles ^= SOUND_LOBBY + prefs.save_preferences() + if(prefs.toggles & SOUND_LOBBY) + src << "You will now hear music in the game lobby." + if(istype(mob, /mob/new_player)) + playtitlemusic() + else + src << "You will no longer hear music in the game lobby." + if(istype(mob, /mob/new_player)) + src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz - if(istype(usr,/mob/new_player)) - var/mob/M = usr - - if(M.client) - M << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz - - return +/client/proc/playtitlemusic() + if(!ticker || !ticker.login_music) return + if(prefs.toggles & SOUND_LOBBY) + src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS \ No newline at end of file diff --git a/code/global.dm b/code/global.dm index 300eebfd3d..cc1da77fd3 100644 --- a/code/global.dm +++ b/code/global.dm @@ -227,6 +227,19 @@ var/fileaccess_timer = 1800 //Cannot access files by ftp until the game is finis #define R_HOST 65535 +//Preference toggles +#define SOUND_ADMINHELP 1 +#define SOUND_MIDI 2 +#define SOUND_AMBIENCE 4 +#define SOUND_LOBBY 8 +#define CHAT_OOC 16 +#define CHAT_DEAD 32 +#define CHAT_GHOSTEARS 64 +#define CHAT_GHOSTSIGHT 128 +#define CHAT_PRAYER 256 +#define CHAT_RADIO 512 + +#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_PRAYER|CHAT_RADIO) //Database connections //A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.). diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 4496973520..89252030a1 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -685,24 +685,18 @@ var/global/floorIsLava = 0 set category = "Admin" set desc="Toggles Deadchat Visibility" set name="Deadchat Visibility" - if(deadchat == 0) - deadchat = 1 - usr << "Deadchat turned on" - else - deadchat = 0 - usr << "Deadchat turned off" + prefs.toggles ^= CHAT_DEAD + prefs.save_preferences() + src << "You will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat." feedback_add_details("admin_verb","TDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/toggleprayers() set category = "Admin" set desc="Toggles Prayer Visibility" set name="Prayer Visibility" - if(seeprayers == 0) - seeprayers = 1 - usr << "Prayer visibility turned on" - else - seeprayers = 0 - usr << "Prayer visibility turned off" + prefs.toggles ^= CHAT_PRAYER + prefs.save_preferences() + src << "You will [(prefs.toggles & CHAT_PRAYER) ? "now" : "no longer"] see prayerchat." feedback_add_details("admin_verb","TP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/unprison(var/mob/M in mob_list) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 49e1cef3aa..a20b32ba9b 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -16,7 +16,6 @@ var/list/admin_verbs_default = list( /client/proc/deadchat, /*toggles deadchat on/off*/ /client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/ /client/proc/toggleprayers, /*toggles prayers on/off*/ - /client/proc/toggle_hear_deadcast, /*toggles whether we hear deadchat*/ /client/proc/toggle_hear_radio, /*toggles whether we hear the radio*/ /client/proc/investigate_show, /*various admintools for investigation. Such as a singulo grief-log*/ /client/proc/secrets @@ -140,7 +139,6 @@ var/list/admin_verbs_hideable = list( /client/proc/deadmin_self, /client/proc/deadchat, /client/proc/toggleprayers, - /client/proc/toggle_hear_deadcast, /client/proc/toggle_hear_radio, /datum/admins/proc/show_traitor_panel, /datum/admins/proc/toggleenter, @@ -396,9 +394,11 @@ var/list/admin_verbs_hideable = list( /client/proc/colorooc() set category = "Fun" set name = "OOC Text Color" - if(holder) - var/new_ooccolor = input(src, "Please select your OOC colour.", "OOC colour") as color|null - if(new_ooccolor) holder.ooccolor = new_ooccolor + if(!holder) return + var/new_ooccolor = input(src, "Please select your OOC colour.", "OOC colour") as color|null + if(new_ooccolor) + prefs.ooccolor = new_ooccolor + prefs.save_preferences() feedback_add_details("admin_verb","OC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return @@ -535,11 +535,9 @@ var/list/admin_verbs_hideable = list( set name = "Toggle Adminhelp Sound" set category = "Admin" if(!holder) return - holder.sound_adminhelp = !holder.sound_adminhelp - if(holder.sound_adminhelp) - usr << "You will now hear a sound when adminhelps arrive" - else - usr << "You will no longer hear a sound when adminhelps arrive" + prefs.toggles ^= SOUND_ADMINHELP + prefs.save_preferences() + usr << "You will [(prefs.toggles & SOUND_ADMINHELP) ? "now" : "no longer"] hear a sound when adminhelps arrive" feedback_add_details("admin_verb","AHS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/object_talk(var/msg as text) // -- TLE @@ -576,22 +574,13 @@ var/list/admin_verbs_hideable = list( world << "Testing of new click proc [using_new_click_proc ? "enabled" : "disabled"]" feedback_add_details("admin_verb","TNCP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/toggle_hear_deadcast() - set name = "Toggle Hear Deadcast" - set category = "Admin" - - if(!holder) return - STFU_ghosts = !STFU_ghosts - usr << "You will now [STFU_ghosts ? "not hear" : "hear"] ghosts" - feedback_add_details("admin_verb","THDC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - /client/proc/toggle_hear_radio() set name = "Toggle Hear Radio" set category = "Admin" - if(!holder) return - STFU_radio = !STFU_radio - usr << "You will now [STFU_radio ? "not hear" : "hear"] radio chatter from nearby radios or speakers" + prefs.toggles ^= CHAT_RADIO + prefs.save_preferences() + usr << "You will [(prefs.toggles & CHAT_RADIO) ? "now" : "no longer"] see radio chatter from nearby radios or speakers" feedback_add_details("admin_verb","THR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/deadmin_self() diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 853558d4c7..832df48ee1 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -3,12 +3,8 @@ var/list/admin_datums = list() /datum/admins var/rank = "Temporary Admin" var/client/owner = null - var/rights = 0 - var/fakekey = null - var/ooccolor = "#b82e00" - var/sound_adminhelp = 0 //If set to 1 this will play a sound when adminhelps are received. var/datum/marked_datum diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 95edd11a17..31664b4039 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -88,7 +88,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," for(var/client/X in admins) if(X.is_afk()) admin_number_afk++ - if(X.holder.sound_adminhelp) + if(X.prefs.toggles & SOUND_ADMINHELP) X << 'sound/effects/adminhelp.ogg' X << msg diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 7688f962a5..56f0156dce 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -73,7 +73,7 @@ src << "PM to-Admins: [msg]" //play the recieving admin the adminhelp sound (if they have them enabled) - if(C.holder.sound_adminhelp) + if(C.prefs.toggles & SOUND_ADMINHELP) C << 'sound/effects/adminhelp.ogg' else diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index 5fd0c54757..e861264f48 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -25,7 +25,7 @@ for (var/mob/M in player_list) if (istype(M, /mob/new_player)) continue - if (M.stat == 2 || (M.client && M.client.holder && M.client.deadchat)) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above + if (M.stat == DEAD || (M.client && M.client.holder && (M.client.prefs.toggles & CHAT_DEAD))) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above M.show_message(rendered, 2) feedback_add_details("admin_verb","D") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! \ No newline at end of file diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index 17fb8c9a44..ce338bfd3e 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -9,7 +9,7 @@ log_admin("[key_name(src)] played sound [S]") message_admins("[key_name_admin(src)] played sound [S]", 1) for(var/mob/M in player_list) - if(M.client.midis) + if(M.client.prefs.toggles & SOUND_MIDI) M << uploaded_sound feedback_add_details("admin_verb","PGS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index a3a140d1bd..f4d12123d2 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -16,7 +16,7 @@ msg = "\blue \icon[cross] PRAY: [key_name(src, 1)] (?) (PP) (VV) (SM) (JMP) (CA) (SC): [msg]" for(var/client/C in admins) - if(C.seeprayers) + if(C.prefs.toggles & CHAT_PRAYER) C << msg usr << "Your prayers have been received by the gods." diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index e13efe01f9..0977ac861e 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -4,7 +4,6 @@ //////////////// var/datum/admins/holder = null var/buildmode = 0 - var/seeprayers = 1 var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming. var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent. @@ -13,23 +12,16 @@ //OTHER// ///////// var/datum/preferences/prefs = null - var/listen_ooc = 1 var/move_delay = 1 var/moving = null var/adminobs = null - var/deadchat = 1 var/area = null - var/played = 0 - var/STFU_ghosts //80+ people rounds are fun to admin when text flies faster than airport security - var/STFU_radio //80+ people rounds are fun to admin when text flies faster than airport security /////////////// //SOUND STUFF// /////////////// - var/canplaysound = 1 var/ambience_playing= null - var/no_ambi = 0 //Toggle Ambience - var/midis = 1 //Toggle Midis + var/played = 0 //////////// //SECURITY// diff --git a/code/modules/mob/living/carbon/brain/emote.dm b/code/modules/mob/living/carbon/brain/emote.dm index c8aff34b3d..8f83bd390a 100644 --- a/code/modules/mob/living/carbon/brain/emote.dm +++ b/code/modules/mob/living/carbon/brain/emote.dm @@ -53,7 +53,7 @@ for(var/mob/M in dead_mob_list) if (!M.client || istype(M, /mob/new_player)) continue //skip monkeys, leavers, and new_players - if(M.stat == 2 && M.client.ghost_sight && !(M in viewers(src,null))) + if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null))) M.show_message(message) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index d45d874039..eb6f7d01ef 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -576,9 +576,9 @@ // Maybe some people are okay with that. for(var/mob/M in dead_mob_list) - if (!M.client || istype(M, /mob/new_player)) + if(!M.client || istype(M, /mob/new_player)) continue //skip monkeys, leavers and new players - if(M.stat == 2 && M.client.ghost_sight && !(M in viewers(src,null))) + if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null))) M.show_message(message) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 54fd8e4665..93d2303d08 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -276,7 +276,7 @@ var/list/department_radio_keys = list( continue //skip monkeys and leavers if (istype(M, /mob/new_player)) continue - if(M.stat == 2 && M.client.ghost_ears) + if(M.stat == DEAD && (M.client.prefs & CHAT_GHOSTEARS)) listening|=M var/turf/T = get_turf(src) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index a47957333a..e97879aa90 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -402,29 +402,21 @@ var/list/slot_equipment_priority = list( \ prefs.save_preferences() winset(src, "rpane.changelog", "background-color=none;font-style=;") -/client/var/ghost_ears = 0 /client/verb/toggle_ghost_ears() set name = "Ghost ears" set category = "OOC" set desc = "Hear talks from everywhere" - ghost_ears = !ghost_ears - if (ghost_ears) - usr << "\blue Now you hear all speech in the world" - else - usr << "\blue Now you hear speech only from nearest creatures." + prefs.toggles ^= CHAT_GHOSTEARS + src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTEARS) ? "see all speech in the world" : "only see speech from nearby mobs"]." + prefs.save_preferences() -/client/var/ghost_sight = 0 /client/verb/toggle_ghost_sight() set name = "Ghost sight" set category = "OOC" set desc = "Hear emotes from everywhere" - ghost_sight = !ghost_sight - if (ghost_sight) - usr << "\blue Now you hear all emotes in the world" - else - usr << "\blue Now you hear emotes only from nearest creatures." - - + prefs.toggles ^= CHAT_GHOSTSIGHT + src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTSIGHT) ? "see all emotes in the world" : "only see emotes from nearby mobs"]." + prefs.save_preferences() /mob/verb/observe() set name = "Observe" diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 56b3cd8524..534ce1a7c1 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -30,5 +30,4 @@ spawn(40) if(client) handle_privacy_poll() - if(client.prefs.lobby_music) - Playmusic() + client.playtitlemusic() diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 7f862f583e..f78006417b 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -61,21 +61,6 @@ src << browse(output,"window=playersetup;size=210x240;can_close=0") return - proc/Playmusic() - while(!ticker) // wait for ticker to be created - sleep(1) - - var/waits = 0 - var/maxwaits = 100 - while(!ticker.login_music) - sleep(2) - - waits++ // prevents DDoSing the server via badminery - if(waits >= maxwaits) - break - - src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS - Stat() ..() @@ -131,10 +116,8 @@ if(client.prefs.be_random_name) client.prefs.randomize_name() observer.name = client.prefs.real_name - observer.key = key observer.real_name = observer.name - - client.prefs.copy_to_observer(observer) + observer.key = key del(src) return 1 diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index 1aeedd792f..3b5f02017b 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -50,13 +50,9 @@ datum/preferences //game-preferences var/lastchangelog = "" //Saved changlog filesize to detect if there was a change var/ooccolor = "#b82e00" - var/midis = 1 //Play admin midis - var/ghost_ears = 1 //Toggle ghost ears - var/ghost_sight = 1 var/be_special = 0 //Special role selection var/UI_style = "Midnight" - var/sound_adminhelp = 0 - var/lobby_music = 1 //Whether or not to play the lobby music(Defaults yes) + var/toggles = TOGGLES_DEFAULT //character preferences var/real_name //our character's name @@ -97,7 +93,7 @@ datum/preferences var/job_engsec_low = 0 // Want randomjob if preferences already filled - Donkie - var/userandomjob = 1 // Defaults to 1 for less assistants! + var/userandomjob = 1 //defaults to 1 for fewer assistants // OOC Metadata: var/metadata = "" @@ -149,17 +145,17 @@ datum/preferences dat += "
" dat += "UI Style: [UI_style]
" - dat += "Play admin midis: [midis == 1 ? "Yes" : "No"]
" - dat += "Play lobby music: [lobby_music == 1 ? "Yes" : "No"]
" - dat += "Ghost ears: [ghost_ears == 0 ? "Nearest Creatures" : "All Speech"]
" - dat += "Ghost sight: [ghost_sight == 0 ? "Nearest Creatures" : "All Emotes"]
" + dat += "Play admin midis: [(toggles & SOUND_MIDI) ? "Yes" : "No"]
" + dat += "Play lobby music: [(toggles & SOUND_LOBBY) ? "Yes" : "No"]
" + dat += "Ghost ears: [(toggles & CHAT_GHOSTEARS) ? "Nearest Creatures" : "All Speech"]
" + dat += "Ghost sight: [(toggles & CHAT_GHOSTSIGHT) ? "Nearest Creatures" : "All Emotes"]
" if(config.allow_Metadata) dat += "OOC Notes: Edit
" if(user.client && user.client.holder) dat += "Adminhelp sound: " - dat += "[(sound_adminhelp)?"On":"Off"] toggle
" + dat += "[(toggles & SOUND_ADMINHELP)?"On":"Off"] toggle
" if(config.allow_admin_ooccolor && check_rights(R_ADMIN,0)) dat += "
OOC
" @@ -492,8 +488,6 @@ datum/preferences be_special = 0 be_random_name = 0 UI_style = "Midnight" - midis = 1 - ghost_ears = 1 userandomjob = 1 if("input") @@ -586,7 +580,7 @@ datum/preferences gender = MALE if("hear_adminhelps") - sound_adminhelp = !sound_adminhelp + toggles ^= SOUND_ADMINHELP if("ui") switch(UI_style) @@ -605,20 +599,20 @@ datum/preferences be_random_name = !be_random_name if("hear_midis") - midis = !midis + toggles ^= SOUND_MIDI if("lobby_music") - lobby_music = !lobby_music - if(lobby_music) + toggles ^= SOUND_LOBBY + if(toggles & SOUND_LOBBY) user << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) else user << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) if("ghost_ears") - ghost_ears = !ghost_ears + toggles ^= CHAT_GHOSTEARS if("ghost_sight") - ghost_sight = !ghost_sight + toggles ^= CHAT_GHOSTSIGHT if("save") save_preferences() @@ -692,28 +686,9 @@ datum/preferences backbag = 1 //Same as above character.backbag = backbag - if(!safety)//To prevent run-time errors due to null datum when using randomize_appearance_for() - spawn(10) - if(character&&character.client) - setup_client(character.client) - //Debugging report to track down a bug, which randomly assigned the plural gender to people. if(character.gender in list(PLURAL, NEUTER)) if(isliving(src)) //Ghosts get neuter by default message_admins("[character] ([character.ckey]) has spawned with their gender as plural or neuter. Please notify coders.") character.gender = MALE - proc/copy_to_observer(mob/dead/observer/character) - spawn(10) - if(character && character.client) - setup_client(character.client) - - proc/setup_client(var/client/C) - if(C) - if(C.holder) - C.holder.sound_adminhelp = src.sound_adminhelp - C.holder.ooccolor = src.ooccolor - C.midis = src.midis - if(isnull(src.ghost_ears)) src.ghost_ears = 1 //There were problems where the default was null before someone saved their profile. - C.ghost_ears = src.ghost_ears - C.ghost_sight = src.ghost_sight diff --git a/code/modules/mob/new_player/savefile.dm b/code/modules/mob/new_player/savefile.dm index 7aae01a20a..9a6f224af0 100644 --- a/code/modules/mob/new_player/savefile.dm +++ b/code/modules/mob/new_player/savefile.dm @@ -1,18 +1,47 @@ -#define SAVEFILE_VERSION_MIN 7 -#define SAVEFILE_VERSION_MAX 7 +#define SAVEFILE_VERSION_MIN 8 +#define SAVEFILE_VERSION_MAX 8 -/datum/preferences/proc/load_path(ckey) +//handles converting savefiles to new formats +//MAKE SURE YOU KEEP THIS UP TO DATE! +//If the sanity checks are capable of handling any issues. Only increase SAVEFILE_VERSION_MAX, +//this will mean that savefile_version will still be over SAVEFILE_VERSION_MIN, meaning +//this savefile update doesn't run everytime we load from the savefile. +//This is mainly for format changes, such as the bitflags in toggles changing order or something. +/datum/preferences/proc/savefile_update() + if(savefile_version < 6) //really old savefile. + return 0 + + if(savefile_version < 8) //lazily delete everything + additional files so they can be saved in the new format + for(var/ckey in preferences_datums) + var/datum/preferences/D = preferences_datums[ckey] + if(D == src) + var/delpath = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/" + if(delpath && fexists(delpath)) + fdel(delpath) + break + savefile_version = 8 + + //save format changes + save_preferences() + save_character() + return 1 + +/datum/preferences/proc/load_path(ckey,filename="preferences.sav") if(!ckey) return - path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/preferences.sav" + path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/[filename]" /datum/preferences/proc/load_preferences() if(!path) return 0 if(!fexists(path)) return 0 - var/savefile/S = new /savefile(path) if(!S) return 0 S["version"] >> savefile_version + //Conversion + if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX) + if(!savefile_update()) + fdel(path) + return 0 //general preferences S["ooccolor"] >> ooccolor @@ -20,20 +49,7 @@ S["UI_style"] >> UI_style S["be_special"] >> be_special S["default_slot"] >> default_slot - - //to be consolidated into a bitfield - S["sound_adminhelp"] >> sound_adminhelp - S["lobby_music"] >> lobby_music - S["midis"] >> midis - S["ghost_ears"] >> ghost_ears - S["ghost_sight"] >> ghost_sight - - //Conversion -/* if(!savefile_version || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX) - if(!savefile_update()) - fdel(path) - C << "Error: savefile_load(): Your savefile was not compatible and had to be deleted." - return 0 */ + S["toggles"] >> toggles //Sanitize ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) @@ -41,41 +57,31 @@ UI_style = sanitize_inlist(UI_style, list("Midnight","Orange","old"), initial(UI_style)) be_special = sanitize_integer(be_special, 0, 65535, initial(be_special)) default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot)) - - sound_adminhelp = sanitize_integer(sound_adminhelp, 0, 1, initial(sound_adminhelp)) - lobby_music = sanitize_integer(lobby_music, 0, 1, initial(lobby_music)) - midis = sanitize_integer(midis, 0, 1, initial(midis)) - ghost_ears = sanitize_integer(ghost_ears, 0, 1, initial(ghost_ears)) - ghost_sight = sanitize_integer(ghost_sight, 0, 1, initial(ghost_sight)) + if(isnull(toggles)) toggles = initial(toggles) + toggles = sanitize_integer(toggles, 0, 65535, initial(toggles)) return 1 /datum/preferences/proc/save_preferences() if(!path) return 0 - var/savefile/S = new /savefile(path) if(!S) return 0 + S["version"] << savefile_version + //general preferences S["ooccolor"] << ooccolor S["lastchangelog"] << lastchangelog S["UI_style"] << UI_style S["be_special"] << be_special S["default_slot"] << default_slot - - //to be consolidated into a bitfield - S["sound_adminhelp"] << sound_adminhelp - S["lobby_music"] << lobby_music - S["midis"] << midis - S["ghost_ears"] << ghost_ears - S["ghost_sight"] << ghost_sight + S["toggles"] << toggles return 1 /datum/preferences/proc/load_character(slot) if(!path) return 0 if(!fexists(path)) return 0 - var/savefile/S = new /savefile(path) if(!S) return 0 if(!slot) slot = default_slot @@ -156,7 +162,6 @@ /datum/preferences/proc/save_character() if(!path) return 0 - var/savefile/S = new /savefile(path) if(!S) return 0 S.cd = "/character[default_slot]" diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index bef4e6a45a..e5aa7e4f02 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -36,13 +36,12 @@ message = src.say_quote(message) var/rendered = "DEAD: [name][alt_name] [message]" - for (var/mob/M in player_list) - if (istype(M, /mob/new_player)) + for(var/mob/M in player_list) + if(istype(M, /mob/new_player)) continue - if(M.client && M.client.holder && M.client.deadchat) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above - if(!M.client.STFU_ghosts) //Admin shut-off for ghosts chatter - M << rendered //Admins can hear deadchat, if they choose to, no matter if they're blind/deaf or not. - else if (M.stat == DEAD) + if(M.client && M.client.holder && (M.client.prefs.toggles & CHAT_DEAD)) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above + M << rendered //Admins can hear deadchat, if they choose to, no matter if they're blind/deaf or not. + else if(M.stat == DEAD) M.show_message(rendered, 2) //Takes into account blindness and such. return