muddesigner/MudEngine/Commands/CommandWalk.cs
Scionwest_cp 7a4c9211d4 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
2010-08-12 17:05:07 -07:00

50 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MudEngine.GameObjects.Characters;
using MudEngine.GameManagement;
using MudEngine.GameObjects.Environment;
using MudEngine.GameObjects;
using MudEngine.FileSystem;
namespace MudEngine.Commands
{
public class CommandWalk : IGameCommand
{
public string Name { get; set; }
public bool Override { get; set; }
public CommandResults Execute(string command, BaseCharacter player)
{
string[] words = command.Split(' ');
List<string> directions = new List<string>();
if (words.Length == 1)
return new CommandResults("No direction supplied");
else
{
foreach (Door door in player.CurrentRoom.Doorways)
{
if (door.TravelDirection == TravelDirections.GetTravelDirectionValue(words[1]))
{
//Move the player into their new room
player.Move(door.TravelDirection);
player.CommandSystem.ExecuteCommand("Look", player);
if (player.ActiveGame.AutoSave)
player.Save(player.Filename);
return null;
}
}
}
player.Send("Unable to travel in that direction.");
return null;
}
}
}