Skip to content

Commit

Permalink
Merge branch 'master' into MOST-IMPORTANT-CHANGES
Browse files Browse the repository at this point in the history
  • Loading branch information
konushi authored Jan 9, 2025
2 parents d319ea7 + 04cb62d commit ad1859f
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/modules/client/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,18 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
return

mob.log_talk(raw_msg, LOG_OOC)

// BANDASTATION CHAT BADGES REPLACE START
var/keyname = get_ooc_badged_name()
/*
var/keyname = key
if(prefs.unlock_content)
if(prefs.toggles & MEMBER_PUBLIC)
keyname = "<font color='[prefs.read_preference(/datum/preference/color/ooc_color) || GLOB.normal_ooc_colour]'>[icon2html('icons/ui/chat/member_content.dmi', world, "blag")][keyname]</font>"
if(prefs.hearted)
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
keyname = "[sheet.icon_tag("emoji-heart")][keyname]"
*/
// BANDASTATION CHAT BADGES REPLACE END
//The linkify span classes and linkify=TRUE below make ooc text get clickable chat href links if you pass in something resembling a url
for(var/client/receiver as anything in GLOB.clients)
if(!receiver.prefs) // Client being created or deleted. Despite all, this can be null.
Expand Down
4 changes: 4 additions & 0 deletions modular_bandastation/chat_badges/_chat_badges.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/chat_badges
name = "Chat badges"
desc = "Добавляет иконки в OOC для различных ролей"
author = "furior, Aylong"
3 changes: 3 additions & 0 deletions modular_bandastation/chat_badges/_chat_badges.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "_chat_badges.dm"

#include "code/badges.dm"
69 changes: 69 additions & 0 deletions modular_bandastation/chat_badges/code/badges.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#define CHAT_BADGES_DMI 'modular_bandastation/chat_badges/icons/chatbadges.dmi'

GLOBAL_LIST(badge_icons_cache)

/client/proc/get_ooc_badged_name()
var/icon/donator_badge_icon = get_badge_icon(get_donator_badge())
var/icon/worker_badge_icon = get_badge_icon(get_worker_badge())

var/list/badge_parts = list()
if(donator_badge_icon)
badge_parts += icon2base64html(donator_badge_icon)

if(worker_badge_icon)
badge_parts += icon2base64html(worker_badge_icon)

var/list/parts = list()
if(length(badge_parts))
parts += badge_parts
parts += "<font color='[prefs.read_preference(/datum/preference/color/ooc_color) || GLOB.normal_ooc_colour]'>[key]</font>"
return jointext(parts, "<div style='display: inline-block; width: 3px;'></div>")

/client/proc/get_donator_badge()
if(prefs.unlock_content && (prefs.toggles & MEMBER_PUBLIC))
return "ByondMember"

if(donator_level && prefs.read_preference(/datum/preference/toggle/donor_public))
return "Tier_[min(donator_level, 5)]"

/client/proc/get_worker_badge()
var/static/list/rank_badge_map = list(
"Максон" = "Wycc",
"Банда" = "Streamer",
"Друг Банды" = "Streamer",
"Хост" = "Host",
"Ведущий Разработчик" = "HeadDeveloper",
"Старший Разработчик" = "Developer",
"Разработчик" = "Developer",
"Начальный Разработчик" = "MiniDeveloper",
"Ведущий Маппер" = "HeadMapper",
"Маппер" = "Mapper",
"Спрайтер" = "Spriceter",
"Ведущий редактор Вики" = "HeadWiki",
"Редактор Вики" = "WikiLore",
"Главный Администратор" = "HeadAdmin",
"Администратор" = "GameAdmin",
"Триал Администратор" = "TrialAdmin",
"Тестовый Администратор" = "TestAdmin",
"Ментор" = "Mentor"
)
return rank_badge_map["[holder?.ranks[1]]"]

/client/proc/get_badge_icon(badge)
if(isnull(badge))
return null

var/icon/badge_icon = LAZYACCESS(GLOB.badge_icons_cache, badge)
if(isnull(badge_icon))
badge_icon = icon(CHAT_BADGES_DMI, badge)
LAZYSET(GLOB.badge_icons_cache, badge, badge_icon)

return badge_icon

#undef CHAT_BADGES_DMI

/datum/preference/toggle/donor_public
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
default_value = TRUE
savefile_key = "donor_public"
savefile_identifier = PREFERENCE_PLAYER
Binary file not shown.
1 change: 1 addition & 0 deletions modular_bandastation/modular_bandastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "autohiss/_autohiss.dme"
#include "balance/_balance.dme"
#include "barsigns/_barsigns.dme"
#include "chat_badges/_chat_badges.dme"
#include "communication/_communication.dme"
#include "customization/_customization.dme"
#include "cyrillic_fixes/_cyrillic_fixes.dme"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { CheckboxInput, FeatureToggle } from '../../base';

export const donor_public: FeatureToggle = {
name: 'Publicize Donor status',
category: 'CHAT',
description:
'When enabled, a donor badge will be shown next to your name in OOC.',
component: CheckboxInput,
};

0 comments on commit ad1859f

Please sign in to comment.