diff options
| author | Sarah Bradley <git@sarahduck.ca> | 2023-12-18 19:51:26 -0800 |
|---|---|---|
| committer | Sarah Bradley <git@sarahduck.ca> | 2023-12-18 19:51:26 -0800 |
| commit | 4b7966ffda3b6ad34d355148ddccbe2959061730 (patch) | |
| tree | 8be290357abb5d7cf8c72a803f3be63b3e353d7e /OnekoLocal.cs | |
| parent | fc3874657348bde6ce7e3fab625c92dfec91baaa (diff) | |
Networked Mice!!
Also combined Spritesheet + Username packets into one UserInfo packet.
Diffstat (limited to 'OnekoLocal.cs')
| -rw-r--r-- | OnekoLocal.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OnekoLocal.cs b/OnekoLocal.cs index b33f376..00eaf82 100644 --- a/OnekoLocal.cs +++ b/OnekoLocal.cs @@ -16,15 +16,15 @@ class OnekoLocal : Oneko Instance ??= this; Client.UserConnected += OnekoNet.SpawnNetNeko; - Client.ServerDisconnected += OnekoNet.DisconnectAll; Name = Client.UserName; } public override void OnekoUpdate() { - if (Raylib.IsWindowFocused() && Raylib.IsCursorOnScreen()) TargetPosition = Raylib.GetMousePosition()/OnekoOnline.WindowScale; - else TargetPosition = new Vector2(320/2, 240/2); + Mouse? NearestMouse = Mouse.AllMice.Where(m => m.Visible).MinBy(m => Vector2.Distance(m.Position, Position)); + if (NearestMouse != null) TargetPosition = NearestMouse.Position; + else TargetPosition = new Vector2(Math.Clamp((Id+1)*40, 20, 300), 240/2); if (OnekoOnline.Client!.Connected) { NetDataWriter writer = new(); |
