Change how mouse is handled in client
This makes it playable on Wayland, which I've been using a lot lately.
This commit is contained in:
parent
c374b38b3f
commit
7e2d657393
@ -28,7 +28,7 @@ namespace TrueCraft.Client.Input
|
|||||||
: base(x, y)
|
: base(x, y)
|
||||||
{
|
{
|
||||||
DeltaX = deltaX;
|
DeltaX = deltaX;
|
||||||
DeltaY = DeltaY;
|
DeltaY = deltaY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,9 +215,13 @@ namespace TrueCraft.Client.Modules
|
|||||||
return false;
|
return false;
|
||||||
var centerX = Game.GraphicsDevice.Viewport.Width / 2;
|
var centerX = Game.GraphicsDevice.Viewport.Width / 2;
|
||||||
var centerY = Game.GraphicsDevice.Viewport.Height / 2;
|
var centerY = Game.GraphicsDevice.Viewport.Height / 2;
|
||||||
|
if (e.X < 10 || e.X > Game.GraphicsDevice.Viewport.Width - 10 ||
|
||||||
|
e.Y < 10 || e.Y > Game.GraphicsDevice.Viewport.Height - 10)
|
||||||
|
{
|
||||||
Mouse.SetPosition(centerX, centerY);
|
Mouse.SetPosition(centerX, centerY);
|
||||||
|
}
|
||||||
|
|
||||||
var look = new Vector2((centerX - e.X), (centerY - e.Y))
|
var look = new Vector2((-e.DeltaX), (-e.DeltaY))
|
||||||
* (float)(gameTime.ElapsedGameTime.TotalSeconds * 30);
|
* (float)(gameTime.ElapsedGameTime.TotalSeconds * 30);
|
||||||
|
|
||||||
Game.Client.Yaw -= look.X;
|
Game.Client.Yaw -= look.X;
|
||||||
|
@ -425,4 +425,45 @@ namespace TrueCraft.Commands
|
|||||||
client.SendMessage("/reinv: Resends your inventory.");
|
client.SendMessage("/reinv: Resends your inventory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RelightCommand : Command
|
||||||
|
{
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "relight"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return "Relights the chunk you're standing in."; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
var server = client.Server as MultiplayerServer;
|
||||||
|
var chunk = client.World.FindChunk((Coordinates3D)client.Entity.Position);
|
||||||
|
var lighter = server.WorldLighters.SingleOrDefault(l => l.World == client.World);
|
||||||
|
if (lighter != null)
|
||||||
|
{
|
||||||
|
lighter.InitialLighting(chunk, true);
|
||||||
|
(client as RemoteClient).UnloadChunk(chunk.Coordinates);
|
||||||
|
(client as RemoteClient).LoadChunk(chunk.Coordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(IRemoteClient client, string alias, string[] arguments)
|
||||||
|
{
|
||||||
|
client.SendMessage("/reinv: Resends your inventory.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -170,6 +170,11 @@ namespace TrueCraft
|
|||||||
void HandleChunkLoaded(object sender, ChunkLoadedEventArgs e)
|
void HandleChunkLoaded(object sender, ChunkLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
ChunksToSchedule.Add(new Tuple<IWorld, IChunk>(sender as IWorld, e.Chunk));
|
ChunksToSchedule.Add(new Tuple<IWorld, IChunk>(sender as IWorld, e.Chunk));
|
||||||
|
if (Program.ServerConfiguration.EnableLighting)
|
||||||
|
{
|
||||||
|
var lighter = WorldLighters.SingleOrDefault(l => l.World == sender);
|
||||||
|
lighter.InitialLighting(e.Chunk, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleBlockChanged(object sender, BlockChangeEventArgs e)
|
void HandleBlockChanged(object sender, BlockChangeEventArgs e)
|
||||||
|
Reference in New Issue
Block a user