Repository navigation
Server events, BaseManager and Skills refactor - #11
Merged
Merged
Conversation
Match [ServerEvent] handlers by their ServerEventArgs parameter type instead of the method name, and find them automatically. - ServerEventDispatcher registers every [ServerEvent] method of the registered IServerSystems at startup. A new event only needs its args class and a PublishAsync call. - Invalid handlers (no or several args parameters, unregistered services) are logged at startup and ignored; async void handlers get a warning. - Errors in a handler are logged with the real exception and the handler's name, and the other handlers still run. - ServerEventAggregator resolves the dispatcher on first publish, so systems whose services publish events don't form a circular dependency. - Remove the hand-written subscriptions, ServerEvents.EventParameterTypes, IServerEventAggregator.Subscribe and ServerEventAttribute.EventName.
Fix the persistence bugs and make the external sync work for several servers sharing one database. - Destroy a component once its deleted row is saved, instead of resetting its deleted flag (deleted items came back). - Save on shutdown: InventorySystem calls SaveNow in OnGameModeExit. - Never reset the temporary entity id counter, so ids still in use can't be handed out again. - Add CreateAndLoad and LoadById. New characters' inventories are loaded right away, and InventoryService is replaced by IInventoryManager.CreateInventory/LoadInventory. - Sync: save own changes first, pull inserts and updates with a high-water mark from the database timestamps, and remove components whose rows were deleted elsewhere. The last save wins. - Save in batches, falling back to one row at a time on failure. - The cycle runs synchronously on the main thread; generic constraints replace the runtime IChangeable/IBaseDataComponent checks.
Port Skills from the gamemode to the Framework and finish the character refactor. - Skills feature: CharacterSkills component loaded on OnCharacterSelected, SkillService, a /skills dialog with details and Back, and the existing 100 x level^2 XP formula. /skills is now a [ServerCommand], so it goes through the permission system. - Character.GetCharacterModel() becomes the internal GetRawCharacterModel(), used only for saving. - IOpenCdnService exposes the Play methods its implementation already had.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging this into
mainpublishes a new OpenRP.Framework NuGet version.Server events
[ServerEvent]handlers are matched by theirServerEventArgsparameter type instead of the method name, and are found automatically at startup. A new event only needs its args class and aPublishAsynccall.async voidhandlers get a warning.BaseManager
SaveNowinOnGameModeExit). Also fixes temporary entity ids being reused while still in use.CreateAndLoadandLoadById. A new character's inventory is available right away instead of after the next sync.Skills
CharacterSkillscomponent loaded when a character is selected, and/skillswith a details view. It's now a[ServerCommand], so it goes through the permission system.Breaking changes for gamemodes
IServerEventAggregator.Subscribe,ServerEventAttribute.EventNameandServerEvents.EventParameterTypesare removed.IInventoryServiceis removed. UseIInventoryManager.CreateInventory/LoadInventory.BaseManager:ResetNewIdis removed, andTComponentmust implementIBaseDataComponentandIChangeable.Character.GetCharacterModel()is no longer public. Use theCharactergetters instead.IOpenCdnServicegainsPlay(...); custom implementations need to add it.