From f9bda059730486bd7cf88d4dba73950c0ee6c2da Mon Sep 17 00:00:00 2001 From: kreeperhlc Date: Tue, 26 Dec 2023 15:10:00 +0300 Subject: [PATCH 1/3] feat(maptext): adds maptext --- baystation12.dme | 1 + code/_onclick/hud/hud.dm | 9 +++++++++ code/_onclick/hud/human.dm | 4 ++-- code/_onclick/hud/maptext.dm | 27 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 code/_onclick/hud/maptext.dm diff --git a/baystation12.dme b/baystation12.dme index 93a4de538a2..1777892fd59 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -199,6 +199,7 @@ #include "code\_onclick\hud\gun_mode.dm" #include "code\_onclick\hud\hud.dm" #include "code\_onclick\hud\human.dm" +#include "code\_onclick\hud\maptext.dm" #include "code\_onclick\hud\metroid.dm" #include "code\_onclick\hud\movable_screen_objects.dm" #include "code\_onclick\hud\radial.dm" diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 0ed29e3a631..e934af1598d 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -45,6 +45,8 @@ /// List of all buttons that never exit the view var/list/obj/screen/always_visible_inventory + var/obj/screen/maptext/maptext + /datum/hud/New(mob/owner) mymob = owner instantiate() @@ -63,6 +65,10 @@ always_visible_inventory = null mymob = null + if(maptext) + qdel(maptext) + maptext = null + /datum/hud/proc/hidden_inventory_update() if(!mymob) return if(ishuman(mymob)) @@ -190,6 +196,9 @@ if(hud_version > HUD_STYLE_TOTAL) hud_version = HUD_STYLE_STANDART + maptext = new(src) + mymob.client.screen += maptext + switch(hud_version) if(HUD_STYLE_STANDART) hud_shown = TRUE diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 6de6664befb..1481cb7c801 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -107,7 +107,7 @@ static_inventory += using inv_box = new /obj/screen/inventory() - inv_box.SetName("r_hand") + inv_box.SetName("right hand") inv_box.icon = ui_style inv_box.icon_state = "r_hand_inactive" if(mymob && !mymob.hand) //This being 0 or null means the right hand is in use @@ -121,7 +121,7 @@ static_inventory += inv_box inv_box = new /obj/screen/inventory() - inv_box.SetName("l_hand") + inv_box.SetName("left hand") inv_box.icon = ui_style inv_box.icon_state = "l_hand_inactive" if(mymob && mymob.hand) //This being 1 means the left hand is in use diff --git a/code/_onclick/hud/maptext.dm b/code/_onclick/hud/maptext.dm new file mode 100644 index 00000000000..bb996bf99a9 --- /dev/null +++ b/code/_onclick/hud/maptext.dm @@ -0,0 +1,27 @@ +/obj/screen/maptext + screen_loc = "NORTH:14,WEST" + plane = HUD_PLANE + layer = HUD_BASE_LAYER + maptext_height = 32 + maptext_width = 480 + var/last_word = null + +/client/MouseEntered(object, location) + ..() + if(!maptext_toggle) + return + if(istype(object, /atom) && !istype(object, /obj/screen/splash)) + var/atom/A = object + if(mob.hud_used) + var/obj_name = A.name + if(mob.hud_used.maptext.last_word == obj_name) + return + obj_name = uppertext(obj_name) + if(mob.mind.assigned_role == "Clown") + mob.hud_used.maptext.maptext = "[obj_name]" + else + mob.hud_used.maptext.maptext = "[obj_name]" + mob.hud_used.maptext.last_word = obj_name + +/client + var/maptext_toggle = TRUE From 605d7fd89a0f996e0a8164a9e40702f5eb6d7cdb Mon Sep 17 00:00:00 2001 From: kreeperhlc Date: Tue, 26 Dec 2023 15:21:25 +0300 Subject: [PATCH 2/3] feat(maptext): adds special font for Changelings --- code/_onclick/hud/maptext.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/_onclick/hud/maptext.dm b/code/_onclick/hud/maptext.dm index bb996bf99a9..b4feb77baa5 100644 --- a/code/_onclick/hud/maptext.dm +++ b/code/_onclick/hud/maptext.dm @@ -17,8 +17,10 @@ if(mob.hud_used.maptext.last_word == obj_name) return obj_name = uppertext(obj_name) - if(mob.mind.assigned_role == "Clown") + if(mob.mind.special_role == "Changeling") mob.hud_used.maptext.maptext = "[obj_name]" + else if(mob.mind.assigned_role == "Clown") + mob.hud_used.maptext.maptext = "[obj_name]" else mob.hud_used.maptext.maptext = "[obj_name]" mob.hud_used.maptext.last_word = obj_name From 01f1b349c916102881c15bc6f912ab537b240bed Mon Sep 17 00:00:00 2001 From: kreeperhlc Date: Tue, 26 Dec 2023 17:34:30 +0300 Subject: [PATCH 3/3] tweak(maptext): adds pref --- code/_onclick/hud/human.dm | 4 ++-- code/_onclick/hud/maptext.dm | 5 +---- code/modules/client/preference_setup/global/preferences.dm | 6 ++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 1481cb7c801..6de6664befb 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -107,7 +107,7 @@ static_inventory += using inv_box = new /obj/screen/inventory() - inv_box.SetName("right hand") + inv_box.SetName("r_hand") inv_box.icon = ui_style inv_box.icon_state = "r_hand_inactive" if(mymob && !mymob.hand) //This being 0 or null means the right hand is in use @@ -121,7 +121,7 @@ static_inventory += inv_box inv_box = new /obj/screen/inventory() - inv_box.SetName("left hand") + inv_box.SetName("l_hand") inv_box.icon = ui_style inv_box.icon_state = "l_hand_inactive" if(mymob && mymob.hand) //This being 1 means the left hand is in use diff --git a/code/_onclick/hud/maptext.dm b/code/_onclick/hud/maptext.dm index b4feb77baa5..b759a07f4d6 100644 --- a/code/_onclick/hud/maptext.dm +++ b/code/_onclick/hud/maptext.dm @@ -8,7 +8,7 @@ /client/MouseEntered(object, location) ..() - if(!maptext_toggle) + if(get_preference_value(/datum/client_preference/maptext) == GLOB.PREF_NO) return if(istype(object, /atom) && !istype(object, /obj/screen/splash)) var/atom/A = object @@ -24,6 +24,3 @@ else mob.hud_used.maptext.maptext = "[obj_name]" mob.hud_used.maptext.last_word = obj_name - -/client - var/maptext_toggle = TRUE diff --git a/code/modules/client/preference_setup/global/preferences.dm b/code/modules/client/preference_setup/global/preferences.dm index 6cac90e7c22..4516af7dc0d 100644 --- a/code/modules/client/preference_setup/global/preferences.dm +++ b/code/modules/client/preference_setup/global/preferences.dm @@ -102,6 +102,12 @@ var/global/list/_client_preferences_by_type options = list(GLOB.PREF_YES, GLOB.PREF_NO, GLOB.PREF_AS_GHOST, GLOB.PREF_AS_LIVING) default_value = GLOB.PREF_YES +/datum/client_preference/maptext + description = "Show Maptext" + key = "SHOW_TMAPTEXT" + options = list(GLOB.PREF_YES, GLOB.PREF_NO) + default_value = GLOB.PREF_NO + /datum/client_preference/runechat description = "Show Runechat (Above-Head-Speech)" key = "CHAT_RUNECHAT"