- Game now checks to see if there is a initial environment setup, if not an Abyss is created to store players in. - Game now compiles scripts prior to loading libary assemblies to ensure the latest assembly is loaded. - BaseCharacter now supports the Abyss room if no initial Game realm is set. - BaseCharacter will no longer load the player into a room that does not exist (was deleted or something), they are defaulted into the Abyss. - ScriptEngine checks for errors in the script prior to trying to reference the compiled assembly (was causing errors if scripts failed to compile; no assembly generated to reference) - Assembly libraries are now only loaded once. MudServer: - Example MyGame.cs script now constructs a realm and sets default properties. - MyPlayer script added to show how to write your own player script. - Server loop restored and now working correctly. - Server now outputs additional info regarding startup. - Server now forces TCP protocol.
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
|
|
using MudEngine.FileSystem;
|
|
using MudEngine.GameManagement;
|
|
using MudEngine.GameObjects;
|
|
using MudEngine.GameObjects.Characters;
|
|
|
|
namespace MudEngine.Commands
|
|
{
|
|
public class CommandSave : IGameCommand
|
|
{
|
|
public bool Override { get; set; }
|
|
public string Name { get; set; }
|
|
|
|
public CommandResults Execute(string command, BaseCharacter player)
|
|
{
|
|
string path = player.ActiveGame.DataPaths.Players;
|
|
string filename = Path.Combine(path, player.Filename);
|
|
|
|
//Temporary hack
|
|
if (player.ActiveGame.PlayerCollection.Length != 0)
|
|
{
|
|
if (player.ActiveGame.PlayerCollection[0].GetType().Name != "BaseCharacter")
|
|
{
|
|
Scripting.GameObject obj = player.ActiveGame.scriptEngine.GetObject(player.ActiveGame.PlayerCollection.GetType().Name);
|
|
|
|
obj.InvokeMethod("Save", new object[] { player.Name });
|
|
}
|
|
}
|
|
else
|
|
player.Save(filename); //Should never be called?
|
|
|
|
return new CommandResults();
|
|
}
|
|
}
|
|
}
|