Commit Graph

72 Commits

Author SHA1 Message Date
Paul Ritter
80f9f24243 Serialization v3 aka constant suffering (#1606)
* oops

* fixes serialization il

* copytest

* typo & misc fixes

* 139 moment

* boxing

* mesa dum

* stuff

* goodbye bad friend

* last commit before the big (4) rewrite

* adds datanodes

* kills yamlobjserializer in favor of the new system

* adds more serializers, actually implements them & removes most of the last of the old system

* changed yamlfieldattribute namespace

* adds back iselfserialize

* refactors consts&flags

* renames everything to data(field/definition)

* adds afterserialization

* help

* dataclassgen

* fuggen help me mannen

* Fix most errors on content

* Fix engine errors except map loader

* maploader & misc fix

* misc fixes

* thing

* help

* refactors datanodes

* help me mannen

* Separate ITypeSerializer into reader and writer

* Convert all type serializers

* priority

* adds alot

* il fixes

* adds robustgen

* argh

* adds array & enum serialization

* fixes dataclasses

* adds vec2i / misc fixes

* fixes inheritance

* a very notcursed todo

* fixes some custom dataclasses

* push dis

* Remove data classes

* boutta box

* yes

* Add angle and regex serializer tests

* Make TypeSerializerTest abstract

* sets up ioc etc

* remove pushinheritance

* fixes

* Merge fixes, fix yaml hot reloading

* General fixes2

* Make enum serialization ignore case

* Fix the tag not being copied in data nodes

* Fix not properly serializing flag enums

* Fix component serialization on startup

* Implement ValueDataNode ToString

* Serialization IL fixes, fix return and string equality

* Remove async from prototype manager

* Make serializing unsupported node as enum exception more descriptive

* Fix serv3 tryread casting to serializer instead of reader

* Add constructor for invalid node type exception

* Temporary fix for SERV3: Turn populate delegate into regular code

* Fix not copying the data of non primitive types

* Fix not using the data definition found in copying

* Make ISerializationHooks require explicit implementations

* Add test for serialization inheritance

* Improve IsOverridenIn method

* Fix error message when a data definition is null

* Add method to cast a read value in Serv3Manager

* Rename IServ3Manager to ISerializationManager

* Rename usages of serv3manager, add generic copy method

* Fix IL copy method lookup

* Rename old usages of serv3manager

* Add ITypeCopier

* resistance is futile

* we will conquer this codebase

* Add copy method to all serializers

* Make primitive mismatch error message more descriptive

* bing bong im going to freacking heck

* oopsie moment

* hello are you interested in my wares

* does generic serializers under new architecture

* Convert every non generic serializer to the new format, general fixes

* Update usgaes of generic serializers, cleanup

* does some pushinheritance logic

* finishes pushinheritance FRAMEWORK

* shed

* Add box2, color and component registry serializer tests

* Create more deserialized types and store prototypes with their deserialized results

* Fixes and serializer updates

* Add serialization manager extensions

* adds pushinheritance

* Update all prototypes to have a parent and have consistent id/parent properties

* Fix grammar component serialization

* Add generic serializer tests

* thonk

* Add array serializer test

* Replace logger warning calls with exceptions

* fixes

* Move redundant methods to serialization manager extensions, cleanup

* Add array serialization

* fixes context

* more fixes

* argh

* inheritance

* this should do it

* fixes

* adds copiers & fixes some stuff

* copiers use context v1

* finishing copy context

* more context fixes

* Test fixes

* funky maps

* Fix server user interface component serialization

* Fix value tuple serialization

* Add copying for value types and arrays. Fix copy internal for primitives, enums and strings

* fixes

* fixes more stuff

* yes

* Make abstract/interface skips debugs instead of warnings

* Fix typo

* Make some dictionaries readonly

* Add checks for the serialization manager initializing and already being initialized

* Add base type required and usage for MeansDataDefinition and ImplicitDataDefinitionForInheritorsAttribute

* copy by ref

* Fix exception wording

* Update data field required summary with the new forbidden docs

* Use extension in map loader

* wanna erp

* Change serializing to not use il temporarily

* Make writing work with nullable types

* pushing

* check

* cuddling slaps HARD

* Add serialization priority test

* important fix

* a serialization thing

* serializer moment

* Add validation for some type serializers

* adds context

* moar context

* fixes

* Do the thing for appearance

* yoo lmao

* push haha pp

* Temporarily make copy delegate regular c# code

* Create deserialized component registry to handle not inheriting conflicting references

* YAML LINTER BABY

* ayes

* Fix sprite component norot not being default true like in latest master

* Remove redundant todos

* Add summary doc to every ISerializationManager method

* icon fixes

* Add skip hook argument to readers and copiers

* Merge fixes

* Fix ordering of arguments in read and copy reflection call

* Fix user interface components deserialization

* pew pew

* i am going to HECK

* Add MustUseReturnValue to copy-over methods

* Make serialization log calls use the same sawmill

* gamin

* Fix doc errors in ISerializationManager.cs

* goodbye brave soldier

* fixes

* WIP merge fixes and entity serialization

* aaaaaaaaaaaaaaa

* aaaaaaaaaaaaaaa

* adds inheritancebehaviour

* test/datafield fixes

* forgot that one

* adds more verbose validation

* This fixes the YAML hot reloading

* Replace yield break with Enumerable.Empty

* adds copiers

* aaaaaaaaaaaaa

* array fix
priority fix
misc fixes

* fix(?)

* fix.

* funny map serialization (wip)

* funny map serialization (wip)

* Add TODO

* adds proper info the validation

* Make yaml linter 5 times faster (~80% less execution time)

* Improves the error message for missing fields in the linter

* Include component name in unknown component type error node

* adds alwaysrelevant usa

* fixes mapsaving

* moved surpressor to analyzers proj

* warning cleanup & moves surpressor

* removes old msbuild targets

* Revert "Make yaml linter 5 times faster (~80% less execution time)"

This reverts commit 2ee4cc2c26.

* Add serialization to RobustServerSimulation and mock reflection methods
Fixes container tests

* Fix nullability warnings

* Improve yaml linter message feedback

* oops moment

* Add IEquatable, IComparable, ToString and operators to DataPosition
Rename it to NodeMark
Make it a readonly struct

* Remove try catch from enum parsing

* Make dependency management in serialization less bad

* Make dependencies an argument instead of a property on the serialization manager

* Clean up type serializers

* Improve validation messages and resourc epath checking

* Fix sprite error message

* reached perfection

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: Vera Aguilera Puerto <zddm@outlook.es>
2021-03-04 15:59:14 -08:00
Pieter-Jan Briers
93018c9843 Silence localization warnings on client again. 2021-03-03 16:02:30 +01:00
Pieter-Jan Briers
cdd38abab5 Fix two shutdown crashes by removing IDisposable managers. 2021-02-28 23:10:03 +01:00
Pieter-Jan Briers
2ace0e9e5a Expose Patreon tier info from auth server. 2021-02-28 18:45:01 +01:00
Pieter-Jan Briers
028724c47b Localization improvements:
*Allow content to define localization functions.
* Add rldloc command to reload localizations.
* Doc comments
* Error handling
* Parallelize loading of localization files, since I can only assume we'll have a lot eventually.
* Type system stuff to allow content to pass custom data types into fluent.
* Code cleanup.
2021-02-23 11:35:54 +01:00
Pieter-Jan Briers
78c132fdab Mute loc warnings for the time being. 2021-02-22 08:57:30 +01:00
DrSmugleaf
eada37378a Add YAML hot reloading (#1571)
* Implement hot reloading for entity prototypes

* Implement automatic prototype hot-reloading

* Merge fixes

* Add yaml hot reloading and a message to notify the client

* Add reloading only changed files, remove cooldown, add retries and remove IPrototype

* Remove reload command

* Make the client listen for reloads instead and only when focused

* Fix errors

* Only queue a reload when the queue has items in it

* Make fails after 10 retries log instead of throw if reloading

Co-authored-by: Jackson Lewis <inquisitivepenguin@protonmail.com>
2021-02-20 00:02:04 +01:00
Acruid
fdb5e014b5 PauseManager moved to Shared (#1553)
* Moved IPauseManager from server to shared.

* Moved ITimerManager from Timers to Timing.

* Added missing IConsoleHost to server/client RegisterIoC. Tests work again.
2021-02-18 20:12:26 -08:00
Acruid
2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00
Pieter-Jan Briers
69daaca399 Remove CVar.SECURE and replace auth CVars with env variables. 2021-02-09 01:50:42 +01:00
Acruid
3eb6e067f9 Console Unify (#1513)
* Renamed shared ICommand to IConsoleCommand.

* Lots of refactoring into a shared context.

* Removed ICommonSession from server concmd Execute.

* Added argStr parameter to concmd execute.

* The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands.

# Conflicts:
#	Robust.Client/Console/Commands/Debug.cs

* Finally move shells and commands into shared.

* Console commands can now be registered directly without a class in a shared context.

* Pulled up ConsoleHost and Console shell into a shared context.

* Pulled up half the functions of ConsoleHost into a shared context.

* Repair rebase damage.

* Make LoadConsoleCommands function not remove any previously registered commands.
2021-02-01 16:40:26 -08:00
Acruid
cd3a85ea04 Replicated CVars (#1489) 2021-01-13 10:02:08 +01:00
Pieter-Jan Briers
f7c28992f8 Disable string map caching to hopefully fix connect. 2020-12-17 00:48:15 +01:00
Pieter-Jan Briers
13e9fe12ce Further fixes to loader exe.
Fix ordering of loads.
Fix loads.
2020-12-13 16:12:32 +01:00
Pieter-Jan Briers
f15c1c7a95 Allow engine to be loaded from a zip file itself. 2020-12-12 11:12:37 +01:00
Ygg01
ad8b0b3c83 Add bytes or sbytes to enum where available (#1430)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-12-08 12:46:30 +01:00
Pieter-Jan Briers
4c72103a97 Do not load SECURE cvars from config file.
To avoid funny business by content.
2020-12-04 11:27:41 +01:00
Pieter-Jan Briers
953120aa76 Move various config manager APIs to internal. 2020-12-04 11:15:09 +01:00
Pieter-Jan Briers
ede4962751 Allow specifying resource mount parameters via command line.
Necessary for engine versioning.
2020-12-04 00:15:08 +01:00
Pieter-Jan Briers
1d26adf746 Stuff related to IResourceManager.TryGetDiskFilePath.
Makes it not a "temporary todo remove" API since it has merits in e.g. assembly loading performance (.NET can mmap the assembly if it has a disk path which is better).

Removed duplicated IResourceManagerInternal APIs in IResourceCache.
2020-11-28 14:59:27 +01:00
Pieter-Jan Briers
a41f64f30e sandboxing (#1408) 2020-11-26 23:37:31 +01:00
Pieter-Jan Briers
69fe81ef20 ConGroups are gone. Long live admin flags in content. (#1371) 2020-11-13 01:10:30 +01:00
Pieter-Jan Briers
362b7804d9 Fix issues with .NET 5. 2020-11-11 00:46:35 +01:00
Pieter-Jan Briers
b69aa3c062 Oops 2020-09-26 13:32:29 +02:00
Pieter-Jan Briers
0c6d612723 Wow I really messed that up huh. 2020-09-25 22:09:24 +02:00
Pieter-Jan Briers
7de08ac592 Define CVars in a central location.
Instead of a bunch of RegisterCVar<> calls, it's now similar to Key Functions.
2020-09-25 21:21:18 +02:00
Pieter-Jan Briers
3ea73e9d2a Various OpenGL fixes.
1. Fixes screenshots on ES by providing a fallback path for when encessary features (PBO, fence sync, mapbuffer) are not available.
2. Correctly detect fence sync as not always being available for 3.1
3. Remove the "bad OpenGL version" box. We have MessageBoxW now.
4. Separated feature detection for ES and Desktop, added more feature detections on various sides.
5. Moved GL feature detection to its own file.
2020-09-02 01:47:12 +02:00
Acruid
900bf76a7d Attempt #2 to fix the timing bugs. CurTime increases again, and all the unit tests pass this time.
This resolves https://github.com/space-wizards/space-station-14/issues/1560.
Special thanks to PJB's prediction unit tests.
2020-07-31 23:20:35 -07:00
Pieter-Jan Briers
449ed4ad7c Don't detach from console.
This was a dumb idea.
2020-07-20 01:02:06 +02:00
Acruid
5e448f20c0 Move parts of the simulation update back into engine, from Content's StateBase.
Allow content to push modal windows in the UI framework.
The MenuBar now closes it's MenuButton frame when you select one of the buttons.
Modal controls on the stack now actually block input from the rest of the UI.
Adds the `scene` concommand for instantly switching between game states (scenes).
2020-07-19 12:31:13 -07:00
Pieter-Jan Briers
f879ced75e Fix exception from client shutdown from logging inside Dispose() 2020-07-11 14:39:58 +02:00
Tyler Young
faacd45eb4 Protect IgnoresAccessChecksTo, Add Task Scheduler Context, Lock on Console Log Flushing (#1153) 2020-06-25 18:00:00 +02:00
Pieter-Jan Briers
564e219504 Silence string serializer. 2020-06-25 02:28:12 +02:00
Tyler Young
e693d3ded7 Buffered VT ANSI Logging, Server Off Console Thread, Log Unhandled Errors (#1152) 2020-06-25 01:43:09 +02:00
Pieter-Jan Briers
8e4ac24840 Re-enable prediction logging but put it behind a cvar. 2020-06-19 00:18:59 +02:00
Tyler Young
9662d52f90 Shared String Dictionary ctd. (#1126) 2020-06-13 04:09:48 +02:00
Pieter-Jan Briers
6674be3adc Client NRTs (#1121) 2020-06-12 12:57:39 +02:00
Tyler Young
0d52def877 Have RobustSerializer use a shared string dictionary (#1117)
* implements shared string dictionary and handshake from net-code-2

* fix unit test

switch to szr sawmill

* try to silence some warnings around ZipEntry

* rebase and use system zip instead of icsharplib

fix rebase artifacts

* Update Robust.Shared/Interfaces/GameObjects/IComponentFactory.cs

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

* Apply suggestions from code review

* Apply suggestions from code review

* Update Robust.Shared/Serialization/RobustSerializer.cs

* since no longer gathering from paths, make string splitting more robust

* make string gathering ignore strings under 4 chars long

make string gathering yet more robust

* add limit to size of mapped strings

* add more string data to feed into shared string dictionary from YAML files

add JSON importer but don't parse RSI metadata yet

fix typo that breaks nulls in MappedStringSerializer

minor refactoring

make string splitting more robust

add WriteUnsignedInt / ReadUnsignedInt for validating WriteCompressedUnsignedInt / ReadCompressedUnsignedInt aren't bogus

* comment out some log statements

* minor refactor, reorder logging

add null check due to smart typing NRT checks

* Add doc comments, readability improvements to MappedStringSerializer

The protocol, handshake, and internal logic are now more documented.

The main area that could still be improved is the documentation of how
the cache system works, but the code is readable enough for now that it
isn't immediately necessary.

* add documentation, organization

* update some more doc comments

* add flows to doc comment for NetworkInitialize

* more documentation and organization

* more docs

* instead of retrieving INetManager by IoC, assign when NetworkInitialize is invoked

* "document" the regex

* Update Robust.Shared/Network/NetManager.cs

* add missing check for LockMappedStrings

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

Co-authored-by: ComicIronic <comicironic@gmail.com>

* change to warning instead of throw for unlocked string mapping

Co-authored-by: ComicIronic <comicironic@gmail.com>
2020-06-12 04:09:55 +02:00
ComicIronic
b2cb334f03 Add config var loading from environment variables (#1108) 2020-06-06 23:53:05 +02:00
Pieter-Jan Briers
9eeb1d1afa Fix compiler warnings 2020-05-28 17:44:31 +02:00
Pieter-Jan Briers
4020f55f5f Unhardcode culture and provide hook for content to set it. 2020-05-02 19:59:48 +02:00
Pieter-Jan Briers
400dcb06fc Server scripting. 2020-04-30 00:06:59 +02:00
Pieter-Jan Briers
0c8f869cb4 Prediction (#1027) 2020-04-18 17:35:54 +02:00
Pieter-Jan Briers
ba933f7db0 Improvements to allow better connection dialog in content. 2020-04-17 14:41:22 +02:00
Pieter-Jan Briers
7e536954be API for accessing initial launch parameters like --launcher. 2020-04-04 15:06:47 +02:00
Pieter-Jan Briers
e0d8b111bc Remove MainMenu and launcher connecting from engine. 2020-04-04 15:05:10 +02:00
Acruid
a947a38f3c View Rotation (#1016)
* Adds a derived class from Nunit's Is test constraint class.
The game camera can now be rotated.

* Added the new `bind` command to the console, used to bind a key to a keybind.
Added two new keybinds for rotating the View camera left and right.
Added more info to the ""Component does not exist for state" exception.
Added Reduced() and FlipPositive() public functions to Angle.

* Fix a copy/paste bug.

* Adds missing code to bind/unbind CameraRotateLeft.
Camera snapping now actually uses the CameraSnapTolerance constant.
2020-03-25 02:22:18 +01:00
Pieter-Jan Briers
d057fdf74f Disable assembly load context on content-start client. 2020-03-25 02:13:23 +01:00
Pieter-Jan Briers
d945247f31 Add necessary infrastructure to allow content to launch game from itself.
This allows us to make Content.Client and Content.Server Exe projects so that they can be executed directly via your IDE. This'll help wtih not forgetting to do a full rebuild and such.
2020-01-22 20:16:29 +01:00
Pieter-Jan Briers
4e3f5508e9 Custom command line args & CVar override on Client. 2020-01-20 20:33:11 +01:00