This commit is contained in:
SandPoot
2023-12-11 17:43:24 -03:00
parent c9b0dedf77
commit e457f40328
27 changed files with 105 additions and 50 deletions

View File

@@ -536,9 +536,6 @@ GLOBAL_LIST_INIT(pda_reskins, list(
#define FALL_NO_MESSAGE (1<<1) //Used to suppress the "[A] falls through [old_turf]" messages where it'd make little sense at all, like going downstairs.
#define FALL_STOP_INTERCEPTING (1<<2) //Used in situations where halting the whole "intercept" loop would be better, like supermatter dusting (and thus deleting) the atom.
//Misc text define. Does 4 spaces. Used as a makeshift tabulator.
#define FOURSPACES "&nbsp;&nbsp;&nbsp;&nbsp;"
#define CRYOMOBS 'icons/obj/cryo_mobs.dmi'
#define CUSTOM_HOLOFORM_DELAY 10 SECONDS //prevents spamming to make lag. it's pretty expensive to do this.

View File

@@ -1,5 +1,50 @@
/// Does 4 spaces. Used as a makeshift tabulator.
#define FOURSPACES "&nbsp;&nbsp;&nbsp;&nbsp;"
/// Standard maptext
/// Prepares a text to be used for maptext. Use this so it doesn't look hideous.
#define MAPTEXT(text) {"<span class='maptext'>[##text]</span>"}
/// Macro from Lummox used to get height from a MeasureText proc
#define WXH_TO_HEIGHT(x) text2num(copytext(x, findtextEx(x, "x") + 1))
/**
* Pixel-perfect scaled fonts for use in the MAP element as defined in skin.dmf
*
* Four sizes to choose from, use the sizes as mentioned below.
* Between the variations and a step there should be an option that fits your use case.
* BYOND uses pt sizing, different than px used in TGUI. Using px will make it look blurry due to poor antialiasing.
*
* Default sizes are prefilled in the macro for ease of use and a consistent visual look.
* To use a step other than the default in the macro, specify it in a span style.
* For example: MAPTEXT_PIXELLARI("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Large size (ie: context tooltips) - Size options: 12pt 24pt.
#define MAPTEXT_PIXELLARI(text) {"<span style='font-family: \"Pixellari\"; font-size: 12pt; -dm-text-outline: 1px black'>[##text]</span>"}
/// Standard size (ie: normal runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_GRAND9K(text) {"<span style='font-family: \"Grand9K Pixel\"; font-size: 6pt; -dm-text-outline: 1px black'>[##text]</span>"}
/// Small size. (ie: context subtooltips, spell delays) - Size options: 12pt 24pt.
#define MAPTEXT_TINY_UNICODE(text) {"<span style='font-family: \"TinyUnicode\"; font-size: 12pt; line-height: 0.75; -dm-text-outline: 1px black'>[##text]</span>"}
/// Smallest size. (ie: whisper runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_SPESSFONT(text) {"<span style='font-family: \"Spess Font\"; font-size: 6pt; line-height: 1.4; -dm-text-outline: 1px black'>[##text]</span>"}
/**
* Prepares a text to be used for maptext, using a variable size font.
*
* More flexible but doesn't scale pixel perfect to BYOND icon resolutions.
* (May be blurry.) Can use any size in pt or px.
*
* You MUST Specify the size when using the macro
* For example: MAPTEXT_VCR_OSD_MONO("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Prepares a text to be used for maptext, using a variable size font.
/// Variable size font. More flexible but doesn't scale pixel perfect to BYOND icon resolutions. (May be blurry.) Can use any size in pt or px.
#define MAPTEXT_VCR_OSD_MONO(text) {"<span style='font-family: \"VCR OSD Mono\"'>[##text]</span>"}
/// Macro from Lummox used to get height from a MeasureText proc.
/// resolves the MeasureText() return value once, then resolves the height, then sets return_var to that.
#define WXH_TO_HEIGHT(measurement, return_var) \
do { \
var/_measurement = measurement; \
return_var = text2num(copytext(_measurement, findtextEx(_measurement, "x") + 1)); \
} while(FALSE);

View File

@@ -992,7 +992,7 @@ world
letter = lowertext(letter)
var/image/text_image = new(loc = A)
text_image.maptext = MAPTEXT("<font size = 4>[letter]</font>")
text_image.maptext = MAPTEXT("<span style='font-size: 24pt'>[letter]</span>")
text_image.pixel_x = 7
text_image.pixel_y = 5
qdel(atom_icon)

View File

@@ -30,7 +30,7 @@
#define RUN_YELL(_T, _P, _D) \
returned = max(_P - max(_T.get_yelling_resistance(_P), 0) - 1, 0); \
processed[_T] = returned;
// _T.maptext = "[returned]";
// _T.maptext = MAPTEXT(returned);
var/list/turf/edges_next
var/list/turf/powers_next

View File

@@ -44,7 +44,7 @@
icon = I
parent = P
icon_state = credited
maptext = MAPTEXT(credited)
maptext = MAPTEXT_PIXELLARI(credited)
maptext_x = world.icon_size + 8
maptext_y = (world.icon_size / 2) - 4
maptext_width = world.icon_size * 3

View File

@@ -44,7 +44,7 @@
/atom/movable/screen/devil/soul_counter/proc/update_counter(souls = 0)
invisibility = 0
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#FF0000'>[souls]</font></div>"
maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#FF0000'>[souls]</font></div>")
switch(souls)
if(0,null)
icon_state = "Devil-1"
@@ -103,7 +103,7 @@
..()
var/valuecolor = "#ff2525"
if(owner.stat == DEAD)
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>ERR-0F</font></div>"
maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>ERR-0F</font></div>")
icon_state = "coolant-3-1"
return
var/coolant_efficiency
@@ -123,7 +123,7 @@
valuecolor = "#dd8109"
else if(coolant > BLOOD_VOLUME_SURVIVE * owner.blood_ratio)
valuecolor = "#e7520d"
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round((coolant / (BLOOD_VOLUME_NORMAL * owner.blood_ratio)) * 100, 1)]</font></div>"
maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round((coolant / (BLOOD_VOLUME_NORMAL * owner.blood_ratio)) * 100, 1)]</font></div>")
var/efficiency_suffix
var/state_suffix

View File

@@ -59,7 +59,7 @@
var/atom/movable/screen/movable/M = new()
M.name = "Movable UI Object"
M.icon_state = "block"
M.maptext = "Movable"
M.maptext = MAPTEXT("Movable")
M.maptext_width = 64
var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text
@@ -78,7 +78,7 @@
var/atom/movable/screen/movable/snap/S = new()
S.name = "Snap UI Object"
S.icon_state = "block"
S.maptext = "Snap"
S.maptext = MAPTEXT("Snap")
S.maptext_width = 64
var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text

View File

@@ -727,7 +727,7 @@
/datum/action/cooldown/proc/StartCooldown()
next_use_time = world.time + cooldown_time
button.maptext = "<b>[round(cooldown_time/10, 0.1)]</b>"
button.maptext = MAPTEXT_TINY_UNICODE("[round(cooldown_time/10, 0.1)]")
UpdateButtonIcon()
START_PROCESSING(SSfastprocess, src)
@@ -741,7 +741,7 @@
UpdateButtonIcon()
STOP_PROCESSING(SSfastprocess, src)
else
button.maptext = "<b>[round(timeleft/10, 0.1)]</b>"
button.maptext = MAPTEXT_TINY_UNICODE("[round(cooldown_time/10, 0.1)]")
/datum/action/cooldown/Grant(mob/M)
..()

View File

@@ -130,7 +130,9 @@
var/tgt_color = extra_classes.Find("italics") ? target.chat_color_darkened : target.chat_color
var/complete_text = "<span class='center maptext [extra_classes.Join(" ")]' style='color: [tgt_color]'>[owner.say_emphasis(text)]</span>"
var/mheight = WXH_TO_HEIGHT(owned_by.MeasureText(complete_text, null, CHAT_MESSAGE_WIDTH))
var/mheight
WXH_TO_HEIGHT(owned_by.MeasureText(complete_text, null, CHAT_MESSAGE_WIDTH), mheight)
approx_lines = max(1, mheight / CHAT_MESSAGE_APPROX_LHEIGHT)
// Translate any existing messages upwards, apply exponential decay factors to timers

View File

@@ -48,7 +48,7 @@
var/datum/numbered_display/ND = numbered_contents[type]
ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE
ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]"
ND.sample_object.maptext = "<font color='white'>[(ND.number > 1)? "[ND.number]" : ""]</font>"
ND.sample_object.maptext = MAPTEXT("<font color='white'>[(ND.number > 1)? "[ND.number]" : ""]</font>")
ND.sample_object.layer = ABOVE_HUD_LAYER
ND.sample_object.plane = ABOVE_HUD_PLANE
. += ND.sample_object

View File

@@ -436,13 +436,13 @@ GLOBAL_LIST_EMPTY(explosions)
if(dist < dev)
T.color = "red"
T.maptext = "Dev"
T.maptext = MAPTEXT("Dev")
else if (dist < heavy)
T.color = "yellow"
T.maptext = "Heavy"
T.maptext = MAPTEXT("Heavy")
else if (dist < light)
T.color = "blue"
T.maptext = "Light"
T.maptext = MAPTEXT("Light")
else
continue

View File

@@ -51,7 +51,7 @@
displayed_text = new_val
if(displayed_text)
maptext = "<font size = [text_size]>[displayed_text]</font>"
maptext = MAPTEXT("[displayed_text]")
else
maptext = null

View File

@@ -13,7 +13,7 @@
/obj/item/electroadaptive_pseudocircuit/Initialize(mapload)
. = ..()
maptext = "[circuits]"
maptext = MAPTEXT("[circuits]")
/obj/item/electroadaptive_pseudocircuit/examine(mob/user)
. = ..()
@@ -40,7 +40,7 @@
playsound(R, 'sound/items/rped.ogg', 50, TRUE)
recharging = TRUE
circuits--
maptext = "[circuits]"
maptext = MAPTEXT("[circuits]")
icon_state = "[initial(icon_state)]_recharging"
var/recharge_time = min(600, circuit_cost * 5) //40W of cost for one fabrication = 20 seconds of recharge time; this is to prevent spamming
addtimer(CALLBACK(src, .proc/recharge), recharge_time)
@@ -53,7 +53,7 @@
if(!is_type_in_typecache(target, recycleable_circuits))
return
circuits++
maptext = "[circuits]"
maptext = MAPTEXT("[circuits]")
user.visible_message("<span class='notice'>User breaks down [target] with [src].</span>", \
"<span class='notice'>You recycle [target] into [src]. It now has material for <b>[circuits]</b> circuits.</span>")
playsound(user, 'sound/items/deconstruct.ogg', 50, TRUE)

View File

@@ -86,7 +86,7 @@
// I assume it's faster to color,tag and OR the turf in, rather
// then checking if its there
T.color = RANDOM_COLOUR
T.maptext = "[T.x],[T.y],[T.z]"
T.maptext = MAPTEXT("[T.x],[T.y],[T.z]")
tagged |= T
/obj/item/gps/visible_debug/proc/clear()

View File

@@ -480,7 +480,7 @@ GLOBAL_LIST_EMPTY(station_turfs)
A = i
if(!QDELETED(A) && A.level >= affecting_level)
. = A.wave_explode(., explosion, dir)
maptext = "[.]"
maptext = MAPTEXT("[.]")
/turf/narsie_act(force, ignore_mobs, probability = 20)
. = (prob(probability) || force)

View File

@@ -81,7 +81,7 @@
var/new_label = stripped_input(user, "Choose a new label.", "Sound Emitter")
if(!new_label)
return
maptext = new_label
maptext = MAPTEXT(new_label)
to_chat(user, "<span class='notice'>Label set to [maptext].</span>", confidential = TRUE)
if(href_list["edit_sound_file"])
var/new_file = input(user, "Choose a sound file.", "Sound Emitter") as null|sound

View File

@@ -83,7 +83,7 @@ GLOBAL_PROTECT(admin_verbs_debug_mapping)
for(var/turf/T in C.can_see())
seen[T]++
for(var/turf/T in seen)
T.maptext = "[seen[T]]"
T.maptext = MAPTEXT("[seen[T]]")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range")

View File

@@ -275,7 +275,7 @@
/mob/living/simple_animal/hostile/blob/blobbernaut/update_health_hud()
if(hud_used)
hud_used.healths.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#e36600'>[round((health / maxHealth) * 100, 0.5)]%</font></div>"
hud_used.healths.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#e36600'>[round((health / maxHealth) * 100, 0.5)]%</font></div>")
/mob/living/simple_animal/hostile/blob/blobbernaut/AttackingTarget()
. = ..()

View File

@@ -197,14 +197,14 @@ GLOBAL_LIST_EMPTY(blob_nodes)
/mob/camera/blob/update_health_hud()
if(blob_core)
hud_used.healths.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#e36600'>[round(blob_core.obj_integrity)]</font></div>"
hud_used.healths.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#e36600'>[round(blob_core.obj_integrity)]</font></div>")
for(var/mob/living/simple_animal/hostile/blob/blobbernaut/B in blob_mobs)
if(B.hud_used && B.hud_used.blobpwrdisplay)
B.hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_core.obj_integrity)]</font></div>"
B.hud_used.blobpwrdisplay.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_core.obj_integrity)]</font></div>")
/mob/camera/blob/proc/add_points(points)
blob_points = clamp(blob_points + points, 0, max_blob_points)
hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_points)]</font></div>"
hud_used.blobpwrdisplay.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_points)]</font></div>")
/mob/camera/blob/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
if (!message)

View File

@@ -725,7 +725,7 @@
/atom/movable/screen/bloodsucker/blood_counter/update_counter(value, valuecolor)
..()
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round(value,1)]</font></div>"
maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round(value,1)]</font></div>")
/atom/movable/screen/bloodsucker/rank_counter
name = "Bloodsucker Rank"
@@ -735,7 +735,7 @@
/atom/movable/screen/bloodsucker/rank_counter/update_counter(value, valuecolor)
..()
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round(value,1)]</font></div>"
maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[round(value,1)]</font></div>")
/atom/movable/screen/bloodsucker/sunlight_counter
icon = 'icons/mob/actions/bloodsucker.dmi'
@@ -763,7 +763,7 @@
/atom/movable/screen/bloodsucker/sunlight_counter/update_counter(value, valuecolor)
..()
maptext = "<div align='center' valign='bottom' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[value]</font></div>"
maptext = MAPTEXT("<div align='center' valign='bottom' style='position:relative; top:0px; left:6px'><font color='[valuecolor]'>[value]</font></div>")
/datum/antagonist/bloodsucker/proc/count_vassals(datum/mind/master)
var/datum/antagonist/bloodsucker/B = master.has_antag_datum(ANTAG_DATUM_BLOODSUCKER)

View File

@@ -180,8 +180,8 @@
resulthealth = "[round((host.health / host.maxHealth) * 100, 0.5)]%"
else
resulthealth = "NONE"
G.hosthealth.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#AF0AAF'>HOST<br>[resulthealth]</font></div>"
hud_used.healths.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#AF0AAF'>[round((health / maxHealth) * 100, 0.5)]%</font>"
G.hosthealth.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#AF0AAF'>HOST<br>[resulthealth]</font></div>")
hud_used.healths.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#AF0AAF'>[round((health / maxHealth) * 100, 0.5)]%</font>")
/mob/living/simple_animal/hostile/clockwork/guardian/proc/update_stats()
if(GLOB.ratvar_awakens)

View File

@@ -150,7 +150,7 @@
essencecolor = "#9A5ACB" //oh boy you've got a lot of essence
else if(!essence)
essencecolor = "#1D2953" //oh jeez you're dying
hud_used.healths.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[essencecolor]'>[essence]E</font></div>"
hud_used.healths.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='[essencecolor]'>[essence]E</font></div>")
/mob/living/simple_animal/revenant/med_hud_set_health()
return //we use no hud

View File

@@ -48,7 +48,7 @@
balloon_alert.appearance_flags = RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM
balloon_alert.maptext = MAPTEXT("<span style='text-align: center; -dm-text-outline: 1px #0005'>[text]</span>")
balloon_alert.maptext_x = (BALLOON_TEXT_WIDTH - bound_width) * -0.5
balloon_alert.maptext_height = WXH_TO_HEIGHT(viewer_client?.MeasureText(text, null, BALLOON_TEXT_WIDTH))
WXH_TO_HEIGHT(viewer_client?.MeasureText(text, null, BALLOON_TEXT_WIDTH), balloon_alert.maptext_height)
balloon_alert.maptext_width = BALLOON_TEXT_WIDTH
viewer_client?.images += balloon_alert

View File

@@ -99,7 +99,7 @@
var/strength = round(rad_places[i] / 1000, 0.1)
var/image/pic = image(loc = place)
var/mutable_appearance/MA = new()
MA.maptext = "<span class='maptext'>[strength]k</span>"
MA.maptext = MAPTEXT("[strength]k")
MA.color = "#04e604"
MA.layer = RAD_TEXT_LAYER
MA.plane = GAME_PLANE

View File

@@ -1,7 +1,7 @@
/mob/living/carbon/alien/proc/updatePlasmaDisplay()
if(hud_used) //clientless aliens
hud_used.alien_plasma_display.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='magenta'>[round(getPlasma())]</font></div>"
hud_used.alien_plasma_display.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='magenta'>[round(getPlasma())]</font></div>")
/mob/living/carbon/alien/larva/updatePlasmaDisplay()
return

View File

@@ -257,7 +257,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
resulthealth = round((abs(HEALTH_THRESHOLD_DEAD - summoner.health) / abs(HEALTH_THRESHOLD_DEAD - summoner.maxHealth)) * 100)
else
resulthealth = round((summoner.health / summoner.maxHealth) * 100, 0.5)
hud_used.healths.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#efeeef'>[resulthealth]%</font></div>"
hud_used.healths.maptext = MAPTEXT("<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#efeeef'>[resulthealth]%</font></div>")
/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, updating_health = TRUE, forced = FALSE) //The spirit is invincible, but passes on damage to the summoner
. = amount

View File

@@ -142,7 +142,7 @@
maptext_x = 10
if(100)
maptext_x = 8
maptext = "[current_number]" //Finally, apply the maptext
maptext = MAPTEXT("[current_number]") //Finally, apply the maptext
/obj/machinery/ticket_machine/attackby(obj/item/I, mob/user, params)
..()
@@ -182,11 +182,7 @@
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 100, FALSE)
ticket_number ++
to_chat(user, "<span class='notice'>You take a ticket from [src], looks like you're ticket number #[ticket_number]...</span>")
var/obj/item/ticket_machine_ticket/theirticket = new /obj/item/ticket_machine_ticket(get_turf(src))
theirticket.name = "Ticket #[ticket_number]"
theirticket.maptext = "<font color='#000000'>[ticket_number]</font>"
theirticket.saved_maptext = "<font color='#000000'>[ticket_number]</font>"
theirticket.ticket_number = ticket_number
var/obj/item/ticket_machine_ticket/theirticket = new /obj/item/ticket_machine_ticket(get_turf(src), ticket_number)
theirticket.source = src
theirticket.owner = user
user.put_in_hands(theirticket)
@@ -211,10 +207,25 @@
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
max_integrity = 50
var/number
var/saved_maptext = null
var/mob/living/carbon/owner
var/obj/machinery/ticket_machine/source
var/ticket_number
/obj/item/ticket_machine_ticket/Initialize(mapload, num)
. = ..()
number = num
if(!isnull(num))
name += " #[num]"
saved_maptext = MAPTEXT(num)
maptext = saved_maptext
/obj/item/ticket_machine_ticket/examine(mob/user)
. = ..()
if(!isnull(number))
. += span_notice("The ticket reads shimmering text that tells you that you are number [number] in queue.")
if(source)
. += span_notice("Below that, you can see that you are [number - source.current_number] spot\s away from being served.")
/obj/item/ticket_machine_ticket/attack_hand(mob/user)
. = ..()
@@ -233,7 +244,7 @@
/obj/item/ticket_machine_ticket/Destroy()
if(owner && source)
source.ticket_holders -= owner
source.tickets[ticket_number] = null
source.tickets[number] = null
owner = null
source = null
return ..()