Reliablesender exception handling, buttons crashing multiplayer, using screwdrivers/wrenches with left click, RestoreCollision exception handling, nerfed c4, UpdateLimbCollisionCategories fix
This commit is contained in:
@@ -215,7 +215,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
attached = true;
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
if (character != null) item.NewComponentEvent(this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Barotrauma.Items.Components
|
||||
if (picker == null) return false;
|
||||
if (picker.Inventory == null) return false;
|
||||
|
||||
if (picker.Inventory.TryPutItem(item, allowedSlots))
|
||||
if (picker.Inventory.TryPutItem(item, allowedSlots, picker==Character.Controlled))
|
||||
{
|
||||
if (!picker.HasSelectedItem(item) && item.body!=null) item.body.Enabled = false;
|
||||
this.picker = picker;
|
||||
|
||||
@@ -108,6 +108,18 @@ namespace Barotrauma.Items.Components
|
||||
set { canBeSelected = value; }
|
||||
}
|
||||
|
||||
public InputType PickKey
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public InputType SelectKey
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
public bool DeleteOnUse
|
||||
{
|
||||
@@ -166,24 +178,26 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
statusEffects = new List<StatusEffect>();
|
||||
|
||||
//var initableProperties = ObjectProperty.GetProperties<Initable>(this);
|
||||
//foreach (ObjectProperty initableProperty in initableProperties)
|
||||
//{
|
||||
// object value = ToolBox.GetAttributeObject(element, initableProperty.Name.ToLower());
|
||||
// if (value==null)
|
||||
// {
|
||||
// foreach (var ini in initableProperty.Attributes.OfType<Initable>())
|
||||
// {
|
||||
// value = ini.defaultValue;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
SelectKey = InputType.Select;
|
||||
|
||||
// initableProperty.TrySetValue(value);
|
||||
//}
|
||||
if (item.Name=="Welding Tool")
|
||||
try
|
||||
{
|
||||
int a = 1;
|
||||
SelectKey = (InputType)Enum.Parse(typeof(InputType), ToolBox.GetAttributeString(element, "selectkey", "Select"), true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Invalid select key in " + element + "!", e);
|
||||
}
|
||||
|
||||
PickKey = InputType.Select;
|
||||
|
||||
try
|
||||
{
|
||||
PickKey = (InputType)Enum.Parse(typeof(InputType), ToolBox.GetAttributeString(element, "selectkey", "Select"), true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e);
|
||||
}
|
||||
|
||||
properties = ObjectProperty.InitProperties(this, element);
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 200, 30), "Activate Radar"))
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 200, 30), "Activate Sonar"))
|
||||
{
|
||||
IsActive = !IsActive;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
@@ -119,11 +119,31 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (stickTarget!=null)
|
||||
{
|
||||
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
||||
try
|
||||
{
|
||||
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Failed to restore collision with stickTarget", e);
|
||||
#endif
|
||||
}
|
||||
|
||||
stickTarget = null;
|
||||
}
|
||||
|
||||
GameMain.World.RemoveJoint(stickJoint);
|
||||
try
|
||||
{
|
||||
GameMain.World.RemoveJoint(stickJoint);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Failed to remove stickJoint", e);
|
||||
#endif
|
||||
}
|
||||
|
||||
stickJoint = null;
|
||||
|
||||
IsActive = false;
|
||||
|
||||
@@ -420,11 +420,17 @@ namespace Barotrauma.Items.Components
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
{
|
||||
Nodes.Clear();
|
||||
|
||||
List<Vector2> newNodes = new List<Vector2>();
|
||||
int nodeCount = message.ReadByte();
|
||||
for (int i = 0; i<nodeCount; i++)
|
||||
{
|
||||
Nodes.Add(new Vector2(message.ReadFloat(), message.ReadFloat()));
|
||||
Vector2 newNode = new Vector2(message.ReadFloat(), message.ReadFloat());
|
||||
if (!MathUtils.IsValid(newNode)) return;
|
||||
newNodes.Add(newNode);
|
||||
}
|
||||
|
||||
Nodes = newNodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user