From a31cf3d3f2a42fc218fadb63d5fb41c4bcb90f52 Mon Sep 17 00:00:00 2001 From: Shifty/Anthomansland Date: Wed, 3 Jun 2020 23:27:15 +0200 Subject: [PATCH] Fix runtimes and togglecreep --- code/modules/client/preferences.dm | 28 ++++++++++++------- code/modules/client/preferences_savefile.dm | 18 ++++++------ .../migrations/SS13_Prefs/023-runechat.dm | 26 +++++++++-------- code/modules/mob/dead/observer/say.dm | 2 +- code/modules/mob/living/say.dm | 11 ++++++-- 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 5f42b1cb9a5..9ce1b609d32 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -214,9 +214,10 @@ var/const/MAX_SAVE_SLOTS = 16 var/jingle = JINGLE_CLASSIC // Runscape-like chat - var/chat_on_map = TRUE + var/mob_chat_on_map = FALSE var/max_chat_length = CHAT_MESSAGE_MAX_LENGTH - var/see_chat_non_mob = TRUE + var/obj_chat_on_map = FALSE + var/no_goonchat_for_obj = FALSE var/client/client var/saveloaded = 0 @@ -419,12 +420,15 @@ var/const/MAX_SAVE_SLOTS = 16 [credits_volume]
Window Flashing [(window_flashing) ? "Yes":"No"]
- Show Runechat Chat Bubbles: - [chat_on_map ? "Enabled" : "Disabled"]
+
Runechat prefererences
+ Chat on map for mobs: + [mob_chat_on_map ? "Enabled" : "Disabled"]
+ Chat on map for objects: + [obj_chat_on_map ? "Enabled" : "Disabled"]
+ No goonchat messages for objects: + [no_goonchat_for_obj ? "Enabled" : "Disabled"]
Runechat message char limit: [max_chat_length]
- See Runechat for non-mobs: - [see_chat_non_mob ? "Enabled" : "Disabled"]
"} @@ -1521,14 +1525,18 @@ NOTE: The change will take effect AFTER any current recruiting periods."} if("typing_indicator") typing_indicator = !typing_indicator - if ("chat_on_map") - chat_on_map = !chat_on_map + if ("mob_chat_on_map") + mob_chat_on_map = !mob_chat_on_map + + if ("obj_chat_on_map") + obj_chat_on_map = !obj_chat_on_map if ("max_chat_length") max_chat_length = input(user, "Choose the max character length of shown Runechat messages. Valid range is 1 to [CHAT_MESSAGE_MAX_LENGTH] (default: [initial(max_chat_length)]))", "Character Preference", max_chat_length) as null|num - if ("see_chat_non_mob") - see_chat_non_mob = !see_chat_non_mob + if ("no_goonchat_for_obj") + no_goonchat_for_obj = !no_goonchat_for_obj + if(user.client.holder) switch(href_list["preference"]) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 7cc6540674e..042bf2e0a42 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -137,9 +137,10 @@ window_flashing = sanitize_integer(window_flashing, 0, 1, initial(window_flashing)) antag_objectives = sanitize_integer(antag_objectives, 0, 1, initial(antag_objectives)) typing_indicator = sanitize_integer(typing_indicator, 0, 1, initial(typing_indicator)) - chat_on_map = sanitize_integer(chat_on_map, 0, 1, initial(chat_on_map)) + mob_chat_on_map = sanitize_integer(mob_chat_on_map, 0, 1, initial(mob_chat_on_map)) max_chat_length = sanitize_integer(max_chat_length, 0, CHAT_MESSAGE_MAX_LENGTH, initial(typing_indicator)) - see_chat_non_mob = sanitize_integer(see_chat_non_mob, 0, 1, initial(see_chat_non_mob)) + obj_chat_on_map = sanitize_integer(obj_chat_on_map, 0, 1, initial(obj_chat_on_map)) + no_goonchat_for_obj = sanitize_integer(no_goonchat_for_obj, 0, 1, initial(no_goonchat_for_obj)) initialize_preferences() return 1 @@ -221,15 +222,15 @@ check.Add("SELECT ckey FROM client WHERE ckey = ?", ckey) if(check.Execute(db)) if(!check.NextRow()) - q.Add("INSERT into client (ckey, ooc_color, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, chat_on_map, max_chat_length, see_chat_non_mob) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",\ - ckey, ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, chat_on_map, max_chat_length, see_chat_non_mob) + q.Add("INSERT into client (ckey, ooc_color, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?)",\ + ckey, ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj) if(!q.Execute(db)) message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]") WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]") return 0 else - q.Add("UPDATE client SET ooc_color=?,lastchangelog=?,UI_style=?,default_slot=?,toggles=?,UI_style_color=?,UI_style_alpha=?,warns=?,warnbans=?,randomslot=?,volume=?,usewmp=?,special=?,usenanoui=?,tooltips=?,progress_bars=?,space_parallax=?,space_dust=?,parallax_speed=?, stumble=?, attack_animation=?, pulltoggle=?, credits=?, jingle=?, hear_voicesound=?, hear_instruments=?, ambience_volume=?, credits_volume=?, window_flashing=?, antag_objectives=? , typing_indicator=? , chat_on_map=? , max_chat_length=?, see_chat_non_mob=?, WHERE ckey = ?",\ - ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, chat_on_map, max_chat_length, see_chat_non_mob, ckey) + q.Add("UPDATE client SET ooc_color=?,lastchangelog=?,UI_style=?,default_slot=?,toggles=?,UI_style_color=?,UI_style_alpha=?,warns=?,warnbans=?,randomslot=?,volume=?,usewmp=?,special=?,usenanoui=?,tooltips=?,progress_bars=?,space_parallax=?,space_dust=?,parallax_speed=?, stumble=?, attack_animation=?, pulltoggle=?, credits=?, jingle=?, hear_voicesound=?, hear_instruments=?, ambience_volume=?, credits_volume=?, window_flashing=?, antag_objectives=? , typing_indicator=? , mob_chat_on_map=? , max_chat_length=?, obj_chat_on_map=?, no_goonchat_for_obj=?, WHERE ckey = ?",\ + ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map,no_goonchat_for_obj, ckey) if(!q.Execute(db)) message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]") WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]") @@ -279,9 +280,10 @@ S["window_flashing"]<< window_flashing S["antag_objectives"]<< antag_objectives S["typing_indicator"]<< typing_indicator - S["chat_on_map"] << chat_on_map + S["mob_chat_on_map"] << mob_chat_on_map S["max_chat_length"] << max_chat_length - S["see_chat_non_mob"] << see_chat_non_mob + S["obj_chat_on_map"] << obj_chat_on_map + S["no_goonchat_for_obj"] << no_goonchat_for_obj return 1 //saving volume changes diff --git a/code/modules/migrations/SS13_Prefs/023-runechat.dm b/code/modules/migrations/SS13_Prefs/023-runechat.dm index 21e4119c014..59c33b7ab59 100644 --- a/code/modules/migrations/SS13_Prefs/023-runechat.dm +++ b/code/modules/migrations/SS13_Prefs/023-runechat.dm @@ -6,22 +6,26 @@ var/mig1 var/mig2 var/mig3 - if(!hasColumn("client","chat_on_map")) - mig1 = execute("ALTER TABLE `client` ADD COLUMN chat_on_map INTEGER DEFAULT 0") + if(!hasColumn("client","mob_chat_on_map")) + mig1 = execute("ALTER TABLE `client` ADD COLUMN mob_chat_on_map INTEGER DEFAULT 0") if(!hasColumn("client","max_chat_length")) mig2 = execute("ALTER TABLE `client` ADD COLUMN max_chat_length INTEGER DEFAULT [CHAT_MESSAGE_MAX_LENGTH]") - if(!hasColumn("client","see_chat_non_mob")) - mig3 = execute("ALTER TABLE `client` ADD COLUMN see_chat_non_mob INTEGER DEFAULT 0") - return mig1 && mig2 && mig3 + if(!hasColumn("client","obj_chat_on_map")) + mig3 = execute("ALTER TABLE `client` ADD COLUMN obj_chat_on_map INTEGER DEFAULT 0") + if(!hasColumn("client","no_goonchat_for_obj")) + mig4 = execute("ALTER TABLE `client` ADD COLUMN no_goonchat_for_obj INTEGER DEFAULT 0") + return mig1 && mig2 && mig3 && mig4 /datum/migration/sqlite/ss13_prefs/_023/down() var/mig1 var/mig2 var/mig3 - if(hasColumn("client","chat_on_map")) - mig1 = execute("ALTER TABLE `client` DROP COLUMN chat_on_map") + if(hasColumn("client","mob_chat_on_map")) + mig1 = execute("ALTER TABLE `client` DROP COLUMN mob_chat_on_map") + if(hasColumn("client","obj_chat_on_map")) + mig2 = execute("ALTER TABLE `client` DROP COLUMN obj_chat_on_map") if(hasColumn("client","max_chat_length")) - mig2 = execute("ALTER TABLE `client` DROP COLUMN max_chat_length") - if(hasColumn("client","see_chat_non_mob")) - mig3 = execute("ALTER TABLE `client` DROP COLUMN see_chat_non_mob") - return mig1 && mig2 && mig3 + mig3 = execute("ALTER TABLE `client` DROP COLUMN max_chat_length") + if(hasColumn("client","no_goonchat_for_obj")) + mig4 = execute("ALTER TABLE `client` DROP COLUMN no_goonchat_for_obj") + return mig1 && mig2 && mig3 && mig4 diff --git a/code/modules/mob/dead/observer/say.dm b/code/modules/mob/dead/observer/say.dm index b200d2b3caf..5ba9f875181 100644 --- a/code/modules/mob/dead/observer/say.dm +++ b/code/modules/mob/dead/observer/say.dm @@ -45,7 +45,7 @@ if ((client.prefs.toggles & CHAT_GHOSTRADIO) != CHAT_GHOSTRADIO) say_testing(src, "/mob/dead/observer/Hear(): CHAT_GHOSTRADIO is disabled, blocking. ([client.prefs.toggles] & [CHAT_GHOSTRADIO]) = [client.prefs.toggles & CHAT_GHOSTRADIO]") return - if (client?.prefs.chat_on_map && (client.prefs.see_chat_non_mob || ismob(speech.speaker))) + if (client?.prefs.mob_chat_on_map && (client.prefs.obj_chat_on_map || ismob(speech.speaker))) create_chat_message(speech.speaker, speech.language, speech.message, speech.mode) to_chat(src, "(Follow) [rendered_speech]") diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 4cfb8fe87e0..4985e132286 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -261,9 +261,16 @@ var/list/department_radio_keys = list( rendered_message = replacetextEx(rendered_message, "AI", "AI") rendered_message = replacetext(rendered_message, ai.real_name, "[ai.real_name]") - show_message(rendered_message, type, deaf_message, deaf_type, src) - if (client?.prefs.chat_on_map && stat != UNCONSCIOUS && (client.prefs.see_chat_non_mob || ismob(speech.speaker)) && !is_deaf()) + // Runechat messages + if (ismob(speech.speaker) && client?.prefs.mob_chat_on_map && stat != UNCONSCIOUS && !is_deaf()) create_chat_message(speech.speaker, speech.language, speech.message, speech.mode) + else if (client?.prefs.obj_chat_on_map && stat != UNCONSCIOUS && !is_deaf()) + create_chat_message(speech.speaker, speech.language, speech.message, speech.mode) + if (ismob(speech.speaker)) + show_message(rendered_message, type, deaf_message, deaf_type, src) + else if (!client.prefs.no_goonchat_for_obj || legnthtext(speech.message) > client?.prefs.max_chat_length) // Objects : only display if no goonchat on map or if the runemessage is too small. + show_message(rendered_message, type, deaf_message, deaf_type, src) + return rendered_message /mob/living/proc/hear_radio_only()