Files
Ed f298396fe4 Upstream sync (#786)
* Box Station - Dechristmassified (#34135)

* dechrismassified

* removed camera from shower

* Marathon Station - Dechristmassified (#34136)

* dechristmassified

* further dechristmassified

* Loop Station Decal and maints additions (#34103)

* many changes

* contentingregrationtests

* serialized invalid removed

* blank

* "Changes and fixes as suggested"

* blank

* blank

* added desk bells

* engi rework rework rework

* added gate to content integration

* tweaks

* aaa

* bbb

* added holopads

* ccc

* Update default.yml

* hotfix

* aaa

* bbb

* many many tweaks and fixes

* aaa

* decals and maints

* aaa

* bbb

* ccc

---------

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

* Rename cryobed yml file (#34134)

renamed cryopod.yml to cryogenic_sleep_unit.yml

* Cog update (not very merry) (#34144)

removed christmas merry

* bagel update (#34145)

* Add hair pulato (#34117)

* add sprite pulato

* update

* add pulato hair

* add pulato hair

* add pulato hair

* update meta "pulato"

* Automatic changelog update

* Holopad UI tweak for incoming calls (#34137)

* Initial commit

* Update

* Comment correction

* Minor margin increase

* Holopads no longer log broadcasted speech and emotes in the chat (#34114)

Initial commit

* Automatic changelog update

* Fixes borgs not being able to check their laws in crit (#34133)

* fix

* fix2

* Add contraband parent to laser gun safe (#34132)

* Automatic changelog update

* Add Holopad Circuit Board to A/V Communication Technology (#34150)

Added the holopad circuit board to the AV Communication technology and circuit imprinter lathe.

* Automatic changelog update

* Fix disposal signal routers sprites (#34139)

* Fix disposal signal routers sprites

* Remove old shitcode

* Automatic changelog update

* Meta station overhaul (#33506)

* added mail, moved some things around, and fixed a lot of APCs

* fixed my mistakes

* Fixed a few mistakes and AI camera names

* Redid south medbay and more wiring

* Finished sci overhaul, and fixed all issues that I could find.

* rebuilt botany, removed vox box, fixed all known issues.

* Overhauled security

* Minor commit as I prepare to update my copy

* Rebalanced role counts

* Final changes, ready for review!

* Emisse and other people fixed issues with the station

* Finalized changes (for real this time)!

* Standardize shotgun ammo in storagefills (#34156)

shotgun ammo changes

* Automatic changelog update

* meta update (#34158)

* Amber Station Adjustments (#34126)

* Made a couple fixes to various decals, cleaned up some entities, gave the clown their bag and the bartender a handlabeler

* Several changes, more cameras, lighting fixes, adjusted hydro a bit, gave sec a bunch of shutters

* Added new random spawners for science and added them to Amber

* fixed the science spawners and modified amber slightly

* Fixed the random instrument entry

* Fix friendly vent spiders (#34153)

Swapped order of parents for MobGiantSpiderAngry

* Removed UseDelay component from RCD (#34149)

* Automatic changelog update

* Decrease hp for rusted walls (#34043)

* Automatic changelog update

* FIX: Thief beacon doubled steal targets (#33750)

* Automatic changelog update

* remove nukemass song (#34066)

* Automatic changelog update

* Corrected all ghost role names to title case. (#34155)

* Corrected all ghost role names to title case.

* Removes full stop from Hamlet's title.

* Updated ghost role names not in the main ghost roles .ftl

* Two capitals corrections

* Packed Update (Remove Christmas & New Evac) (#34168)

* Packed update (remove christmas, new shuttle)

* Fix invalid

* the voices

* Omega Update (Remove Christmas) (#34174)

omega soap

* Renamed "Irish Car Bomb" drink to "Irish Slammer" (#34107)

* Renamed "Irish Car Bomb" drink to "Irish Slammer", due to concerns over insensitivity.

* Fixing some missed references

* Added prototype id changes to migration.yml. Removed any reference to the troubles (and corrected ale to stout for flavour text).

* Corrected description back to "Irish Cream"

* Removed non-entities from migration.yml

* Automatic changelog update

* Bugfix for the AI player's eye getting stuck when their broadcast is interrupted (#34093)

Initial commit

* Speech is relayed by holopad holograms (#33978)

* Initial commit

* Corrected a field attribute

* Make JPEG a PNG (#34176)

Make 3.png a PNG

* Removed Undesirable Ion Storm Verbs (#34175)

* Remove Undesirable Laws

* empty

* added basic admin logs for PDA notekeeper notes (#34118)

* added basic admin logs for PDA notekeeper notes

* formatting

* added new LogType 'PdaInteract' and changed PDA notekeeper logs to it

---------

Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>

* Automatic changelog update

* Sprites defined for all non-generic computer boards. Added new syndicate computer board sprite. (#34104)

* Defined sprites for non-generic computer boards. Added new syndicate computer board sprite.

* Added new sprite to meta.json and updated attribution.

* Reformatted module.rsi meta.json to match other meta file styles.

* Syndicate board sprite made less yellow/gold, changed outer chips to black. Using grey/silver for CPU centre, akin to syndie agent PDA theme, and to keep distinctive from security board.

* Corrected indentation spacing for currently edited entities.

* Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml

* add pr link to attribution

---------

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

* Added pricegun sound (#34119)

added pricegun sound

Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>

* Automatic changelog update

* Separate Tables n' Counters  (#32673)

* Update tables.yml

* Remove Extra base: state_

* Update tables.yml

* Automatic changelog update

* Add Chameleon PDA (#30514)

* V1 commit

* Remove PDA name and unnecessary pda state

* Adds PDA to Chameleon backpack & thief toolbox

* Change to use AppearanceDataInit

* Add basic PDA state to ensure there's always a sprite before AppearanceData can be applied

* Revert PDA name (this will be changed to another way later)

* Update PDA name updating to new system

* Fix yaml, and fix Agent ID chameleon

* Updated based on review

* Automatic changelog update

* Add some ion storm actions to replace removed ones (#34180)

* Add some ion storm actions to replace removed ones

* Remove other country references, replace

* Some more tuning of the storm values, removing real-world countries

* boldy basics

* Automatic changelog update

* Amber Station and Science Spawner Tweaks (#34187)

* Modified science spawners a bit since I realized including maints loot was undesireable

* Linked Medical doors to buttons, redesigned the floor of the dining area a bit, placed more science spawners

* Somehow I overlooked that I was importing the maints loot table instead of the sci loot table

* Gave sci an EOD closet

* named the evac shuttle

* Core update (#34201)

add

* Elkridge Depot (The station formerly known as Cell) (#34085)

* named apcs, doors, air alarms, cameras, fire alarms, substations, SMESs

* updated PostMapInitTest.cs to include Cell

* added psychologist spawn

* fixed scanner console link, fixed disposals conveyors, and more

* added janitor service lights, maints firelocks, and more

* added more fun maint rooms

* improved head offices, kitchen, psych. added maints between science and arrivals

* fixed spawners placed over solid objects

* added unique evac shuttle, the Cilium

* evac shuttle is now orientated correctly

* added unique cargo shuttle

* updated kitchen area

* renamed Cell Station to Elkridge Depot, removed most main hall airlocks for smoother travel

* general last-minute touch-ups around the bridge and sec

* changed station name in PostMapInitTest.cs

* Add Elkridge Depot into Map Rotation (#34206)

* named apcs, doors, air alarms, cameras, fire alarms, substations, SMESs

* updated PostMapInitTest.cs to include Cell

* added psychologist spawn

* fixed scanner console link, fixed disposals conveyors, and more

* added janitor service lights, maints firelocks, and more

* added more fun maint rooms

* improved head offices, kitchen, psych. added maints between science and arrivals

* fixed spawners placed over solid objects

* added unique evac shuttle, the Cilium

* evac shuttle is now orientated correctly

* added unique cargo shuttle

* updated kitchen area

* renamed Cell Station to Elkridge Depot, removed most main hall airlocks for smoother travel

* general last-minute touch-ups around the bridge and sec

* changed station name in PostMapInitTest.cs

* added Elkridge to default map pool

* added myself to map_attribution.yml credits

* Automatic changelog update

* Packed Update (#34208)

Packed Update (decals mostly)

* Apply forensics when loading with an ammo box (#32280)

* Automatic changelog update

* Update Credits (#34220)

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

* Fix rainbow lizard plushie inhands (#34128)

* fix rainbow plushie inhands

* address requested changes

* attribute sprites

* wielding refactor/fixes (#32188)

* refactor wieldable events

* fix inconsitency with wielding and use updated events

* wieldable cosmetic refactoring

* Update Content.Shared/Wieldable/Events.cs

Co-authored-by: Centronias <charlie.t.santos@gmail.com>

* real

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: Centronias <charlie.t.santos@gmail.com>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

* Automatic changelog update

* Lobby chat width and custom lobby titles (#33783)

* lobby name cvar

* panel width

* skrek

* server name localization fix

* comment format fix

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* remove redundant newline

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* string.empty

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* use SetWidth

* Update Resources/Locale/en-US/lobby/lobby-gui.ftl

---------

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

* Automatic changelog update

* Adds bullet collision to station lights (#34070)

Adds collision with bullets to lights

* Automatic changelog update

* Oasis Update (#34245)

santa is keel.

* Amber Station - Minor Fixes (#34246)

* Moved the stand clear decal in front of the janitor's shutters up two pixels

* added tech maints under most maints doors, fixed power issues in cargo, and fixed a couple minor issues

* Make station anchor hitbox less insufferable (#34217)

* Automatic changelog update

* Remove kessler and zombeteors gamemodes from the secret pool (#34051)

* Remove kessler, zombeteors gameodes

* Probably should keep the protos in case an admin wants to torture players secretly

* address slart review

* Automatic changelog update

* Added distinct ad and bye chatter to Dr. Gibb vending (#34182)

* Added distinct ad and bye chatter to Dr. Gibb vending

* Correcting revert mistake

* Changed ad pack names to better match naming convention

* Implement approved rule changes (#34233)

* Special reagents now appear in the guidebook (#34265)

* Special reagents now appear in the guidebook

* Improved guidebook wording for reagent category

* Automatic changelog update

* Implement approved rule changes (#34233)

* Fix compilation errors in tests from update (#34272)

Required for https://github.com/space-wizards/RobustToolbox/pull/5590 to not cause compile fails, but can be merged on its own

* Fix portable scrubber appearing powered on spawn (#34274)

* [HOTFIX] Fix chameleon PDAs renaming IDs (#34249)

Fix chameleon PDA

* [HOTFIX] Fix Meta station power (#34256)

* hotfix meta power

* fixed AME

* add missing cargo shuttle pilot console to cargo

* Update vessel_warning.ogg (#34263)

* Update vessel_warning.ogg

Remove DC offset and apply short fade out.

* Update attributions.yml

* Update attributions.yml

* Add bleating accent to goats (#34273)

* Automatic changelog update

* Happy New Year (#34288)

happy new year

* Amber Station - Balance Improvements (#34294)

changed the center area in med bay to a garden, weakened meteor shielding in some areas, also general touch ups around the station

* Fixed Loop Station's southern solar array unlinked airlocks  (#34296)

Fixed Southern solar external airlock door bolts

* Fix empty lines in adminwho with stealthmins. (#34122)

Don't print newline if admin is hidden.

* Automatic changelog update

* Added missing cameras to Loop Station (#34308)

* Added missing cameras

* Added missing cameras

* Amber Station - Fixes and Warm Lights (#34324)

* Added warm lights, placed them around the map, also fixed an issue with the MV wire in the cafeteria

* Fixed lv wiring in caf, and adjusted a couple things

* Empty commit to force checks to rerun

* Automatic changelog update

* change locking to use ComplexInteraction (#34326)

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

* Automatic changelog update

* Drink titles and soda vendor consistency (#34178)

* Made capitalisation of proper names consistent.

* Roy Rogers is presumably a proper name.

* Second pass at distinguishing proper names only.

* Two nitpicking/minor changes

* Fixed some overlooked can brand names. Matched case with descriptions.

* Switched generic sodas with brands for SodaInventory

* Removed commonly available branded cans

* Matched case consistency used elsewhere. Minor SPAG corrections.

* Added "nothing" and some missing alcohol bottles to RandomSpawner

* Added distinct ad and bye chatter to Dr. Gibb machines.

* Revert "Added distinct ad and bye chatter to Dr. Gibb machines."

This reverts commit f90b8a470556de05aca81255db8b6b03596ae944.

* Revert "Removed commonly available branded cans"

This reverts commit 43b82168dac1f73b187b7677f34ecdd33b6bb81a.

* Revert "Switched generic sodas with brands for SodaInventory"

This reverts commit f1790f0ce61ef135c79068de6a741e8bb50d85d3.

* Lowercased DrinkGlass suffix. Moved alcoholic drinks from drinks to alcohol.

* Renamed energy drink to Red Bool. Corrected and added some jug descriptions.

* Added reagent names for all bottles except poison-wine

* Revision of title case for cocktails

* SPAG and fixed the only brand reagen with unbranded name.

* Possibly controversial, shortened some bran names to better fit the UI.

* Fixed some inconsistencies in naming

* Matched brand localisation change

* Two name style edits

* Fixed Smite bottle name

* Minor, punctuation

* Blank line to end of file

* Upgraded descriptive names to title case

* Banana Mama

* reverts change, moved to another PR to avoid conflict.

* Removed caffeine reference.

* Minor, corrected some more inconsistencies

* Removed Bottle of Nothing from random spawner.

* Automatic changelog update

* Fix access configurator debug assert (#34330)

* fix

* greytide fix

* fix admin log

* Dirty

* Renamed water melon juice to watermelon juice (#34341)

* Fix battery charging stopping just short of being full (#34028)

* Add copy threshold button to air alarms (#34346)

* Automatic changelog update

* Oasis updoot the dimmining (#34347)

updooty

* Fland Station - Dirt Fix (#34352)

Fland

* Omega Station - Dirt Fix (#34353)

omega

* Marathon Station - Dirt Fix (#34354)

* Marathon

* Rerunning tests

* Cog Station - Dirt Fix (#34355)

Cog

* Box Station - Dirt Fix (#34356)

Box

* Bagel Station - Dirt Fix (#34357)

Bagel

* Packed Station - Dirt Fix (#34351)

* packed

* Rerunning tests

* Replace some sound PlayEntity with PlayPvs (#34317)

* Fixed Forensic Gloves to be Security Contraband  (#34193)

* added BaseRestrictedContraband to forensic gloves

* moved from id to parent

* Automatic changelog update

* add large instruments to the cargo request computer (#34240)

* added the church organ to the cargo console (will add more in this PR, assuming i did this right (HOW DO YOU BUY CARGO ORDERS IN DEV ENVIROMENT???? *sobs))

* added other structure instruments to cargo Catalog

* fixed an epic copy/paste fail

* changed prices

* fixed epic copy/paste fail #2

---------

Co-authored-by: TeenSarlacc <baddiepro123@gmail.com>

* Automatic changelog update

* Fix crayon losing durability on stamped paper (#34202)

* Automatic changelog update

* Adds a border to Oppenhopper poster (#34219)

* border

* Update meta.json

* Update Resources/Textures/Structures/Wallmounts/posters.rsi/meta.json

---------

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

* Trim trailing newlines from examine messages (#33381)

* Trim trailing newlines from examine messages

* TrimTrailingNewlines -> TrimEnd

* Add a popup message when ghost Boo action does nothing (#34369)

* fix ghost_component.ftl locale grammar (#34372)

fix ghost component locale grammar

* Let ghosts sometimes make certain devices say creepy things (#34368)

* Add SpookySpeaker component/system

* Shuffle Boo action targets before trying to activate them

* Add SpookySpeaker to vending machines

* Fix chatcode eating messages starting with "..."

* Add SpookySpeaker to recycler

* Oops

* Decrease speak probability for vending machines

* Add spooky speaker to arcade machines

* Automatic changelog update

* Add directional escape pod sign (#34367)

* Make indestructible tiles not breakable by explosions (#34339)

* No more Ai Spacing

* Move guard into earlier guard statement

* Automatic changelog update

* Arachnid stomach organ yaml fix (#34298)

Arachnid stomach yaml fix

Arachnids had their stomach `updateInterval` set to 1.5, 50% slower than
normal. But this doesn't actually slow down the speed that the stomach
digests things, only the rate at which it updates to check if enough
time has passed. (See 23f0b304f2/Content.Server/Body/Systems/StomachSystem.cs (L57) )

This PR changes arachnid stomachs to have a `digestionDelay` of 30 (20
is default) to achive the desired effect.

Stasis beds are also bugged in a similar manner. They are intended to
slow down the digestion speed, but similarly all they do is change the
update rate. But fixing that requires actual code changes and is out of
scope for this commit.

* Automatic changelog update

* Bended radiator (#34251)

* Automatic changelog update

* Remove Entity<T> data-fields (#34083)

* Update submodule, .NET 9 (#34320)

* Role Types (#33420)

* mindcomponent namespace

* wip MindRole stuff

* admin player tab

* mindroletype comment

* mindRolePrototype redesign

* broken param

* wip RoleType implementation

* basic role type switching for antags

* traitor fix

* fix AdminPanel update

* the renameningTM

* cleanup

* feature uncreeping

* roletypes on mind roles

* update MindComponent.RoleType when MindRoles change

* ghostrole configuration

* ghostrole config improvements

* live update of roleType on the character window

* logging stuff and notes

* remove thing no one asked for

* weh

* Mind Role Entities wip

* headrev count fix

* silicon stuff, cleanup

* exclusive antag config, cleanup

* jobroleadd overwerite

* logging stuff

* MindHasRole cleanup, admin log stuff

* last second cleanup

* ocd

* move roletypeprototype to its own file, minor note stuff

* remove Roletype.Created

* log stuff

* roletype setup for ghostroles and autotraitor reinforcements

* ghostrole type configs

* adjustable admin overlay

* cleanup

* fix this in its own PR

* silicon antagonist

* borg stuff

* mmi roletype handling

* spawnable borg roletype handling

* weh

* ghost role cleanup

* weh

* RoleEvent update

* polish

* log stuff

* admin overlay config

* ghostrolecomponent cleanup

* weh

* admin overlay code cleanup

* minor cleanup

* Obsolete MindRoleAddedEvent

* comment

* minor code cleanup

* MindOnDoGreeting fix

* Role update message

* fix duplicate job greeting for cyborgs

* fix emag job message dupe

* nicer-looking role type update

* crew aligned

* syndicate assault borg role fix

* fix test fail

* fix a merge mistake

* fix LoneOp role type

* Update Content.Client/Administration/AdminNameOverlay.cs

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

* Update Content.Shared/Roles/SharedRoleSystem.cs

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

* comment formatting

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

* change logging category

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

* fix a space

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

* use MindAddRoles

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

* get MindComponent from TryGetMind

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

* move var declaration outside loop

* remove TryComp

* take RoleEnum behind the barn

* don't use ensurecomp unnecessarily

* cvar comments

* toggleableghostrolecomponent documentation

* skrek

* use EntProtoId

* mindrole config

* merge baserolecomponent into basemindrolecomponent

* ai and borg silicon role tweaks

* formatting

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

* I will end you (the color)

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

* use LocId type for a locale id

* update RoleEvent documentation

* update RoleEvent documentation

* remove obsolete MindRoleAddedEvent

* refine MindRolesUpdate()

* use dependency

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

* inject dependency

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

* roleType.Name no longer required

* reformatted draw code logic

* GhostRoleMarkerRoleComponent comment

* minor SharedRoleSystem cleanup

* StartingMindRoleComponent, unhardcode roundstart silicon

* Update Content.Shared/Roles/SharedRoleSystem.cs

* remove a whitespace

---------

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

* Automatic changelog update

* Update Credits (#34389)

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

* Elkridge Depot Improvements (#34377)

* updates decals

* more decal work, more dinginess in certain areas

* added decals under doors

* Fix force-feeding Loc strings not using target's gender (#34276)

* HOTFIX Tweaked air alarm default settings for nitrogen breathing crew (#34198)

air alarm default settings modified for anaerobic crew

* #33571 Bomb defusal lockers always should have tools (#34394)

* Automatic changelog update

* [HOTFIX] fix holopads with multiple ai cores dying (#34289)

change return to continue

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

* Reduce Panic Bunker Minimum Playtime to 2 hours (#34401)

* Add IPIntel API support. (#33339)

Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>

* Automatic changelog update

* Fland Reporters Room (#34408)

changed the command checkpoint to a reporters room.

* Automatic changelog update

* Add a high-capacity water tank to the janitor's closet of Oasis (#34366)

added high capacity water tank

* Darkened Service job interface icons for better contrast (#34270)

* Darkened Service job interface icons for better contrast

* Fixed Botanist job interface icon dark handle hole

* Change to new, darker, service color in all resource yml files

* Revert Map file service color changes

* Use new darker service color on id cards

* Revert Service color change in mapping_actions.yml

* Revert salvage difficulties service color

* Redo service ID and job colors to match advanced palette

* Revert all service color yml file changes

* Switch icons to use existing service pallete colors from advanced pallete

* Update meta.json for darkened service icons

---------

Co-authored-by: Erskin Cherry <frobnic8@gmail.com>

* Amber Station - Moved Vents Around (#34410)

* Moved all vents around, made some small changes

* Finished work

* Removed insuls spawner since they're not merged yet

* Insuls Spawner (#34407)

* Added insuls spawner, time to test

* adjusted whitespace since that was causing issues

* Update Resources/Prototypes/Entities/Markers/Spawners/Random/maintenance.yml

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

---------

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

* Manual Valves Resprite (#34378)

* resprited manual valves to be colourblind friendly

* Update Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json

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

---------

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

* Automatic changelog update

* loop station door access fixes and air sink (#34414)

small fixes

* Raise syndicate kobold reinforcement HP crit threshold from 75 to 100 to match monkey. (#34409)

kobold ops have 100 health

* Anomaly dragging exploit fix and QOL changes (#34280)

* Wood wall is now built from barricade congraph and on top of a barricade instead of using rods

* APE dragging exploit fix

* Fixed doors being blocked with mousetraps, and other Collidable items (#34045)

* Changed SharedDoorSystem.GetColliding() to allow non-LowImpassible mask entities to stay in the door while it closes

* Update Content.Shared/Doors/Systems/SharedDoorSystem.cs

Clarifies comment of how the mask is used

Co-authored-by: Centronias <charlie.t.santos@gmail.com>

---------

Co-authored-by: Centronias <charlie.t.santos@gmail.com>

* Fixed Jazz Instrument for Electric Guitars (#33363)

* fixed jazz midi program byte

* swapped around jazz and clean in instrumentList

* Automatic changelog update

* Porting Pride-O-Mat to Upstream (#34412)

* Pride-O-Mat (#1322)

* Added Pride-O-Mat

* Yep

* Updated license to the correct one

* Added more lines, reconfigured settings a bit, also added cloaks to inventory, set coder socks to emag inventory

* Removed bunny ears, fixed typo

* Made requested changes 

Webedit lmao

---------

Co-authored-by: Dorragon <101672978+Dorragon@users.noreply.github.com>

* Automatic changelog update

* Oasis Power Rebalance + Misc fixes (#34425)

* balance oasis power as a stopgap

* change waste color to proper waste color

* Fix IPIntel causing frequent errors with the cleanup job. (#34428)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>

* craftable pet carrier (#34431)

* craftable pet carrier

* epic integration test fail

* Update Resources/Prototypes/Recipes/Crafting/improvised.yml

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

* Update Resources/Prototypes/Recipes/Crafting/Graphs/storage/pet_carrier.yml

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

* Update Resources/Prototypes/Recipes/Crafting/Graphs/storage/pet_carrier.yml

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

* Update Resources/Prototypes/Entities/Objects/Misc/pet_carrier.yml

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

* extra tab begone

* epic linter fail

* how did linter not see this???

---------

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

* Automatic changelog update

* Adds omnisexual pin (#34439)

* Make important change (#7)

This is to help julian test his bot

* Omnibus

* Remove random test file from testing a gh bot

* Add pin to vendor, spawners and loadout

---------

Co-authored-by: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>

* Fix bad Rider analysis error in AccessOverriderWindow.xaml.cs (#34213)

* Disable meta-atlas for big rare RSIs (#33643)

* Persist deadmin to database, add admin suspension system (#34048)

* Automatic changelog update

* STAThread client content start (#34212)

* Minor client packaging changes (#33787)

* Fix muzzle accent (#34419)

* Automatic changelog update

* Add Discord webhook on watchlist connection (#33483)

* Automatic changelog update

* Fixed Thief starting gear failing on specific bag inventories. (#34430)

Fixed it yayyy

* Added missing details from worn capes to head of department beadsheets (#34396)

* Added key and missing details from worn cape to HOP bedsheet

* Corrected canvas size for sprite

* Subtle tweak to shading to reduce color blurring at pillow edge

* Matched Hue and tone to cape

* Tweak chekered pattern marks for gold trim

* Removed accidental palette inclusion

* Clearer wording and corrected attribution name.

* Tweaked shading on key image to fit in better with bed aesthetics

* Added CE cape icon to bedsheet

* Added cape image to HOP bedsheet. Made gold trim better match cape visuals

* RD cape icon added. Colour tweaked to better match cape.

* Updates json

* Tweaks to gold trim shading to match bed aesthetics

* Added better shading for HOP sheet side. Halved file size.

* Optimised HOS RD and CE sheet sprites

* Corrected sprite title in attribution

* Replace ERT Medic's Advanced Medkits with 2 Combat Medkits (#34380)

Replaced Adv kits with 2 combat kits

* Fix nonsensical RegEx for name restriction (#34375)

* Fixed nonsense RegEx

"-" character is a range, caused an error.
No need for "," to repeat so much, it's not a separator.
"\\" - just why?

* Further optimized RegEx structure

Added:
"@" delimiter for consistency
"/" to escape "-" for good and to avoid further problems

* Remove the ability to print the station anchor circuit board (#34358)

remove the ability to print the station anchor circuit board

* Automatic changelog update

* Meta hotfix (#34306)

* Fixed major issues with power, cargo shuttle docking, etc.

* remove serialized invalids

* Finished fixing the critical issues, ready for merge?

* Empty commit

* Added new break room to sci (they deserve it)

* Fixed up other minor issues

* if this map isnt PERFECT Emisse has permission to gib me and turn me into a cyborg

* added Roomba's changes

---------

Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>

* Make Mime PDA interactions silent (#34426)

* make insert and eject datafields in ItemSlotsComponent.cs nullable, make mime PDA silent

* make it so that you can't fit wirecutters into the slots, among other various things

* Automatic changelog update

* Smite vending machine (#34420)

* Added smite machine to YAML

* Added smite ads and inventory

* Added smite vendor sprites

* Changed the description of the machine to not repeat and ad line.

* Added newline to end of inventory .yml

* Corrected erroneous edit.

* Tweaked all sprites

* Added tesla toy to contraband. Reduced number of drinks available

* Reduced soda varieties but increased can numbers.

* Removed tesla toy from contraband inventory

* Removed speech component from vending machines that already inherit it

* Moved Sprite component to top of list

* Added Smite vendors to random spanwers

* Alphabetised spawn prototypes, commented where name is unclear

* Automatic changelog update

* Printable bedsheets (#34034)

* Bedsheets

* that one fixes yellow bedsheet and delete american bedsheet

* Automatic changelog update

* Update RT to v239.0.1 (#34454)

* Remove christmas anomaly spawn (#34053)

Update anomaly.yml

* Automatic changelog update

* Remove baby jail (#34443)

* Remove baby jail

Closes #33893

* Test fail fix.

* Add a CCVar to allow from hiding admins in the reported player count. (#34406)

Good for:
- Keeping admins hidden
- Not confuse players seeing 84/80 players

Nicely pairs up with the ``admin.admins_count_for_max_players`` ccvar

* Automatic changelog update

* Fix Mixed puddles not updating slips when evap (#34303)

* Fix Mixed puddles not updating slips when evap

* Remove Comment that isn't needed

Co-authored-by: Centronias <charlie.t.santos@gmail.com>

* CR - use SolutionContainerSystem.UpdateChemicals

* CR - cleanup unused imports

---------

Co-authored-by: Centronias <charlie.t.santos@gmail.com>

* Automatic changelog update

* WizDen config update for IPIntel (#34457)

* Fix DNA scrambler updating station record (#34091)

* Fix DNA scrambler updating station record

* Update Content.Server/Implants/SubdermalImplantSystem.cs

---------

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

* Automatic changelog update

* New and Modified Map Spawners (#34424)

* Added spanwers and modified others

* adjusted values to be more in line with what I want

* this comment may have caused that test fail

* oh my god another typo

* Modified door crate to be engineering flavored

* reduced the pride vendor odds

Webedit lmao

* Elkridge Depot Fixes Again (#34461)

fixes evac shuttle, fix north solars, fix vents and scrubbers

* Space Ruins Variant (#34445)

* Space Ruins Variant

* Updated File

* Added Goliaths/Removed some mobs

* Plasma Station (#33991)

* Plasma Station initial commit

* Map fixes 1

Expanded science's SMES array
Added advanced SMES
Redone stamped documents with custom stamps
Expanded atmospherics with more storage tanks
Added status displays
Add missing beacons to solars
Replaced the passive gates in science with valves
Removed protolathe in engineering
Added guitar to CE office
Replaced throngler plushie with weh cloak
Add a lattice tile outside the atmos burn chamber and storange tanks
Added atmos network monitor in bridge

* Add cargo and emergency shuttle

* Updated maps

* Add plasma to map testing list

* Map fixes 2

Reworked pipenets to not go under walls
Redid salvage and disposals
Reworked the bar to include a new bar extension facing the pool
Replaced arrivals cryo with an arcade
Replaced the toilets in the service plaza with cryo
Removed the cryo in dorms
Added more details to hallways
Redid tools room to include a front desk for the janitor closet
Reconnected sci to power roundstart
Removed some unideal spawns
Expanded the TEG airlock to be 2x3 instead of 1x3
Reduced the size of the SMES bank from 10 to 6
Disabled the plasma miners (downstreams or admins can re-enable them)
Replaced illegal maint items

* Fixes a 6 pack destroying the universe

Ok maybe cracking a cold one with the boys wasn't a great idea.

* Map fixes 3

* Quick research assistant fix

* Map fixes 4

* Map fixes 5

* webedit go brrrt

* Map fixes 6

* Map fixes 7

* Map fixes 8

* Fixes non-existent object

It's amazing this game runs at all

* Map fixes 9

* update pools

* Map fixes 10

* forgot to clear my multitool

I love mapping I love mapping I love mapping I love mapping I love mapping

---------

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

* Automatic changelog update

* Plasma station population tweak (#34462)

* Plasma Station initial commit

* Map fixes 1

Expanded science's SMES array
Added advanced SMES
Redone stamped documents with custom stamps
Expanded atmospherics with more storage tanks
Added status displays
Add missing beacons to solars
Replaced the passive gates in science with valves
Removed protolathe in engineering
Added guitar to CE office
Replaced throngler plushie with weh cloak
Add a lattice tile outside the atmos burn chamber and storange tanks
Added atmos network monitor in bridge

* Add cargo and emergency shuttle

* Updated maps

* Add plasma to map testing list

* Map fixes 2

Reworked pipenets to not go under walls
Redid salvage and disposals
Reworked the bar to include a new bar extension facing the pool
Replaced arrivals cryo with an arcade
Replaced the toilets in the service plaza with cryo
Removed the cryo in dorms
Added more details to hallways
Redid tools room to include a front desk for the janitor closet
Reconnected sci to power roundstart
Removed some unideal spawns
Expanded the TEG airlock to be 2x3 instead of 1x3
Reduced the size of the SMES bank from 10 to 6
Disabled the plasma miners (downstreams or admins can re-enable them)
Replaced illegal maint items

* Fixes a 6 pack destroying the universe

Ok maybe cracking a cold one with the boys wasn't a great idea.

* Map fixes 3

* Quick research assistant fix

* Map fixes 4

* Map fixes 5

* webedit go brrrt

* Map fixes 6

* Map fixes 7

* Map fixes 8

* Fixes non-existent object

It's amazing this game runs at all

* Map fixes 9

* update pools

* Map fixes 10

* forgot to clear my multitool

I love mapping I love mapping I love mapping I love mapping I love mapping

* Tweaked player counts

---------

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

* Automatic changelog update

* Fix inconsistent borg flashlight state (#33027)

* Fix borg light being stuck on if no cell is inserted

* Fix HandheldLightComponent.Activted becoming out of sync with SharedPointLightComponent.Enabled

* Fix for entities which don't have a handheld light component

* FIX: Uranium, Cak, and BreadDog are not garbage! (#34192)

* FIX: Uranium, Cak, and BreadDog are not garbage!

* Fixed bread typo for spacegarbage change.

* Style: moved ediblebase

* Update Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/bread.yml

* Update Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/cake.yml

---------

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

* Automatic changelog update

* Fix the HoS mantle metashield break (#33831)

Changes 'nukies' to 'syndicate agents' in the HoS mantle's description.

* fix for climbable pianos (#33690)

fix for climable pianos

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

* Automatic changelog update

* BorgChassis transfer their mind to a dropped BorgBrain fix (#34464)

Fix

* Staging: Add taped logo back for 10th anniversary (#34486)

* Update engine to v240.0.1 (#34497)

* mind roles

* partial ritual serialization fix

* Update CP14RoundEndSystem.cs

* delete worldEdge system

* Delete StencilOverlay.WorldEdge.cs

* Update CP14MagicEffectComponent.cs

* delete rituals system

* fix demiplane serialization

* mapdamage fix serialization

* common objectives fix

* remove failed personal goals endscreen

* fix special selling, fix serialization

* more fixes

* more fixes x2

* final bruh

* fix

---------

Co-authored-by: Southbridge <7013162+southbridge-fur@users.noreply.github.com>
Co-authored-by: TytosB <54259736+TytosB@users.noreply.github.com>
Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>
Co-authored-by: Booblesnoot42 <108703193+Booblesnoot42@users.noreply.github.com>
Co-authored-by: Spessmann <156740760+Spessmann@users.noreply.github.com>
Co-authored-by: ~DreamlyJack~ <148849095+DreamlyJack@users.noreply.github.com>
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
Co-authored-by: PopGamer46 <yt1popgamer@gmail.com>
Co-authored-by: crazybrain23 <44417085+crazybrain23@users.noreply.github.com>
Co-authored-by: amatwiedle <amatwiedle@gmail.com>
Co-authored-by: justdie12 <125140938+justdie12@users.noreply.github.com>
Co-authored-by: Nox <nebulousnox38@gmail.com>
Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Co-authored-by: ReeZer2 <63300653+ReeZer2@users.noreply.github.com>
Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>
Co-authored-by: Alpaccalypse <21291379+Alpaccalypse@users.noreply.github.com>
Co-authored-by: Spanky <scott@wearejacob.com>
Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
Co-authored-by: Dylan Hunter Whittingham <45404433+DylanWhittingham@users.noreply.github.com>
Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Ps3Moira <113228053+ps3moira@users.noreply.github.com>
Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Co-authored-by: Hannah Giovanna Dawson <karakkaraz@gmail.com>
Co-authored-by: Ubaser <134914314+UbaserB@users.noreply.github.com>
Co-authored-by: Deerstop <edainturner@gmail.com>
Co-authored-by: themias <89101928+themias@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: Centronias <charlie.t.santos@gmail.com>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Co-authored-by: SpaceRox1244 <138547931+SpaceRox1244@users.noreply.github.com>
Co-authored-by: IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
Co-authored-by: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
Co-authored-by: Pancake <Pangogie@users.noreply.github.com>
Co-authored-by: Piras314 <p1r4s@proton.me>
Co-authored-by: flymo5678 <86871317+flymo5678@users.noreply.github.com>
Co-authored-by: c4llv07e <igor@c4llv07e.xyz>
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Co-authored-by: Coolsurf6 <coolsurf24@yahoo.com.au>
Co-authored-by: TeenSarlacc <46608342+TeenSarlacc@users.noreply.github.com>
Co-authored-by: TeenSarlacc <baddiepro123@gmail.com>
Co-authored-by: SpaceManiac <tad@platymuus.com>
Co-authored-by: War Pigeon <54217755+minus1over12@users.noreply.github.com>
Co-authored-by: Zachary Higgs <compgeek223@gmail.com>
Co-authored-by: 0x6273 <0x40@keemail.me>
Co-authored-by: Floxington <florian.decker@mailbox.org>
Co-authored-by: Myra <vasilis@pikachu.systems>
Co-authored-by: SlimSlam <73899110+Stewie523@users.noreply.github.com>
Co-authored-by: frobnic8 <erskin@eldritch.org>
Co-authored-by: Erskin Cherry <frobnic8@gmail.com>
Co-authored-by: hyperDelegate <zachary1064@gmail.com>
Co-authored-by: JustinWinningham <justinmwinningham@gmail.com>
Co-authored-by: zHonys <69396539+zHonys@users.noreply.github.com>
Co-authored-by: Dorragon <101672978+Dorragon@users.noreply.github.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Co-authored-by: Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
Co-authored-by: Julian Giebel <juliangiebel@live.de>
Co-authored-by: Palladinium <patrick.chieppe@hotmail.com>
Co-authored-by: Alpha-Two <92269094+Alpha-Two@users.noreply.github.com>
Co-authored-by: Hyper B <137433177+HyperB1@users.noreply.github.com>
Co-authored-by: kosticia <kosticia46@gmail.com>
Co-authored-by: compilatron <40789662+jbox144@users.noreply.github.com>
Co-authored-by: eoineoineoin <github@eoinrul.es>
Co-authored-by: Patrik Caes-Sayrs <heartofgoldfish@gmail.com>
Co-authored-by: ApolloVector <149586366+ApolloVector@users.noreply.github.com>
Co-authored-by: Gansu <68031780+GansuLalan@users.noreply.github.com>
Co-authored-by: aa5g21 <aa5g21@soton.ac.uk>
2025-01-21 23:57:12 +03:00

1325 lines
46 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Text.Json;
using Content.Shared.Database;
using Microsoft.EntityFrameworkCore;
using NpgsqlTypes;
namespace Content.Server.Database
{
public abstract class ServerDbContext : DbContext
{
protected ServerDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Preference> Preference { get; set; } = null!;
public DbSet<Profile> Profile { get; set; } = null!;
public DbSet<AssignedUserId> AssignedUserId { get; set; } = null!;
public DbSet<Player> Player { get; set; } = default!;
public DbSet<Admin> Admin { get; set; } = null!;
public DbSet<AdminRank> AdminRank { get; set; } = null!;
public DbSet<Round> Round { get; set; } = null!;
public DbSet<Server> Server { get; set; } = null!;
public DbSet<AdminLog> AdminLog { get; set; } = null!;
public DbSet<AdminLogPlayer> AdminLogPlayer { get; set; } = null!;
public DbSet<Whitelist> Whitelist { get; set; } = null!;
public DbSet<Blacklist> Blacklist { get; set; } = null!;
public DbSet<ServerBan> Ban { get; set; } = default!;
public DbSet<ServerUnban> Unban { get; set; } = default!;
public DbSet<ServerBanExemption> BanExemption { get; set; } = default!;
public DbSet<ConnectionLog> ConnectionLog { get; set; } = default!;
public DbSet<ServerBanHit> ServerBanHit { get; set; } = default!;
public DbSet<ServerRoleBan> RoleBan { get; set; } = default!;
public DbSet<ServerRoleUnban> RoleUnban { get; set; } = default!;
public DbSet<PlayTime> PlayTime { get; set; } = default!;
public DbSet<UploadedResourceLog> UploadedResourceLog { get; set; } = default!;
public DbSet<AdminNote> AdminNotes { get; set; } = null!;
public DbSet<AdminWatchlist> AdminWatchlists { get; set; } = null!;
public DbSet<AdminMessage> AdminMessages { get; set; } = null!;
public DbSet<RoleWhitelist> RoleWhitelists { get; set; } = null!;
public DbSet<BanTemplate> BanTemplate { get; set; } = null!;
public DbSet<IPIntelCache> IPIntelCache { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Preference>()
.HasIndex(p => p.UserId)
.IsUnique();
modelBuilder.Entity<Profile>()
.HasIndex(p => new {p.Slot, PrefsId = p.PreferenceId})
.IsUnique();
modelBuilder.Entity<Antag>()
.HasIndex(p => new {HumanoidProfileId = p.ProfileId, p.AntagName})
.IsUnique();
modelBuilder.Entity<Trait>()
.HasIndex(p => new {HumanoidProfileId = p.ProfileId, p.TraitName})
.IsUnique();
modelBuilder.Entity<ProfileRoleLoadout>()
.HasOne(e => e.Profile)
.WithMany(e => e.Loadouts)
.HasForeignKey(e => e.ProfileId)
.IsRequired();
modelBuilder.Entity<ProfileLoadoutGroup>()
.HasOne(e => e.ProfileRoleLoadout)
.WithMany(e => e.Groups)
.HasForeignKey(e => e.ProfileRoleLoadoutId)
.IsRequired();
modelBuilder.Entity<ProfileLoadout>()
.HasOne(e => e.ProfileLoadoutGroup)
.WithMany(e => e.Loadouts)
.HasForeignKey(e => e.ProfileLoadoutGroupId)
.IsRequired();
modelBuilder.Entity<Job>()
.HasIndex(j => j.ProfileId);
modelBuilder.Entity<Job>()
.HasIndex(j => j.ProfileId, "IX_job_one_high_priority")
.IsUnique()
.HasFilter("priority = 3");
modelBuilder.Entity<Job>()
.HasIndex(j => new { j.ProfileId, j.JobName })
.IsUnique();
modelBuilder.Entity<AssignedUserId>()
.HasIndex(p => p.UserName)
.IsUnique();
// Can't have two usernames with the same user ID.
modelBuilder.Entity<AssignedUserId>()
.HasIndex(p => p.UserId)
.IsUnique();
modelBuilder.Entity<Admin>()
.HasOne(p => p.AdminRank)
.WithMany(p => p!.Admins)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminFlag>()
.HasIndex(f => new {f.Flag, f.AdminId})
.IsUnique();
modelBuilder.Entity<AdminRankFlag>()
.HasIndex(f => new {f.Flag, f.AdminRankId})
.IsUnique();
modelBuilder.Entity<AdminLog>()
.HasKey(log => new {log.RoundId, log.Id});
modelBuilder.Entity<AdminLog>()
.Property(log => log.Id);
modelBuilder.Entity<AdminLog>()
.HasIndex(log => log.Date);
modelBuilder.Entity<PlayTime>()
.HasIndex(v => new { v.PlayerId, Role = v.Tracker })
.IsUnique();
modelBuilder.Entity<AdminLogPlayer>()
.HasOne(player => player.Player)
.WithMany(player => player.AdminLogs)
.HasForeignKey(player => player.PlayerUserId)
.HasPrincipalKey(player => player.UserId);
modelBuilder.Entity<AdminLogPlayer>()
.HasIndex(p => p.PlayerUserId);
modelBuilder.Entity<Round>()
.HasIndex(round => round.StartDate);
modelBuilder.Entity<AdminLogPlayer>()
.HasKey(logPlayer => new {logPlayer.RoundId, logPlayer.LogId, logPlayer.PlayerUserId});
modelBuilder.Entity<ServerBan>()
.HasIndex(p => p.PlayerUserId);
modelBuilder.Entity<ServerBan>()
.HasIndex(p => p.Address);
modelBuilder.Entity<ServerBan>()
.HasIndex(p => p.PlayerUserId);
modelBuilder.Entity<ServerUnban>()
.HasIndex(p => p.BanId)
.IsUnique();
modelBuilder.Entity<ServerBan>().ToTable(t =>
t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR player_user_id IS NOT NULL OR hwid IS NOT NULL"));
// Ban exemption can't have flags 0 since that wouldn't exempt anything.
// The row should be removed if setting to 0.
modelBuilder.Entity<ServerBanExemption>().ToTable(t =>
t.HasCheckConstraint("FlagsNotZero", "flags != 0"));
modelBuilder.Entity<ServerRoleBan>()
.HasIndex(p => p.PlayerUserId);
modelBuilder.Entity<ServerRoleBan>()
.HasIndex(p => p.Address);
modelBuilder.Entity<ServerRoleBan>()
.HasIndex(p => p.PlayerUserId);
modelBuilder.Entity<ServerRoleUnban>()
.HasIndex(p => p.BanId)
.IsUnique();
modelBuilder.Entity<ServerRoleBan>().ToTable(t =>
t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR player_user_id IS NOT NULL OR hwid IS NOT NULL"));
modelBuilder.Entity<Player>()
.HasIndex(p => p.UserId)
.IsUnique();
modelBuilder.Entity<Player>()
.HasIndex(p => p.LastSeenUserName);
modelBuilder.Entity<ConnectionLog>()
.HasIndex(p => p.UserId);
modelBuilder.Entity<ConnectionLog>()
.HasIndex(p => p.Time);
modelBuilder.Entity<ConnectionLog>()
.Property(p => p.ServerId)
.HasDefaultValue(0);
modelBuilder.Entity<ConnectionLog>()
.HasOne(p => p.Server)
.WithMany(p => p.ConnectionLogs)
.OnDelete(DeleteBehavior.SetNull);
// SetNull is necessary for created by/edited by-s here,
// so you can safely delete admins (GDPR right to erasure) while keeping the notes intact
modelBuilder.Entity<AdminNote>()
.HasOne(note => note.Player)
.WithMany(player => player.AdminNotesReceived)
.HasForeignKey(note => note.PlayerUserId)
.HasPrincipalKey(player => player.UserId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<AdminNote>()
.HasOne(version => version.CreatedBy)
.WithMany(author => author.AdminNotesCreated)
.HasForeignKey(note => note.CreatedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminNote>()
.HasOne(version => version.LastEditedBy)
.WithMany(author => author.AdminNotesLastEdited)
.HasForeignKey(note => note.LastEditedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminNote>()
.HasOne(version => version.DeletedBy)
.WithMany(author => author.AdminNotesDeleted)
.HasForeignKey(note => note.DeletedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminWatchlist>()
.HasOne(note => note.Player)
.WithMany(player => player.AdminWatchlistsReceived)
.HasForeignKey(note => note.PlayerUserId)
.HasPrincipalKey(player => player.UserId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<AdminWatchlist>()
.HasOne(version => version.CreatedBy)
.WithMany(author => author.AdminWatchlistsCreated)
.HasForeignKey(note => note.CreatedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminWatchlist>()
.HasOne(version => version.LastEditedBy)
.WithMany(author => author.AdminWatchlistsLastEdited)
.HasForeignKey(note => note.LastEditedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminWatchlist>()
.HasOne(version => version.DeletedBy)
.WithMany(author => author.AdminWatchlistsDeleted)
.HasForeignKey(note => note.DeletedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminMessage>()
.HasOne(note => note.Player)
.WithMany(player => player.AdminMessagesReceived)
.HasForeignKey(note => note.PlayerUserId)
.HasPrincipalKey(player => player.UserId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<AdminMessage>()
.HasOne(version => version.CreatedBy)
.WithMany(author => author.AdminMessagesCreated)
.HasForeignKey(note => note.CreatedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminMessage>()
.HasOne(version => version.LastEditedBy)
.WithMany(author => author.AdminMessagesLastEdited)
.HasForeignKey(note => note.LastEditedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<AdminMessage>()
.HasOne(version => version.DeletedBy)
.WithMany(author => author.AdminMessagesDeleted)
.HasForeignKey(note => note.DeletedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
// A message cannot be "dismissed" without also being "seen".
modelBuilder.Entity<AdminMessage>().ToTable(t =>
t.HasCheckConstraint("NotDismissedAndSeen",
"NOT dismissed OR seen"));
modelBuilder.Entity<ServerBan>()
.HasOne(ban => ban.CreatedBy)
.WithMany(author => author.AdminServerBansCreated)
.HasForeignKey(ban => ban.BanningAdmin)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<ServerBan>()
.HasOne(ban => ban.LastEditedBy)
.WithMany(author => author.AdminServerBansLastEdited)
.HasForeignKey(ban => ban.LastEditedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<ServerRoleBan>()
.HasOne(ban => ban.CreatedBy)
.WithMany(author => author.AdminServerRoleBansCreated)
.HasForeignKey(ban => ban.BanningAdmin)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<ServerRoleBan>()
.HasOne(ban => ban.LastEditedBy)
.WithMany(author => author.AdminServerRoleBansLastEdited)
.HasForeignKey(ban => ban.LastEditedById)
.HasPrincipalKey(author => author.UserId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<RoleWhitelist>()
.HasOne(w => w.Player)
.WithMany(p => p.JobWhitelists)
.HasForeignKey(w => w.PlayerUserId)
.HasPrincipalKey(p => p.UserId)
.OnDelete(DeleteBehavior.Cascade);
// Changes for modern HWID integration
modelBuilder.Entity<Player>()
.OwnsOne(p => p.LastSeenHWId)
.Property(p => p.Hwid)
.HasColumnName("last_seen_hwid");
modelBuilder.Entity<Player>()
.OwnsOne(p => p.LastSeenHWId)
.Property(p => p.Type)
.HasDefaultValue(HwidType.Legacy);
modelBuilder.Entity<ServerBan>()
.OwnsOne(p => p.HWId)
.Property(p => p.Hwid)
.HasColumnName("hwid");
modelBuilder.Entity<ServerBan>()
.OwnsOne(p => p.HWId)
.Property(p => p.Type)
.HasDefaultValue(HwidType.Legacy);
modelBuilder.Entity<ServerRoleBan>()
.OwnsOne(p => p.HWId)
.Property(p => p.Hwid)
.HasColumnName("hwid");
modelBuilder.Entity<ServerRoleBan>()
.OwnsOne(p => p.HWId)
.Property(p => p.Type)
.HasDefaultValue(HwidType.Legacy);
modelBuilder.Entity<ConnectionLog>()
.OwnsOne(p => p.HWId)
.Property(p => p.Hwid)
.HasColumnName("hwid");
modelBuilder.Entity<ConnectionLog>()
.OwnsOne(p => p.HWId)
.Property(p => p.Type)
.HasDefaultValue(HwidType.Legacy);
}
public virtual IQueryable<AdminLog> SearchLogs(IQueryable<AdminLog> query, string searchText)
{
return query.Where(log => EF.Functions.Like(log.Message, "%" + searchText + "%"));
}
public abstract int CountAdminLogs();
}
public class Preference
{
// NOTE: on postgres there SHOULD be an FK ensuring that the selected character slot always exists.
// I had to use a migration to implement it and as a result its creation is a finicky mess.
// Because if I let EFCore know about it it would explode on a circular reference.
// Also it has to be DEFERRABLE INITIALLY DEFERRED so that insertion of new preferences works.
// Also I couldn't figure out how to create it on SQLite.
public int Id { get; set; }
public Guid UserId { get; set; }
public int SelectedCharacterSlot { get; set; }
public string AdminOOCColor { get; set; } = null!;
public List<Profile> Profiles { get; } = new();
}
public class Profile
{
public int Id { get; set; }
public int Slot { get; set; }
[Column("char_name")] public string CharacterName { get; set; } = null!;
public string FlavorText { get; set; } = null!;
public int Age { get; set; }
public string Sex { get; set; } = null!;
public string Gender { get; set; } = null!;
public string Species { get; set; } = null!;
[Column(TypeName = "jsonb")] public JsonDocument? Markings { get; set; } = null!;
public string HairName { get; set; } = null!;
public string HairColor { get; set; } = null!;
public string FacialHairName { get; set; } = null!;
public string FacialHairColor { get; set; } = null!;
public string EyeColor { get; set; } = null!;
public string SkinColor { get; set; } = null!;
public int SpawnPriority { get; set; } = 0;
public List<Job> Jobs { get; } = new();
public List<Antag> Antags { get; } = new();
public List<Trait> Traits { get; } = new();
public List<ProfileRoleLoadout> Loadouts { get; } = new();
[Column("pref_unavailable")] public DbPreferenceUnavailableMode PreferenceUnavailable { get; set; }
public int PreferenceId { get; set; }
public Preference Preference { get; set; } = null!;
}
public class Job
{
public int Id { get; set; }
public Profile Profile { get; set; } = null!;
public int ProfileId { get; set; }
public string JobName { get; set; } = null!;
public DbJobPriority Priority { get; set; }
}
public enum DbJobPriority
{
// These enum values HAVE to match the ones in JobPriority in Content.Shared
Never = 0,
Low = 1,
Medium = 2,
High = 3
}
public class Antag
{
public int Id { get; set; }
public Profile Profile { get; set; } = null!;
public int ProfileId { get; set; }
public string AntagName { get; set; } = null!;
}
public class Trait
{
public int Id { get; set; }
public Profile Profile { get; set; } = null!;
public int ProfileId { get; set; }
public string TraitName { get; set; } = null!;
}
#region Loadouts
/// <summary>
/// Corresponds to a single role's loadout inside the DB.
/// </summary>
public class ProfileRoleLoadout
{
public int Id { get; set; }
public int ProfileId { get; set; }
public Profile Profile { get; set; } = null!;
/// <summary>
/// The corresponding role prototype on the profile.
/// </summary>
public string RoleName { get; set; } = string.Empty;
/// <summary>
/// Store the saved loadout groups. These may get validated and removed when loaded at runtime.
/// </summary>
public List<ProfileLoadoutGroup> Groups { get; set; } = new();
}
/// <summary>
/// Corresponds to a loadout group prototype with the specified loadouts attached.
/// </summary>
public class ProfileLoadoutGroup
{
public int Id { get; set; }
public int ProfileRoleLoadoutId { get; set; }
/// <summary>
/// The corresponding RoleLoadout that owns this.
/// </summary>
public ProfileRoleLoadout ProfileRoleLoadout { get; set; } = null!;
/// <summary>
/// The corresponding group prototype.
/// </summary>
public string GroupName { get; set; } = string.Empty;
/// <summary>
/// Selected loadout prototype. Null if none is set.
/// May get validated at runtime and updated to to the default.
/// </summary>
public List<ProfileLoadout> Loadouts { get; set; } = new();
}
/// <summary>
/// Corresponds to a selected loadout.
/// </summary>
public class ProfileLoadout
{
public int Id { get; set; }
public int ProfileLoadoutGroupId { get; set; }
public ProfileLoadoutGroup ProfileLoadoutGroup { get; set; } = null!;
/// <summary>
/// Corresponding loadout prototype.
/// </summary>
public string LoadoutName { get; set; } = string.Empty;
/*
* Insert extra data here like custom descriptions or colors or whatever.
*/
}
#endregion
public enum DbPreferenceUnavailableMode
{
// These enum values HAVE to match the ones in PreferenceUnavailableMode in Shared.
StayInLobby = 0,
SpawnAsOverflow,
}
public class AssignedUserId
{
public int Id { get; set; }
public string UserName { get; set; } = null!;
public Guid UserId { get; set; }
}
[Table("player")]
public class Player
{
public int Id { get; set; }
// Permanent data
public Guid UserId { get; set; }
public DateTime FirstSeenTime { get; set; }
// Data that gets updated on each join.
public string LastSeenUserName { get; set; } = null!;
public DateTime LastSeenTime { get; set; }
public IPAddress LastSeenAddress { get; set; } = null!;
public TypedHwid? LastSeenHWId { get; set; }
// Data that changes with each round
public List<Round> Rounds { get; set; } = null!;
public List<AdminLogPlayer> AdminLogs { get; set; } = null!;
public DateTime? LastReadRules { get; set; }
public List<AdminNote> AdminNotesReceived { get; set; } = null!;
public List<AdminNote> AdminNotesCreated { get; set; } = null!;
public List<AdminNote> AdminNotesLastEdited { get; set; } = null!;
public List<AdminNote> AdminNotesDeleted { get; set; } = null!;
public List<AdminWatchlist> AdminWatchlistsReceived { get; set; } = null!;
public List<AdminWatchlist> AdminWatchlistsCreated { get; set; } = null!;
public List<AdminWatchlist> AdminWatchlistsLastEdited { get; set; } = null!;
public List<AdminWatchlist> AdminWatchlistsDeleted { get; set; } = null!;
public List<AdminMessage> AdminMessagesReceived { get; set; } = null!;
public List<AdminMessage> AdminMessagesCreated { get; set; } = null!;
public List<AdminMessage> AdminMessagesLastEdited { get; set; } = null!;
public List<AdminMessage> AdminMessagesDeleted { get; set; } = null!;
public List<ServerBan> AdminServerBansCreated { get; set; } = null!;
public List<ServerBan> AdminServerBansLastEdited { get; set; } = null!;
public List<ServerRoleBan> AdminServerRoleBansCreated { get; set; } = null!;
public List<ServerRoleBan> AdminServerRoleBansLastEdited { get; set; } = null!;
public List<RoleWhitelist> JobWhitelists { get; set; } = null!;
}
[Table("whitelist")]
public class Whitelist
{
[Required, Key] public Guid UserId { get; set; }
}
/// <summary>
/// List of users who are on the "blacklist". This is a list that may be used by Whitelist implementations to deny access to certain users.
/// </summary>
[Table("blacklist")]
public class Blacklist
{
[Required, Key] public Guid UserId { get; set; }
}
public class Admin
{
[Key] public Guid UserId { get; set; }
public string? Title { get; set; }
/// <summary>
/// If true, the admin is voluntarily deadminned. They can re-admin at any time.
/// </summary>
public bool Deadminned { get; set; }
/// <summary>
/// If true, the admin is suspended by an admin with <c>PERMISSIONS</c>. They will not have in-game permissions.
/// </summary>
public bool Suspended { get; set; }
public int? AdminRankId { get; set; }
public AdminRank? AdminRank { get; set; }
public List<AdminFlag> Flags { get; set; } = default!;
}
public class AdminFlag
{
public int Id { get; set; }
public string Flag { get; set; } = default!;
public bool Negative { get; set; }
public Guid AdminId { get; set; }
public Admin Admin { get; set; } = default!;
}
public class AdminRank
{
public int Id { get; set; }
public string Name { get; set; } = default!;
public List<Admin> Admins { get; set; } = default!;
public List<AdminRankFlag> Flags { get; set; } = default!;
}
public class AdminRankFlag
{
public int Id { get; set; }
public string Flag { get; set; } = default!;
public int AdminRankId { get; set; }
public AdminRank Rank { get; set; } = default!;
}
public class Round
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime? StartDate { get; set; }
public List<Player> Players { get; set; } = default!;
public List<AdminLog> AdminLogs { get; set; } = default!;
[ForeignKey("Server")] public int ServerId { get; set; }
public Server Server { get; set; } = default!;
}
public class Server
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; } = default!;
[InverseProperty(nameof(Round.Server))]
public List<Round> Rounds { get; set; } = default!;
[InverseProperty(nameof(ConnectionLog.Server))]
public List<ConnectionLog> ConnectionLogs { get; set; } = default!;
}
[Index(nameof(Type))]
public class AdminLog
{
[Key, ForeignKey("Round")] public int RoundId { get; set; }
[Key]
public int Id { get; set; }
public Round Round { get; set; } = default!;
[Required] public LogType Type { get; set; }
[Required] public LogImpact Impact { get; set; }
[Required] public DateTime Date { get; set; }
[Required] public string Message { get; set; } = default!;
[Required, Column(TypeName = "jsonb")] public JsonDocument Json { get; set; } = default!;
public List<AdminLogPlayer> Players { get; set; } = default!;
}
public class AdminLogPlayer
{
[Required, Key] public int RoundId { get; set; }
[Required, Key] public int LogId { get; set; }
[Required, Key, ForeignKey("Player")] public Guid PlayerUserId { get; set; }
public Player Player { get; set; } = default!;
[ForeignKey("RoundId,LogId")] public AdminLog Log { get; set; } = default!;
}
// Used by SS14.Admin
public interface IBanCommon<TUnban> where TUnban : IUnbanCommon
{
int Id { get; set; }
Guid? PlayerUserId { get; set; }
NpgsqlInet? Address { get; set; }
TypedHwid? HWId { get; set; }
DateTime BanTime { get; set; }
DateTime? ExpirationTime { get; set; }
string Reason { get; set; }
NoteSeverity Severity { get; set; }
Guid? BanningAdmin { get; set; }
TUnban? Unban { get; set; }
}
// Used by SS14.Admin
public interface IUnbanCommon
{
int Id { get; set; }
int BanId { get; set; }
Guid? UnbanningAdmin { get; set; }
DateTime UnbanTime { get; set; }
}
/// <summary>
/// Flags for use with <see cref="ServerBanExemption"/>.
/// </summary>
[Flags]
public enum ServerBanExemptFlags
{
// @formatter:off
None = 0,
/// <summary>
/// Ban is a datacenter range, connections usually imply usage of a VPN service.
/// </summary>
Datacenter = 1 << 0,
/// <summary>
/// Ban only matches the IP.
/// </summary>
/// <remarks>
/// Intended use is for users with shared connections. This should not be used as an alternative to <see cref="Datacenter"/>.
/// </remarks>
IP = 1 << 1,
/// <summary>
/// Ban is an IP range that is only applied for first time joins.
/// </summary>
/// <remarks>
/// Intended for use with residential IP ranges that are often used maliciously.
/// </remarks>
BlacklistedRange = 1 << 2,
/// <summary>
/// Represents having all possible exemption flags.
/// </summary>
All = int.MaxValue,
// @formatter:on
}
/// <summary>
/// A ban from playing on the server.
/// If an incoming connection matches any of UserID, IP, or HWID, they will be blocked from joining the server.
/// </summary>
/// <remarks>
/// At least one of UserID, IP, or HWID must be given (otherwise the ban would match nothing).
/// </remarks>
[Table("server_ban"), Index(nameof(PlayerUserId))]
public class ServerBan : IBanCommon<ServerUnban>
{
public int Id { get; set; }
[ForeignKey("Round")]
public int? RoundId { get; set; }
public Round? Round { get; set; }
/// <summary>
/// The user ID of the banned player.
/// </summary>
public Guid? PlayerUserId { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
/// <summary>
/// CIDR IP address range of the ban. The whole range can match the ban.
/// </summary>
public NpgsqlInet? Address { get; set; }
/// <summary>
/// Hardware ID of the banned player.
/// </summary>
public TypedHwid? HWId { get; set; }
/// <summary>
/// The time when the ban was applied by an administrator.
/// </summary>
public DateTime BanTime { get; set; }
/// <summary>
/// The time the ban will expire. If null, the ban is permanent and will not expire naturally.
/// </summary>
public DateTime? ExpirationTime { get; set; }
/// <summary>
/// The administrator-stated reason for applying the ban.
/// </summary>
public string Reason { get; set; } = null!;
/// <summary>
/// The severity of the incident
/// </summary>
public NoteSeverity Severity { get; set; }
/// <summary>
/// User ID of the admin that applied the ban.
/// </summary>
[ForeignKey("CreatedBy")]
public Guid? BanningAdmin { get; set; }
public Player? CreatedBy { get; set; }
/// <summary>
/// User ID of the admin that last edited the note
/// </summary>
[ForeignKey("LastEditedBy")]
public Guid? LastEditedById { get; set; }
public Player? LastEditedBy { get; set; }
/// <summary>
/// When the ban was last edited
/// </summary>
public DateTime? LastEditedAt { get; set; }
/// <summary>
/// Optional flags that allow adding exemptions to the ban via <see cref="ServerBanExemption"/>.
/// </summary>
public ServerBanExemptFlags ExemptFlags { get; set; }
/// <summary>
/// If present, an administrator has manually repealed this ban.
/// </summary>
public ServerUnban? Unban { get; set; }
/// <summary>
/// Whether this ban should be automatically deleted from the database when it expires.
/// </summary>
/// <remarks>
/// This isn't done automatically by the game,
/// you will need to set up something like a cron job to clear this from your database,
/// using a command like this:
/// psql -d ss14 -c "DELETE FROM server_ban WHERE auto_delete AND expiration_time &lt; NOW()"
/// </remarks>
public bool AutoDelete { get; set; }
/// <summary>
/// Whether to display this ban in the admin remarks (notes) panel
/// </summary>
public bool Hidden { get; set; }
public List<ServerBanHit> BanHits { get; set; } = null!;
}
/// <summary>
/// An explicit repeal of a <see cref="ServerBan"/> by an administrator.
/// Having an entry for a ban neutralizes it.
/// </summary>
[Table("server_unban")]
public class ServerUnban : IUnbanCommon
{
[Column("unban_id")] public int Id { get; set; }
/// <summary>
/// The ID of ban that is being repealed.
/// </summary>
public int BanId { get; set; }
/// <summary>
/// The ban that is being repealed.
/// </summary>
public ServerBan Ban { get; set; } = null!;
/// <summary>
/// The admin that repealed the ban.
/// </summary>
public Guid? UnbanningAdmin { get; set; }
/// <summary>
/// The time the ban repealed.
/// </summary>
public DateTime UnbanTime { get; set; }
}
/// <summary>
/// An exemption for a specific user to a certain type of <see cref="ServerBan"/>.
/// </summary>
/// <example>
/// Certain players may need to be exempted from VPN bans due to issues with their ISP.
/// We would tag all VPN bans with <see cref="ServerBanExemptFlags.Datacenter"/>,
/// and then add an exemption for these players to this table with the same flag.
/// They will only be exempted from VPN bans, other bans (if they manage to get any) will still apply.
/// </example>
[Table("server_ban_exemption")]
public sealed class ServerBanExemption
{
/// <summary>
/// The UserID of the exempted player.
/// </summary>
[Key]
public Guid UserId { get; set; }
/// <summary>
/// The ban flags to exempt this player from.
/// If any bit overlaps <see cref="ServerBan.ExemptFlags"/>, the ban is ignored.
/// </summary>
public ServerBanExemptFlags Flags { get; set; }
}
[Table("connection_log")]
public class ConnectionLog
{
public int Id { get; set; }
public Guid UserId { get; set; }
public string UserName { get; set; } = null!;
public DateTime Time { get; set; }
public IPAddress Address { get; set; } = null!;
public TypedHwid? HWId { get; set; }
public ConnectionDenyReason? Denied { get; set; }
/// <summary>
/// ID of the <see cref="Server"/> that the connection was attempted to.
/// </summary>
/// <remarks>
/// <para>
/// The default value of this column is set to <c>0</c>, which is the ID of the "<c>unknown</c>" server.
/// This is intended for old entries (that didn't track this) and if the server name isn't configured.
/// </para>
/// </remarks>
public int ServerId { get; set; }
public List<ServerBanHit> BanHits { get; set; } = null!;
public Server Server { get; set; } = null!;
public float Trust { get; set; }
}
public enum ConnectionDenyReason : byte
{
Ban = 0,
Whitelist = 1,
Full = 2,
Panic = 3,
/*
* If baby jail is removed, please reserve this value for as long as can reasonably be done to prevent causing ambiguity in connection denial reasons.
* Reservation by commenting out the value is likely sufficient for this purpose, but may impact projects which depend on SS14 like SS14.Admin.
*
* Edit: It has
*/
BabyJail = 4,
/// Results from rejected connections with external API checking tools
IPChecks = 5,
}
public class ServerBanHit
{
public int Id { get; set; }
public int BanId { get; set; }
public int ConnectionId { get; set; }
public ServerBan Ban { get; set; } = null!;
public ConnectionLog Connection { get; set; } = null!;
}
[Table("server_role_ban"), Index(nameof(PlayerUserId))]
public sealed class ServerRoleBan : IBanCommon<ServerRoleUnban>
{
public int Id { get; set; }
public int? RoundId { get; set; }
public Round? Round { get; set; }
public Guid? PlayerUserId { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
public NpgsqlInet? Address { get; set; }
public TypedHwid? HWId { get; set; }
public DateTime BanTime { get; set; }
public DateTime? ExpirationTime { get; set; }
public string Reason { get; set; } = null!;
public NoteSeverity Severity { get; set; }
[ForeignKey("CreatedBy")] public Guid? BanningAdmin { get; set; }
public Player? CreatedBy { get; set; }
[ForeignKey("LastEditedBy")] public Guid? LastEditedById { get; set; }
public Player? LastEditedBy { get; set; }
public DateTime? LastEditedAt { get; set; }
public ServerRoleUnban? Unban { get; set; }
public bool Hidden { get; set; }
public string RoleId { get; set; } = null!;
}
[Table("server_role_unban")]
public sealed class ServerRoleUnban : IUnbanCommon
{
[Column("role_unban_id")] public int Id { get; set; }
public int BanId { get; set; }
public ServerRoleBan Ban { get; set; } = null!;
public Guid? UnbanningAdmin { get; set; }
public DateTime UnbanTime { get; set; }
}
[Table("play_time")]
public sealed class PlayTime
{
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required, ForeignKey("player")]
public Guid PlayerId { get; set; }
public string Tracker { get; set; } = null!;
public TimeSpan TimeSpent { get; set; }
}
[Table("uploaded_resource_log")]
public sealed class UploadedResourceLog
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime Date { get; set; }
public Guid UserId { get; set; }
public string Path { get; set; } = string.Empty;
public byte[] Data { get; set; } = default!;
}
// Note: this interface isn't used by the game, but it *is* used by SS14.Admin.
// Don't remove! Or face the consequences!
public interface IAdminRemarksCommon
{
public int Id { get; }
public int? RoundId { get; }
public Round? Round { get; }
public Guid? PlayerUserId { get; }
public Player? Player { get; }
public TimeSpan PlaytimeAtNote { get; }
public string Message { get; }
public Player? CreatedBy { get; }
public DateTime CreatedAt { get; }
public Player? LastEditedBy { get; }
public DateTime? LastEditedAt { get; }
public DateTime? ExpirationTime { get; }
public bool Deleted { get; }
}
[Index(nameof(PlayerUserId))]
public class AdminNote : IAdminRemarksCommon
{
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }
[ForeignKey("Round")] public int? RoundId { get; set; }
public Round? Round { get; set; }
[ForeignKey("Player")] public Guid? PlayerUserId { get; set; }
public Player? Player { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
[Required, MaxLength(4096)] public string Message { get; set; } = string.Empty;
[Required] public NoteSeverity Severity { get; set; }
[ForeignKey("CreatedBy")] public Guid? CreatedById { get; set; }
public Player? CreatedBy { get; set; }
[Required] public DateTime CreatedAt { get; set; }
[ForeignKey("LastEditedBy")] public Guid? LastEditedById { get; set; }
public Player? LastEditedBy { get; set; }
[Required] public DateTime? LastEditedAt { get; set; }
public DateTime? ExpirationTime { get; set; }
public bool Deleted { get; set; }
[ForeignKey("DeletedBy")] public Guid? DeletedById { get; set; }
public Player? DeletedBy { get; set; }
public DateTime? DeletedAt { get; set; }
public bool Secret { get; set; }
}
[Index(nameof(PlayerUserId))]
public class AdminWatchlist : IAdminRemarksCommon
{
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }
[ForeignKey("Round")] public int? RoundId { get; set; }
public Round? Round { get; set; }
[ForeignKey("Player")] public Guid? PlayerUserId { get; set; }
public Player? Player { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
[Required, MaxLength(4096)] public string Message { get; set; } = string.Empty;
[ForeignKey("CreatedBy")] public Guid? CreatedById { get; set; }
public Player? CreatedBy { get; set; }
[Required] public DateTime CreatedAt { get; set; }
[ForeignKey("LastEditedBy")] public Guid? LastEditedById { get; set; }
public Player? LastEditedBy { get; set; }
[Required] public DateTime? LastEditedAt { get; set; }
public DateTime? ExpirationTime { get; set; }
public bool Deleted { get; set; }
[ForeignKey("DeletedBy")] public Guid? DeletedById { get; set; }
public Player? DeletedBy { get; set; }
public DateTime? DeletedAt { get; set; }
}
[Index(nameof(PlayerUserId))]
public class AdminMessage : IAdminRemarksCommon
{
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }
[ForeignKey("Round")] public int? RoundId { get; set; }
public Round? Round { get; set; }
[ForeignKey("Player")]
public Guid? PlayerUserId { get; set; }
public Player? Player { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
[Required, MaxLength(4096)] public string Message { get; set; } = string.Empty;
[ForeignKey("CreatedBy")] public Guid? CreatedById { get; set; }
public Player? CreatedBy { get; set; }
[Required] public DateTime CreatedAt { get; set; }
[ForeignKey("LastEditedBy")] public Guid? LastEditedById { get; set; }
public Player? LastEditedBy { get; set; }
public DateTime? LastEditedAt { get; set; }
public DateTime? ExpirationTime { get; set; }
public bool Deleted { get; set; }
[ForeignKey("DeletedBy")] public Guid? DeletedById { get; set; }
public Player? DeletedBy { get; set; }
public DateTime? DeletedAt { get; set; }
/// <summary>
/// Whether the message has been seen at least once by the player.
/// </summary>
public bool Seen { get; set; }
/// <summary>
/// Whether the message has been dismissed permanently by the player.
/// </summary>
public bool Dismissed { get; set; }
}
[PrimaryKey(nameof(PlayerUserId), nameof(RoleId))]
public class RoleWhitelist
{
[Required, ForeignKey("Player")]
public Guid PlayerUserId { get; set; }
public Player Player { get; set; } = default!;
[Required]
public string RoleId { get; set; } = default!;
}
/// <summary>
/// Defines a template that admins can use to quickly fill out ban information.
/// </summary>
/// <remarks>
/// <para>
/// This information is not currently used by the game itself, but it is used by SS14.Admin.
/// </para>
/// </remarks>
public sealed class BanTemplate
{
public int Id { get; set; }
/// <summary>
/// Title of the ban template. This is purely for reference by admins and not copied into the ban.
/// </summary>
public required string Title { get; set; }
/// <summary>
/// How long the ban should last. 0 for permanent.
/// </summary>
public TimeSpan Length { get; set; }
/// <summary>
/// The reason for the ban.
/// </summary>
/// <seealso cref="ServerBan.Reason"/>
public string Reason { get; set; } = "";
/// <summary>
/// Exemptions granted to the ban.
/// </summary>
/// <seealso cref="ServerBan.ExemptFlags"/>
public ServerBanExemptFlags ExemptFlags { get; set; }
/// <summary>
/// Severity of the ban
/// </summary>
/// <seealso cref="ServerBan.Severity"/>
public NoteSeverity Severity { get; set; }
/// <summary>
/// Ban will be automatically deleted once expired.
/// </summary>
/// <seealso cref="ServerBan.AutoDelete"/>
public bool AutoDelete { get; set; }
/// <summary>
/// Ban is not visible to players in the remarks menu.
/// </summary>
/// <seealso cref="ServerBan.Hidden"/>
public bool Hidden { get; set; }
}
/// <summary>
/// A hardware ID value together with its <see cref="HwidType"/>.
/// </summary>
/// <seealso cref="ImmutableTypedHwid"/>
[Owned]
public sealed class TypedHwid
{
public byte[] Hwid { get; set; } = default!;
public HwidType Type { get; set; }
[return: NotNullIfNotNull(nameof(immutable))]
public static implicit operator TypedHwid?(ImmutableTypedHwid? immutable)
{
if (immutable == null)
return null;
return new TypedHwid
{
Hwid = immutable.Hwid.ToArray(),
Type = immutable.Type,
};
}
[return: NotNullIfNotNull(nameof(hwid))]
public static implicit operator ImmutableTypedHwid?(TypedHwid? hwid)
{
if (hwid == null)
return null;
return new ImmutableTypedHwid(hwid.Hwid.ToImmutableArray(), hwid.Type);
}
}
/// <summary>
/// Cache for the IPIntel system
/// </summary>
public class IPIntelCache
{
public int Id { get; set; }
/// <summary>
/// The IP address (duh). This is made unique manually for psql cause of ef core bug.
/// </summary>
public IPAddress Address { get; set; } = null!;
/// <summary>
/// Date this record was added. Used to check if our cache is out of date.
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// The score IPIntel returned
/// </summary>
public float Score { get; set; }
}
}