Skip to content

Commit

Permalink
Upstream0708 (#201)
Browse files Browse the repository at this point in the history
<!-- ЭТО ШАБЛОН ВАШЕГО PULL REQUEST. Текст между стрелками - это
комментарии - они не будут видны в PR. -->

## Описание PR
<!-- Ниже опишите ваш Pull Request. Что он изменяет? На что еще это
может повлиять? Постарайтесь описать все внесённые вами изменения! -->


## Admin.yml
<details><summary>Лист чейнжлогов, смотреть подробнее..</summary>

```yml

- author: Repo
  changes:
  - message: Added aHelp player pinning.
    type: Add
  - message: Added disconnection, reconnection, banning notice on relay and ahelp.
    type: Add
  - message: Fixed search clears on aHelp close.
    type: Fix
  id: 46
  time: '2024-07-30T08:28:32.0000000+00:00'
  url: space-wizards/space-station-14#28639
- author: Repo
  changes:
  - message: Fixed Ahelp Sorting
    type: Fix
  id: 47
  time: '2024-07-31T01:58:31.0000000+00:00'
  url: space-wizards/space-station-14#30518
Name: Admin
Order: 1


```

</details>

## Changelog.yml
<details><summary>Лист чейнжлогов, смотреть подробнее..</summary>

```yml
- author: Plykiya
  changes:
  - message: Syndicate traitor reinforcements are now specialized to be medics, spies,
      or thieves.
    type: Add
  - message: Reinforcement radios with options now have a radial menu, similar to
      RCDs.
    type: Tweak
  id: 6956
  time: '2024-07-21T10:32:25.0000000+00:00'
  url: space-wizards/space-station-14#29853
- author: Cojoke-dot
  changes:
  - message: Dead Space Dragons no long despawn
    type: Fix
  id: 6957
  time: '2024-07-21T10:46:33.0000000+00:00'
  url: space-wizards/space-station-14#29842
- author: slarticodefast
  changes:
  - message: Fixed microwave construction.
    type: Fix
  id: 6958
  time: '2024-07-21T16:20:09.0000000+00:00'
  url: space-wizards/space-station-14#30232
- author: Sphiral&Kezu
  changes:
  - message: 'Added a variety of new wall based storages: Shelfs! Build some today!'
    type: Add
  id: 6959
  time: '2024-07-21T17:16:58.0000000+00:00'
  url: space-wizards/space-station-14#27858
- author: valquaint, slarticodefast
  changes:
  - message: Fixed borgs being unable to state laws with an activated flashlight.
    type: Fix
  id: 6960
  time: '2024-07-22T03:55:35.0000000+00:00'
  url: space-wizards/space-station-14#30183
- author: Lank
  changes:
  - message: Darts can now pop balloons. Keep them away from any monkeys.
    type: Add
  id: 6961
  time: '2024-07-22T05:38:56.0000000+00:00'
  url: space-wizards/space-station-14#30088
- author: Plykiya
  changes:
  - message: You can now eat or drink and swap hands without it being interrupted.
    type: Tweak
  id: 6962
  time: '2024-07-22T09:17:57.0000000+00:00'
  url: space-wizards/space-station-14#30060
- author: IProduceWidgets
  changes:
  - message: Zookeepers can now possess Nonlethal shotguns according to spacelaw.
    type: Tweak
  id: 6963
  time: '2024-07-22T09:33:03.0000000+00:00'
  url: space-wizards/space-station-14#30237
- author: Plykiya
  changes:
  - message: Bag sounds can now only be heard from half the distance and is quieter
      in general.
    type: Tweak
  id: 6964
  time: '2024-07-22T09:54:15.0000000+00:00'
  url: space-wizards/space-station-14#30225
- author: osjarw
  changes:
  - message: Syringes are now 0.5 seconds faster.
    type: Tweak
  id: 6965
  time: '2024-07-22T10:20:36.0000000+00:00'
  url: space-wizards/space-station-14#29825
- author: Errant
  changes:
  - message: Replay observers now always spawn on the station.
    type: Fix
  id: 6966
  time: '2024-07-22T19:32:30.0000000+00:00'
  url: space-wizards/space-station-14#30252
- author: Cojoke-dot
  changes:
  - message: You can now read the volume of a gas tank in its examine text
    type: Tweak
  id: 6967
  time: '2024-07-22T21:41:42.0000000+00:00'
  url: space-wizards/space-station-14#29771
- author: Cojoke-dot
  changes:
  - message: Throwing a jetpack mid-flight will no longer freeze your character
    type: Fix
  id: 6968
  time: '2024-07-22T22:24:26.0000000+00:00'
  url: space-wizards/space-station-14#30223
- author: Flareguy
  changes:
  - message: Added vox sprites for a few headwear items, including radiation suits
      and the paramedic helmet.
    type: Add
  id: 6969
  time: '2024-07-23T02:18:33.0000000+00:00'
  url: space-wizards/space-station-14#30150
- author: Cojoke-dot
  changes:
  - message: You can no longer use telescreens and televisions while blind or asleep.
    type: Fix
  id: 6970
  time: '2024-07-23T02:33:41.0000000+00:00'
  url: space-wizards/space-station-14#30260
- author: Cojoke-dot
  changes:
  - message: Fix one of the QSI popups
    type: Fix
  id: 6971
  time: '2024-07-23T03:23:04.0000000+00:00'
  url: space-wizards/space-station-14#30265
- author: Errant
  changes:
  - message: Players are now notified when trying to insert an incompatible magazine
      into a gun.
    type: Add
  id: 6972
  time: '2024-07-23T06:36:06.0000000+00:00'
  url: space-wizards/space-station-14#29046
- author: TheKittehJesus
  changes:
  - message: The Syndicate Assault Borg can now wield their double esword
    type: Fix
  id: 6973
  time: '2024-07-23T08:13:18.0000000+00:00'
  url: space-wizards/space-station-14#30229
- author: Scribbles0
  changes:
  - message: Handless mobs can no longer wipe devices like positronic brains or pAIs.
    type: Fix
  id: 6974
  time: '2024-07-23T17:47:08.0000000+00:00'
  url: space-wizards/space-station-14#30149
- author: Quantus
  changes:
  - message: Reagent grinders can no longer auto-grind when unpowered.
    type: Fix
  id: 6975
  time: '2024-07-23T21:02:07.0000000+00:00'
  url: space-wizards/space-station-14#30267
- author: BombasterDS
  changes:
  - message: Fixed items disappearing after shelfs and mannequin disassembling
    type: Fix
  id: 6976
  time: '2024-07-24T08:57:03.0000000+00:00'
  url: space-wizards/space-station-14#30313
- author: Cojoke-dot
  changes:
  - message: Fix infinite QSI linking range
    type: Fix
  id: 6977
  time: '2024-07-24T20:57:45.0000000+00:00'
  url: space-wizards/space-station-14#30332
- author: deltanedas
  changes:
  - message: Borgs can no longer unlock the robotics console or other borgs.
    type: Tweak
  id: 6978
  time: '2024-07-25T03:54:52.0000000+00:00'
  url: space-wizards/space-station-14#27888
- author: themias
  changes:
  - message: Fixed the ripley control panel not loading
    type: Fix
  id: 6979
  time: '2024-07-25T05:23:53.0000000+00:00'
  url: space-wizards/space-station-14#30325
- author: Timur2011
  changes:
  - message: Space adders are now butcherable.
    type: Add
  - message: Snakes now drop snake meat when butchered.
    type: Fix
  - message: Snakes now appear lying when in critical state.
    type: Tweak
  id: 6980
  time: '2024-07-25T10:52:18.0000000+00:00'
  url: space-wizards/space-station-14#29629
- author: Plykiya
  changes:
  - message: You can now build atmos gas pipes through things like walls.
    type: Tweak
  id: 6981
  time: '2024-07-25T23:26:06.0000000+00:00'
  url: space-wizards/space-station-14#28707
- author: Ilya246
  changes:
  - message: Nuclear operative reinforcements now come with full nuclear operative
      gear (and a toy carp) at no additional cost.
    type: Tweak
  - message: Nuclear operative reinforcements now get nuclear operative names.
    type: Tweak
  id: 6982
  time: '2024-07-25T23:37:54.0000000+00:00'
  url: space-wizards/space-station-14#30173
- author: Cojoke-dot
  changes:
  - message: Engineering goggles and other similar-looking eyewear now help block
      identity.
    type: Tweak
  - message: Radiation suit's hood now blocks identity.
    type: Fix
  id: 6983
  time: '2024-07-26T05:26:05.0000000+00:00'
  url: space-wizards/space-station-14#30305
- author: Moomoobeef
  changes:
  - message: Some radio channel colors have been tweaked in order to be more easily
      distinguishable.
    type: Tweak
  id: 6984
  time: '2024-07-26T06:47:20.0000000+00:00'
  url: space-wizards/space-station-14#30133
- author: Errant
  changes:
  - message: Replay ghosts now actually spawn on the proper station, take two.
    type: Fix
  id: 6985
  time: '2024-07-26T12:59:43.0000000+00:00'
  url: space-wizards/space-station-14#30273
- author: themias
  changes:
  - message: Arcade machines are functional again
    type: Fix
  id: 6986
  time: '2024-07-26T17:30:50.0000000+00:00'
  url: space-wizards/space-station-14#30376
- author: themias
  changes:
  - message: Zombies now get uncuffed upon transformation
    type: Fix
  id: 6987
  time: '2024-07-26T18:48:03.0000000+00:00'
  url: space-wizards/space-station-14#30321
- author: metalgearsloth
  changes:
  - message: Fix grid labels getting spammed from VGRoid.
    type: Fix
  id: 6988
  time: '2024-07-27T01:54:38.0000000+00:00'
  url: space-wizards/space-station-14#29946
- author: GoldenCan
  changes:
  - message: Added a Security Clown Mask which is obtainable by hacking a SecDrobe.
    type: Add
  id: 6989
  time: '2024-07-27T04:09:24.0000000+00:00'
  url: space-wizards/space-station-14#30249
- author: Plykiya
  changes:
  - message: Thief game rule now properly selects more than one thief.
    type: Fix
  id: 6990
  time: '2024-07-27T07:27:21.0000000+00:00'
  url: space-wizards/space-station-14#30393
- author: BombasterDS
  changes:
  - message: Added new plant mutations for apple, sugarcane and galaxythistle
    type: Add
  id: 6991
  time: '2024-07-27T15:08:49.0000000+00:00'
  url: space-wizards/space-station-14#28993
- author: Spessmann
  changes:
  - message: Thief objectives for figurines and stamps now require less items
    type: Tweak
  id: 6992
  time: '2024-07-27T23:11:27.0000000+00:00'
  url: space-wizards/space-station-14#30390
- author: metalgearsloth
  changes:
  - message: Moved VGRoid from 1,000m away to ~500m.
    type: Tweak
  id: 6993
  time: '2024-07-28T03:14:18.0000000+00:00'
  url: space-wizards/space-station-14#29943
- author: lzk228
  changes:
  - message: Fixed pancakes stacks. Before it, splitting not default pancakes stacks
      would give you default pancakes.
    type: Fix
  id: 6994
  time: '2024-07-28T03:49:06.0000000+00:00'
  url: space-wizards/space-station-14#30270
- author: Plykiya
  changes:
  - message: Fixed the client mispredicting people slipping with their magboots turned
      on
    type: Fix
  id: 6995
  time: '2024-07-28T06:17:06.0000000+00:00'
  url: space-wizards/space-station-14#30425
- author: Katzenminer
  changes:
  - message: Pun and similar pets are no longer firemune
    type: Fix
  id: 6996
  time: '2024-07-28T08:32:27.0000000+00:00'
  url: space-wizards/space-station-14#30424
- author: lzk228
  changes:
  - message: Fixed permanent absence of the approver string in cargo invoice.
    type: Fix
  id: 6997
  time: '2024-07-29T06:19:43.0000000+00:00'
  url: space-wizards/space-station-14#29690
- author: JIPDawg
  changes:
  - message: F9 is correctly bound to the Round End Summary window by default now.
    type: Fix
  id: 6998
  time: '2024-07-29T06:49:28.0000000+00:00'
  url: space-wizards/space-station-14#30438
- author: githubuser508
  changes:
  - message: Candles crate and the ability for Cargo to order it.
    type: Add
  id: 6999
  time: '2024-07-29T08:29:27.0000000+00:00'
  url: space-wizards/space-station-14#29736
- author: Blackern5000
  changes:
  - message: Emergency oxygen and fire lockers now generally contain more supplies
    type: Tweak
  id: 7000
  time: '2024-07-29T09:57:04.0000000+00:00'
  url: space-wizards/space-station-14#29230
- author: Moomoobeef
  changes:
  - message: Added the ability to wear lizard plushies on your head!
    type: Add
  id: 7001
  time: '2024-07-29T12:52:40.0000000+00:00'
  url: space-wizards/space-station-14#30400
- author: TurboTrackerss14
  changes:
  - message: Reduced Kobold ghostrole chance to mirror Monkey
    type: Tweak
  id: 7002
  time: '2024-07-29T15:16:54.0000000+00:00'
  url: space-wizards/space-station-14#30450
- author: Ian321
  changes:
  - message: The Courser now comes with a defibrillator.
    type: Tweak
  id: 7003
  time: '2024-07-30T01:05:27.0000000+00:00'
  url: space-wizards/space-station-14#30471
- author: slarticodefast
  changes:
  - message: Fixed puppy Ian not counting as a thief steal target.
    type: Fix
  id: 7004
  time: '2024-07-30T01:22:17.0000000+00:00'
  url: space-wizards/space-station-14#30474
- author: themias
  changes:
  - message: Added envelopes to the PTech and bureaucracy crate
    type: Add
  id: 7005
  time: '2024-07-30T01:49:05.0000000+00:00'
  url: space-wizards/space-station-14#30298
- author: TheKittehJesus
  changes:
  - message: The recipe for chow mein, egg-fried rice, and both brownies now use liquid
      egg instead of a whole egg.
    type: Tweak
  - message: Cake batter now also requires 5u of milk
    type: Tweak
  id: 7006
  time: '2024-07-30T02:14:11.0000000+00:00'
  url: space-wizards/space-station-14#30262
- author: Plykiya
  changes:
  - message: Wearing something that covers your head will prevent your hair from being
      cut.
    type: Add
  - message: You now see a popup when your hair is being altered.
    type: Add
  - message: The doafter for altering other people's hair now takes seven seconds.
    type: Tweak
  id: 7007
  time: '2024-07-30T02:17:28.0000000+00:00'
  url: space-wizards/space-station-14#30366
- author: Cojoke-dot
  changes:
  - message: Hamlet and other ghost rolls can now spin when they enter combat mode
    type: Fix
  id: 7008
  time: '2024-07-30T02:48:28.0000000+00:00'
  url: space-wizards/space-station-14#30478
- author: themias
  changes:
  - message: Fixed the ACC wire not appearing in vending machine wire layouts
    type: Fix
  id: 7009
  time: '2024-07-30T03:04:17.0000000+00:00'
  url: space-wizards/space-station-14#30453
- author: Blackern5000
  changes:
  - message: The defibrillator has been recolored slightly
    type: Tweak
  id: 7010
  time: '2024-07-30T04:41:21.0000000+00:00'
  url: space-wizards/space-station-14#29964
- author: themias
  changes:
  - message: Fixed victim's fingerprints transferring onto an attacker's weapon
    type: Fix
  id: 7011
  time: '2024-07-30T08:35:30.0000000+00:00'
  url: space-wizards/space-station-14#30257
- author: to4no_fix
  changes:
  - message: Now engineering access is needed to interact with the particle accelerator
    type: Tweak
  id: 7012
  time: '2024-07-30T11:29:32.0000000+00:00'
  url: space-wizards/space-station-14#30394
- author: Cojoke-dot
  changes:
  - message: You can no longer get out of a disposal chute or container while knocked
      over by trying to walk
    type: Fix
  id: 7013
  time: '2024-07-30T13:53:44.0000000+00:00'
  url: space-wizards/space-station-14#30391
- author: Cojoke-dot
  changes:
  - message: QSI now swaps the top most valid container instead of QSI when placed
      in an anchored container
    type: Fix
  id: 7014
  time: '2024-07-30T14:07:35.0000000+00:00'
  url: space-wizards/space-station-14#30241
- author: TheShuEd
  changes:
  - message: industrial ore processor can now process diamonds
    type: Fix
  id: 7015
  time: '2024-07-30T14:41:15.0000000+00:00'
  url: space-wizards/space-station-14#30499
- author: PJB3005
  changes:
  - message: CLF3 is now called "chlorine trifluoride"
    type: Tweak
  id: 7016
  time: '2024-07-31T00:14:23.0000000+00:00'
  url: space-wizards/space-station-14#30510
- author: slarticodefast
  changes:
  - message: Fixed the mouse position when it is over a singularity distortion effect
      while zoomed in or out.
    type: Fix
  id: 7017
  time: '2024-07-31T00:14:49.0000000+00:00'
  url: space-wizards/space-station-14#30509
- author: metalgearsloth
  changes:
  - message: Add a button to the lobby so you can export a .png of your characters
    type: Add
  id: 7018
  time: '2024-07-31T15:14:20.0000000+00:00'
  url: space-wizards/space-station-14#29874
- author: slarticodefast
  changes:
  - message: Skeletons no longer have fingerprints.
    type: Tweak
  id: 7019
  time: '2024-07-31T16:08:20.0000000+00:00'
  url: space-wizards/space-station-14#30530
- author: themias
  changes:
  - message: Pens can be clicked cathartically
    type: Tweak
  id: 7020
  time: '2024-07-31T17:57:41.0000000+00:00'
  url: space-wizards/space-station-14#30531
- author: Plykiya
  changes:
  - message: Meteors now leave behind asteroid rocks on impact.
    type: Add
  id: 7021
  time: '2024-08-01T02:55:02.0000000+00:00'
  url: space-wizards/space-station-14#30419
- author: PixelTheAertist
  changes:
  - message: The Social Anxiety trait is now renamed to "Stutter"
    type: Tweak
  id: 7022
  time: '2024-08-01T02:58:16.0000000+00:00'
  url: space-wizards/space-station-14#29898
- author: Plykiya
  changes:
  - message: Adds hand labelers to the PTech, ChemDrobe, and LawDrobe.
    type: Add
  id: 7023
  time: '2024-08-01T02:59:54.0000000+00:00'
  url: space-wizards/space-station-14#29958
- author: Ko4erga
  changes:
  - message: Added a cutter machine for crafting patterned steel tiles, concrete and
      wooden tiles.
    type: Add
  - message: After rip off patterned tiles you get current pattern, not just steel
      tile.
    type: Tweak
  id: 7024
  time: '2024-08-01T10:26:32.0000000+00:00'
  url: space-wizards/space-station-14#30431
- author: NakataRin
  changes:
  - message: Added paramedic to the train station.
    type: Add
  id: 7025
  time: '2024-08-01T19:59:43.0000000+00:00'
  url: space-wizards/space-station-14#30556
- author: marbow
  changes:
  - message: Rejoice, detectives! Hand labeler has been added to your closet!
    type: Add
  id: 7026
  time: '2024-08-01T20:01:05.0000000+00:00'
  url: space-wizards/space-station-14#30501
- author: metalgearsloth
  changes:
  - message: Fix some popups playing twice.
    type: Fix
  id: 7027
  time: '2024-08-02T01:33:20.0000000+00:00'
  url: space-wizards/space-station-14#30452
- author: WarMechanic
  changes:
  - message: Adjusted meteors to have less lethal blast fragments.
    type: Tweak
  id: 7028
  time: '2024-08-02T05:43:41.0000000+00:00'
  url: space-wizards/space-station-14#29199
- author: slarticodefast
  changes:
  - message: Fixed borgs not being able to state laws or open other UIs without an
      active module.
    type: Fix
  id: 7029
  time: '2024-08-02T05:44:59.0000000+00:00'
  url: space-wizards/space-station-14#30299
- author: TropicalHibi
  changes:
  - message: Now fs (for sure) and wru (where are you) are changed to their full version
      in text
    type: Add
  id: 7030
  time: '2024-08-02T05:57:50.0000000+00:00'
  url: space-wizards/space-station-14#30508
- author: Plykiya
  changes:
  - message: Rechargers now show the percent charged of the item it is charging.
    type: Add
  id: 7031
  time: '2024-08-02T06:05:38.0000000+00:00'
  url: space-wizards/space-station-14#28500
- author: ShadowCommander
  changes:
  - message: Rollerbeds now deploy when holding them in hand and clicking on the ground.
    type: Add
  id: 7032
  time: '2024-08-02T07:05:12.0000000+00:00'
  url: space-wizards/space-station-14#30000
```

</details>


**Проверки**
<!-- Выполнение всех следующих действий, если это приемлемо для вида
изменений сильно ускорит разбор вашего PR -->
- [x] PR полностью завершён и мне не нужна помощь чтобы его закончить.
- [x] Я внимательно просмотрел все свои изменения и багов в них не
нашёл.
- [x] Я запускал локальный сервер со своими изменениями и всё
протестировал.
- [x] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR
этого не требует.

**Изменения**

:cl: Шрёдька
- tweak: Подтянуты коммиты с Корвакса, 07.08.24
  • Loading branch information
Schrodinger71 authored Aug 7, 2024
2 parents dd11f33 + 37985f0 commit c297112
Show file tree
Hide file tree
Showing 967 changed files with 93,783 additions and 86,769 deletions.
6 changes: 5 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
- changed-files:
- any-glob-to-any-file: '**/*.xaml*'

"Changes: Shaders":
- changed-files:
- any-glob-to-any-file: '**/*.swsl'

"Changes: Localization":
- changed-files:
- any-glob-to-any-file: 'Resources/Locale/**/*.ftl'
- any-glob-to-any-file: '**/*.ftl'

"No C#":
- changed-files:
Expand Down
41 changes: 37 additions & 4 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public BwoinkControl()
var ach = AHelpHelper.EnsurePanel(a.SessionId);
var bch = AHelpHelper.EnsurePanel(b.SessionId);

// Pinned players first
if (a.IsPinned != b.IsPinned)
return a.IsPinned ? -1 : 1;

// First, sort by unread. Any chat with unread messages appears first. We just sort based on unread
// status, not number of unread messages, so that more recent unread messages take priority.
var aUnread = ach.Unread > 0;
Expand All @@ -99,15 +103,31 @@ public BwoinkControl()
if (a.Connected != b.Connected)
return a.Connected ? -1 : 1;

// Next, group by whether or not the players have participated in this round.
// The ahelp window shows all players that have connected since server restart, this groups them all towards the bottom.
if (a.ActiveThisRound != b.ActiveThisRound)
return a.ActiveThisRound ? -1 : 1;
// Sort connected players by New Player status, then by Antag status
if (a.Connected && b.Connected)
{
var aNewPlayer = a.OverallPlaytime <= TimeSpan.FromMinutes(_cfg.GetCVar(CCVars.NewPlayerThreshold));
var bNewPlayer = b.OverallPlaytime <= TimeSpan.FromMinutes(_cfg.GetCVar(CCVars.NewPlayerThreshold));

if (aNewPlayer != bNewPlayer)
return aNewPlayer ? -1 : 1;

if (a.Antag != b.Antag)
return a.Antag ? -1 : 1;
}

// Sort disconnected players by participation in the round
if (!a.Connected && !b.Connected)
{
if (a.ActiveThisRound != b.ActiveThisRound)
return a.ActiveThisRound ? -1 : 1;
}

// Finally, sort by the most recent message.
return bch.LastMessage.CompareTo(ach.LastMessage);
};


