muddesigner/MudEngine/Commands/CommandWalk.cs
Scionwest_cp 8b1be3d1eb MudEngine:
- CommandLogin no longer invokes the Look Command
 - Fixed CommandWalk no longer telling the player an invalid direction message when trying to walk to someplace that does not exist.
 - Moved PlayerCollection array referencing from Game.Start() to the Game's constructor so that scripts may change the player class during its startup.
 - BaseCharacter now invokes the Look command after Login command is completed.
 - ScriptEngine no longer sets the output path for a compiled script if the script is designated as compile to memory.
 - Fixed custom players not being able to access their own Methods and Properties during runtime.

MudServer:
 - Additional Console Log Messages added.
2010-08-06 23:37:52 -07:00

47 lines
1.4 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);
return null;
}
}
}
player.Send("Unable to travel in that direction.");
return null;
}
}
}