From 1eaede2a58150b664e26c4996ae808ba9efeda5a Mon Sep 17 00:00:00 2001 From: Superlagg Date: Sun, 21 Apr 2024 23:09:32 -0700 Subject: [PATCH 1/3] guts lag, kills intuitiveness --- code/controllers/subsystem/chat.dm | 13 ++-- code/controllers/subsystem/gunreticle.dm | 2 + .../client/verbs/character_directory.dm | 31 ++++++++- tgui/packages/tgui/components/TogglePopup.js | 69 +++++++++++++++++++ tgui/packages/tgui/components/index.js | 1 + .../tgui/interfaces/CargoBountyConsole.js | 4 +- .../tgui/interfaces/CharacterDirectory.js | 44 ++++++++---- tgui/packages/tgui/interfaces/PaperSheet.js | 2 +- 8 files changed, 143 insertions(+), 23 deletions(-) create mode 100644 tgui/packages/tgui/components/TogglePopup.js diff --git a/code/controllers/subsystem/chat.dm b/code/controllers/subsystem/chat.dm index 240525ed048..e45f09eb86c 100644 --- a/code/controllers/subsystem/chat.dm +++ b/code/controllers/subsystem/chat.dm @@ -36,6 +36,7 @@ SUBSYSTEM_DEF(chat) var/list/flirt_cooldowns = list() /// how long between flirts can we flirt var/flirt_cooldown_time = 5 SECONDS + var/debug_character_directory = 0 /datum/controller/subsystem/chat/Initialize(start_timeofday) setup_emoticon_cache() @@ -295,7 +296,8 @@ SUBSYSTEM_DEF(chat) to_chat(sender, span_warning("Module failed to load.")) return var/theirname = name_or_shark(reciever) || "some jerk" // stop. naming. your. ckeys. after. your characcteres!!!!!!!!!!!!!!!!!! - if(check_rights(R_ADMIN, FALSE)) + var/sender_should_see_ckey = check_rights_for(extract_client(sender), R_ADMIN) + if(sender_should_see_ckey) theirname = "[theirname] - [extract_ckey(reciever)]" // we're an admin, we can see their name var/mesage = input( sender, @@ -306,18 +308,19 @@ SUBSYSTEM_DEF(chat) if(!mesage) return var/myname = name_or_shark(sender) || "Anonymouse" - if(check_rights(R_ADMIN, FALSE)) + var/recipient_should_see_ckey = check_rights_for(extract_client(reciever), R_ADMIN) + if(recipient_should_see_ckey) myname = "[myname] - [extract_ckey(sender)]" // we're an admin, we can see their name var/payload2them = "From [dm_linkify(reciever, sender, myname)]: [mesage]
" payload2them = span_private(payload2them) - to_chat(reciever, span_private("
You have a new message from [name_or_shark(sender) || "Some jerk"]!")) + to_chat(reciever, span_private("
You have a new message from [name_or_shark(sender) || "Some jerk"]!
")) to_chat(reciever, payload2them) reciever.playsound_local(reciever, 'sound/effects/direct_message_recieved.ogg', 75, FALSE) var/payload2me = "To [dm_linkify(sender, reciever, theirname)]: [mesage]
" payload2me = span_private_sent(payload2me) - to_chat(sender, span_private_sent("
Your message to [theirname] has been sent!")) + to_chat(sender, span_private_sent("
Your message to [theirname] has been sent!
")) to_chat(sender, payload2me) sender.playsound_local(sender, 'sound/effects/direct_message_setn.ogg', 75, FALSE) @@ -360,6 +363,8 @@ SUBSYSTEM_DEF(chat) return test_name if(strings("data/super_special_ultra_instinct.json", "[ckey(they.real_name)]", TRUE, TRUE)) return test_name + if(they.ckey == "aldrictavalin") // tired of this not working + return test_name return they.client.prefs.my_shark return test_name return safepick(GLOB.cow_names + GLOB.megacarp_first_names + GLOB.megacarp_last_names) diff --git a/code/controllers/subsystem/gunreticle.dm b/code/controllers/subsystem/gunreticle.dm index 60001943fbd..4fb1df26407 100644 --- a/code/controllers/subsystem/gunreticle.dm +++ b/code/controllers/subsystem/gunreticle.dm @@ -29,10 +29,12 @@ SUBSYSTEM_DEF(reticle) if(dir & WEST) pixel_x = CLAMP(-apparent_offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE) base.Blend(overlay, ICON_OVERLAY, x=32+pixel_x, y=32+pixel_y) + CHECK_TICK var/spread_color = gradient("#00FF00", "#0000FF", "#FFFF00", (offset/(SSrecoil.recoil_max_spread*2))) base.Blend(spread_color, ICON_MULTIPLY) reticle_icons["reticle-[round(true_offset)]"] = base SSassets.transport.register_asset("reticle-[offset]", base) + CHECK_TICK /datum/controller/subsystem/reticle/proc/find_cursor_icon(offset) var/my_cursor = LAZYACCESS(reticle_icons, "reticle-[offset]") diff --git a/modular_splurt/code/datums/modules/client/verbs/character_directory.dm b/modular_splurt/code/datums/modules/client/verbs/character_directory.dm index 09a26b18640..6c7992db4c4 100644 --- a/modular_splurt/code/datums/modules/client/verbs/character_directory.dm +++ b/modular_splurt/code/datums/modules/client/verbs/character_directory.dm @@ -145,6 +145,26 @@ GLOBAL_LIST_INIT(char_directory_erptags, list("Top", "Bottom", "Switch", "No ERP "profile_pic" = PfpHostLink(C.prefs.profilePicture, C.prefs.pfphost) ))) + if(SSchat.debug_character_directory) + for(var/i in 1 to SSchat.debug_character_directory) + directory_mobs.Add(list(list( + "name" = (safepick(GLOB.megacarp_first_names) + " " + safepick(GLOB.megacarp_last_names)), + "species" = "Test Species", + "ooc_notes" = "Test OOC Notes", + "tag" = "Test Tag", + "erptag" = "Test ERP Tag", + "character_ad" = "Test Ad", + "flavor_text" = "Test Flavor Text", + "ref" = null, + "gender" = "Fluid", + "whokisser" = "Likes Anyone", + "flist" = "Test F-List", + "quid" = "Test QUID", + "dms_r_open" = TRUE, + "looking_for_friends" = TRUE, + "profile_pic" = "https://www.example.com/test.jpg" + ))) + data["directory"] = directory_mobs return data @@ -165,10 +185,12 @@ GLOBAL_LIST_INIT(char_directory_erptags, list("Top", "Bottom", "Switch", "No ERP if(!COOLDOWN_FINISHED(user.client, char_directory_cooldown)) to_chat(user, span_alert("Hold your horses! Its still refreshing!")) return - COOLDOWN_START(user.client, char_directory_cooldown, 10) + COOLDOWN_START(user.client, char_directory_cooldown, 5) update_static_data(user, ui) return TRUE if("orbit") + if(!isobserver(user)) + return TRUE var/ref = params["ref"] var/mob/dead/observer/ghost = user var/atom/movable/poi = (locate(ref) in GLOB.mob_list) || (locate(ref) in GLOB.poi_list) @@ -208,10 +230,13 @@ GLOBAL_LIST_INIT(char_directory_erptags, list("Top", "Bottom", "Switch", "No ERP SSchat.inspect_character(user, payload) if("pager") SSchat.start_page(user, params["quid"]) - update_static_data(user, ui) + // update_static_data(user, ui) if("setLookingForFriends") TOGGLE_VAR(user.client.prefs.needs_a_friend) - + if(!COOLDOWN_FINISHED(user.client, char_directory_cooldown)) + return + COOLDOWN_START(user.client, char_directory_cooldown, 5) + // update_static_data(user, ui) else return check_for_mind_or_prefs(user, action, params["overwrite_prefs"]) return TRUE diff --git a/tgui/packages/tgui/components/TogglePopup.js b/tgui/packages/tgui/components/TogglePopup.js new file mode 100644 index 00000000000..e2dce8eed35 --- /dev/null +++ b/tgui/packages/tgui/components/TogglePopup.js @@ -0,0 +1,69 @@ +/** + * @file + * @copyright 2024 Sudessa Perdel Laggette + * @license BQDM-1.0-SC-1-Alpaca-9905 + */ + +import { Component, createRef } from 'inferno'; +import { Button } from './Button'; +import { Box } from './Box'; + +/* + * Simple component that opens a floating box element when clicked. + * This box will be closed when clicked again. + * It will also follow the page scroll, so it looks like it's a tooltip + * that follows the trigger element. + * the box will appear overtop of other elements, without affecting the layout. + * + * @example + * Opened stuff} + * ClosedStuff={
Closed stuff
} + * /> + */ + +export class TogglePopup extends Component { + constructor(props) { + super(props); + const { open } = props; + this.state = { + open: open || false, + }; + } + + render() { + const { props } = this; + const { open } = this.state; + const { + OpenStuff, + ClosedStuff, + ...rest + } = props; + if(!open) { + return ( + + ); + } + return ( + + + + ); + } + + static defaultProps = { + open: false, + }; +} + + diff --git a/tgui/packages/tgui/components/index.js b/tgui/packages/tgui/components/index.js index 3ac242d1f3a..899450462bc 100644 --- a/tgui/packages/tgui/components/index.js +++ b/tgui/packages/tgui/components/index.js @@ -39,4 +39,5 @@ export { Tabs } from './Tabs'; export { TextArea } from './TextArea'; export { TimeDisplay } from './TimeDisplay'; export { ToggleBox } from './ToggleBox'; +export { TogglePopup } from './TogglePopup'; export { Tooltip } from './Tooltip'; diff --git a/tgui/packages/tgui/interfaces/CargoBountyConsole.js b/tgui/packages/tgui/interfaces/CargoBountyConsole.js index 6d9810b0fb6..319ce957031 100644 --- a/tgui/packages/tgui/interfaces/CargoBountyConsole.js +++ b/tgui/packages/tgui/interfaces/CargoBountyConsole.js @@ -578,7 +578,7 @@ const QuestCard = (props, context) => { icon={DiffIcon} iconSize={1.5} iconColor={DiffiColor} - tooltip={DiffiTooltip} + // tooltip={DiffiTooltip} color="transparent" /> ); @@ -599,7 +599,7 @@ const QuestCard = (props, context) => { return (