Bans.OnPressed += _ =>
{
if (_currentPlayer is not null)
Expand Down Expand Up @@ -253,7 +273,20 @@ private void SwitchToChannel(NetUserId? ch)

public void PopulateList()
{
// Maintain existing pin statuses
var pinnedPlayers = ChannelSelector.PlayerInfo.Where(p => p.IsPinned).ToDictionary(p => p.SessionId);

ChannelSelector.PopulateList();

// Restore pin statuses
foreach (var player in ChannelSelector.PlayerInfo)
{
if (pinnedPlayers.TryGetValue(player.SessionId, out var pinnedPlayer))
{
player.IsPinned = pinnedPlayer.IsPinned;
}
}

UpdateButtons();
}
}
Expand Down
6 changes: 5 additions & 1 deletion Content.Client/Administration/UI/Bwoink/BwoinkWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public BwoinkWindow()
}
};

OnOpen += () => Bwoink.PopulateList();
OnOpen += () =>
{
Bwoink.ChannelSelector.StopFiltering();
Bwoink.PopulateList();
};
}
}
}
236 changes: 124 additions & 112 deletions Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,154 +4,166 @@
using Content.Client.Verbs.UI;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Utility;

namespace Content.Client.Administration.UI.CustomControls
namespace Content.Client.Administration.UI.CustomControls;

[GenerateTypedNameReferences]
public sealed partial class PlayerListControl : BoxContainer
{
[GenerateTypedNameReferences]
public sealed partial class PlayerListControl : BoxContainer
{
private readonly AdminSystem _adminSystem;
private readonly AdminSystem _adminSystem;

private List<PlayerInfo> _playerList = new();
private readonly List<PlayerInfo> _sortedPlayerList = new();
private readonly IEntityManager _entManager;
private readonly IUserInterfaceManager _uiManager;

public event Action<PlayerInfo?>? OnSelectionChanged;
public IReadOnlyList<PlayerInfo> PlayerInfo => _playerList;
private PlayerInfo? _selectedPlayer;

public Func<PlayerInfo, string, string>? OverrideText;
public Comparison<PlayerInfo>? Comparison;
private List<PlayerInfo> _playerList = new();
private List<PlayerInfo> _sortedPlayerList = new();

private IEntityManager _entManager;
private IUserInterfaceManager _uiManager;
public Comparison<PlayerInfo>? Comparison;
public Func<PlayerInfo, string, string>? OverrideText;

private PlayerInfo? _selectedPlayer;
public PlayerListControl()
{
_entManager = IoCManager.Resolve<IEntityManager>();
_uiManager = IoCManager.Resolve<IUserInterfaceManager>();
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
// Fill the Option data
PlayerListContainer.ItemPressed += PlayerListItemPressed;
PlayerListContainer.ItemKeyBindDown += PlayerListItemKeyBindDown;
PlayerListContainer.GenerateItem += GenerateButton;
PlayerListContainer.NoItemSelected += PlayerListNoItemSelected;
PopulateList(_adminSystem.PlayerList);
FilterLineEdit.OnTextChanged += _ => FilterList();
_adminSystem.PlayerListChanged += PopulateList;
BackgroundPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) };
}

public PlayerListControl()
{
_entManager = IoCManager.Resolve<IEntityManager>();
_uiManager = IoCManager.Resolve<IUserInterfaceManager>();
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
// Fill the Option data
PlayerListContainer.ItemPressed += PlayerListItemPressed;
PlayerListContainer.ItemKeyBindDown += PlayerListItemKeyBindDown;
PlayerListContainer.GenerateItem += GenerateButton;
PlayerListContainer.NoItemSelected += PlayerListNoItemSelected;
PopulateList(_adminSystem.PlayerList);
FilterLineEdit.OnTextChanged += _ => FilterList();
_adminSystem.PlayerListChanged += PopulateList;
BackgroundPanel.PanelOverride = new StyleBoxFlat {BackgroundColor = new Color(32, 32, 40)};
}
public IReadOnlyList<PlayerInfo> PlayerInfo => _playerList;

private void PlayerListNoItemSelected()
{
_selectedPlayer = null;
OnSelectionChanged?.Invoke(null);
}
public event Action<PlayerInfo?>? OnSelectionChanged;

private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? data)
{
if (args == null || data is not PlayerListData {Info: var selectedPlayer})
return;
private void PlayerListNoItemSelected()
{
_selectedPlayer = null;
OnSelectionChanged?.Invoke(null);
}

if (selectedPlayer == _selectedPlayer)
return;
private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? data)
{
if (args == null || data is not PlayerListData { Info: var selectedPlayer })
return;

if (args.Event.Function != EngineKeyFunctions.UIClick)
return;
if (selectedPlayer == _selectedPlayer)
return;

OnSelectionChanged?.Invoke(selectedPlayer);
_selectedPlayer = selectedPlayer;
if (args.Event.Function != EngineKeyFunctions.UIClick)
return;

// update label text. Only required if there is some override (e.g. unread bwoink count).
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer);
}
OnSelectionChanged?.Invoke(selectedPlayer);
_selectedPlayer = selectedPlayer;

private void PlayerListItemKeyBindDown(GUIBoundKeyEventArgs? args, ListData? data)
{
if (args == null || data is not PlayerListData { Info: var selectedPlayer })
return;
// update label text. Only required if there is some override (e.g. unread bwoink count).
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer);
}

if (args.Function != EngineKeyFunctions.UIRightClick || selectedPlayer.NetEntity == null)
return;
private void PlayerListItemKeyBindDown(GUIBoundKeyEventArgs? args, ListData? data)
{
if (args == null || data is not PlayerListData { Info: var selectedPlayer })
return;

_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
args.Handle();
}
if (args.Function != EngineKeyFunctions.UIRightClick || selectedPlayer.NetEntity == null)
return;

_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
args.Handle();
}

public void StopFiltering()
{
FilterLineEdit.Text = string.Empty;
}

public void StopFiltering()
private void FilterList()
{
_sortedPlayerList.Clear();
foreach (var info in _playerList)
{
FilterLineEdit.Text = string.Empty;
var displayName = $"{info.CharacterName} ({info.Username})";
if (info.IdentityName != info.CharacterName)
displayName += $" [{info.IdentityName}]";
if (!string.IsNullOrEmpty(FilterLineEdit.Text)
&& !displayName.ToLowerInvariant().Contains(FilterLineEdit.Text.Trim().ToLowerInvariant()))
continue;
_sortedPlayerList.Add(info);
}

private void FilterList()
{
_sortedPlayerList.Clear();
foreach (var info in _playerList)
{
var displayName = $"{info.CharacterName} ({info.Username})";
if (info.IdentityName != info.CharacterName)
displayName += $" [{info.IdentityName}]";
if (!string.IsNullOrEmpty(FilterLineEdit.Text)
&& !displayName.ToLowerInvariant().Contains(FilterLineEdit.Text.Trim().ToLowerInvariant()))
continue;
_sortedPlayerList.Add(info);
}
if (Comparison != null)
_sortedPlayerList.Sort((a, b) => Comparison(a, b));

if (Comparison != null)
_sortedPlayerList.Sort((a, b) => Comparison(a, b));
PlayerListContainer.PopulateList(_sortedPlayerList.Select(info => new PlayerListData(info)).ToList());
if (_selectedPlayer != null)
PlayerListContainer.Select(new PlayerListData(_selectedPlayer));
}

PlayerListContainer.PopulateList(_sortedPlayerList.Select(info => new PlayerListData(info)).ToList());
if (_selectedPlayer != null)
PlayerListContainer.Select(new PlayerListData(_selectedPlayer));
}

