Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавление маптекста #11297

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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))
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions code/_onclick/hud/maptext.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/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)
Copy link
Member

@TobyThorne TobyThorne Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

документация такая

This is called when no mouse buttons are pressed while pointing to the object.
Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead.

разработчик такой

image

..()
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
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.special_role == "Changeling")
mob.hud_used.maptext.maptext = "<font size=4 style=\"font: 'Comic Sans MS'; text-align: center; text-shadow: 1px 1px 2px black;\">[obj_name]</font>"
else if(mob.mind.assigned_role == "Clown")
mob.hud_used.maptext.maptext = "<font size=4 style=\"font: 'Exocet'; text-align: center; text-shadow: 1px 1px 2px black;\">[obj_name]</font>"
else
mob.hud_used.maptext.maptext = "<font size=4 style=\"font: 'Small Fonts'; text-align: center; text-shadow: 1px 1px 2px black;\">[obj_name]</font>"
mob.hud_used.maptext.last_word = obj_name
6 changes: 6 additions & 0 deletions code/modules/client/preference_setup/global/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading