Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
c363b1e36c
@ -10,6 +10,7 @@ namespace TrueCraft.API.World
|
|||||||
{
|
{
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
IChunkProvider ChunkProvider { get; set; }
|
IChunkProvider ChunkProvider { get; set; }
|
||||||
|
long Time { get; set; }
|
||||||
|
|
||||||
event EventHandler<BlockChangeEventArgs> BlockChanged;
|
event EventHandler<BlockChangeEventArgs> BlockChanged;
|
||||||
|
|
||||||
|
18
TrueCraft.Core/Logic/Items/FlintAndSteelItem.cs
Normal file
18
TrueCraft.Core/Logic/Items/FlintAndSteelItem.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using TrueCraft.API.Logic;
|
||||||
|
|
||||||
|
namespace TrueCraft.Core.Logic.Items
|
||||||
|
{
|
||||||
|
public class FlintAndSteelItem : ToolItem
|
||||||
|
{
|
||||||
|
public static readonly short ItemID = 0x103;
|
||||||
|
|
||||||
|
public override short ID { get { return 0x103; } }
|
||||||
|
|
||||||
|
public override sbyte MaximumStack { get { return 1; } }
|
||||||
|
|
||||||
|
public override short BaseDurability { get { return 65; } }
|
||||||
|
|
||||||
|
public override string DisplayName { get { return "Flint and Steel"; } }
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,18 @@ namespace TrueCraft.Core.World
|
|||||||
public string BaseDirectory { get; internal set; }
|
public string BaseDirectory { get; internal set; }
|
||||||
public IDictionary<Coordinates2D, IRegion> Regions { get; set; }
|
public IDictionary<Coordinates2D, IRegion> Regions { get; set; }
|
||||||
public IChunkProvider ChunkProvider { get; set; }
|
public IChunkProvider ChunkProvider { get; set; }
|
||||||
|
public DateTime BaseTime { get; set; }
|
||||||
|
public long Time
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (long)((DateTime.Now - BaseTime).TotalSeconds * 20) % 24000;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public event EventHandler<BlockChangeEventArgs> BlockChanged;
|
public event EventHandler<BlockChangeEventArgs> BlockChanged;
|
||||||
|
|
||||||
@ -23,6 +35,7 @@ namespace TrueCraft.Core.World
|
|||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Regions = new Dictionary<Coordinates2D, IRegion>();
|
Regions = new Dictionary<Coordinates2D, IRegion>();
|
||||||
|
BaseTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World(string name, IChunkProvider chunkProvider) : this(name)
|
public World(string name, IChunkProvider chunkProvider) : this(name)
|
||||||
|
@ -23,6 +23,8 @@ namespace TrueCraft.Commands
|
|||||||
Commands.Add(new GiveCommand());
|
Commands.Add(new GiveCommand());
|
||||||
Commands.Add(new HelpCommand());
|
Commands.Add(new HelpCommand());
|
||||||
Commands.Add(new ResendInvCommand());
|
Commands.Add(new ResendInvCommand());
|
||||||
|
Commands.Add(new PositionCommand());
|
||||||
|
Commands.Add(new TimeCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -9,6 +9,72 @@ using TrueCraft.Core.Networking.Packets;
|
|||||||
|
|
||||||
namespace TrueCraft.Commands
|
namespace TrueCraft.Commands
|
||||||
{
|
{
|
||||||
|
public class PositionCommand : Command
|
||||||
|
{
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "pos"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return "Shows your position."; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string[] Aliases
|
||||||
|
{
|
||||||
|
get { return new string[0]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Handle(IRemoteClient Client, string Alias, string[] Arguments)
|
||||||
|
{
|
||||||
|
if (Arguments.Length != 0)
|
||||||
|
{
|
||||||
|
Help(Client, Alias, Arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Client.SendMessage(Client.Entity.Position.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(IRemoteClient Client, string Alias, string[] Arguments)
|
||||||
|
{
|
||||||
|
Client.SendMessage("/pos: Shows your position.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TimeCommand : Command
|
||||||
|
{
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "time"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return "Shows the current time."; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string[] Aliases
|
||||||
|
{
|
||||||
|
get { return new string[0]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Handle(IRemoteClient Client, string Alias, string[] Arguments)
|
||||||
|
{
|
||||||
|
if (Arguments.Length != 0)
|
||||||
|
{
|
||||||
|
Help(Client, Alias, Arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Client.SendMessage(Client.World.Time.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(IRemoteClient Client, string Alias, string[] Arguments)
|
||||||
|
{
|
||||||
|
Client.SendMessage("/time: Shows the current time.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ResendInvCommand : Command
|
public class ResendInvCommand : Command
|
||||||
{
|
{
|
||||||
public override string Name
|
public override string Name
|
||||||
|
@ -44,6 +44,7 @@ namespace TrueCraft.Handlers
|
|||||||
(int)client.Entity.Position.Y, (int)client.Entity.Position.Z));
|
(int)client.Entity.Position.Y, (int)client.Entity.Position.Z));
|
||||||
client.QueuePacket(new SetPlayerPositionPacket(client.Entity.Position.X, client.Entity.Position.Y,
|
client.QueuePacket(new SetPlayerPositionPacket(client.Entity.Position.X, client.Entity.Position.Y,
|
||||||
client.Entity.Position.Y + client.Entity.Size.Height, client.Entity.Position.Z, 0, 0, true));
|
client.Entity.Position.Y + client.Entity.Size.Height, client.Entity.Position.Z, 0, 0, true));
|
||||||
|
client.QueuePacket(new TimeUpdatePacket(client.World.Time));
|
||||||
|
|
||||||
// Start housekeeping for this client
|
// Start housekeeping for this client
|
||||||
server.GetEntityManagerForWorld(client.World).SpawnEntity(client.Entity);
|
server.GetEntityManagerForWorld(client.World).SpawnEntity(client.Entity);
|
||||||
|
Reference in New Issue
Block a user