public void PopulateList(IReadOnlyList<PlayerInfo>? players = null)
{
players ??= _adminSystem.PlayerList;
public void PopulateList(IReadOnlyList<PlayerInfo>? players = null)
{
// Maintain existing pin statuses
var pinnedPlayers = _playerList.Where(p => p.IsPinned).ToDictionary(p => p.SessionId);

_playerList = players.ToList();
if (_selectedPlayer != null && !_playerList.Contains(_selectedPlayer))
_selectedPlayer = null;
players ??= _adminSystem.PlayerList;

FilterList();
}
_playerList = players.ToList();

private string GetText(PlayerInfo info)
// Restore pin statuses
foreach (var player in _playerList)
{
var text = $"{info.CharacterName} ({info.Username})";
if (OverrideText != null)
text = OverrideText.Invoke(info, text);
return text;
if (pinnedPlayers.TryGetValue(player.SessionId, out var pinnedPlayer))
{
player.IsPinned = pinnedPlayer.IsPinned;
}
}

private void GenerateButton(ListData data, ListContainerButton button)
{
if (data is not PlayerListData { Info: var info })
return;
if (_selectedPlayer != null && !_playerList.Contains(_selectedPlayer))
_selectedPlayer = null;

button.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Children =
{
new Label
{
ClipText = true,
Text = GetText(info)
}
}
});

button.AddStyleClass(ListContainer.StyleClassListContainerButton);
}
FilterList();
}


private string GetText(PlayerInfo info)
{
var text = $"{info.CharacterName} ({info.Username})";
if (OverrideText != null)
text = OverrideText.Invoke(info, text);
return text;
}

public record PlayerListData(PlayerInfo Info) : ListData;
private void GenerateButton(ListData data, ListContainerButton button)
{
if (data is not PlayerListData { Info: var info })
return;

var entry = new PlayerListEntry();
entry.Setup(info, OverrideText);
entry.OnPinStatusChanged += _ =>
{
FilterList();
};

button.AddChild(entry);
button.AddStyleClass(ListContainer.StyleClassListContainerButton);
}
}

public record PlayerListData(PlayerInfo Info) : ListData;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Horizontal" HorizontalExpand="true">
<Label Name="PlayerEntryLabel" Text="" ClipText="True" HorizontalExpand="True" />
<TextureButton Name="PlayerEntryPinButton"
HorizontalAlignment="Right" />
</BoxContainer>
Loading

0 comments on commit c297112

Please sign in to comment.