DataPaths now have values for the games Root directory and Script directory.
DataPath class is now completed and includes a new SetExtension() method for setting game object file extensions. Scripting support fully implemented. StandardGame now contains a Initialize() method for compiling scripts and searching for sub-classes of StandardGame Server app will now use a Scripted game class instead of the default StandardGame if one is present. StandardGame.Start() is now virtual so child classes can override it. Sample Game script created to show how to create a custom game script, including how to setup the game and create Rooms pragamatically. ScriptFactory has a new method for searching all scripts and scripts that inherit from a specified class. Renamed all of the Command scripts. They no longer start with 'Command'. Example: "CommandSay" has now become "Say". There is no need to preceed the command name with the word "Command" anymore.
This commit is contained in:
parent
c40d32e7ae
commit
8639403255
14 changed files with 323 additions and 69 deletions
|
@ -1,49 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MudEngine.Core.Interfaces;
|
||||
using MudEngine.Game;
|
||||
using MudEngine.Game.Characters;
|
||||
using MudEngine.Networking;
|
||||
|
||||
namespace MudEngine.GameScripts.Commands
|
||||
{
|
||||
public class CommandSay : ICommand
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public List<string> Help { get; set; }
|
||||
|
||||
public CommandSay()
|
||||
{
|
||||
this.Name = "Say";
|
||||
this.Description = "Chat command that allows objects to communicate.";
|
||||
}
|
||||
|
||||
public Boolean Execute(string command, StandardCharacter character)
|
||||
{
|
||||
//Grab a reference to the character for simplifying access.
|
||||
StandardGame game = character.Game;
|
||||
//Remove the command "Say " from the string so we only have it's message
|
||||
String message = command.Substring(3).Trim();
|
||||
|
||||
//Loop through each character on the server and broadcast the message.
|
||||
//TODO: This should only broadcast to characters that are in the same Environment.
|
||||
foreach (StandardCharacter c in character.Game.Server.ConnectionManager.GetConnectedCharacters())
|
||||
{
|
||||
//Only broadcast this message to those that are not the broadcastor.
|
||||
if (c != character)
|
||||
c.SendMessage(character.ToString() + " says: " + message);
|
||||
}
|
||||
|
||||
//Send a different copy of the message to the broadcastor.
|
||||
character.SendMessage("You say: " + message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue