Skip to content

Commit

Permalink
Merge pull request #5013 from Superlagg/why-are-my-tabs-so-fucking-la…
Browse files Browse the repository at this point in the history
…ggy-i-hate-this-game

Fixes certain menus being laggy as all get out
  • Loading branch information
Tk420634 authored Apr 22, 2024
2 parents de85dfd + 31129e8 commit a13f27b
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 23 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ GLOBAL_LIST_INIT(undie_position_strings, list("Under Clothes", "Over Clothes", "
#define PMC_UNBREAK_FAVORITE_PLAPS "/datum/interaction/bang/datum/interaction/funch" // Player Master Changelog
#define PMC_ADDED_RADIO_BLURBLES "CHAT_HEAR_RADIOBLURBLES" // Player Master Changelog
#define PMC_ADDED_RADIO_STATIC "PMC_ADDED_RADIO_STATIC" // Player Master Changelog
#define PMC_WHY_DOES_EVERYTHING_DEFAULT_TO_OFF "lookingatyouwiretap" // Player Master Changelog

/// The master Preferences Changelog to check the player's prefs against.
/// includes a list of actions that need to be taken to update the player's prefs.
Expand Down
13 changes: 9 additions & 4 deletions code/controllers/subsystem/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand All @@ -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 = "<u><b>From [dm_linkify(reciever, sender, myname)]</u></b>: [mesage]<br>"
payload2them = span_private(payload2them)
to_chat(reciever, span_private("<br><U>You have a new message from [name_or_shark(sender) || "Some jerk"]!</U>"))
to_chat(reciever, span_private("<br><U>You have a new message from [name_or_shark(sender) || "Some jerk"]!</U><br>"))
to_chat(reciever, payload2them)
reciever.playsound_local(reciever, 'sound/effects/direct_message_recieved.ogg', 75, FALSE)

var/payload2me = "<u><b>To [dm_linkify(sender, reciever, theirname)]</u></b>: [mesage]<br>"
payload2me = span_private_sent(payload2me)
to_chat(sender, span_private_sent("<br><U>Your message to [theirname] has been sent!</U>"))
to_chat(sender, span_private_sent("<br><U>Your message to [theirname] has been sent!</U><br>"))
to_chat(sender, payload2me)
sender.playsound_local(sender, 'sound/effects/direct_message_setn.ogg', 75, FALSE)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/gunreticle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
chat_toggles |= CHAT_HEAR_RADIOSTATIC
WRITE_FILE(S["chat_toggles"], chat_toggles)
current_version |= PMC_ADDED_RADIO_STATIC
if(PMC_WHY_DOES_EVERYTHING_DEFAULT_TO_OFF) // i broke it =3
S["admin_wire_tap"] >> admin_wire_tap
admin_wire_tap = TRUE
WRITE_FILE(S["admin_wire_tap"], admin_wire_tap)
current_version |= PMC_WHY_DOES_EVERYTHING_DEFAULT_TO_OFF

WRITE_FILE(S["current_version"], safe_json_encode(current_version))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
69 changes: 69 additions & 0 deletions tgui/packages/tgui/components/TogglePopup.js
Original file line number Diff line number Diff line change
@@ -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
* <TogglePopup
* OpenStuff={<div>Opened stuff</div>}
* ClosedStuff={<div>Closed stuff</div>}
* />
*/

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 (
<Button
onClick={() => this.setState({ open: true })}
{...rest}>
{ClosedStuff}
</Button>
);
}
return (
<Box
position="absolute">
<Button
onClick={() => this.setState({ open: false })}
position="absolute"
{...rest}>
{OpenStuff}
</Button>
</Box>
);
}

static defaultProps = {
open: false,
};
}


1 change: 1 addition & 0 deletions tgui/packages/tgui/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
4 changes: 2 additions & 2 deletions tgui/packages/tgui/interfaces/CargoBountyConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ const QuestCard = (props, context) => {
icon={DiffIcon}
iconSize={1.5}
iconColor={DiffiColor}
tooltip={DiffiTooltip}
// tooltip={DiffiTooltip}
color="transparent" />
);

Expand All @@ -599,7 +599,7 @@ const QuestCard = (props, context) => {
return (
<Button
width="100%"
tooltip={TooTip}
// tooltip={TooTip}
disabled={IsDisabled}
color={CuteColor}
p={0.5}
Expand Down
44 changes: 31 additions & 13 deletions tgui/packages/tgui/interfaces/CharacterDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
Table,
Flex,
Tabs,
Stack } from '../components';
ToggleBox,
Stack,
Tooltip} from '../components';
import { Window } from '../layouts';

const erpTagColor = {
Expand Down Expand Up @@ -42,8 +44,9 @@ export const CharacterDirectory = (props, context) => {

return (
<Window
width={1024}
height={480}
width={1280}
height={600}
theme="ntos"
title="Coyote Bayou Yellow Pages"
resizable>
<Window.Content
Expand Down Expand Up @@ -296,6 +299,12 @@ const CharacterDirectoryList = (props, context) => {
}>
<Table collapsing>
<Table.Row bold>
<SortButton id="looking_for_friends">
<Tooltip
content="These people are looking to make new friends! Why not click a star and say hello?">
LFF
</Tooltip>
</SortButton>
<SortButton id="name">Name</SortButton>
<SortButton id="gender">Gender</SortButton>
<SortButton id="species">Species</SortButton>
Expand All @@ -315,29 +324,38 @@ const CharacterDirectoryList = (props, context) => {
{directory
.sort((a, b) => {
const i = sortOrder ? 1 : -1;
return a[sortId].localeCompare(b[sortId]) * i;
const thea_string = a[sortId].toString()
const theb_string = b[sortId].toString()
return thea_string.localeCompare(theb_string) * i;
})
.map((character, i) => (
<Table.Row key={i} backgroundColor={erpTagColor[character.erptag]}>
<Table.Cell p={1} collapsing>
<Table.Row
key={i}
backgroundColor={erpTagColor[character.erptag] || 'label'}
style={{
border: '1px solid #000',
"border-radius": "30px",
}}>
<Table.Cell p={1} collapsing textAlign="center">
{character.looking_for_friends ?
<Button
icon="star"
color="green"
tooltip="This person is looking to make new friends! Why not click here and say hello?"
// tooltip="This person is looking to make new friends! Why not click here and say hello?"
onClick={() => act("pager", { quid: character.quid })} />
: <Fragment />
}
</Table.Cell>
<Table.Cell p={1} collapsing>
{canOrbit
? <Button
color={erpTagColor[character.erptag]}
icon="ghost"
tooltip="Orbit"
content={` ${character.name}`}
// tooltip="Orbit"
onClick={() => act("orbit", { ref: character.ref })} />
: ` ${character.name}`}
: <Fragment />}
{` ${character.name}`}
</Table.Cell>

<Table.Cell>{character.gender}</Table.Cell>
<Table.Cell>{character.species}</Table.Cell>
<Table.Cell>{character.whokisser}</Table.Cell>
Expand Down Expand Up @@ -383,7 +401,7 @@ const CharacterDirectoryList = (props, context) => {
<Button
onClick={() => act("pager", { quid: character.quid })}
icon="envelope"
tooltip="Send a message to this character!"
// tooltip="Send a message to this character!"
mr={1}
/>
</Table.Cell>
Expand All @@ -404,7 +422,7 @@ const SortButton = (props, context) => {
const [sortOrder, setSortOrder] = useLocalState(context, 'sortOrder', 'name');

return (
<Table.Cell collapsing>
<Table.Cell collapsing textAlign="center" width="1px">
<Button
width="100%"
color={sortId !== id && 'transparent'}
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/PaperSheet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file
* @copyright 2020 WarlockD (https://github.com/warlockd)
* @author Original WarlockD (https://github.com/warlockd)
* @author Original WarlockD https://github.com/warlockd
* @author Changes stylemistake
* @author Changes ThePotato97
* @author Changes Ghommie
Expand Down

0 comments on commit a13f27b

Please sign in to comment.