Merge branch 'master' of https://github.com/Regalis11/Barotrauma
This commit is contained in:
@@ -78,7 +78,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//re-enable collider
|
||||
if (!Collider.FarseerBody.Enabled)
|
||||
if (!Collider.Enabled)
|
||||
{
|
||||
var lowestLimb = FindLowestLimb();
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Barotrauma
|
||||
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
|
||||
0.0f);
|
||||
|
||||
Collider.FarseerBody.Enabled = true;
|
||||
Collider.Enabled = true;
|
||||
}
|
||||
|
||||
ResetPullJoints();
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Barotrauma
|
||||
|
||||
|
||||
//re-enable collider
|
||||
if (!Collider.FarseerBody.Enabled)
|
||||
if (!Collider.Enabled)
|
||||
{
|
||||
var lowestLimb = FindLowestLimb();
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Barotrauma
|
||||
Collider.Rotation);
|
||||
|
||||
Collider.FarseerBody.ResetDynamics();
|
||||
Collider.FarseerBody.Enabled = true;
|
||||
Collider.Enabled = true;
|
||||
}
|
||||
|
||||
if (swimming)
|
||||
|
||||
@@ -1469,5 +1469,12 @@ namespace Barotrauma
|
||||
list.Remove(this);
|
||||
}
|
||||
|
||||
public static void RemoveAll()
|
||||
{
|
||||
for (int i = list.Count - 1; i >= 0; i--)
|
||||
{
|
||||
list[i].Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,18 +344,18 @@ namespace Barotrauma
|
||||
if (GameMain.Client != null) return;
|
||||
|
||||
float newHealth = MathHelper.Clamp(value, minHealth, maxHealth);
|
||||
if (newHealth == health) return;
|
||||
//if (newHealth == health) return;
|
||||
|
||||
health = newHealth;
|
||||
|
||||
if (GameMain.Server != null)
|
||||
/*if (GameMain.Server != null)
|
||||
{
|
||||
if (Math.Abs(health - lastSentHealth) > (maxHealth - minHealth) / 255.0f || Math.Sign(health) != Math.Sign(lastSentHealth))
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
lastSentHealth = health;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,12 +373,12 @@ namespace Barotrauma
|
||||
if (GameMain.Client != null) return;
|
||||
|
||||
float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f);
|
||||
if (newBleeding == bleeding) return;
|
||||
//if (newBleeding == bleeding) return;
|
||||
|
||||
bleeding = newBleeding;
|
||||
|
||||
if (GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
|
||||
/*if (GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1540,11 +1540,11 @@ namespace Barotrauma
|
||||
if (stunTimer > 0.0f)
|
||||
{
|
||||
stunTimer -= deltaTime;
|
||||
if (stunTimer < 0.0f && GameMain.Server != null)
|
||||
/*if (stunTimer < 0.0f && GameMain.Server != null)
|
||||
{
|
||||
//stun ended -> notify clients
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
//Skip health effects as critical health handles it differently
|
||||
@@ -1574,8 +1574,8 @@ namespace Barotrauma
|
||||
if (IsRagdolled)
|
||||
{
|
||||
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
|
||||
if(GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
/*if(GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
|
||||
AnimController.ResetPullJoints();
|
||||
selectedConstruction = null;
|
||||
return;
|
||||
@@ -1821,11 +1821,11 @@ namespace Barotrauma
|
||||
|
||||
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
|
||||
|
||||
if (GameMain.Server != null &&
|
||||
/*if (GameMain.Server != null &&
|
||||
(Math.Sign(newStun) != Math.Sign(stunTimer) || Math.Abs(newStun - stunTimer) > 0.1f))
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
}
|
||||
}*/
|
||||
|
||||
if (Math.Sign(newStun) != Math.Sign(stunTimer)) AnimController.ResetPullJoints();
|
||||
|
||||
@@ -1884,11 +1884,11 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameMain.NetworkMember != null)
|
||||
/*if (GameMain.NetworkMember != null)
|
||||
{
|
||||
if (GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
}
|
||||
}*/
|
||||
|
||||
AnimController.Frozen = false;
|
||||
|
||||
|
||||
@@ -332,6 +332,7 @@ namespace Barotrauma
|
||||
inventory.ServerRead(type, msg, c);
|
||||
break;
|
||||
case 1:
|
||||
bool doingCPR = msg.ReadBoolean();
|
||||
if (c.Character != this)
|
||||
{
|
||||
#if DEBUG
|
||||
@@ -340,7 +341,6 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
bool doingCPR = msg.ReadBoolean();
|
||||
AnimController.Anim = doingCPR ? AnimController.Animation.CPR : AnimController.Animation.None;
|
||||
break;
|
||||
case 2:
|
||||
@@ -358,7 +358,15 @@ namespace Barotrauma
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
AnimController.GrabLimb = (LimbType)msg.ReadUInt16();
|
||||
LimbType grabLimb = (LimbType)msg.ReadUInt16();
|
||||
if (c.Character != this)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.Log("Received a character update message from a client who's not controlling the character");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
AnimController.GrabLimb = grabLimb;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -384,10 +392,6 @@ namespace Barotrauma
|
||||
Client owner = ((Client)extraData[1]);
|
||||
msg.Write(owner == null ? (byte)0 : owner.ID);
|
||||
break;
|
||||
case NetEntityEvent.Type.Status:
|
||||
msg.WriteRangedInteger(0, 2, 2);
|
||||
WriteStatus(msg);
|
||||
break;
|
||||
}
|
||||
msg.WritePadBits();
|
||||
}
|
||||
@@ -474,6 +478,8 @@ namespace Barotrauma
|
||||
tempBuffer.Write(SimPosition.Y);
|
||||
tempBuffer.Write(AnimController.Collider.Rotation);
|
||||
|
||||
WriteStatus(tempBuffer);
|
||||
|
||||
tempBuffer.WritePadBits();
|
||||
|
||||
msg.Write((byte)tempBuffer.LengthBytes);
|
||||
|
||||
@@ -13,13 +13,15 @@ namespace Barotrauma
|
||||
{
|
||||
public string Text;
|
||||
public Color Color;
|
||||
public bool IsCommand;
|
||||
|
||||
public readonly string Time;
|
||||
|
||||
public ColoredText(string text, Color color)
|
||||
public ColoredText(string text, Color color, bool isCommand)
|
||||
{
|
||||
this.Text = text;
|
||||
this.Color = color;
|
||||
this.IsCommand = isCommand;
|
||||
|
||||
Time = DateTime.Now.ToString();
|
||||
}
|
||||
@@ -1303,9 +1305,14 @@ namespace Barotrauma
|
||||
|
||||
direction = MathHelper.Clamp(direction, -1, 1);
|
||||
|
||||
selectedIndex += direction;
|
||||
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
||||
selectedIndex = selectedIndex % Messages.Count;
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
selectedIndex += direction;
|
||||
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
||||
selectedIndex = selectedIndex % Messages.Count;
|
||||
if (++i >= Messages.Count) break;
|
||||
} while (!Messages[selectedIndex].IsCommand);
|
||||
|
||||
return Messages[selectedIndex].Text;
|
||||
}
|
||||
@@ -1317,7 +1324,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
activeQuestionText = null;
|
||||
#endif
|
||||
NewMessage(command, Color.White);
|
||||
NewMessage(command, Color.White, true);
|
||||
//reset the variable before invoking the delegate because the method may need to activate another question
|
||||
var temp = activeQuestionCallback;
|
||||
activeQuestionCallback = null;
|
||||
@@ -1331,7 +1338,7 @@ namespace Barotrauma
|
||||
|
||||
if (!splitCommand[0].ToLowerInvariant().Equals("admin"))
|
||||
{
|
||||
NewMessage(command, Color.White);
|
||||
NewMessage(command, Color.White, true);
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
@@ -1611,12 +1618,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static void NewMessage(string msg, Color color)
|
||||
public static void NewMessage(string msg, Color color, bool isCommand = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty((msg))) return;
|
||||
|
||||
#if SERVER
|
||||
Messages.Add(new ColoredText(msg, color));
|
||||
Messages.Add(new ColoredText(msg, color, isCommand));
|
||||
|
||||
//TODO: REMOVE
|
||||
Console.ForegroundColor = XnaToConsoleColor.Convert(color);
|
||||
@@ -1631,7 +1638,7 @@ namespace Barotrauma
|
||||
#elif CLIENT
|
||||
lock (queuedMessages)
|
||||
{
|
||||
queuedMessages.Enqueue(new ColoredText(msg, color));
|
||||
queuedMessages.Enqueue(new ColoredText(msg, color, isCommand));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -515,6 +515,7 @@ namespace Barotrauma.Items.Components
|
||||
case "requireditem":
|
||||
if (!overrideRequiredItems) requiredItems.Clear();
|
||||
overrideRequiredItems = true;
|
||||
|
||||
RelatedItem newRequiredItem = RelatedItem.Load(subElement);
|
||||
|
||||
if (newRequiredItem == null) continue;
|
||||
|
||||
@@ -1207,7 +1207,7 @@ namespace Barotrauma
|
||||
Color color = Color.Red;
|
||||
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
||||
|
||||
texts.Add(new ColoredText(ic.Msg, color));
|
||||
texts.Add(new ColoredText(ic.Msg, color, false));
|
||||
}
|
||||
|
||||
return texts;
|
||||
@@ -1608,7 +1608,7 @@ namespace Barotrauma
|
||||
msg.Write(body.FarseerBody.Awake);
|
||||
if (body.FarseerBody.Awake)
|
||||
{
|
||||
body.FarseerBody.Enabled = true;
|
||||
body.Enabled = true;
|
||||
msg.WriteRangedSingle(MathHelper.Clamp(body.LinearVelocity.X, -MaxVel, MaxVel), -MaxVel, MaxVel, 12);
|
||||
msg.WriteRangedSingle(MathHelper.Clamp(body.LinearVelocity.Y, -MaxVel, MaxVel), -MaxVel, MaxVel, 12);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Created by SharpDevelop.
|
||||
* User: Burhan
|
||||
* Date: 17/06/2014
|
||||
@@ -8,31 +8,31 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 James Humphreys. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those of the
|
||||
authors and should not be interpreted as representing official policies, either expressed
|
||||
or implied, of James Humphreys.
|
||||
Copyright 2011 James Humphreys. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those of the
|
||||
authors and should not be interpreted as representing official policies, either expressed
|
||||
or implied, of James Humphreys.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -58,63 +58,63 @@ using System.Collections.Generic;
|
||||
namespace Voronoi2
|
||||
{
|
||||
public class Point
|
||||
{
|
||||
public double x, y;
|
||||
|
||||
public void setPoint ( double x, double y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
// use for sites and vertecies
|
||||
public class Site
|
||||
{
|
||||
public Point coord;
|
||||
public int sitenbr;
|
||||
{
|
||||
public double x, y;
|
||||
|
||||
public void setPoint ( double x, double y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
// use for sites and vertecies
|
||||
public class Site
|
||||
{
|
||||
public Point coord;
|
||||
public int sitenbr;
|
||||
|
||||
public void SetPoint(Vector2 point)
|
||||
{
|
||||
coord.setPoint(point.X, point.Y);
|
||||
}
|
||||
|
||||
public Site ()
|
||||
{
|
||||
coord = new Point();
|
||||
}
|
||||
}
|
||||
|
||||
public class Edge
|
||||
{
|
||||
public double a = 0, b = 0, c = 0;
|
||||
public Site[] ep;
|
||||
public Site[] reg;
|
||||
public int edgenbr;
|
||||
|
||||
public Edge ()
|
||||
{
|
||||
ep = new Site[2];
|
||||
reg = new Site[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Halfedge
|
||||
{
|
||||
public Halfedge ELleft, ELright;
|
||||
public Edge ELedge;
|
||||
public bool deleted;
|
||||
public int ELpm;
|
||||
public Site vertex;
|
||||
public double ystar;
|
||||
public Halfedge PQnext;
|
||||
|
||||
public Halfedge ()
|
||||
{
|
||||
PQnext = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Site ()
|
||||
{
|
||||
coord = new Point();
|
||||
}
|
||||
}
|
||||
|
||||
public class Edge
|
||||
{
|
||||
public double a = 0, b = 0, c = 0;
|
||||
public Site[] ep;
|
||||
public Site[] reg;
|
||||
public int edgenbr;
|
||||
|
||||
public Edge ()
|
||||
{
|
||||
ep = new Site[2];
|
||||
reg = new Site[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Halfedge
|
||||
{
|
||||
public Halfedge ELleft, ELright;
|
||||
public Edge ELedge;
|
||||
public bool deleted;
|
||||
public int ELpm;
|
||||
public Site vertex;
|
||||
public double ystar;
|
||||
public Halfedge PQnext;
|
||||
|
||||
public Halfedge ()
|
||||
{
|
||||
PQnext = null;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CellType
|
||||
{
|
||||
@@ -187,11 +187,11 @@ namespace Voronoi2
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class GraphEdge
|
||||
{
|
||||
|
||||
public class GraphEdge
|
||||
{
|
||||
public Vector2 point1, point2;
|
||||
public Site site1, site2;
|
||||
public Site site1, site2;
|
||||
public VoronoiCell cell1, cell2;
|
||||
|
||||
public bool isSolid;
|
||||
@@ -239,20 +239,20 @@ namespace Voronoi2
|
||||
|
||||
return normal;
|
||||
}
|
||||
}
|
||||
|
||||
// للترتيب
|
||||
public class SiteSorterYX : IComparer<Site>
|
||||
{
|
||||
public int Compare ( Site p1, Site p2 )
|
||||
{
|
||||
Point s1 = p1.coord;
|
||||
Point s2 = p2.coord;
|
||||
if ( s1.y < s2.y ) return -1;
|
||||
if ( s1.y > s2.y ) return 1;
|
||||
if ( s1.x < s2.x ) return -1;
|
||||
if ( s1.x > s2.x ) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// للترتيب
|
||||
public class SiteSorterYX : IComparer<Site>
|
||||
{
|
||||
public int Compare ( Site p1, Site p2 )
|
||||
{
|
||||
Point s1 = p1.coord;
|
||||
Point s2 = p2.coord;
|
||||
if ( s1.y < s2.y ) return -1;
|
||||
if ( s1.y > s2.y ) return 1;
|
||||
if ( s1.x < s2.x ) return -1;
|
||||
if ( s1.x > s2.x ) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ namespace Barotrauma
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected bool ResizeHorizontal
|
||||
public bool ResizeHorizontal
|
||||
{
|
||||
get { return prefab != null && prefab.ResizeHorizontal; }
|
||||
}
|
||||
protected bool ResizeVertical
|
||||
public bool ResizeVertical
|
||||
{
|
||||
get { return prefab != null && prefab.ResizeVertical; }
|
||||
}
|
||||
|
||||
@@ -848,6 +848,7 @@ namespace Barotrauma
|
||||
{
|
||||
StairDirection = StairDirection == Direction.Left ? Direction.Right : Direction.Left;
|
||||
bodies.ForEach(b => GameMain.World.RemoveBody(b));
|
||||
bodies.Clear();
|
||||
|
||||
CreateStairBodies();
|
||||
}
|
||||
|
||||
@@ -1208,9 +1208,9 @@ namespace Barotrauma
|
||||
Item.ItemList.Clear();
|
||||
}
|
||||
|
||||
PhysicsBody.RemoveAll();
|
||||
Ragdoll.RemoveAll();
|
||||
|
||||
Ragdoll.list.Clear();
|
||||
PhysicsBody.RemoveAll();
|
||||
|
||||
GameMain.World.Clear();
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static bool IsValidName(string name)
|
||||
{
|
||||
if (name.Contains("\n") || name.Contains("\r\n")) return false;
|
||||
if (name.Contains("\n") || name.Contains("\r")) return false;
|
||||
|
||||
return (name.All(c =>
|
||||
c != ';' &&
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Barotrauma.Networking
|
||||
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (invalid name)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (clName.ToLower() == Name.ToLower())
|
||||
if (Homoglyphs.Compare(clName.ToLower(),Name.ToLower()))
|
||||
{
|
||||
DisconnectUnauthClient(inc, unauthClient, "That name is taken.");
|
||||
Log(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (name taken by the server)", ServerLog.MessageType.Error);
|
||||
|
||||
@@ -349,9 +349,12 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
clientPermissions.Clear();
|
||||
|
||||
if (File.Exists("Data/clientpermissions.txt") && !File.Exists(ClientPermissionsFile))
|
||||
if (!File.Exists(ClientPermissionsFile))
|
||||
{
|
||||
LoadClientPermissionsOld("Data/clientpermissions.txt");
|
||||
if (File.Exists("Data/clientpermissions.txt"))
|
||||
{
|
||||
LoadClientPermissionsOld("Data/clientpermissions.txt");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -94,9 +94,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
class Key
|
||||
{
|
||||
private bool hit, hitQueue;
|
||||
class Key
|
||||
{
|
||||
private bool hit, hitQueue;
|
||||
private bool held, heldQueue;
|
||||
|
||||
|
||||
@@ -106,23 +106,23 @@ namespace Barotrauma
|
||||
//{
|
||||
// get { return canBeHeld; }
|
||||
//}
|
||||
|
||||
public Key(KeyOrMouse binding)
|
||||
{
|
||||
|
||||
public Key(KeyOrMouse binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
{
|
||||
return hit;
|
||||
}
|
||||
set
|
||||
{
|
||||
hit = value;
|
||||
}
|
||||
}
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
{
|
||||
return hit;
|
||||
}
|
||||
set
|
||||
{
|
||||
hit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Held
|
||||
{
|
||||
@@ -141,14 +141,14 @@ namespace Barotrauma
|
||||
get { return binding; }
|
||||
}
|
||||
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
|
||||
held = binding.IsDown();
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetState(bool hit, bool held)
|
||||
{
|
||||
@@ -156,12 +156,12 @@ namespace Barotrauma
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
|
||||
public bool DequeueHit()
|
||||
{
|
||||
bool value = hitQueue;
|
||||
hitQueue = false;
|
||||
return value;
|
||||
}
|
||||
public bool DequeueHit()
|
||||
{
|
||||
bool value = hitQueue;
|
||||
hitQueue = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
public bool DequeueHeld()
|
||||
{
|
||||
@@ -187,11 +187,11 @@ namespace Barotrauma
|
||||
held = false;
|
||||
}
|
||||
|
||||
public void ResetHit()
|
||||
{
|
||||
hit = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
public void ResetHit()
|
||||
{
|
||||
hit = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
|
||||
|
||||
public void ResetHeld()
|
||||
@@ -199,5 +199,5 @@ namespace Barotrauma
|
||||
held = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,6 +508,52 @@ namespace Barotrauma
|
||||
// Return formatted number with suffix
|
||||
return readable.ToString("0.# ") + suffix;
|
||||
}
|
||||
|
||||
public static void SplitRectanglesHorizontal(List<Rectangle> rects, Vector2 point)
|
||||
{
|
||||
for (int i = 0; i < rects.Count; i++)
|
||||
{
|
||||
if (point.Y > rects[i].Y && point.Y < rects[i].Y + rects[i].Height)
|
||||
{
|
||||
Rectangle rect1 = rects[i];
|
||||
Rectangle rect2 = rects[i];
|
||||
|
||||
rect1.Height = (int)(point.Y - rects[i].Y);
|
||||
|
||||
rect2.Height = rects[i].Height - rect1.Height;
|
||||
rect2.Y = rect1.Y + rect1.Height;
|
||||
rects[i] = rect1;
|
||||
rects.Insert(i + 1, rect2); i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SplitRectanglesVertical(List<Rectangle> rects, Vector2 point)
|
||||
{
|
||||
for (int i = 0; i < rects.Count; i++)
|
||||
{
|
||||
if (point.X>rects[i].X && point.X<rects[i].X+rects[i].Width)
|
||||
{
|
||||
Rectangle rect1 = rects[i];
|
||||
Rectangle rect2 = rects[i];
|
||||
|
||||
rect1.Width = (int)(point.X-rects[i].X);
|
||||
|
||||
rect2.Width = rects[i].Width - rect1.Width;
|
||||
rect2.X = rect1.X + rect1.Width;
|
||||
rects[i] = rect1;
|
||||
rects.Insert(i + 1, rect2); i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*for (int i = 0; i < rects.Count; i++)
|
||||
{
|
||||
if (rects[i].Width <= 0 || rects[i].Height <= 0)
|
||||
{
|
||||
rects.RemoveAt(i); i--;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
class CompareCCW : IComparer<Vector2>
|
||||
|
||||
Reference in New Issue
Block a user