MudEngine:
- Player login now creates the directories needed if they don't exist. - Added Update method that serves as the game loop now. - Added additional save code to Game.Save() now saves all realms, zones, rooms and players. Called during server shutdown (Game.Shutdown()) - Began work on implementing a Unique Identifier system for all game objects. - Renamed GetRealm() and GetZone() to GetRealmByID() and GetZoneByID. Now accepts a Int32 instead of a string as the parameter, returning a reference to the object. - Added GetRealmByName() and GetZoneByName(). Similar to the old GetRealm and GetZone methods. Accepts a string as a parameter, however it returns a list<> collection of the found objects due to objects with duplicate names are allowed to co-exist in the game world. - Temp directory that was being generated during server startup within Game.Start() is now deleted once script compilation is completed. - Added GameTime.cs; contains all the properties and methods needed to have a working time system built into the engine for the game world. Not fully complete. - Added CommandGetTime.cs which prints the current date and time to the players console. Prints the GameTime.DayNames and GameTime.MonthNames to the player. Defaults to real-world names, however these can be configured and changed, along with the number of days per week, weeks per month, months per year, seconds per minute, minutes per hour and hours per day. MudGame: - Now supports Game.AutoSave. If AutoSave is true, then the server loop will call Game.Save() automatically. - Server Game Loop now calls Game.Update() every loop cycle.
This commit is contained in:
parent
a2181572d0
commit
d212f5b854
12 changed files with 417 additions and 63 deletions
|
@ -21,6 +21,8 @@ namespace MudEngine.GameObjects
|
|||
[RefreshProperties(RefreshProperties.All)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public Guid ID { get; internal set; }
|
||||
|
||||
[Category("Object Setup")]
|
||||
[Description("A brief description of this object. The description is displayed to users when they use a command for investigating an object")]
|
||||
public string Description { get; set; }
|
||||
|
@ -39,12 +41,7 @@ namespace MudEngine.GameObjects
|
|||
//Filenames are generated by the class itself, users can not assign it.
|
||||
get
|
||||
{
|
||||
if (this.GetType().Name.StartsWith("Base"))
|
||||
{
|
||||
return this.Name + "." + GetType().Name.Substring("Base".Length);
|
||||
}
|
||||
else
|
||||
return this.Name + "." + GetType().Name;
|
||||
return this.ID + "." + GetType().Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,13 +62,6 @@ namespace MudEngine.GameObjects
|
|||
|
||||
public Game ActiveGame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// used for serialization only.
|
||||
/// </summary>
|
||||
internal BaseObject()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the base object
|
||||
/// </summary>
|
||||
|
@ -85,6 +75,13 @@ namespace MudEngine.GameObjects
|
|||
this.Listen = "You hear nothing of interest.";
|
||||
this.Smell = "You don't smell anything unsual.";
|
||||
this.Name = DefaultName();
|
||||
|
||||
//This must be called on instancing of the object.
|
||||
//It is unique and will be used for saving the object.
|
||||
//Allows for multiple objects with the same Name property
|
||||
//but different Identifiers. Letting there be multiple versions
|
||||
//of the same object.
|
||||
this.ID = Guid.NewGuid();
|
||||
}
|
||||
|
||||
private bool ShouldSerializeName()
|
||||
|
@ -151,6 +148,7 @@ namespace MudEngine.GameObjects
|
|||
File.Delete(filename);
|
||||
|
||||
FileManager.WriteLine(filename, this.Name, "Name");
|
||||
FileManager.WriteLine(filename, this.ID.ToString(), "Identifier");
|
||||
FileManager.WriteLine(filename, this.Description, "Description");
|
||||
FileManager.WriteLine(filename, this.Feel, "Feel");
|
||||
FileManager.WriteLine(filename, this.Listen, "Listen");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue