MudEngine:
- Game World Auto-save property now fully implemented. However, the Game world saving mechanics are not fully implemented. As additional components are implemented, they will be auto-saved if the property is set to true. - Game.AutoSaveInterval property added for setting how often the Game will save all objects in the world (incase run-time changes to environments/objects were made, they must be saved). - Player walk command now supports Game.AutoSave. Every-time the player changes location they will be saved. - ScriptEngine now supports Initializing both Assembly and Source based scripts at the same time via the new ScriptTypes.Both element. - ScriptEngine now auto-loads previously saved settings from Settings.ini - Game.ObjectIdentifierCollection renamed to Game.WorldObjects. Type collection changed from that of Int32 to BaseObject. - Game.update now contains the code needed to update the World Time and Auto-Save the world if needed. - Game.AddObject method added for adding World Objects to the Game.WorldObjects collection
This commit is contained in:
parent
d212f5b854
commit
7a4c9211d4
9 changed files with 105 additions and 61 deletions
|
@ -41,9 +41,7 @@ namespace MudGame
|
|||
Log.IsVerbose = false;
|
||||
|
||||
Log.Write("Loading settings...");
|
||||
scriptEngine = new ScriptEngine(new Game(), ScriptEngine.ScriptTypes.SourceFiles);
|
||||
scriptEngine.ScriptPath = FileManager.GetData(SettingsFile, "ScriptPath");
|
||||
scriptEngine.ScriptExtension = FileManager.GetData(SettingsFile, "ScriptExtension");
|
||||
scriptEngine = new ScriptEngine(new Game(), ScriptEngine.ScriptTypes.Both);
|
||||
|
||||
//scriptEngine.CompileScripts();
|
||||
Log.Write("Initializing Script Engine for Script Compilation...");
|
||||
|
@ -66,7 +64,6 @@ namespace MudGame
|
|||
game = (Game)obj.Instance;
|
||||
scriptEngine = new ScriptEngine(game, ScriptEngine.ScriptTypes.Assembly);
|
||||
}
|
||||
scriptEngine.ScriptPath = FileManager.GetDataPath(SaveDataTypes.Root);
|
||||
//Force TCP
|
||||
game.ServerType = ProtocolType.Tcp;
|
||||
|
||||
|
@ -111,38 +108,8 @@ namespace MudGame
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
DateTime serverTime = new DateTime();
|
||||
DateTime systemTime = DateTime.Now;
|
||||
|
||||
int lastSaveGap = 0;
|
||||
|
||||
while (game.IsRunning)
|
||||
{
|
||||
if (lastSaveGap == 30)
|
||||
{
|
||||
if (game.AutoSave)
|
||||
game.Save();
|
||||
lastSaveGap = 0;
|
||||
}
|
||||
|
||||
//ServerTime holds the last minute prior to our current minute.
|
||||
if (serverTime.Minute != DateTime.Now.Minute)
|
||||
{
|
||||
serverTime = DateTime.Now;
|
||||
lastSaveGap++;
|
||||
}
|
||||
|
||||
if (game.IsMultiplayer)
|
||||
{
|
||||
Console.Write(Log.GetMessages());
|
||||
Log.FlushMessages();
|
||||
System.Threading.Thread.Sleep(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
game.PlayerCollection[0].ExecuteCommand(Console.ReadLine());
|
||||
}
|
||||
game.Update();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue