From 20b75be0d393c77c382090710d5a9eff9325d1f5 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:04:02 +0100 Subject: [PATCH 01/20] some --- code/__DEFINES/dcs/signals.dm | 4 ++- code/datums/components/pref_viewer.dm | 35 +++++++++++++++++++ code/modules/client/preference/preferences.dm | 2 ++ .../client/preference/preferences_toggles.dm | 17 +++++++-- .../mob/living/carbon/human/examine.dm | 4 --- code/modules/mob/mob.dm | 6 ++-- 6 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 code/datums/components/pref_viewer.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index aa521e47314..7ad62106ccd 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -452,8 +452,10 @@ #define COMSIG_MOB_THROW "mob_throw" ///called when a user is getting new weapon and we want to remove previous weapon to clear hands #define COMSIG_MOB_WEAPON_APPEARS "mob_weapon_appears" -///from base of /mob/verb/examinate(): (atom/target) +/// from base of /mob/verb/examinate(): (atom/target) #define COMSIG_MOB_EXAMINATE "mob_examinate" +/// from base of /mob/proc/run_examinate(): (atom/target, list/result) +#define COMSIG_MOB_RUN_EXAMINATE "mob_run_examinate" ///from base of /mob/update_sight(): () #define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" ////from /mob/living/say(): () diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm new file mode 100644 index 00000000000..d93d6d57306 --- /dev/null +++ b/code/datums/components/pref_viewer.dm @@ -0,0 +1,35 @@ +/datum/component/pref_viewer + var/list/preferences_to_show = list() + +/datum/component/pref_viewer/Destroy(force) + LAZYNULL(preferences_to_show) + + return ..() + +/datum/component/pref_viewer/Initialize( + list/preferences_to_show +) + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + + src.preferences_to_show = preferences_to_show + +/datum/component/pref_viewer/RegisterWithParent() + RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) + +/datum/component/pref_viewer/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) + +/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) + SIGNAL_HANDLER + + if(!istype(target) || !target.client) + return + + for(var/datum/preference_toggle/pref as anything in target.client.prefs.toggled_preferences) + if(!LAZYIN(preferences_to_show, pref)) + continue + + LAZYADD(result, pref::examine_text) + + return \ No newline at end of file diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 7a371b75989..1439f21151e 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -106,6 +106,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts var/clientfps = 0 var/atklog = ATKLOG_ALL var/fuid // forum userid + /// Contains typepathes of activated prefs. + var/list/toggled_preferences = list() //character preferences var/real_name //our character's name diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index 2cef26fd5e9..453736fd825 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -25,22 +25,32 @@ var/blackbox_message /// Rights required to be able to use this pref option var/rights_required + /// That text will be shown to pref-viewer component owner. + var/examine_text /datum/preference_toggle/proc/set_toggles(client/user) var/datum/preferences/our_prefs = user.prefs + var/result + switch(preftoggle_toggle) if(PREFTOGGLE_SPECIAL) CRASH("[src] did not have it's set_toggles overriden even though it was a special toggle, please use the special_toggle path!") if(PREFTOGGLE_TOGGLE1) - our_prefs.toggles ^= preftoggle_bitflag + result = our_prefs.toggles ^= preftoggle_bitflag to_chat(user, "[(our_prefs.toggles & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_TOGGLE2) - our_prefs.toggles2 ^= preftoggle_bitflag + result = our_prefs.toggles2 ^= preftoggle_bitflag to_chat(user, "[(our_prefs.toggles2 & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_SOUND) - our_prefs.sound ^= preftoggle_bitflag + result = our_prefs.sound ^= preftoggle_bitflag to_chat(user, "[(our_prefs.sound & preftoggle_bitflag) ? enable_message : disable_message]") + if(result) + LAZYADD(our_prefs.toggled_preferences, src) + + else + LAZYREMOVE(our_prefs.toggled_preferences, src) + SSblackbox.record_feedback("tally", "toggle_verbs", 1, blackbox_message) our_prefs.save_preferences(user) @@ -600,4 +610,5 @@ enable_message = "Другие игроки теперь имеют право выводить вас из раунда без цели." disable_message = "Другие игроки больше не имеют права выводить вас из раунда без цели." blackbox_message = "Переключение разрешения выводить игрока из раунда" + examine_text = "\n
[span_info("Вы можете вывести этого игрока из игры не имея соответствующей цели.")]
" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 6152cecfe17..1cfac94b198 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -426,10 +426,6 @@ pose = addtext(pose,".") //Makes sure all emotes end with a period. msg += "\n[p_they(TRUE)] [p_are()] [pose]" - if(client && mind && !mind.offstation_role && user.mind?.special_role) // No ashwalkers, monkeys etc - var/permission_granted = client.prefs.toggles2 & PREFTOGGLE_2_GIB_WITHOUT_OBJECTIVE - msg += "\n
[span_info("Вы[permission_granted ? "" : " [span_warning("НЕ")]"] можете вывести этого игрока из игры не имея соответствующей цели.")]
" - . = list(msg) SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d1020156e82..60720fd0c59 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -344,8 +344,10 @@ DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_examinate), A)) -/mob/proc/run_examinate(atom/A) - var/list/result = A.examine(src) +/mob/proc/run_examinate(atom/target) + var/list/result = target.examine(src) + SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, target, result) + to_chat(src, chat_box_examine(result.Join("\n")), MESSAGE_TYPE_INFO, confidential = TRUE) From 08ef7b277c4566bbc3e053acfb16d5f7454ab889 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:02:21 +0100 Subject: [PATCH 02/20] more meow. --- code/datums/components/pref_viewer.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index d93d6d57306..2819b234827 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -26,10 +26,11 @@ if(!istype(target) || !target.client) return - for(var/datum/preference_toggle/pref as anything in target.client.prefs.toggled_preferences) + INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) + +/datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) + for(var/datum/preference_toggle/pref as anything in target.client.prefs.toggled_preferences) if(!LAZYIN(preferences_to_show, pref)) continue LAZYADD(result, pref::examine_text) - - return \ No newline at end of file From 1f75f2084dc79c7574ad93c0b91a20ea674b3d5b Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:29:40 +0100 Subject: [PATCH 03/20] more dorabotochka --- code/modules/client/preference/preferences_toggles.dm | 5 ++--- code/modules/mob/mob.dm | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index 453736fd825..7832452b814 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -37,13 +37,10 @@ CRASH("[src] did not have it's set_toggles overriden even though it was a special toggle, please use the special_toggle path!") if(PREFTOGGLE_TOGGLE1) result = our_prefs.toggles ^= preftoggle_bitflag - to_chat(user, "[(our_prefs.toggles & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_TOGGLE2) result = our_prefs.toggles2 ^= preftoggle_bitflag - to_chat(user, "[(our_prefs.toggles2 & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_SOUND) result = our_prefs.sound ^= preftoggle_bitflag - to_chat(user, "[(our_prefs.sound & preftoggle_bitflag) ? enable_message : disable_message]") if(result) LAZYADD(our_prefs.toggled_preferences, src) @@ -51,7 +48,9 @@ else LAZYREMOVE(our_prefs.toggled_preferences, src) + to_chat(user, span_notice(result ? enable_message : disable_message)) SSblackbox.record_feedback("tally", "toggle_verbs", 1, blackbox_message) + our_prefs.save_preferences(user) /datum/preference_toggle/toggle_ghost_ears diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 60720fd0c59..a86541dba19 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -346,7 +346,7 @@ /mob/proc/run_examinate(atom/target) var/list/result = target.examine(src) - SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, target, result) + SEND_SIGNAL(src, COMSIG_MOB_RUN_EXAMINATE, target, result) to_chat(src, chat_box_examine(result.Join("\n")), MESSAGE_TYPE_INFO, confidential = TRUE) From 49977389886955794c3fc23477123f08c4b7275a Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:40:18 +0100 Subject: [PATCH 04/20] czponk --- code/__DEFINES/dcs/signals.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 7ad62106ccd..fe24a5b3bf3 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -453,7 +453,7 @@ ///called when a user is getting new weapon and we want to remove previous weapon to clear hands #define COMSIG_MOB_WEAPON_APPEARS "mob_weapon_appears" /// from base of /mob/verb/examinate(): (atom/target) -#define COMSIG_MOB_EXAMINATE "mob_examinate" +#define COMSIG_MOB_VERB_EXAMINATE "mob_examinate" /// from base of /mob/proc/run_examinate(): (atom/target, list/result) #define COMSIG_MOB_RUN_EXAMINATE "mob_run_examinate" ///from base of /mob/update_sight(): () From d1192e7263a8e284534c35bf460576626e365102 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:18:52 +0100 Subject: [PATCH 05/20] mew --- code/__HELPERS/bitflags.dm | 7 +++++++ code/datums/components/pref_viewer.dm | 5 +++-- code/modules/client/preference/preferences.dm | 2 -- .../client/preference/preferences_toggles.dm | 19 ++++++------------- 4 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 code/__HELPERS/bitflags.dm diff --git a/code/__HELPERS/bitflags.dm b/code/__HELPERS/bitflags.dm new file mode 100644 index 00000000000..298a7f09fb2 --- /dev/null +++ b/code/__HELPERS/bitflags.dm @@ -0,0 +1,7 @@ +#define HASBIT(CONTAINER, FLAG) ((CONTAINER) & (FLAG)) + +#define SETBIT(CONTAINER, FLAG) (CONTAINER |= (FLAG)) + +#define CLEARBIT(CONTAINER, FLAG) (CONTAINER &= ~(FLAG)) + +#define TOGGLEBIT(CONTAINER, FLAG) (CONTAINER ^= (FLAG)) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 2819b234827..02d68aafc22 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -1,4 +1,5 @@ /datum/component/pref_viewer + /// Should contain typepathes /datum/preference_toggle var/list/preferences_to_show = list() /datum/component/pref_viewer/Destroy(force) @@ -29,8 +30,8 @@ INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) /datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) - for(var/datum/preference_toggle/pref as anything in target.client.prefs.toggled_preferences) - if(!LAZYIN(preferences_to_show, pref)) + for(var/datum/preference_toggle/pref as anything in preferences_to_show) + if(!HASBIT(target.client.prefs.toggles, pref::preftoggle_bitflag) || !HASBIT(target.client.prefs.toggles2, pref::preftoggle_bitflag)) continue LAZYADD(result, pref::examine_text) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 1439f21151e..7a371b75989 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -106,8 +106,6 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts var/clientfps = 0 var/atklog = ATKLOG_ALL var/fuid // forum userid - /// Contains typepathes of activated prefs. - var/list/toggled_preferences = list() //character preferences var/real_name //our character's name diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index 7832452b814..a94df3b3166 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -30,27 +30,20 @@ /datum/preference_toggle/proc/set_toggles(client/user) var/datum/preferences/our_prefs = user.prefs - var/result - switch(preftoggle_toggle) if(PREFTOGGLE_SPECIAL) CRASH("[src] did not have it's set_toggles overriden even though it was a special toggle, please use the special_toggle path!") if(PREFTOGGLE_TOGGLE1) - result = our_prefs.toggles ^= preftoggle_bitflag + our_prefs.toggles ^= preftoggle_bitflag + to_chat(user, "[(our_prefs.toggles & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_TOGGLE2) - result = our_prefs.toggles2 ^= preftoggle_bitflag + our_prefs.toggles2 ^= preftoggle_bitflag + to_chat(user, "[(our_prefs.toggles2 & preftoggle_bitflag) ? enable_message : disable_message]") if(PREFTOGGLE_SOUND) - result = our_prefs.sound ^= preftoggle_bitflag - - if(result) - LAZYADD(our_prefs.toggled_preferences, src) - - else - LAZYREMOVE(our_prefs.toggled_preferences, src) + our_prefs.sound ^= preftoggle_bitflag + to_chat(user, "[(our_prefs.sound & preftoggle_bitflag) ? enable_message : disable_message]") - to_chat(user, span_notice(result ? enable_message : disable_message)) SSblackbox.record_feedback("tally", "toggle_verbs", 1, blackbox_message) - our_prefs.save_preferences(user) /datum/preference_toggle/toggle_ghost_ears From 1deff485e0a3e3dd613fcc5d1676b77317d4fa2a Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:18:14 +0100 Subject: [PATCH 06/20] save i'm gonna finish it tomorrow --- code/datums/components/pref_viewer.dm | 1 - code/modules/antagonists/changeling/changeling_datum.dm | 5 +++++ code/modules/antagonists/space_ninja/ninja_datum.dm | 5 +++++ code/modules/antagonists/traitor/datum_traitor.dm | 5 +++++ code/modules/antagonists/vampire/vampire_datum.dm | 5 +++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 02d68aafc22..6f8e5f80614 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -1,5 +1,4 @@ /datum/component/pref_viewer - /// Should contain typepathes /datum/preference_toggle var/list/preferences_to_show = list() /datum/component/pref_viewer/Destroy(force) diff --git a/code/modules/antagonists/changeling/changeling_datum.dm b/code/modules/antagonists/changeling/changeling_datum.dm index 0331c578aa7..fdbf7378c80 100644 --- a/code/modules/antagonists/changeling/changeling_datum.dm +++ b/code/modules/antagonists/changeling/changeling_datum.dm @@ -160,6 +160,11 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E var/obj/item/organ/internal/brain/ling_brain = carbon_user.get_organ_slot(INTERNAL_ORGAN_BRAIN) ling_brain?.decoy_brain = TRUE + AddComponent( \ + /datum/component/pref_viewer, \ + /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + ) + /datum/antagonist/changeling/remove_innate_effects(mob/living/mob_override) var/mob/living/user = ..() diff --git a/code/modules/antagonists/space_ninja/ninja_datum.dm b/code/modules/antagonists/space_ninja/ninja_datum.dm index 1bc6f1254f4..4467d229d44 100644 --- a/code/modules/antagonists/space_ninja/ninja_datum.dm +++ b/code/modules/antagonists/space_ninja/ninja_datum.dm @@ -114,6 +114,11 @@ var/mob/living/user = ..() user.faction = list(ROLE_NINJA) + AddComponent( \ + /datum/component/pref_viewer, \ + /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + ) + /datum/antagonist/ninja/proc/change_species(mob/living/mob_to_change = null) // This should be used to fully to remove robo-limbs & change species for lack of sprites human_ninja = ishuman(mob_to_change) ? mob_to_change : null diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 9c95b19510b..66f82d61e24 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -38,6 +38,11 @@ datum_owner.AddComponent(/datum/component/codeword_hearing, GLOB.syndicate_code_phrase_regex, "codephrases", src) datum_owner.AddComponent(/datum/component/codeword_hearing, GLOB.syndicate_code_response_regex, "coderesponses", src) + AddComponent( \ + /datum/component/pref_viewer, \ + /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + ) + /datum/antagonist/traitor/remove_innate_effects(mob/living/mob_override) . = ..() var/mob/living/datum_owner = mob_override || owner.current diff --git a/code/modules/antagonists/vampire/vampire_datum.dm b/code/modules/antagonists/vampire/vampire_datum.dm index 362a11ff5cf..3c332821d4b 100644 --- a/code/modules/antagonists/vampire/vampire_datum.dm +++ b/code/modules/antagonists/vampire/vampire_datum.dm @@ -113,6 +113,11 @@ //slaved.leave_serv_hud(mob_override.mind) //.mind.som = null + AddComponent( \ + /datum/component/pref_viewer, \ + /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + ) + /datum/antagonist/vampire/remove_innate_effects(mob/living/mob_override, transformation = FALSE) var/mob/living/user = ..() From 03edec83150a8e402cc4c4b6f10bc1232181a206 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:22:53 +0100 Subject: [PATCH 07/20] save --- .../client/preference/preference_info.dm | 122 ++++++++++++++++++ .../client/preference/preferences_toggles.dm | 95 +++++++++++++- paradise.dme | 2 + 3 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 code/modules/client/preference/preference_info.dm diff --git a/code/modules/client/preference/preference_info.dm b/code/modules/client/preference/preference_info.dm new file mode 100644 index 00000000000..cb69f87a022 --- /dev/null +++ b/code/modules/client/preference/preference_info.dm @@ -0,0 +1,122 @@ +/datum/preference_info + var/name + +/datum/preference_info/ghost_ears + name = "Hearing All Speech as a Ghost" + +/datum/preference_info/ghost_sight + name = "Ghost Emote Viewing" + +/datum/preference_info/ghost_radio + name = "Ghost Radio" + +/datum/preference_info/admin_radio + name = "Admin Radio" + +/datum/preference_info/ai_voice_announcements + name = "AI Voice Announcements" + +/datum/preference_info/admin_pm_sound + name = "Admin PM Sound" + +/datum/preference_info/mentor_pm_sound + name = "Mentor PM Sound" + +/datum/preference_info/deadchat_visibility + name = "Deadchat Visibility" + +/datum/preference_info/end_of_round_scoreboard + name = "End of Round Scoreboard" + +/datum/preference_info/title_music + name = "Lobby Music" + +/datum/preference_info/admin_midis + name = "Admin Midis" + +/datum/preference_info/ooc + name = "OOC Chat" + +/datum/preference_info/looc + name = "LOOC Chat" + +/datum/preference_info/ambience + name = "Ambient Sounds" + +/datum/preference_info/white_noise + name = "White Noise" + +/datum/preference_info/heartbeat_noise + name = "Heartbeat Noise" + +/datum/preference_info/instruments + name = "Instruments" + +/datum/preference_info/disco + name = "Disco Machine Music" + +/datum/preference_info/ghost_pda + name = "Ghost PDA Messages" + +/datum/preference_info/runechat + name = "Runechat" + +/datum/preference_info/ghost_death_notifs + name = "Ghost Death Notifications" + +/datum/preference_info/reverb + name = "Reverb" + +/datum/preference_info/simple_stat_panel + name = "Item Outlines" + +/datum/preference_info/anonmode + name = "Anonymous Mode" + +/datum/preference_info/typing_indicator + name = "Typing Indicator" + +/datum/preference_info/admin_logs + name = "Admin Log Messages" + +/datum/preference_info/mhelp_notification + name = "Mentor Ticket Messages" + +/datum/preference_info/ahelp_notification + name = "Admin Ticket Messages" + +/datum/preference_info/debug_logs + name = "Debug Log Messages" + +/datum/preference_info/mctabs + name = "MC Tab" + +/datum/preference_info/attack_animations + name = "Attack Animations" + +/datum/preference_info/toggleprayers + name = "Prayers" + +/datum/preference_info/prayers_notify + name = "Prayers Notify" + +/datum/preference_info/karma_reminder + name = "End Round Karma Reminder" + +/datum/preference_info/parallax_multiz + name = "Parallax Multi-Z" + +/datum/preference_info/vote_popup + name = "Vote Popup" + +/datum/preference_info/tgui_input + name = "TGUI Input" + +/datum/preference_info/strip_tgui_size + name = "TGUI Strip Menu Size" + +/datum/preference_info/item_description_tips + name = "Item Description Tips" + +/datum/preference_info/take_out_of_the_round_without_obj + name = "Вывод из игры без цели" diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index a94df3b3166..859dc1f1d15 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -25,8 +25,6 @@ var/blackbox_message /// Rights required to be able to use this pref option var/rights_required - /// That text will be shown to pref-viewer component owner. - var/examine_text /datum/preference_toggle/proc/set_toggles(client/user) var/datum/preferences/our_prefs = user.prefs @@ -46,6 +44,9 @@ SSblackbox.record_feedback("tally", "toggle_verbs", 1, blackbox_message) our_prefs.save_preferences(user) +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_ghost_ears name = "Toggle Hearing All Speech as a Ghost" description = "Toggle Between seeing all mob speech, and only speech of nearby mobs" @@ -56,6 +57,9 @@ disable_message = "As a ghost, you will now see all speech in the world." blackbox_message = "Toggle GhostEars" +/datum/preference_toggle/toggle_ghost_ears/get_preference_datum() + return /datum/preference_info/ghost_ears + /datum/preference_toggle/toggle_ghost_sight name = "Toggle Ghost Emote Viewing" description = "Toggle Between seeing all mob emotes, and only emotes of nearby mobs" @@ -66,6 +70,9 @@ disable_message = "As a ghost, you will now see all emotes in the world." blackbox_message = "Toggle GhostSight" +/datum/preference_toggle/toggle_ghost_sight/get_preference_datum() + return /datum/preference_info/ghost_sight + /datum/preference_toggle/toggle_ghost_radio name = "Toggle Ghost Radio" description = "Toggle between hearing all radio chatter, or only from nearby speakers" @@ -76,6 +83,9 @@ disable_message = "As a ghost, you will now hear all radio chat in the world." blackbox_message = "Toggle GhostRadio" +/datum/preference_toggle/toggle_ghost_radio/get_preference_datum() + return /datum/preference_info/ghost_radio + /datum/preference_toggle/toggle_admin_radio name = "Admin Radio" description = "Toggle seeing radiochatter from radios and speakers" @@ -87,6 +97,9 @@ disable_message = "You will now see radio chatter from radios or speakers." blackbox_message = "Toggle RadioChatter" +/datum/preference_toggle/toggle_admin_radio/get_preference_datum() + return /datum/preference_info/admin_radio + /datum/preference_toggle/toggle_ai_voice_annoucements name = "AI Voice Announcements" description = "Toggle hearing AI annoucements in voice form or in text form" @@ -97,6 +110,9 @@ disable_message = "You will now hear AI announcements." blackbox_message = "Toggle AI Voice" +/datum/preference_toggle/toggle_ai_voice_annoucements/get_preference_datum() + return /datum/preference_info/ai_voice_announcements + /datum/preference_toggle/toggle_admin_pm_sound name = "Admin PM sound" description = "Toggle hearing a notification when admin PMs are received" @@ -108,6 +124,9 @@ disable_message = "You will no longer hear a sound when adminhelp is sent." blackbox_message = "Toggle Admin Bwoinks" +/datum/preference_toggle/toggle_admin_pm_sound/get_preference_datum() + return /datum/preference_info/admin_pm_sound + /datum/preference_toggle/toggle_mentor_pm_sound name = "Mentor PM sound" description = "Toggle hearing a notification when mentor PMs are received" @@ -119,6 +138,9 @@ disable_message = "You will no longer hear a sound when mentorhelp is sent." blackbox_message = "Toggle Mentor Bwoinks" +/datum/preference_toggle/toggle_mentor_pm_sound/get_preference_datum() + return /datum/preference_info/mentor_pm_sound + /datum/preference_toggle/toggle_deadchat_visibility name = "Toggle Deadchat visibility" description = "Toggles Dchat's visibility" @@ -129,6 +151,9 @@ disable_message = "You will no longer see deadchat." blackbox_message = "Toggle Deadchat" +/datum/preference_toggle/toggle_deadchat_visibility/get_preference_datum() + return /datum/preference_info/deadchat_visibility + /datum/preference_toggle/end_of_round_scoreboard name = "Toggle the End of Round Scoreboard" description = "Prevents you from seeing the end of round scoreboard" @@ -139,6 +164,9 @@ disable_message = "You will no longer see see the end of round scoreboard." blackbox_message = "Toggle Scoreboard" +/datum/preference_toggle/end_of_round_scoreboard/get_preference_datum() + return /datum/preference_info/end_of_round_scoreboard + /datum/preference_toggle/title_music name = "Toggle Lobby Music" description = "Toggles hearing the GameLobby music" @@ -149,6 +177,9 @@ disable_message = "You will no longer hear music in the game lobby." blackbox_message = "Toggle Lobby Music" +/datum/preference_toggle/title_music/get_preference_datum() + return /datum/preference_info/title_music + /datum/preference_toggle/title_music/set_toggles(client/user) . = ..() if(user.prefs.sound & SOUND_LOBBY) @@ -168,6 +199,9 @@ disable_message = "You will no longer hear sounds uploaded by admins; any currently playing midis have been disabled." blackbox_message = "Toggle MIDIs" +/datum/preference_toggle/toggle_admin_midis/get_preference_datum() + return /datum/preference_info/admin_midis + /datum/preference_toggle/toggle_admin_midis/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_LOBBY) @@ -183,6 +217,9 @@ disable_message = "You will no longer see the OOC channel." blackbox_message = "Toggle OOC" +/datum/preference_toggle/toggle_ooc/get_preference_datum() + return /datum/preference_info/ooc + /datum/preference_toggle/toggle_looc name = "Toggle LOOC chat" description = "Toggles seeing Local OutOfCharacter chat" @@ -193,6 +230,9 @@ disable_message = "You will no longer see the LOOC channel." blackbox_message = "Toggle LOOC" +/datum/preference_toggle/toggle_looc/get_preference_datum() + return /datum/preference_info/looc + /datum/preference_toggle/toggle_ambience name = "Toggle Ambient sounds" description = "Toggles hearing ambient sound effects" @@ -203,6 +243,9 @@ disable_message = "Ambience is now silenced." blackbox_message = "Toggle Ambience" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_ambience/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_AMBIENCE) @@ -219,6 +262,9 @@ disable_message = "You will no longer hear ambient white noise." blackbox_message = "Toggle Whitenoise" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_white_noise/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_BUZZ) @@ -234,6 +280,9 @@ disable_message = "You will no longer hear heartbeat sounds." blackbox_message = "Toggle Hearbeat" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_heartbeat_noise/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_HEARTBEAT) @@ -249,6 +298,9 @@ disable_message = "You will no longer hear musical instruments." blackbox_message = "Toggle Instruments" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_disco name = "Toggle Disco Machine Music" description = "Toggles hearing musical instruments like the violin and piano" @@ -259,6 +311,9 @@ disable_message = "You will no longer hear or dance to the radiant dance machine." blackbox_message = "Toggle Dance Machine" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_disco/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_DISCO) @@ -274,6 +329,9 @@ disable_message = "As a ghost, you will no longer see PDA messages." blackbox_message = "Toggle Ghost PDA" +/datum/preference_toggle/proc/get_preference_datum() + return + /client/verb/silence_current_midi() set name = "Silence Current Midi" set category = "Special Verbs" @@ -291,6 +349,9 @@ disable_message = "You will no longer see runechat." blackbox_message = "Toggle Runechat" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_ghost_death_notifs name = "Toggle Ghost Death Notifications" description = "Toggle a notification when a player dies" @@ -301,6 +362,9 @@ disable_message = "You will no longer see a notification in deadchat when a player dies." blackbox_message = "Toggle Death Notifications" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_reverb name = "Toggle Reverb" description = "Toggles Reverb on specific sounds" @@ -311,6 +375,9 @@ disable_message = "You will no longer get reverb on some in game sounds." blackbox_message = "Toggle reverb" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_simple_stat_panel name = "Toggle item outlines" description = "Toggles seeing item outlines on hover" @@ -321,6 +388,9 @@ disable_message = "You now see item outlines when hovering over an item with your mouse." blackbox_message = "Toggle item outlines" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_anonmode name = "Toggle Anonymous Mode" description = "Toggles showing your key in various parts of the game (deadchat, end round, etc)" @@ -331,6 +401,9 @@ disable_message = "Your key will now will be shown in certain events (end round reports, deadchat, etc)." blackbox_message = "Toggle Anon mode" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_typing_indicator name = "Toggle Typing Indicator" description = "Hides the typing indicator" @@ -341,6 +414,9 @@ disable_message = "You will now display a typing indicator." blackbox_message = "Toggle Typing Indicator (Speech)" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_typing_indicator/set_toggles(client/user) . = ..() if(user.prefs.toggles & PREFTOGGLE_SHOW_TYPING) @@ -358,6 +434,9 @@ disable_message = "Admin logs re-enabled." blackbox_message = "Admin logs toggled" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_mhelp_notification name = "Toggle Mentor Ticket Messages" description = "Disables mentor ticket notifications" @@ -369,6 +448,9 @@ disable_message = "You now will get mentor ticket messages." blackbox_message = "Mentor ticket notification toggled" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_ahelp_notification name = "Toggle Admin Ticket Messages" description = "Disables admin ticket notifications" @@ -380,6 +462,9 @@ disable_message = "You now will get admin ticket messages." blackbox_message = "Admin ticket notification toggled" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_debug_logs name = "Toggle Debug Log Messages" description = "Disables debug notifications (Runtimes, ghost role notifications, weird checks that weren't removed)" @@ -391,6 +476,9 @@ disable_message = "You now will get debug logs." blackbox_message = "Debug logs toggled" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/toggle_mctabs name = "Toggle MC tab" description = "Toggles MC tab visibility" @@ -402,6 +490,9 @@ disable_message = "You'll no longer see subsystem information in the verb panel." blackbox_message = "MC tabs toggled" +/datum/preference_toggle/proc/get_preference_datum() + return + /datum/preference_toggle/special_toggle preftoggle_toggle = PREFTOGGLE_SPECIAL diff --git a/paradise.dme b/paradise.dme index d07486cf3fa..011a0355653 100644 --- a/paradise.dme +++ b/paradise.dme @@ -462,6 +462,7 @@ #include "code\datums\components\overlay_lighting.dm" #include "code\datums\components\paintable.dm" #include "code\datums\components\persistent_overlay.dm" +#include "code\datums\components\pref_viewer.dm" #include "code\datums\components\proximity_monitor.dm" #include "code\datums\components\radioactivity.dm" #include "code\datums\components\ritual_object.dm" @@ -1875,6 +1876,7 @@ #include "code\modules\client\ping.dm" #include "code\modules\client\view.dm" #include "code\modules\client\preference\preferences.dm" +#include "code\modules\client\preference\preference_info.dm" #include "code\modules\client\preference\preferences_mysql.dm" #include "code\modules\client\preference\preferences_spawnpoints.dm" #include "code\modules\client\preference\preferences_toggles.dm" From 27963b3a3b30eef069642cbb2ba82963f622c128 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 09:15:06 +0100 Subject: [PATCH 08/20] rework --- code/datums/components/pref_viewer.dm | 7 +- .../client/preference/preference_info.dm | 131 +++++++++++++++++- .../client/preference/preferences_toggles.dm | 94 ------------- 3 files changed, 135 insertions(+), 97 deletions(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 6f8e5f80614..f18924e7c40 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -30,7 +30,10 @@ /datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) for(var/datum/preference_toggle/pref as anything in preferences_to_show) - if(!HASBIT(target.client.prefs.toggles, pref::preftoggle_bitflag) || !HASBIT(target.client.prefs.toggles2, pref::preftoggle_bitflag)) + var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() + if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) || \ + !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) + ) continue - LAZYADD(result, pref::examine_text) + LAZYADD(result, pref::get_examine_text()) diff --git a/code/modules/client/preference/preference_info.dm b/code/modules/client/preference/preference_info.dm index cb69f87a022..f01ffce0da1 100644 --- a/code/modules/client/preference/preference_info.dm +++ b/code/modules/client/preference/preference_info.dm @@ -1,6 +1,12 @@ /datum/preference_info var/name +/datum/preference_info/proc/get_preference_toggle() + return + +/datum/preference_info/proc/get_examine_text() + return + /datum/preference_info/ghost_ears name = "Hearing All Speech as a Ghost" @@ -94,7 +100,7 @@ /datum/preference_info/attack_animations name = "Attack Animations" -/datum/preference_info/toggleprayers +/datum/preference_info/prayers name = "Prayers" /datum/preference_info/prayers_notify @@ -120,3 +126,126 @@ /datum/preference_info/take_out_of_the_round_without_obj name = "Вывод из игры без цели" + +/datum/preference_info/deadchat_visibility/get_preference_toggle() + return /datum/preference_toggle/deadchat_visibility + +/datum/preference_info/ghost_ears/get_preference_toggle() + return /datum/preference_toggle/ghost_ears + +/datum/preference_info/ghost_sight/get_preference_toggle() + return /datum/preference_toggle/ghost_sight + +/datum/preference_info/ghost_radio/get_preference_toggle() + return /datum/preference_toggle/ghost_radio + +/datum/preference_info/admin_radio/get_preference_toggle() + return /datum/preference_toggle/admin_radio + +/datum/preference_info/ai_voice_announcements/get_preference_toggle() + return /datum/preference_toggle/ai_voice_annoucements + +/datum/preference_info/admin_pm_sound/get_preference_toggle() + return /datum/preference_toggle/admin_pm_sound + +/datum/preference_info/mentor_pm_sound/get_preference_toggle() + return /datum/preference_toggle/mentor_pm_sound + +/datum/preference_info/end_of_round_scoreboard/get_preference_toggle() + return /datum/preference_toggle/end_of_round_scoreboard + +/datum/preference_info/title_music/get_preference_toggle() + return /datum/preference_toggle/title_music + +/datum/preference_info/admin_midis/get_preference_toggle() + return /datum/preference_toggle/admin_midis + +/datum/preference_info/ooc/get_preference_toggle() + return /datum/preference_toggle/ooc + +/datum/preference_info/looc/get_preference_toggle() + return /datum/preference_toggle/looc + +/datum/preference_info/ambience/get_preference_toggle() + return /datum/preference_toggle/ambience + +/datum/preference_info/white_noise/get_preference_toggle() + return /datum/preference_toggle/white_noise + +/datum/preference_info/heartbeat_noise/get_preference_toggle() + return /datum/preference_toggle/heartbeat_noise + +/datum/preference_info/instruments/get_preference_toggle() + return /datum/preference_toggle/instruments + +/datum/preference_info/disco/get_preference_toggle() + return /datum/preference_toggle/disco + +/datum/preference_info/ghost_pda/get_preference_toggle() + return /datum/preference_toggle/ghost_pda + +/datum/preference_info/runechat/get_preference_toggle() + return /datum/preference_toggle/runechat + +/datum/preference_info/ghost_death_notifs/get_preference_toggle() + return /datum/preference_toggle/ghost_death_notifs + +/datum/preference_info/reverb/get_preference_toggle() + return /datum/preference_toggle/reverb + +/datum/preference_info/simple_stat_panel/get_preference_toggle() + return /datum/preference_toggle/simple_stat_panel + +/datum/preference_info/anonmode/get_preference_toggle() + return /datum/preference_toggle/anonmode + +/datum/preference_info/typing_indicator/get_preference_toggle() + return /datum/preference_toggle/typing_indicator + +/datum/preference_info/admin_logs/get_preference_toggle() + return /datum/preference_toggle/admin_logs + +/datum/preference_info/mhelp_notification/get_preference_toggle() + return /datum/preference_toggle/mhelp_notification + +/datum/preference_info/ahelp_notification/get_preference_toggle() + return /datum/preference_toggle/ahelp_notification + +/datum/preference_info/debug_logs/get_preference_toggle() + return /datum/preference_toggle/debug_logs + +/datum/preference_info/mctabs/get_preference_toggle() + return /datum/preference_toggle/mctabs + +/datum/preference_info/attack_animations/get_preference_toggle() + return /datum/preference_toggle/attack_animations + +/datum/preference_info/prayers/get_preference_toggle() + return /datum/preference_toggle/toggleprayers + +/datum/preference_info/prayers_notify/get_preference_toggle() + return /datum/preference_toggle/prayers_notify + +/datum/preference_info/karma_reminder/get_preference_toggle() + return /datum/preference_toggle/karma_reminder + +/datum/preference_info/parallax_multiz/get_preference_toggle() + return /datum/preference_toggle/parallax_multiz + +/datum/preference_info/vote_popup/get_preference_toggle() + return /datum/preference_toggle/vote_popup + +/datum/preference_info/tgui_input/get_preference_toggle() + return /datum/preference_toggle/tgui_input + +/datum/preference_info/strip_tgui_size/get_preference_toggle() + return /datum/preference_toggle/strip_tgui_size + +/datum/preference_info/item_descritpion_tips/get_preference_toggle() + return /datum/preference_toggle/item_descritpion_tips + +/datum/preference_info/take_out_of_the_round_without_obj/get_preference_toggle() + return /datum/preference_toggle/take_out_of_the_round_without_obj + +/datum/preference_info/take_out_of_the_round_without_obj/get_examine_text() + return "\n
[span_info("Вы можете вывести этого игрока из игры не имея соответствующей цели.")]
" diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index 859dc1f1d15..2cef26fd5e9 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -44,9 +44,6 @@ SSblackbox.record_feedback("tally", "toggle_verbs", 1, blackbox_message) our_prefs.save_preferences(user) -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_ghost_ears name = "Toggle Hearing All Speech as a Ghost" description = "Toggle Between seeing all mob speech, and only speech of nearby mobs" @@ -57,9 +54,6 @@ disable_message = "As a ghost, you will now see all speech in the world." blackbox_message = "Toggle GhostEars" -/datum/preference_toggle/toggle_ghost_ears/get_preference_datum() - return /datum/preference_info/ghost_ears - /datum/preference_toggle/toggle_ghost_sight name = "Toggle Ghost Emote Viewing" description = "Toggle Between seeing all mob emotes, and only emotes of nearby mobs" @@ -70,9 +64,6 @@ disable_message = "As a ghost, you will now see all emotes in the world." blackbox_message = "Toggle GhostSight" -/datum/preference_toggle/toggle_ghost_sight/get_preference_datum() - return /datum/preference_info/ghost_sight - /datum/preference_toggle/toggle_ghost_radio name = "Toggle Ghost Radio" description = "Toggle between hearing all radio chatter, or only from nearby speakers" @@ -83,9 +74,6 @@ disable_message = "As a ghost, you will now hear all radio chat in the world." blackbox_message = "Toggle GhostRadio" -/datum/preference_toggle/toggle_ghost_radio/get_preference_datum() - return /datum/preference_info/ghost_radio - /datum/preference_toggle/toggle_admin_radio name = "Admin Radio" description = "Toggle seeing radiochatter from radios and speakers" @@ -97,9 +85,6 @@ disable_message = "You will now see radio chatter from radios or speakers." blackbox_message = "Toggle RadioChatter" -/datum/preference_toggle/toggle_admin_radio/get_preference_datum() - return /datum/preference_info/admin_radio - /datum/preference_toggle/toggle_ai_voice_annoucements name = "AI Voice Announcements" description = "Toggle hearing AI annoucements in voice form or in text form" @@ -110,9 +95,6 @@ disable_message = "You will now hear AI announcements." blackbox_message = "Toggle AI Voice" -/datum/preference_toggle/toggle_ai_voice_annoucements/get_preference_datum() - return /datum/preference_info/ai_voice_announcements - /datum/preference_toggle/toggle_admin_pm_sound name = "Admin PM sound" description = "Toggle hearing a notification when admin PMs are received" @@ -124,9 +106,6 @@ disable_message = "You will no longer hear a sound when adminhelp is sent." blackbox_message = "Toggle Admin Bwoinks" -/datum/preference_toggle/toggle_admin_pm_sound/get_preference_datum() - return /datum/preference_info/admin_pm_sound - /datum/preference_toggle/toggle_mentor_pm_sound name = "Mentor PM sound" description = "Toggle hearing a notification when mentor PMs are received" @@ -138,9 +117,6 @@ disable_message = "You will no longer hear a sound when mentorhelp is sent." blackbox_message = "Toggle Mentor Bwoinks" -/datum/preference_toggle/toggle_mentor_pm_sound/get_preference_datum() - return /datum/preference_info/mentor_pm_sound - /datum/preference_toggle/toggle_deadchat_visibility name = "Toggle Deadchat visibility" description = "Toggles Dchat's visibility" @@ -151,9 +127,6 @@ disable_message = "You will no longer see deadchat." blackbox_message = "Toggle Deadchat" -/datum/preference_toggle/toggle_deadchat_visibility/get_preference_datum() - return /datum/preference_info/deadchat_visibility - /datum/preference_toggle/end_of_round_scoreboard name = "Toggle the End of Round Scoreboard" description = "Prevents you from seeing the end of round scoreboard" @@ -164,9 +137,6 @@ disable_message = "You will no longer see see the end of round scoreboard." blackbox_message = "Toggle Scoreboard" -/datum/preference_toggle/end_of_round_scoreboard/get_preference_datum() - return /datum/preference_info/end_of_round_scoreboard - /datum/preference_toggle/title_music name = "Toggle Lobby Music" description = "Toggles hearing the GameLobby music" @@ -177,9 +147,6 @@ disable_message = "You will no longer hear music in the game lobby." blackbox_message = "Toggle Lobby Music" -/datum/preference_toggle/title_music/get_preference_datum() - return /datum/preference_info/title_music - /datum/preference_toggle/title_music/set_toggles(client/user) . = ..() if(user.prefs.sound & SOUND_LOBBY) @@ -199,9 +166,6 @@ disable_message = "You will no longer hear sounds uploaded by admins; any currently playing midis have been disabled." blackbox_message = "Toggle MIDIs" -/datum/preference_toggle/toggle_admin_midis/get_preference_datum() - return /datum/preference_info/admin_midis - /datum/preference_toggle/toggle_admin_midis/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_LOBBY) @@ -217,9 +181,6 @@ disable_message = "You will no longer see the OOC channel." blackbox_message = "Toggle OOC" -/datum/preference_toggle/toggle_ooc/get_preference_datum() - return /datum/preference_info/ooc - /datum/preference_toggle/toggle_looc name = "Toggle LOOC chat" description = "Toggles seeing Local OutOfCharacter chat" @@ -230,9 +191,6 @@ disable_message = "You will no longer see the LOOC channel." blackbox_message = "Toggle LOOC" -/datum/preference_toggle/toggle_looc/get_preference_datum() - return /datum/preference_info/looc - /datum/preference_toggle/toggle_ambience name = "Toggle Ambient sounds" description = "Toggles hearing ambient sound effects" @@ -243,9 +201,6 @@ disable_message = "Ambience is now silenced." blackbox_message = "Toggle Ambience" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_ambience/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_AMBIENCE) @@ -262,9 +217,6 @@ disable_message = "You will no longer hear ambient white noise." blackbox_message = "Toggle Whitenoise" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_white_noise/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_BUZZ) @@ -280,9 +232,6 @@ disable_message = "You will no longer hear heartbeat sounds." blackbox_message = "Toggle Hearbeat" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_heartbeat_noise/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_HEARTBEAT) @@ -298,9 +247,6 @@ disable_message = "You will no longer hear musical instruments." blackbox_message = "Toggle Instruments" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_disco name = "Toggle Disco Machine Music" description = "Toggles hearing musical instruments like the violin and piano" @@ -311,9 +257,6 @@ disable_message = "You will no longer hear or dance to the radiant dance machine." blackbox_message = "Toggle Dance Machine" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_disco/set_toggles(client/user) . = ..() if(user.prefs.sound & ~SOUND_DISCO) @@ -329,9 +272,6 @@ disable_message = "As a ghost, you will no longer see PDA messages." blackbox_message = "Toggle Ghost PDA" -/datum/preference_toggle/proc/get_preference_datum() - return - /client/verb/silence_current_midi() set name = "Silence Current Midi" set category = "Special Verbs" @@ -349,9 +289,6 @@ disable_message = "You will no longer see runechat." blackbox_message = "Toggle Runechat" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_ghost_death_notifs name = "Toggle Ghost Death Notifications" description = "Toggle a notification when a player dies" @@ -362,9 +299,6 @@ disable_message = "You will no longer see a notification in deadchat when a player dies." blackbox_message = "Toggle Death Notifications" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_reverb name = "Toggle Reverb" description = "Toggles Reverb on specific sounds" @@ -375,9 +309,6 @@ disable_message = "You will no longer get reverb on some in game sounds." blackbox_message = "Toggle reverb" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_simple_stat_panel name = "Toggle item outlines" description = "Toggles seeing item outlines on hover" @@ -388,9 +319,6 @@ disable_message = "You now see item outlines when hovering over an item with your mouse." blackbox_message = "Toggle item outlines" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_anonmode name = "Toggle Anonymous Mode" description = "Toggles showing your key in various parts of the game (deadchat, end round, etc)" @@ -401,9 +329,6 @@ disable_message = "Your key will now will be shown in certain events (end round reports, deadchat, etc)." blackbox_message = "Toggle Anon mode" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_typing_indicator name = "Toggle Typing Indicator" description = "Hides the typing indicator" @@ -414,9 +339,6 @@ disable_message = "You will now display a typing indicator." blackbox_message = "Toggle Typing Indicator (Speech)" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_typing_indicator/set_toggles(client/user) . = ..() if(user.prefs.toggles & PREFTOGGLE_SHOW_TYPING) @@ -434,9 +356,6 @@ disable_message = "Admin logs re-enabled." blackbox_message = "Admin logs toggled" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_mhelp_notification name = "Toggle Mentor Ticket Messages" description = "Disables mentor ticket notifications" @@ -448,9 +367,6 @@ disable_message = "You now will get mentor ticket messages." blackbox_message = "Mentor ticket notification toggled" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_ahelp_notification name = "Toggle Admin Ticket Messages" description = "Disables admin ticket notifications" @@ -462,9 +378,6 @@ disable_message = "You now will get admin ticket messages." blackbox_message = "Admin ticket notification toggled" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_debug_logs name = "Toggle Debug Log Messages" description = "Disables debug notifications (Runtimes, ghost role notifications, weird checks that weren't removed)" @@ -476,9 +389,6 @@ disable_message = "You now will get debug logs." blackbox_message = "Debug logs toggled" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/toggle_mctabs name = "Toggle MC tab" description = "Toggles MC tab visibility" @@ -490,9 +400,6 @@ disable_message = "You'll no longer see subsystem information in the verb panel." blackbox_message = "MC tabs toggled" -/datum/preference_toggle/proc/get_preference_datum() - return - /datum/preference_toggle/special_toggle preftoggle_toggle = PREFTOGGLE_SPECIAL @@ -693,5 +600,4 @@ enable_message = "Другие игроки теперь имеют право выводить вас из раунда без цели." disable_message = "Другие игроки больше не имеют права выводить вас из раунда без цели." blackbox_message = "Переключение разрешения выводить игрока из раунда" - examine_text = "\n
[span_info("Вы можете вывести этого игрока из игры не имея соответствующей цели.")]
" From 24bb4d446848f4fde61056dce64de4378c16cf92 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 09:24:45 +0100 Subject: [PATCH 09/20] =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/datums/components/pref_viewer.dm | 9 ++- .../changeling/changeling_datum.dm | 5 +- .../antagonists/space_ninja/ninja_datum.dm | 5 +- .../antagonists/traitor/datum_traitor.dm | 6 +- .../antagonists/vampire/vampire_datum.dm | 5 +- .../client/preference/preference_info.dm | 78 +++++++++---------- 6 files changed, 61 insertions(+), 47 deletions(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index f18924e7c40..4d80142b96b 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -29,11 +29,12 @@ INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) /datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) - for(var/datum/preference_toggle/pref as anything in preferences_to_show) + for(var/datum/preference_info/pref as anything in preferences_to_show) var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() - if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) || \ - !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) + + if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ + || !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) ) continue - LAZYADD(result, pref::get_examine_text()) + LAZYADD(result, pref.get_examine_text()) diff --git a/code/modules/antagonists/changeling/changeling_datum.dm b/code/modules/antagonists/changeling/changeling_datum.dm index fdbf7378c80..9c58fa0f2be 100644 --- a/code/modules/antagonists/changeling/changeling_datum.dm +++ b/code/modules/antagonists/changeling/changeling_datum.dm @@ -162,9 +162,12 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + /datum/preference_info/take_out_of_the_round_without_obj, \ ) +/datum/antagonist/changeling/on_body_transfer(mob/living/old_body, mob/living/new_body) + . = ..() + qdel(old_body.GetComponent(/datum/component/pref_viewer)) /datum/antagonist/changeling/remove_innate_effects(mob/living/mob_override) var/mob/living/user = ..() diff --git a/code/modules/antagonists/space_ninja/ninja_datum.dm b/code/modules/antagonists/space_ninja/ninja_datum.dm index 4467d229d44..bf930381fb1 100644 --- a/code/modules/antagonists/space_ninja/ninja_datum.dm +++ b/code/modules/antagonists/space_ninja/ninja_datum.dm @@ -116,9 +116,12 @@ AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + /datum/preference_info/take_out_of_the_round_without_obj, \ ) +/datum/antagonist/ninja/on_body_transfer(mob/living/old_body, mob/living/new_body) + . = ..() + qdel(old_body.GetComponent(/datum/component/pref_viewer)) /datum/antagonist/ninja/proc/change_species(mob/living/mob_to_change = null) // This should be used to fully to remove robo-limbs & change species for lack of sprites human_ninja = ishuman(mob_to_change) ? mob_to_change : null diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 66f82d61e24..20774f5f380 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -40,9 +40,13 @@ AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + /datum/preference_info/take_out_of_the_round_without_obj, \ ) +/datum/antagonist/traitor/on_body_transfer(mob/living/old_body, mob/living/new_body) + . = ..() + qdel(old_body.GetComponent(/datum/component/pref_viewer)) + /datum/antagonist/traitor/remove_innate_effects(mob/living/mob_override) . = ..() var/mob/living/datum_owner = mob_override || owner.current diff --git a/code/modules/antagonists/vampire/vampire_datum.dm b/code/modules/antagonists/vampire/vampire_datum.dm index 3c332821d4b..c924994c58c 100644 --- a/code/modules/antagonists/vampire/vampire_datum.dm +++ b/code/modules/antagonists/vampire/vampire_datum.dm @@ -115,9 +115,12 @@ AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_toggle/toggle_take_out_of_the_round_without_obj, \ + /datum/preference_info/take_out_of_the_round_without_obj, \ ) +/datum/antagonist/vampire/on_body_transfer(mob/living/old_body, mob/living/new_body) + . = ..() + qdel(old_body.GetComponent(/datum/component/pref_viewer)) /datum/antagonist/vampire/remove_innate_effects(mob/living/mob_override, transformation = FALSE) var/mob/living/user = ..() diff --git a/code/modules/client/preference/preference_info.dm b/code/modules/client/preference/preference_info.dm index f01ffce0da1..7d612f05d6f 100644 --- a/code/modules/client/preference/preference_info.dm +++ b/code/modules/client/preference/preference_info.dm @@ -128,124 +128,124 @@ name = "Вывод из игры без цели" /datum/preference_info/deadchat_visibility/get_preference_toggle() - return /datum/preference_toggle/deadchat_visibility + return /datum/preference_toggle/toggle_deadchat_visibility /datum/preference_info/ghost_ears/get_preference_toggle() - return /datum/preference_toggle/ghost_ears + return /datum/preference_toggle/toggle_ghost_ears /datum/preference_info/ghost_sight/get_preference_toggle() - return /datum/preference_toggle/ghost_sight + return /datum/preference_toggle/toggle_ghost_sight /datum/preference_info/ghost_radio/get_preference_toggle() - return /datum/preference_toggle/ghost_radio + return /datum/preference_toggle/toggle_ghost_radio /datum/preference_info/admin_radio/get_preference_toggle() - return /datum/preference_toggle/admin_radio + return /datum/preference_toggle/toggle_admin_radio /datum/preference_info/ai_voice_announcements/get_preference_toggle() - return /datum/preference_toggle/ai_voice_annoucements + return /datum/preference_toggle/toggle_ai_voice_annoucements /datum/preference_info/admin_pm_sound/get_preference_toggle() - return /datum/preference_toggle/admin_pm_sound + return /datum/preference_toggle/toggle_admin_pm_sound /datum/preference_info/mentor_pm_sound/get_preference_toggle() - return /datum/preference_toggle/mentor_pm_sound + return /datum/preference_toggle/toggle_mentor_pm_sound /datum/preference_info/end_of_round_scoreboard/get_preference_toggle() - return /datum/preference_toggle/end_of_round_scoreboard + return /datum/preference_toggle/toggle_end_of_round_scoreboard /datum/preference_info/title_music/get_preference_toggle() - return /datum/preference_toggle/title_music + return /datum/preference_toggle/toggle_title_music /datum/preference_info/admin_midis/get_preference_toggle() - return /datum/preference_toggle/admin_midis + return /datum/preference_toggle/toggle_admin_midis /datum/preference_info/ooc/get_preference_toggle() - return /datum/preference_toggle/ooc + return /datum/preference_toggle/toggle_ooc /datum/preference_info/looc/get_preference_toggle() - return /datum/preference_toggle/looc + return /datum/preference_toggle/toggle_looc /datum/preference_info/ambience/get_preference_toggle() - return /datum/preference_toggle/ambience + return /datum/preference_toggle/toggle_ambience /datum/preference_info/white_noise/get_preference_toggle() - return /datum/preference_toggle/white_noise + return /datum/preference_toggle/toggle_white_noise /datum/preference_info/heartbeat_noise/get_preference_toggle() - return /datum/preference_toggle/heartbeat_noise + return /datum/preference_toggle/toggle_heartbeat_noise /datum/preference_info/instruments/get_preference_toggle() - return /datum/preference_toggle/instruments + return /datum/preference_toggle/toggle_instruments /datum/preference_info/disco/get_preference_toggle() - return /datum/preference_toggle/disco + return /datum/preference_toggle/toggle_disco /datum/preference_info/ghost_pda/get_preference_toggle() - return /datum/preference_toggle/ghost_pda + return /datum/preference_toggle/toggle_ghost_pda /datum/preference_info/runechat/get_preference_toggle() - return /datum/preference_toggle/runechat + return /datum/preference_toggle/toggle_runechat /datum/preference_info/ghost_death_notifs/get_preference_toggle() - return /datum/preference_toggle/ghost_death_notifs + return /datum/preference_toggle/toggle_ghost_death_notifs /datum/preference_info/reverb/get_preference_toggle() - return /datum/preference_toggle/reverb + return /datum/preference_toggle/toggle_reverb /datum/preference_info/simple_stat_panel/get_preference_toggle() - return /datum/preference_toggle/simple_stat_panel + return /datum/preference_toggle/toggle_simple_stat_panel /datum/preference_info/anonmode/get_preference_toggle() - return /datum/preference_toggle/anonmode + return /datum/preference_toggle/toggle_anonmode /datum/preference_info/typing_indicator/get_preference_toggle() - return /datum/preference_toggle/typing_indicator + return /datum/preference_toggle/toggle_typing_indicator /datum/preference_info/admin_logs/get_preference_toggle() - return /datum/preference_toggle/admin_logs + return /datum/preference_toggle/toggle_admin_logs /datum/preference_info/mhelp_notification/get_preference_toggle() - return /datum/preference_toggle/mhelp_notification + return /datum/preference_toggle/toggle_mhelp_notification /datum/preference_info/ahelp_notification/get_preference_toggle() - return /datum/preference_toggle/ahelp_notification + return /datum/preference_toggle/toggle_ahelp_notification /datum/preference_info/debug_logs/get_preference_toggle() - return /datum/preference_toggle/debug_logs + return /datum/preference_toggle/toggle_debug_logs /datum/preference_info/mctabs/get_preference_toggle() - return /datum/preference_toggle/mctabs + return /datum/preference_toggle/toggle_mctabs /datum/preference_info/attack_animations/get_preference_toggle() - return /datum/preference_toggle/attack_animations + return /datum/preference_toggle/toggle_attack_animations /datum/preference_info/prayers/get_preference_toggle() return /datum/preference_toggle/toggleprayers /datum/preference_info/prayers_notify/get_preference_toggle() - return /datum/preference_toggle/prayers_notify + return /datum/preference_toggle/toggle_prayers_notify /datum/preference_info/karma_reminder/get_preference_toggle() - return /datum/preference_toggle/karma_reminder + return /datum/preference_toggle/toggle_karma_reminder /datum/preference_info/parallax_multiz/get_preference_toggle() - return /datum/preference_toggle/parallax_multiz + return /datum/preference_toggle/toggle_parallax_multiz /datum/preference_info/vote_popup/get_preference_toggle() - return /datum/preference_toggle/vote_popup + return /datum/preference_toggle/toggle_vote_popup /datum/preference_info/tgui_input/get_preference_toggle() - return /datum/preference_toggle/tgui_input + return /datum/preference_toggle/toggle_tgui_input /datum/preference_info/strip_tgui_size/get_preference_toggle() - return /datum/preference_toggle/strip_tgui_size + return /datum/preference_toggle/toggle_strip_tgui_size /datum/preference_info/item_descritpion_tips/get_preference_toggle() - return /datum/preference_toggle/item_descritpion_tips + return /datum/preference_toggle/toggle_item_descritpion_tips /datum/preference_info/take_out_of_the_round_without_obj/get_preference_toggle() - return /datum/preference_toggle/take_out_of_the_round_without_obj + return /datum/preference_toggle/toggle_take_out_of_the_round_without_obj /datum/preference_info/take_out_of_the_round_without_obj/get_examine_text() return "\n
[span_info("Вы можете вывести этого игрока из игры не имея соответствующей цели.")]
" From 384ed825ee02c06bc937f8ea0ea8e1563b8f3792 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 09:47:52 +0100 Subject: [PATCH 10/20] fix --- code/datums/components/pref_viewer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 4d80142b96b..3da844c319b 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -33,7 +33,7 @@ var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ - || !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) + && !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) ) continue From d34994a3041ebb6b337aa9a1171358f7ad3b8c18 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 09:59:34 +0100 Subject: [PATCH 11/20] fix x2 --- code/datums/components/pref_viewer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 3da844c319b..b5cf8d83ae1 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -1,5 +1,5 @@ /datum/component/pref_viewer - var/list/preferences_to_show = list() + var/list/preferences_to_show /datum/component/pref_viewer/Destroy(force) LAZYNULL(preferences_to_show) From 0510362ec8ca108a7051f72ce9fb14876db42715 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:17:31 +0100 Subject: [PATCH 12/20] =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/datums/mind.dm | 7 +++++-- .../antagonists/_common/antag_datum.dm | 19 +++++++++++++++++++ .../changeling/changeling_datum.dm | 5 ++++- .../antagonists/space_ninja/ninja_datum.dm | 5 ++++- .../antagonists/traitor/datum_traitor.dm | 5 ++++- .../antagonists/vampire/vampire_datum.dm | 5 ++++- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index a6de1c0034c..41047236591 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -2583,8 +2583,11 @@ */ /datum/mind/proc/remove_antag_datum(datum_type) var/datum/antagonist/antag = has_antag_datum(datum_type) - if(antag) - qdel(antag) + + if(!antag) + return + + qdel(antag) /** diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm index 2b137da292e..f6dfa00a07f 100644 --- a/code/modules/antagonists/_common/antag_datum.dm +++ b/code/modules/antagonists/_common/antag_datum.dm @@ -53,20 +53,32 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/Destroy(force) for(var/datum/objective/objective as anything in objectives) objectives -= objective + if(!objective.team) qdel(objective) + remove_owner_from_gamemode() GLOB.antagonists -= src + if(!silent) farewell() + remove_innate_effects() + antag_memory = null + var/datum/team/team = get_team() team?.remove_member(owner) + if(owner) LAZYREMOVE(owner.antag_datums, src) + + if(!LAZYLEN(owner.antag_datums)) // that one was the last antag datum. + last_datum_removal() + restore_last_hud_and_role() owner = null + return ..() @@ -92,8 +104,15 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/is_banned(mob/user) if(!user) return FALSE + return (jobban_isbanned(user, ROLE_SYNDICATE) || (job_rank && jobban_isbanned(user, job_rank))) +/** + * When our datum was last and became removed. + */ +/datum/antagonist/proc/handle_last_instance_removal() + return + /** * Attempts to replace the role banned antag with a ghost player. diff --git a/code/modules/antagonists/changeling/changeling_datum.dm b/code/modules/antagonists/changeling/changeling_datum.dm index 9c58fa0f2be..962a881bcd4 100644 --- a/code/modules/antagonists/changeling/changeling_datum.dm +++ b/code/modules/antagonists/changeling/changeling_datum.dm @@ -160,7 +160,7 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E var/obj/item/organ/internal/brain/ling_brain = carbon_user.get_organ_slot(INTERNAL_ORGAN_BRAIN) ling_brain?.decoy_brain = TRUE - AddComponent( \ + user.AddComponent( \ /datum/component/pref_viewer, \ /datum/preference_info/take_out_of_the_round_without_obj, \ ) @@ -169,6 +169,9 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E . = ..() qdel(old_body.GetComponent(/datum/component/pref_viewer)) +/datum/antagonist/changeling/handle_last_instance_removal() + qdel(owner.current.GetComponent(/datum/component/pref_viewer)) + /datum/antagonist/changeling/remove_innate_effects(mob/living/mob_override) var/mob/living/user = ..() diff --git a/code/modules/antagonists/space_ninja/ninja_datum.dm b/code/modules/antagonists/space_ninja/ninja_datum.dm index bf930381fb1..d4aee098f22 100644 --- a/code/modules/antagonists/space_ninja/ninja_datum.dm +++ b/code/modules/antagonists/space_ninja/ninja_datum.dm @@ -114,11 +114,14 @@ var/mob/living/user = ..() user.faction = list(ROLE_NINJA) - AddComponent( \ + user.AddComponent( \ /datum/component/pref_viewer, \ /datum/preference_info/take_out_of_the_round_without_obj, \ ) +/datum/antagonist/ninja/handle_last_instance_removal() + qdel(owner.current.GetComponent(/datum/component/pref_viewer)) + /datum/antagonist/ninja/on_body_transfer(mob/living/old_body, mob/living/new_body) . = ..() qdel(old_body.GetComponent(/datum/component/pref_viewer)) diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 20774f5f380..6e2086e8132 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -38,7 +38,7 @@ datum_owner.AddComponent(/datum/component/codeword_hearing, GLOB.syndicate_code_phrase_regex, "codephrases", src) datum_owner.AddComponent(/datum/component/codeword_hearing, GLOB.syndicate_code_response_regex, "coderesponses", src) - AddComponent( \ + datum_owner.AddComponent( \ /datum/component/pref_viewer, \ /datum/preference_info/take_out_of_the_round_without_obj, \ ) @@ -47,6 +47,9 @@ . = ..() qdel(old_body.GetComponent(/datum/component/pref_viewer)) +/datum/antagonist/traitor/handle_last_instance_removal() + qdel(owner.current.GetComponent(/datum/component/pref_viewer)) + /datum/antagonist/traitor/remove_innate_effects(mob/living/mob_override) . = ..() var/mob/living/datum_owner = mob_override || owner.current diff --git a/code/modules/antagonists/vampire/vampire_datum.dm b/code/modules/antagonists/vampire/vampire_datum.dm index c924994c58c..d22881362c8 100644 --- a/code/modules/antagonists/vampire/vampire_datum.dm +++ b/code/modules/antagonists/vampire/vampire_datum.dm @@ -113,7 +113,7 @@ //slaved.leave_serv_hud(mob_override.mind) //.mind.som = null - AddComponent( \ + user.AddComponent( \ /datum/component/pref_viewer, \ /datum/preference_info/take_out_of_the_round_without_obj, \ ) @@ -122,6 +122,9 @@ . = ..() qdel(old_body.GetComponent(/datum/component/pref_viewer)) +/datum/antagonist/vampire/handle_last_instance_removal() + qdel(owner.current.GetComponent(/datum/component/pref_viewer)) + /datum/antagonist/vampire/remove_innate_effects(mob/living/mob_override, transformation = FALSE) var/mob/living/user = ..() From ff3f54e5d6eff4a50b97b9c4456451477fb0027d Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:18:35 +0100 Subject: [PATCH 13/20] fix --- code/modules/antagonists/_common/antag_datum.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm index f6dfa00a07f..f8e1005915b 100644 --- a/code/modules/antagonists/_common/antag_datum.dm +++ b/code/modules/antagonists/_common/antag_datum.dm @@ -74,7 +74,7 @@ GLOBAL_LIST_EMPTY(antagonists) LAZYREMOVE(owner.antag_datums, src) if(!LAZYLEN(owner.antag_datums)) // that one was the last antag datum. - last_datum_removal() + handle_last_instance_removal() restore_last_hud_and_role() owner = null From e22f9ee20181dc6bc32ecdaac0af6f62460c5321 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:24:42 +0100 Subject: [PATCH 14/20] fix --- code/modules/client/preference/preference_info.dm | 4 ++-- paradise.dme | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/client/preference/preference_info.dm b/code/modules/client/preference/preference_info.dm index 7d612f05d6f..b08672429f5 100644 --- a/code/modules/client/preference/preference_info.dm +++ b/code/modules/client/preference/preference_info.dm @@ -152,10 +152,10 @@ return /datum/preference_toggle/toggle_mentor_pm_sound /datum/preference_info/end_of_round_scoreboard/get_preference_toggle() - return /datum/preference_toggle/toggle_end_of_round_scoreboard + return /datum/preference_toggle/end_of_round_scoreboard /datum/preference_info/title_music/get_preference_toggle() - return /datum/preference_toggle/toggle_title_music + return /datum/preference_toggle/title_music /datum/preference_info/admin_midis/get_preference_toggle() return /datum/preference_toggle/toggle_admin_midis diff --git a/paradise.dme b/paradise.dme index 011a0355653..f149a6226b6 100644 --- a/paradise.dme +++ b/paradise.dme @@ -167,6 +167,7 @@ #include "code\__HELPERS\atmospherics.dm" #include "code\__HELPERS\atoms.dm" #include "code\__HELPERS\bitflag_lists.dm" +#include "code\__HELPERS\bitflag.dm" #include "code\__HELPERS\cmp.dm" #include "code\__HELPERS\constants.dm" #include "code\__HELPERS\experimental.dm" From 3f99d06bba4776ae2f97c4cc27fa6b1d2fe73ad5 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:25:52 +0100 Subject: [PATCH 15/20] whoops --- paradise.dme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paradise.dme b/paradise.dme index f149a6226b6..99e510966e1 100644 --- a/paradise.dme +++ b/paradise.dme @@ -167,7 +167,7 @@ #include "code\__HELPERS\atmospherics.dm" #include "code\__HELPERS\atoms.dm" #include "code\__HELPERS\bitflag_lists.dm" -#include "code\__HELPERS\bitflag.dm" +#include "code\__HELPERS\bitflags.dm" #include "code\__HELPERS\cmp.dm" #include "code\__HELPERS\constants.dm" #include "code\__HELPERS\experimental.dm" From 99221507242ca9cc783240ff21c8c4b4aba38e6d Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:28:53 +0100 Subject: [PATCH 16/20] clrf to lf --- code/__HELPERS/bitflags.dm | 14 ++--- code/datums/components/pref_viewer.dm | 80 +++++++++++++-------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/code/__HELPERS/bitflags.dm b/code/__HELPERS/bitflags.dm index 298a7f09fb2..5aa80c92560 100644 --- a/code/__HELPERS/bitflags.dm +++ b/code/__HELPERS/bitflags.dm @@ -1,7 +1,7 @@ -#define HASBIT(CONTAINER, FLAG) ((CONTAINER) & (FLAG)) - -#define SETBIT(CONTAINER, FLAG) (CONTAINER |= (FLAG)) - -#define CLEARBIT(CONTAINER, FLAG) (CONTAINER &= ~(FLAG)) - -#define TOGGLEBIT(CONTAINER, FLAG) (CONTAINER ^= (FLAG)) +#define HASBIT(CONTAINER, FLAG) ((CONTAINER) & (FLAG)) + +#define SETBIT(CONTAINER, FLAG) (CONTAINER |= (FLAG)) + +#define CLEARBIT(CONTAINER, FLAG) (CONTAINER &= ~(FLAG)) + +#define TOGGLEBIT(CONTAINER, FLAG) (CONTAINER ^= (FLAG)) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index b5cf8d83ae1..99cd453f13a 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -1,40 +1,40 @@ -/datum/component/pref_viewer - var/list/preferences_to_show - -/datum/component/pref_viewer/Destroy(force) - LAZYNULL(preferences_to_show) - - return ..() - -/datum/component/pref_viewer/Initialize( - list/preferences_to_show -) - if(!ismob(parent)) - return COMPONENT_INCOMPATIBLE - - src.preferences_to_show = preferences_to_show - -/datum/component/pref_viewer/RegisterWithParent() - RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) - -/datum/component/pref_viewer/UnregisterFromParent() - UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) - -/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) - SIGNAL_HANDLER - - if(!istype(target) || !target.client) - return - - INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) - -/datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) - for(var/datum/preference_info/pref as anything in preferences_to_show) - var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() - - if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ - && !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) - ) - continue - - LAZYADD(result, pref.get_examine_text()) +/datum/component/pref_viewer + var/list/preferences_to_show + +/datum/component/pref_viewer/Destroy(force) + LAZYNULL(preferences_to_show) + + return ..() + +/datum/component/pref_viewer/Initialize( + list/preferences_to_show +) + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + + src.preferences_to_show = preferences_to_show + +/datum/component/pref_viewer/RegisterWithParent() + RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) + +/datum/component/pref_viewer/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) + +/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) + SIGNAL_HANDLER + + if(!istype(target) || !target.client) + return + + INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) + +/datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) + for(var/datum/preference_info/pref as anything in preferences_to_show) + var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() + + if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ + && !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) + ) + continue + + LAZYADD(result, pref.get_examine_text()) From 2de39eb7c04621d2602ff82d27bb94fe4236f8d1 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:39:31 +0100 Subject: [PATCH 17/20] english --- code/modules/client/preference/preference_info.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/client/preference/preference_info.dm b/code/modules/client/preference/preference_info.dm index b08672429f5..2da8f02b214 100644 --- a/code/modules/client/preference/preference_info.dm +++ b/code/modules/client/preference/preference_info.dm @@ -125,7 +125,7 @@ name = "Item Description Tips" /datum/preference_info/take_out_of_the_round_without_obj - name = "Вывод из игры без цели" + name = "Take out from round without objective" /datum/preference_info/deadchat_visibility/get_preference_toggle() return /datum/preference_toggle/toggle_deadchat_visibility From 4c1c595d00a1362c16ae7905a2fefe110cd21e21 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:59:04 +0100 Subject: [PATCH 18/20] fix --- code/datums/components/pref_viewer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 99cd453f13a..9c44362d394 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -20,7 +20,7 @@ /datum/component/pref_viewer/UnregisterFromParent() UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) -/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) +/datum/component/pref_viewer/proc/on_examine(mob/source, mob/target, list/result) SIGNAL_HANDLER if(!istype(target) || !target.client) From 638dd43707c8b33f7aae1b08fb129132f8535f95 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:10:47 +0100 Subject: [PATCH 19/20] fix --- code/datums/components/pref_viewer.dm | 17 +++++++++-------- .../antagonists/changeling/changeling_datum.dm | 2 +- .../antagonists/space_ninja/ninja_datum.dm | 2 +- .../antagonists/traitor/datum_traitor.dm | 2 +- .../antagonists/vampire/vampire_datum.dm | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 9c44362d394..67f431e4e02 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -12,7 +12,8 @@ if(!ismob(parent)) return COMPONENT_INCOMPATIBLE - src.preferences_to_show = preferences_to_show + for(var/datum/preference_info/pref as anything in preferences_to_show) + LAZYADD(src.preferences_to_show, new pref) /datum/component/pref_viewer/RegisterWithParent() RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) @@ -29,12 +30,12 @@ INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) /datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) - for(var/datum/preference_info/pref as anything in preferences_to_show) - var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() - - if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ - && !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) + for(var/datum/preference_info/pref as anything in preferences_to_show) + var/datum/preference_toggle/toggle = pref.get_preference_toggle() + + if(!HASBIT(target.client.prefs.toggles, toggle::preftoggle_bitflag) \ + && !HASBIT(target.client.prefs.toggles2, toggle::preftoggle_bitflag) ) - continue + continue - LAZYADD(result, pref.get_examine_text()) + LAZYADD(result, pref.get_examine_text()) diff --git a/code/modules/antagonists/changeling/changeling_datum.dm b/code/modules/antagonists/changeling/changeling_datum.dm index 962a881bcd4..9f57b820b36 100644 --- a/code/modules/antagonists/changeling/changeling_datum.dm +++ b/code/modules/antagonists/changeling/changeling_datum.dm @@ -162,7 +162,7 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E user.AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_info/take_out_of_the_round_without_obj, \ + list(/datum/preference_info/take_out_of_the_round_without_obj), \ ) /datum/antagonist/changeling/on_body_transfer(mob/living/old_body, mob/living/new_body) diff --git a/code/modules/antagonists/space_ninja/ninja_datum.dm b/code/modules/antagonists/space_ninja/ninja_datum.dm index d4aee098f22..3f0eab1bac3 100644 --- a/code/modules/antagonists/space_ninja/ninja_datum.dm +++ b/code/modules/antagonists/space_ninja/ninja_datum.dm @@ -116,7 +116,7 @@ user.AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_info/take_out_of_the_round_without_obj, \ + list(/datum/preference_info/take_out_of_the_round_without_obj), \ ) /datum/antagonist/ninja/handle_last_instance_removal() diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 6e2086e8132..10ddbd90b7d 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -40,7 +40,7 @@ datum_owner.AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_info/take_out_of_the_round_without_obj, \ + list(/datum/preference_info/take_out_of_the_round_without_obj), \ ) /datum/antagonist/traitor/on_body_transfer(mob/living/old_body, mob/living/new_body) diff --git a/code/modules/antagonists/vampire/vampire_datum.dm b/code/modules/antagonists/vampire/vampire_datum.dm index d22881362c8..b0b3810547b 100644 --- a/code/modules/antagonists/vampire/vampire_datum.dm +++ b/code/modules/antagonists/vampire/vampire_datum.dm @@ -115,7 +115,7 @@ user.AddComponent( \ /datum/component/pref_viewer, \ - /datum/preference_info/take_out_of_the_round_without_obj, \ + list(/datum/preference_info/take_out_of_the_round_without_obj), \ ) /datum/antagonist/vampire/on_body_transfer(mob/living/old_body, mob/living/new_body) From e93ea52a896951fc876e2ba67315374db8ece7cf Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:12:28 +0100 Subject: [PATCH 20/20] fix --- code/datums/components/pref_viewer.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/datums/components/pref_viewer.dm b/code/datums/components/pref_viewer.dm index 67f431e4e02..5760e80f3f6 100644 --- a/code/datums/components/pref_viewer.dm +++ b/code/datums/components/pref_viewer.dm @@ -9,10 +9,10 @@ /datum/component/pref_viewer/Initialize( list/preferences_to_show ) - if(!ismob(parent)) - return COMPONENT_INCOMPATIBLE + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE - for(var/datum/preference_info/pref as anything in preferences_to_show) + for(var/datum/preference_info/pref as anything in preferences_to_show) LAZYADD(src.preferences_to_show, new pref) /datum/component/pref_viewer/RegisterWithParent()