Files
ss14-wl/Content.Server/Connection/ConnectionManager.cs
mosleyos 049ba95a0d Upstream sync (#65)
* or was it

* S: Awaiting Changes

* Temporarily make singularity a bit harder to loose as non-antag

* Fix Fluent string ID copypaste fail

* Fix the component defaults

* Changes + Cleanup

* Reduced cost of coloured light fixtures

* Bump the failsafe timer down

* Increase softcap back to 80 (#33400)

* Toggle clothing fix (#32826)

* toggle clothing fix

* some adding

* Automatic changelog update

* .NET 9 forward compatibility changes (#33421)

This doesn't switch the projects over to .NET 9, but it does make them work on .NET 9 when we decide to switch in the future.

* Fix security riot crate (#33415)

* move riot crate from security to armory category

* Move riot crate to armory, actually make it require armory access to unlock

* Localize planet dataset names (#33398)

* Localize planet names (borer)

* DatasetPrototype -> LocalizedDatasetPrototype

* Apply requested changes

* Automatic changelog update

* Remove drag & drop dropping items from containers (#32706)

* Initial commit

* Update based on maintainer discussion

* Forgot to remove this woops

* Automatic changelog update

* Automatically add "Approved" to maintainer PRs (#33337)

* Add an Approved labeler for maintainer PRs

* Be extra safe with conditions

* Crew monitoring crate updated to contain flatpacks, science access instead of engi (#33417)

* Make a crew monitoring crate with flatpacks

* fix image

* migration

* Automatic changelog update

* Add emag functionality

* Move some of the new singularity code into shared

Hopefully without explosions yay

* Fix toggle verbs (#32138)

First commit

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Construction menu grid view (#32577)

* button

* implement populate grid view

* tweak min width

* Make grid button toggle visible

* tweak min window size

* fix missing recipe button when mirroring item

* make grid buttons toggleable

* align button texture vertically

* selected grid item has plain color background

* tweak window width so all buttons look good

* rename select method, defer colouring

* get icon better

* whoops

* simpler button toggle

* spritesys frame0, move spritesys

* delete old sprite system refs

* Automatic changelog update

* Automatic changelog update

* Automatic changelog update

* Actually make the emagging popup work properly

* Move PlayerBeforeSpawnEvent and PlayerSpawnCompleteEvent to Shared

* Fix imports

* Automatic changelog update

* Automatic changelog update

* Automatic changelog update

* Set airlock unlit layers as invisible (#32484)

Doesn't really affect anything due to appearance bulldozing this but this aligns with their actual normal states so.

* Update salvage.yml

* Update cargo_vending.yml

* Update salvage.yml

* Update salvage.yml

* Update to Robust v237.2.0

* Syndicate item fix ups (#33435)

tweaks and fixes

* Coal presents and chrimmas tree options. Presents no longer itemify (#33147)

* Dont ensure ItemComp because it could lead to weirds, and also PickupOrDrop handles non-items already.

* presents and tree

* woops

* reviews a

* Automatic changelog update

* Fix approval labeler (#33440)

* Fix approval labeler

* Update labeler-review.yml

* Update labeler-review.yml

* electrification hud

* Fix admin ghosts not being able to see items in pockets or interact with them (#31076)

* Fix admin ghosts not being able to see items in pouches or interact with them

* fix

* oops

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Automatic changelog update

* Gas pipe sensors (#33128)

* Initial commit

* Monitored pipe node is now referenced by name

* Review changes

* Simplified construction

* Tweaked deconstruction to match other binary atmos devices

* Helper function removal

* Updated attribution

* Automatic changelog update

* Add telegram to the server info-links (#33459)

* Fix sandbox error with new HWID code. (#33461)

Oops

* cleanup

* rename

* another rename

* baby proof the terminal (#33281)

* baby proof the terminal

* Make a couple exceptions for items that you might take with you.

* alwayspoweredlights

* Uncuttable cables since cablecomp is a snowflake construction system

* chairs and vendors

* rerun heisentests

* rerun tests again

* Automatic changelog update

* Automatic changelog update

* Automatic changelog update

* Disable submit admin note button on switch to note (#33456)

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>

* Automatic changelog update

* Fix startingGear storage (#33394)

* fix starting gear storage

* removal of unused

---------

Co-authored-by: MetalSage <metalsage.official@gmail.com>

* Minor improvements & fixes to Shuttle Console UI (#31623)

* Fix grids and docks being culled from display prematurely

* Fix inconsistent disabling of "Undock" buttons

* Add a radar icon to indicate where the controlling console is

* Tidy up math

Remove lots of sketchy transforms-of-transforms, which should have been
as single matrix multiply. Assign proper names to matrices. Remove some
redundant calculations.

* Feedback

* Fix door animations mispredicting if closing is interrupted (#33481)

* Fix door animations mispredicting if closing is interrupted

On master it will flicker states a little bit partially due to it not being predicted.

Instead we'll just set it straight back to opening (no animation is ever played anyway).

* no log

* Automatic changelog update

* Don't show drag-drop outline if climbing (#33477)

It won't actually do anything.

* Automatic changelog update

* Ensure wires can always be cut (#32447)

ensure wires are always cut

* Automatic changelog update

* babyproof arrivals shuttle (#33284)

* babyproof arrivals shuttle

* always powered lights

* uncuttable cables from terminal PR.

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Automatic changelog update

* Add delay to AutoOrient (#33479)

It functions identically to how V1 of orientation worked and it's incredibly annoying.

* Automatic changelog update

* Update Credits (#33503)

Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>

* Draw muzzle flash below mobs (#33465)

* Draw muzzle flash below mobs

* Better naming

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>

* Automatic changelog update

* Allow shuttles on planets to make FTL jump (#33507)

This check conflicts with an attempt to FTL from the planet before expedition ends

* Automatic changelog update

* fix exped caves generation (#32890)

Co-authored-by: deltanedas <@deltanedas:kde.org>

* Automatic changelog update

* various material & ore inhands (#33342)

* begin

* bones + pyrotten + goliath hide inhands

* Update Resources/Prototypes/Entities/Objects/Materials/materials.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Textures/Objects/Materials/materials.rsi/meta.json

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Textures/Objects/Materials/materials.rsi/meta.json

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Textures/Objects/Materials/materials.rsi/meta.json

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* pyrottOn

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Delete HOS headset from warden's locker (#33234)

* add headset

* Add icons

* Meta change

* fix

* Revert + delete headset from locker

* RCD icons resprite (#2800)

* fix airlocks inconsistently auto-closing after unbolting (#33524)

fix door auto close timer

* Automatic changelog update

* baby proof the terminal (#33281)

* baby proof the terminal

* Make a couple exceptions for items that you might take with you.

* alwayspoweredlights

* Uncuttable cables since cablecomp is a snowflake construction system

* chairs and vendors

* rerun heisentests

* rerun tests again

* babyproof arrivals shuttle (#33284)

* babyproof arrivals shuttle

* always powered lights

* uncuttable cables from terminal PR.

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* [BUGFIX] "Ghost" in the lobby lets you see the whole chat (#33529)

* fix bug, in ghost command lobby

* fix

* Fix build

* Automatic changelog update

* removed obsolete netmessage creator (#33542)

removed opsolete netmessage createor

* Fix RA0003 warning for ChatBox (#33531)

* Shark plushies now goes rawr on hit. (#33540)

Shark goes rawr more

* Automatic changelog update

* Turn off PointLights on VendingMachines when broken or off. (#33513)

The light itself should already turn off due to `LitOnPowered`
component, but the broken state of a VendingMachine did not.

Fixes  #33382

* Automatic changelog update

* Adds more diona names (#33066)

* adds more diona names

* more stuff

* AHHHHHHHHHHHHHHHHHHHHHHH

* further additions

* removes depression + adds comment

* fixes + remove some weird stuff + more stuff

* remove haste

* minor AI cleanup (#33555)

* minor cleanup

* to

* Simplify separated screen top menu (#33047)

* Automatic changelog update

* [Maps] Maus Winter Update (#2803)

* [MAPS] Paper tweak (#2804)

* Automatic changelog update

* Ghost role drop-down alignment (#33397)

* dropdown shares margin width with children

* removed dependency that rider added for some reason

* reduced vertical margin from 8 to 2

* Greytide Virus station event (#33547)

* proof of concept

* full implementation

* I commited a crime

* t

* min players increase

* Make shuttle airlocks not snapcardinals (#33557)

* Make shuttle airlocks not snapcardinals

* Update Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Automatic changelog update

* [MAPS] Avrite winter (#2806)

* Added two N2 lockers to Reach (#33409)

Co-authored-by: dylanstrategie <188926747+dylanstrategie@users.noreply.github.com~>

* Hotfix the randomly occurring DeleteAllThenGhost test failures (#33582)

* clear mindrole on component shutdown

* let it go

* Fix space ambient music (#33594)

* Automatic changelog update

* Fix windoor and high security door not showing electrocution HUD (#33551)

* Automatic changelog update

* [Maps] Awesome new god update (#2811)

* [Maps] Avrite minor change (#2810)

* Automatic changelog update

* Removes burnt tiles (#33422)

remove burnt tiles

* Parallax pack 2 (#2813)

* Added Oppenhopper poster to the game. (#33588)

* o7

* -

* oppenhopper v2

* Update Resources/Prototypes/Entities/Structures/Wallmounts/Signs/posters.yml

* Update Resources/Prototypes/Entities/Structures/Wallmounts/Signs/posters.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Fix version for electril_grill meta.json (#33611)

fix

fixing the version thing in meta json for electril grill textures

Co-authored-by: Arthur Kustenko <arthur.kustenko@learnet.se>

* Fix gauze eyepatch flying pixel (#33564)

boo

* Fix swapped uniform printer east/west sprites (#33442)

Fix uniform printer sprites rotating the wrong way

* Makes knives fly straight when thrown (#33615)

Gives knives a thrown angle

* Light verb is now predicted (#33622)

Fix

* Automatic changelog update

* Update `Content.PatreonParser` to use `net8.0` `TargetFramework` (#33559)

Update Content.PatreonParse to use net8.0 targetframework

* Approval labeler fix electric boogaloo (#33633)

Nik told me to not name this "nya"

* Fix gender, maybe (#33631)

Co-authored-by: Alpha-Two <alpha2.5232@gmail.com>

* Display GPS coordinates on their own line (#33625)

* Automatic changelog update

* Remove grasshopper from the panic bunker message (#33638)

Can be retargetted to stable if preferred, which will then be a hotfix

* Add admin log for ghost warping (#33636)

* Automatic changelog update

* Rename nitrogen internals crate (#33545)

* rename nitrogen internals crate

* nitrogen internals crate description

* migrate CrateNitrogenInternals ID

* Automatic changelog update

* Cleanup some Client atmos systems (#33634)

* Cleanup `ScrubberControl.xaml.cs`

* Minor cleanups

* Another pile of minor cleanups

* Apply requested changes

* Rename "which" into "bound". Add whitespace after "if"

* Fix for arrivals deleting nuke (#33659)

Adds FTLSmashImmune to nuke prototype to stop it from arrival smashing
Adds a comment in FasterThanLight to indicate where the FTLSmashImmuneComponent is checked

Co-authored-by: aa5g21 <aa5g21@soton.ac.uk>

* Automatic changelog update

* add locale to Shuttle Console Map tab (#33651)

fixed

* Automatic changelog update

* fix PermanentBlindnessComponent to be not so permanent (#33292)

* adjust min blindness back to 0 when PermanentBlindnessComponent is removed

* mapinit changes

* remove OnRemove, move changes to OnShutdown

* goodbye event

* dependency removal

* final adjustment

---------

Co-authored-by: lunarcomets <luanrcomets2@gmail,com>

* Cog/Marathon: Airlock fixes (#33621)

* Fixes the TEG airlock on marathon

* Fixes the atmos external airlock on cog

* Automatic changelog update

* Revert "Rebalancing zombie mode chances" (#2818)

* Automatic changelog update

* [Maps] Silly Winter Update (#2809)

* [Maps] Pilgrim update #7 — Winter (#2821)

* Fix for handcuffing someone more than once (#33646)

* Fix for over-cuffing someone

* comment

* Automatic changelog update

* Fix for inspecting entities in hand (#33642)

Actually inspect entity in hands

* Automatic changelog update

* Fix for inspecting entities in the stripping window (#33644)

Handle it

* Automatic changelog update

* Fix borgs not getting names on roundstart (#33578)

* Fix borgs not getting names on roundstart

* Glory to the NT

* Allow riggable to take in multiple reagents

* Revert

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>

* Automatic changelog update

* Require Wield To Activate Double-bladed ESword (#32869)

* Add MeleeRequiresWield component

* Prevent world activation

* Automatic changelog update

* Fix makeghostroleraffle command where 4 arguments (#31836)

Fix makeghostroleraffle command with 4 arguments

* Automatic changelog update

* Update Credits (#33670)

Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>

* Fix formatting IDE0055 warnings in VS Code (#33669)

* Replace obsolete GetTilesIntersecting methods (#32455)

* Remove usage of obsolete GetTilesIntersecting round 1

* Oop wrong uids

* Remove usage of obsolete GetLocalTilesIntersecting round 2

* Remove usage of obsolete GetLocalTilesIntersecting final round

* weh

* Fix using `SharedMapSystem` in `StencilOverlay`

* delta winter (#2824)

* Update Snowasis (#33364)

* Update Snowasis

* Appease test gods

* Woops had the leftward animation backwards. Fixed.

* add santa suits and envelopes to chapel

* It looks worse unscaled but whatever.

* fix ghost role

* examines

* Automatic changelog update

* [MAPS] Paper Cristmass update (#2822)

* Fix wrong system usage (#33679)

Fix wrong system using

* resprite new year nuke (#2825)

* Fix BuckleSystem always marking InteractHandEvent as Handled (#33602)

* Add check before marking event as handled

* Update Content.Shared/Buckle/SharedBuckleSystem.Interaction.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Cleanup

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Automatic changelog update

* Touching up Bagel Security Brig (#33680)

* Touching up Bagel Security Brig

* Added a few missing door names

* Last door name I promise

* Address feedback

* Forgot to delete old shutter button

---------

Co-authored-by: dylanstrategie <188926747+dylanstrategie@users.noreply.github.com~>

* [Maps] Tushkan update #3 — Winter (#2826)

* Map pool tweak (#2827)

* Fixed ghost role rules for some syndicate familiars (#32457)

* fix ghost role rules for some syndicate familiars

* change from monkey rules to Team Antag rules.

* Resolve reviews + Fix rules for LoneOp and Xenos

* ghostrole rules

---------

Co-authored-by: JIPDawg <JIPDawg93@gmail.com>
Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>

* Automatic changelog update

* Fix lobby countdown not showing hours (#33685)

* New Low-Mid Pop Station - Amber Station  (#33441)

* Initial Commit with two departments done

* Checkpointing work

* Added most of service and science

* Started work on medbay

* Modified TEG setup and set up atmos pipes for engineering

* Re-added medbay, added chapel and janitorial, started routing disposals and generally the final layout of the map is coming together

* Plenty of additions, too many to list in a commit message

* Major update

* Nearly done with the map, just have to do decals and emergency lights

* Added all decals, only thing missing is department signs

* Toned back the dirt decals a bunch, added hallway signs and other decorations

* Finishing touches on the map before testing.

* Fixed invalids

* Renamed the station to Amber, and made a couple adjustments

* Completely redid cargo, added maints around sec

* Added Amber to the map post init integration test

* Many small updates addressing issues.

* Ran a script to update all the camera names, also ran fixgridatmos, fixrotations, tilewalls, and variantize

* Started addressing some of the issues brough up by Emisse and others

* Addressed all issues mentioned by reviewers. Added mail system.

* Wrapped up meeting all the issues raised by reviewers, also did a bunch of testing and resolved issues found during those tests

* Addressed additional requested changes, and nabbed some ship designs from Frontier. Redesigned south east maints and surrounding meteor nets based off of those designs

* Making a couple more requested changes

* Reduced the amount of Nitrogen Closets, made several small adjustments. Ready for review again!

* Removed invalids!

* web edit lmao

---------

Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>

* Automatic changelog update

* Makes kukri not use combat knife's storage sprite (#33661)

* Adds a morgue locked maints airlock (#33693)

Co-authored-by: Velcroboy <velcroboy333@hotmail.com>

* Juiceable slimeballs (#33660)

adds extractable component to slimeball prototype

* Add missing nacho recipes (#33637)

* Nacho recipes, nutrition, and trash

In meal_recipes.yml: Add recipes for Nachos, Cheesy Nachos, and Cuban Nachos.

In meals.yml: Add a solutions container to regular nachos so it lines up with the others, and add a small plate as trash to each one.

* Volumes, nutritional tweaks, and flavor

In meals.yml: Lowered maxVol on nachos to leave 5 units of space. Nachos nutriment and vitamin lowered for costing so little. A cheese wedge is 3.75 nutriment, so cheesy having 4 more total nutritional value lines up nicely to me.

Cuban nachos had too little volume to fit its reagents in the first place, so increased maxVol by 10. Chili peppers are 4 nutri / 4 vitamin and ketchup has a touch of tomato, so bumped to 8 and 5. Capsaicin lowered partly to make it an even 20u. Ketchup dilutes I guess. Also they don't have cheese so I changed the flavor profile to tomato instead.

In meal_recipes.yml: Cuban Nachos recipe tweaked to require one less pepper. Given above numbers, this fits the nutritional value imo.

* Automatic changelog update

* Amber Station Seasonal Update (#33698)

Made some modifications requested by reviewers prior to and after map merge, also added holiday decorations!

* [Maps] Pilgrim update #8 & Silly tweak (#2828)

* Amber Improvements (#33707)

* Various changes (see PR)

* variantized, fixedgridatmos, tiledwalls

* Fix sinks and toilets not draining (#33691)

* Fix AutoDrain

Per the system comments, AutoDrain is designed to automatically move
puddles into the drain (like a floor drain). Drains without AutoDrain
are still supposed to gradually empty the buffer, but not remove puddles
(like sinks and toilets).

However, a logic error in the original implementation causes drains with
AutoDrain set to false to simply not work. Hence sinks never emptied.

* Update documentation

* Automatic changelog update

* Fix layout on wires UI (#33714)

Layout would break for machines with >6 lights because the column count was hardcoded. Uncap the UI width and fix the rows count instead.

Lights with less than 4 characters of text weren't aligned right, now they are.

* Automatic changelog update

* Fix for towels not having a cooldown for cleaning (#33700)

Added a delay to cleaning with the towel

* Add cooldown to buttons in borg's laws UI (#31490)

* Adds Store on Collide and Wand of the Locker (#33710)

* Adds wand of locker and locker projectile

* Adds IsOpen method to check if storage is open

* Adds store on collide

* Adds Store On Collide to Wizard Locker

* Adds Lock API

* Adds locking support

* Adds resist override and custom visual layers

* Fixes decursed states, adds comment for a future visualizer

* adds locker wand visuals and descriptions

* shrinks locker radius, moves TODO for throw support

* Adds whitelist and moves storage and lock logic into their own methods

* Adds support to disable store on collide after the first open. Fixes prediction issues with disabling.

* Adds wand of locker to the grimoire

* Adds wizard access prototype

* Adds Wizard to universal access

* Moves Lock on collide to on collide method

* Comments

* Changes layer order

* Fixes prediction issues when locking.

* Adds Wiz access to universal ID

* Automatic changelog update

* Update locale

* Fix upstream

* update server configs (#2799)

* Fix displacements map for female vulp and reptilian (#2832)

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>

* Translate Upstream #2748 (#2837)

Co-authored-by: lapatison <100279397+lapatison@users.noreply.github.com>

* Перевод Upstream #2830  (#2836)

Co-authored-by: lapatison <lapatisonsocial@gmail.com>
Co-authored-by: NotSoDamn <75203942+NotSoDana@users.noreply.github.com>
Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Co-authored-by: cfif126 <94059374+cfif126@users.noreply.github.com>

* translate borer names (#2835)

* [Localize] Poster 52 (#2840)

* Translate new diona names (#2839)

Co-authored-by: lapatison <100279397+lapatison@users.noreply.github.com>

* [Resprite] Medical uniforms & rollerbeds (#2802)

* Automatic changelog update

* Revert "new year lobbyscreens removed" (#2831)

* Surgeon spawnpoint (#2841)

Added to support map in corvax next
Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>

* fix nukedisk chances (#2745)

* Adds surgeon spawnpoint on maps  (#2845)

* Winter stuff tweak (#2833)

* [MAPS] Silly Christmass Date  (#2854)

* [MAPS] Paper Christmass Date (#2853)

* [MAPS] Avrite New Year update (#2852)

* [Maps] Tushkan new year update (#2851)

* [Maps] Pilgrim new year update (#2850)

* [Maps] Maus new year update (#2849)

* [Maps] Awesome new year update (#2848)

* [Maps] Outpost return (#2847)

Co-authored-by: kvant8 <ar4477023rr.@gmail.com>
Co-authored-by: Ko4ergaPunk <62609550+Ko4ergaPunk@users.noreply.github.com>

* [Maps] Astra new year update (#2844)

* Update corvax_delta.yml (#2856)

* [Maps] Pilgrim hotfix #2 (#2860)

* Resprite botany food (#2858)

* Fix spacelaw loadout (#2861)

* Make Jolene TTS voice female (#2834)

* Update configs (#2855)

* New Year Music (#2829)

* Revert "Удаление лимита времени для доступа к стартовым ролям." (#2652)

* Automatic changelog update

* Automatic changelog update

* [Maps] Glacier new year update (#2864)

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Co-authored-by: Saphire <lattice@saphi.re>
Co-authored-by: Justice League <the.justice.league.of.canada@gmail.com>
Co-authored-by: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
Co-authored-by: ArZarLordOfMango <96249677+ArZarLordOfMango@users.noreply.github.com>
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com>
Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>
Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: beck-thompson <107373427+beck-thompson@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: qwerltaz <69696513+qwerltaz@users.noreply.github.com>
Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
Co-authored-by: MissKay1994 <15877268+MissKay1994@users.noreply.github.com>
Co-authored-by: ThatGuyUSA <thatguyusa123@gmail.com>
Co-authored-by: IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
Co-authored-by: Vasilis <vasilis@pikachu.systems>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
Co-authored-by: c4llv07e <igor@c4llv07e.xyz>
Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
Co-authored-by: MetalSage <74924875+MetalSage@users.noreply.github.com>
Co-authored-by: MetalSage <metalsage.official@gmail.com>
Co-authored-by: eoineoineoin <github@eoinrul.es>
Co-authored-by: goet <6637097+goet@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: mubururu_ <139181059+muburu@users.noreply.github.com>
Co-authored-by: kosticia <kosticia46@gmail.com>
Co-authored-by: SonicHDC <100022571+SonicHDC@users.noreply.github.com>
Co-authored-by: Schrödinger <132720404+Schrodinger71@users.noreply.github.com>
Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>
Co-authored-by: Ben <benjaminevanownby@gmail.com>
Co-authored-by: Nikolai Korolev <CrafterKolyan@mail.ru>
Co-authored-by: Minemoder5000 <minemoder50000@gmail.com>
Co-authored-by: Niels Huylebroeck <red15@users.noreply.github.com>
Co-authored-by: Flareguy <78941145+Flareguy@users.noreply.github.com>
Co-authored-by: Meguneri <163569304+Meguneri@users.noreply.github.com>
Co-authored-by: TiFeRi <57865696+XsenonDash@users.noreply.github.com>
Co-authored-by: IanComradeBot <96892333+IanComradeBot@users.noreply.github.com>
Co-authored-by: Intoxicating-Innocence <188202277+Intoxicating-Innocence@users.noreply.github.com>
Co-authored-by: CaptainMaru <124701378+CaptainMaru@users.noreply.github.com>
Co-authored-by: dylanstrategie <188926747+dylanstrategie@users.noreply.github.com>
Co-authored-by: dylanstrategie <188926747+dylanstrategie@users.noreply.github.com~>
Co-authored-by: Stubaretka24 <143966631+Stubaretka24@users.noreply.github.com>
Co-authored-by: AlexUm <159550239+AlexUm418@users.noreply.github.com>
Co-authored-by: Arthur Kustenko <arthur.kustenko@learnet.se>
Co-authored-by: Mifia <xzx._@outlook.com>
Co-authored-by: SpaceManiac <tad@platymuus.com>
Co-authored-by: SpaceRox1244 <138547931+SpaceRox1244@users.noreply.github.com>
Co-authored-by: Alpha-Two <92269094+Alpha-Two@users.noreply.github.com>
Co-authored-by: Alpha-Two <alpha2.5232@gmail.com>
Co-authored-by: Alice "Arimah" Heurlin <30327355+arimah@users.noreply.github.com>
Co-authored-by: MossyGreySlope <mossygreyslope@gmail.com>
Co-authored-by: Gansu <68031780+GansuLalan@users.noreply.github.com>
Co-authored-by: aa5g21 <aa5g21@soton.ac.uk>
Co-authored-by: VideoKompany <135313844+VlaDOS1408@users.noreply.github.com>
Co-authored-by: lunarcomets <140772713+lunarcomets@users.noreply.github.com>
Co-authored-by: lunarcomets <luanrcomets2@gmail,com>
Co-authored-by: compilatron <40789662+jbox144@users.noreply.github.com>
Co-authored-by: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com>
Co-authored-by: Doctorjakes <122163951+Doctorjakes@users.noreply.github.com>
Co-authored-by: Ko4ergaPunk <62609550+Ko4ergaPunk@users.noreply.github.com>
Co-authored-by: Preston Smith <92108534+thetolbean@users.noreply.github.com>
Co-authored-by: Token <56667933+TokenStyle@users.noreply.github.com>
Co-authored-by: Nikolai Korolev <korolevns98@gmail.com>
Co-authored-by: Bloodcanis <113198922+Bloodcanis@users.noreply.github.com>
Co-authored-by: JIPDawg <51352440+JIPDawg@users.noreply.github.com>
Co-authored-by: JIPDawg <JIPDawg93@gmail.com>
Co-authored-by: Southbridge <7013162+southbridge-fur@users.noreply.github.com>
Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>
Co-authored-by: Velcroboy <107660393+IamVelcroboy@users.noreply.github.com>
Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
Co-authored-by: Luiz Costa <33888056+luizwritescode@users.noreply.github.com>
Co-authored-by: CheddaCheez <cheddacheezy@gmail.com>
Co-authored-by: Partmedia <kevinz5000@gmail.com>
Co-authored-by: Tap <tapiocaphobe@gmail.com>
Co-authored-by: Hreno <hrenor@gmail.com>
Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com>
Co-authored-by: Morb0 <14136326+Morb0@users.noreply.github.com>
Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Co-authored-by: Litogin <139079015+Litogin@users.noreply.github.com>
Co-authored-by: lapatison <100279397+lapatison@users.noreply.github.com>
Co-authored-by: lapatison <lapatisonsocial@gmail.com>
Co-authored-by: NotSoDamn <75203942+NotSoDana@users.noreply.github.com>
Co-authored-by: cfif126 <94059374+cfif126@users.noreply.github.com>
Co-authored-by: MureixloI <132683811+MureixloI@users.noreply.github.com>
Co-authored-by: kvant8 <163752943+kvant8@users.noreply.github.com>
Co-authored-by: kvant8 <ar4477023rr.@gmail.com>
Co-authored-by: lastPechkin <mevlyutov1958@gmail.com>
Co-authored-by: AwareFoxy <135021509+AwareFoxy@users.noreply.github.com>
2024-12-17 22:37:21 +03:00

445 lines
19 KiB
C#

using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using Content.Corvax.Interfaces.Server;
using Content.Corvax.Interfaces.Shared;
using Content.Server.Chat.Managers;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Server.Preferences.Managers;
using Content.Shared.CCVar;
using Content.Shared.Corvax.CCCVars;
using Content.Shared.GameTicking;
using Content.Shared.Players.PlayTimeTracking;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Player;
using Robust.Shared.Timing;
/*
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
*/
namespace Content.Server.Connection
{
public interface IConnectionManager
{
void Initialize();
void PostInit();
Task<bool> HavePrivilegedJoin(NetUserId userId); // Corvax-Queue
/// <summary>
/// Temporarily allow a user to bypass regular connection requirements.
/// </summary>
/// <remarks>
/// The specified user will be allowed to bypass regular player cap,
/// whitelist and panic bunker restrictions for <paramref name="duration"/>.
/// Bans are not bypassed.
/// </remarks>
/// <param name="user">The user to give a temporary bypass.</param>
/// <param name="duration">How long the bypass should last for.</param>
void AddTemporaryConnectBypass(NetUserId user, TimeSpan duration);
}
/// <summary>
/// Handles various duties like guest username assignment, bans, connection logs, etc...
/// </summary>
public sealed partial class ConnectionManager : IConnectionManager
{
[Dependency] private readonly IPlayerManager _plyMgr = default!;
[Dependency] private readonly IServerNetManager _netMgr = default!;
[Dependency] private readonly IServerDbManager _db = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ServerDbEntryManager _serverDbEntry = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
private ISharedSponsorsManager? _sponsorsMgr; // Corvax-Sponsors
private IServerVPNGuardManager? _vpnGuardMgr; // Corvax-VPNGuard
private ISawmill _sawmill = default!;
private readonly Dictionary<NetUserId, TimeSpan> _temporaryBypasses = [];
public void Initialize()
{
_sawmill = _logManager.GetSawmill("connections");
IoCManager.Instance!.TryResolveType(out _sponsorsMgr); // Corvax-Sponsors
_netMgr.Connecting += NetMgrOnConnecting;
_netMgr.AssignUserIdCallback = AssignUserIdCallback;
_plyMgr.PlayerStatusChanged += PlayerStatusChanged;
// Approval-based IP bans disabled because they don't play well with Happy Eyeballs.
// _netMgr.HandleApprovalCallback = HandleApproval;
}
public void AddTemporaryConnectBypass(NetUserId user, TimeSpan duration)
{
ref var time = ref CollectionsMarshal.GetValueRefOrAddDefault(_temporaryBypasses, user, out _);
var newTime = _gameTiming.RealTime + duration;
// Make sure we only update the time if we wouldn't shrink it.
if (newTime > time)
time = newTime;
}
/*
private async Task<NetApproval> HandleApproval(NetApprovalEventArgs eventArgs)
{
var ban = await _db.GetServerBanByIpAsync(eventArgs.Connection.RemoteEndPoint.Address);
if (ban != null)
{
var expires = Loc.GetString("ban-banned-permanent");
if (ban.ExpirationTime is { } expireTime)
{
var duration = expireTime - ban.BanTime;
var utc = expireTime.ToUniversalTime();
expires = Loc.GetString("ban-expires", ("duration", duration.TotalMinutes.ToString("N0")), ("time", utc.ToString("f")));
}
var reason = Loc.GetString("ban-banned-1") + "\n" + Loc.GetString("ban-banned-2", ("reason", this.Reason)) + "\n" + expires;;
return NetApproval.Deny(reason);
}
return NetApproval.Allow();
}
*/
private async Task NetMgrOnConnecting(NetConnectingArgs e)
{
var deny = await ShouldDeny(e);
var addr = e.IP.Address;
var userId = e.UserId;
var serverId = (await _serverDbEntry.ServerEntity).Id;
var hwid = e.UserData.GetModernHwid();
var trust = e.UserData.Trust;
if (deny != null)
{
var (reason, msg, banHits) = deny.Value;
var id = await _db.AddConnectionLogAsync(userId, e.UserName, addr, hwid, trust, reason, serverId);
if (banHits is { Count: > 0 })
await _db.AddServerBanHitsAsync(id, banHits);
var properties = new Dictionary<string, object>();
if (reason == ConnectionDenyReason.Full)
properties["delay"] = _cfg.GetCVar(CCVars.GameServerFullReconnectDelay);
e.Deny(new NetDenyReason(msg, properties));
}
else
{
await _db.AddConnectionLogAsync(userId, e.UserName, addr, hwid, trust, null, serverId);
if (!ServerPreferencesManager.ShouldStorePrefs(e.AuthType))
return;
await _db.UpdatePlayerRecordAsync(userId, e.UserName, addr, hwid);
}
}
private async void PlayerStatusChanged(object? sender, SessionStatusEventArgs args)
{
if (args.NewStatus == SessionStatus.Connected)
{
AdminAlertIfSharedConnection(args.Session);
}
}
private void AdminAlertIfSharedConnection(ICommonSession newSession)
{
var playerThreshold = _cfg.GetCVar(CCVars.AdminAlertMinPlayersSharingConnection);
if (playerThreshold < 0)
return;
var addr = newSession.Channel.RemoteEndPoint.Address;
var otherConnectionsFromAddress = _plyMgr.Sessions.Where(session =>
session.Status is SessionStatus.Connected or SessionStatus.InGame
&& session.Channel.RemoteEndPoint.Address.Equals(addr)
&& session.UserId != newSession.UserId)
.ToList();
var otherConnectionCount = otherConnectionsFromAddress.Count;
if (otherConnectionCount + 1 < playerThreshold) // Add one for the total, not just others, using the address
return;
var username = newSession.Name;
var otherUsernames = string.Join(", ",
otherConnectionsFromAddress.Select(session => session.Name));
_chatManager.SendAdminAlert(Loc.GetString("admin-alert-shared-connection",
("player", username),
("otherCount", otherConnectionCount),
("otherList", otherUsernames)));
}
/*
* TODO: Jesus H Christ what is this utter mess of a function
* TODO: Break this apart into is constituent steps.
*/
private async Task<(ConnectionDenyReason, string, List<ServerBanDef>? bansHit)?> ShouldDeny(
NetConnectingArgs e)
{
// Check if banned.
var addr = e.IP.Address;
var userId = e.UserId;
ImmutableArray<byte>? hwId = e.UserData.HWId;
if (hwId.Value.Length == 0 || !_cfg.GetCVar(CCVars.BanHardwareIds))
{
// HWId not available for user's platform, don't look it up.
// Or hardware ID checks disabled.
hwId = null;
}
var modernHwid = e.UserData.ModernHWIds;
var bans = await _db.GetServerBansAsync(addr, userId, hwId, modernHwid, includeUnbanned: false);
if (bans.Count > 0)
{
var firstBan = bans[0];
var message = firstBan.FormatBanMessage(_cfg, _loc);
return (ConnectionDenyReason.Ban, message, bans);
}
if (HasTemporaryBypass(userId))
{
_sawmill.Verbose("User {UserId} has temporary bypass, skipping further connection checks", userId);
return null;
}
var adminData = await _db.GetAdminDataForAsync(e.UserId);
// Corvax-Start: Allow privileged players bypass bunker
var isPrivileged = await HavePrivilegedJoin(e.UserId);
if (_cfg.GetCVar(CCVars.PanicBunkerEnabled) && adminData == null && !isPrivileged)
// Corvax-End
{
var showReason = _cfg.GetCVar(CCVars.PanicBunkerShowReason);
var customReason = _cfg.GetCVar(CCVars.PanicBunkerCustomReason);
var minMinutesAge = _cfg.GetCVar(CCVars.PanicBunkerMinAccountAge);
var record = await _db.GetPlayerRecordByUserId(userId);
var validAccountAge = record != null &&
record.FirstSeenTime.CompareTo(DateTimeOffset.UtcNow - TimeSpan.FromMinutes(minMinutesAge)) <= 0;
var bypassAllowed = _cfg.GetCVar(CCVars.BypassBunkerWhitelist) && await _db.GetWhitelistStatusAsync(userId);
// Use the custom reason if it exists & they don't have the minimum account age
if (customReason != string.Empty && !validAccountAge && !bypassAllowed)
{
return (ConnectionDenyReason.Panic, customReason, null);
}
if (showReason && !validAccountAge && !bypassAllowed)
{
return (ConnectionDenyReason.Panic,
Loc.GetString("panic-bunker-account-denied-reason",
("reason", Loc.GetString("panic-bunker-account-reason-account", ("minutes", minMinutesAge)))), null);
}
var minOverallMinutes = _cfg.GetCVar(CCVars.PanicBunkerMinOverallMinutes);
var overallTime = ( await _db.GetPlayTimes(e.UserId)).Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall);
var haveMinOverallTime = overallTime != null && overallTime.TimeSpent.TotalMinutes > minOverallMinutes;
// Use the custom reason if it exists & they don't have the minimum time
if (customReason != string.Empty && !haveMinOverallTime && !bypassAllowed)
{
return (ConnectionDenyReason.Panic, customReason, null);
}
if (showReason && !haveMinOverallTime && !bypassAllowed)
{
return (ConnectionDenyReason.Panic,
Loc.GetString("panic-bunker-account-denied-reason",
("reason", Loc.GetString("panic-bunker-account-reason-overall", ("minutes", minOverallMinutes)))), null);
}
// Corvax-VPNGuard-Start
if (_vpnGuardMgr == null) // "lazyload" because of problems with dependency resolve order
IoCManager.Instance!.TryResolveType(out _vpnGuardMgr);
var denyVpn = false;
if (_cfg.GetCVar(CCCVars.PanicBunkerDenyVPN) && _vpnGuardMgr != null)
{
denyVpn = await _vpnGuardMgr.IsConnectionVpn(e.IP.Address);
if (denyVpn)
{
return (ConnectionDenyReason.Panic,
Loc.GetString("panic-bunker-account-denied-reason",
("reason", Loc.GetString("panic-bunker-account-reason-vpn"))), null);
}
}
// Corvax-VPNGuard-End
if ((!validAccountAge || !haveMinOverallTime || denyVpn) && !bypassAllowed) // Corvax-VPNGuard
{
return (ConnectionDenyReason.Panic, Loc.GetString("panic-bunker-account-denied"), null);
}
}
if (_cfg.GetCVar(CCVars.BabyJailEnabled) && adminData == null)
{
var result = await IsInvalidConnectionDueToBabyJail(userId, e);
if (result.IsInvalid)
return (ConnectionDenyReason.BabyJail, result.Reason, null);
}
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) &&
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
status == PlayerGameStatus.JoinedGame;
var adminBypass = _cfg.GetCVar(CCVars.AdminBypassMaxPlayers) && adminData != null;
// Corvax-Queue-Start
var isQueueEnabled = IoCManager.Instance!.TryResolveType<IServerJoinQueueManager>(out var mgr) && mgr.IsEnabled;
if ((_plyMgr.PlayerCount >= _cfg.GetCVar(CCVars.SoftMaxPlayers) && !adminBypass) && !wasInGame && !isQueueEnabled)
// Corvax-Queue-End
{
return (ConnectionDenyReason.Full, Loc.GetString("soft-player-cap-full"), null);
}
// Checks for whitelist IF it's enabled AND the user isn't an admin. Admins are always allowed.
if (_cfg.GetCVar(CCVars.WhitelistEnabled) && adminData is null)
{
if (_whitelists is null)
{
_sawmill.Error("Whitelist enabled but no whitelists loaded.");
// Misconfigured, deny everyone.
return (ConnectionDenyReason.Whitelist, Loc.GetString("whitelist-misconfigured"), null);
}
foreach (var whitelist in _whitelists)
{
if (!IsValid(whitelist, _plyMgr.PlayerCount))
{
// Not valid for current player count.
continue;
}
var whitelistStatus = await IsWhitelisted(whitelist, e.UserData, _sawmill);
if (!whitelistStatus.isWhitelisted)
{
// Not whitelisted.
return (ConnectionDenyReason.Whitelist, Loc.GetString("whitelist-fail-prefix", ("msg", whitelistStatus.denyMessage!)), null);
}
// Whitelisted, don't check any more.
break;
}
}
return null;
}
private async Task<(bool IsInvalid, string Reason)> IsInvalidConnectionDueToBabyJail(NetUserId userId, NetConnectingArgs e)
{
// If you're whitelisted then bypass this whole thing
if (await _db.GetWhitelistStatusAsync(userId))
return (false, "");
// Initial cvar retrieval
var showReason = _cfg.GetCVar(CCVars.BabyJailShowReason);
var reason = _cfg.GetCVar(CCVars.BabyJailCustomReason);
var maxAccountAgeMinutes = _cfg.GetCVar(CCVars.BabyJailMaxAccountAge);
var maxPlaytimeMinutes = _cfg.GetCVar(CCVars.BabyJailMaxOverallMinutes);
// Wait some time to lookup data
var record = await _db.GetPlayerRecordByUserId(userId);
// No player record = new account or the DB is having a skill issue
if (record == null)
return (false, "");
var isAccountAgeInvalid = record.FirstSeenTime.CompareTo(DateTimeOffset.UtcNow - TimeSpan.FromMinutes(maxAccountAgeMinutes)) <= 0;
if (isAccountAgeInvalid)
{
_sawmill.Debug($"Baby jail will deny {userId} for account age {record.FirstSeenTime}"); // Remove on or after 2024-09
}
if (isAccountAgeInvalid && showReason)
{
var locAccountReason = reason != string.Empty
? reason
: Loc.GetString("baby-jail-account-denied-reason",
("reason",
Loc.GetString(
"baby-jail-account-reason-account",
("minutes", maxAccountAgeMinutes))));
return (true, locAccountReason);
}
var overallTime = ( await _db.GetPlayTimes(e.UserId)).Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall);
var isTotalPlaytimeInvalid = overallTime != null && overallTime.TimeSpent.TotalMinutes >= maxPlaytimeMinutes;
if (isTotalPlaytimeInvalid)
{
_sawmill.Debug($"Baby jail will deny {userId} for playtime {overallTime!.TimeSpent}"); // Remove on or after 2024-09
}
if (isTotalPlaytimeInvalid && showReason)
{
var locPlaytimeReason = reason != string.Empty
? reason
: Loc.GetString("baby-jail-account-denied-reason",
("reason",
Loc.GetString(
"baby-jail-account-reason-overall",
("minutes", maxPlaytimeMinutes))));
return (true, locPlaytimeReason);
}
if (!showReason && isTotalPlaytimeInvalid || isAccountAgeInvalid)
return (true, Loc.GetString("baby-jail-account-denied"));
return (false, "");
}
private bool HasTemporaryBypass(NetUserId user)
{
return _temporaryBypasses.TryGetValue(user, out var time) && time > _gameTiming.RealTime;
}
private async Task<NetUserId?> AssignUserIdCallback(string name)
{
if (!_cfg.GetCVar(CCVars.GamePersistGuests))
{
return null;
}
var userId = await _db.GetAssignedUserIdAsync(name);
if (userId != null)
{
return userId;
}
var assigned = new NetUserId(Guid.NewGuid());
await _db.AssignUserIdAsync(name, assigned);
return assigned;
}
// Corvax-Queue-Start: Make these conditions in one place, for checks in the connection and in the queue
public async Task<bool> HavePrivilegedJoin(NetUserId userId)
{
var adminBypass = _cfg.GetCVar(CCVars.AdminBypassMaxPlayers) && await _db.GetAdminDataForAsync(userId) != null;
var havePriorityJoin = _sponsorsMgr != null && _sponsorsMgr.HaveServerPriorityJoin(userId); // Corvax-Sponsors
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) &&
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
status == PlayerGameStatus.JoinedGame;
return adminBypass ||
havePriorityJoin || // Corvax-Sponsors
wasInGame;
}
// Corvax-Queue-End
}
}