Skip to content

Added async /save command for admins+ and server console.#42

Merged
Jimmacle merged 3 commits intoTorchAPI:masterfrom
Maldark:master
Jul 6, 2017
Merged

Added async /save command for admins+ and server console.#42
Jimmacle merged 3 commits intoTorchAPI:masterfrom
Maldark:master

Conversation

@Maldark
Copy link
Copy Markdown
Contributor

@Maldark Maldark commented Jul 6, 2017

Also redesigned TorchBase.SaveGameAsync to take a callback function for error/success handling. Also removed local host checks as we are hosting a dedicated server.

Redesigned TorchBase.SaveGameAsync to take a callback function for error/success handling. Also removed local host checks as we are hosting a dedicated server.
Copy link
Copy Markdown
Member

@Jimmacle Jimmacle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, I commented on a few things that should be changed. In addition, please add ///summary documentation to all of the non-private members/types you added.

Comment thread Torch/TorchBase.cs Outdated

if (!MySandboxGame.IsGameReady)
{
callback(SaveGameStatus.GameNotReady);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actions should be null checked in the beginning of the method or invoked like action?.Invoke() to avoid NREs when the action is null.

Comment thread Torch/TorchBase.cs Outdated

namespace Torch
{
public enum SaveGameStatus : byte
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to its own file.

Comment thread Torch/TorchBase.cs Outdated
Log.Error("Save failed!");
Multiplayer.SendMessage("Save timed out!", "Error");
callback(SaveGameStatus.Success);
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check this, return; is not in the conditional and the callback will never be called with SaveGameStatus.TimedOut.

@Maldark
Copy link
Copy Markdown
Contributor Author

Maldark commented Jul 6, 2017

Fixed the issues you mentioned and resolved a merge conflict introduced with the latest update to Torch.

@Jimmacle Jimmacle merged commit c137fb4 into TorchAPI:master Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants