Reliablesender exception handling, buttons crashing multiplayer, using screwdrivers/wrenches with left click, RestoreCollision exception handling, nerfed c4, UpdateLimbCollisionCategories fix

This commit is contained in:
Regalis
2015-10-23 00:10:27 +03:00
parent 51e68f0949
commit b3462b24b4
34 changed files with 256 additions and 113 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<ErrorReportUrlHistory /> <ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture> <FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles> <VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ProjectFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ReferencePath> <ReferencePath>
@@ -30,7 +30,7 @@
<!-- front fins --> <!-- front fins -->
<limb id = "4" width="50" height="200"> <limb id = "4" width="50" height="200">
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="133,5,91,202" depth="0.01" origin="0.7,0.5"/> <sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="133,5,91,202" depth="0.008" origin="0.7,0.5"/>
</limb> </limb>
<!-- back fins --> <!-- back fins -->
+2 -2
View File
@@ -15,12 +15,12 @@
<sound file="beep.ogg" type="OnUse" range="500.0"/> <sound file="beep.ogg" type="OnUse" range="500.0"/>
</Controller> </Controller>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<RequiredItem name="Screwdriver" type="Equipped"/> <RequiredItem name="Screwdriver" type="Equipped"/>
<output name="signal_out"/> <output name="signal_out"/>
</ConnectionPanel> </ConnectionPanel>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" attachedbydefault="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" attachedbydefault="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
+2 -2
View File
@@ -19,7 +19,7 @@
<item name="Welding Tool"/> <item name="Welding Tool"/>
</fixrequirement> </fixrequirement>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="toggle"/> <input name="toggle"/>
<input name="set_state"/> <input name="set_state"/>
@@ -48,7 +48,7 @@
<item name="Welding Tool"/> <item name="Welding Tool"/>
</fixrequirement> </fixrequirement>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="toggle"/> <input name="toggle"/>
<input name="set_state"/> <input name="set_state"/>
@@ -11,7 +11,7 @@
<LightComponent color="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="50"/> <LightComponent color="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="50"/>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="power"/> <input name="power"/>
<input name="toggle"/> <input name="toggle"/>
@@ -17,7 +17,7 @@
<GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/> <GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/>
</PowerTransfer> </PowerTransfer>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<RequiredSkill name="Electrical Engineering" level="30"/> <RequiredSkill name="Electrical Engineering" level="30"/>
<StatusEffect type="OnFailure" target="Character"> <StatusEffect type="OnFailure" target="Character">
<Explosion range="100.0" damage="5" stun="10" force="2.0" flames="false" shockwave="false" sparks="true"/> <Explosion range="100.0" damage="5" stun="10" force="2.0" flames="false" shockwave="false" sparks="true"/>
@@ -45,7 +45,7 @@
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/> <StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
</PowerContainer> </PowerContainer>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<StatusEffect type="OnFailure" target="Character"> <StatusEffect type="OnFailure" target="Character">
<Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/> <Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/>
</StatusEffect> </StatusEffect>
@@ -69,7 +69,7 @@
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/> <GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
</PowerContainer> </PowerContainer>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<StatusEffect type="OnFailure" target="Character"> <StatusEffect type="OnFailure" target="Character">
<Explosion range="100.0" damage="30" stun="20" force="5.0" shockwave="false" sparks="true"/> <Explosion range="100.0" damage="30" stun="20" force="5.0" shockwave="false" sparks="true"/>
</StatusEffect> </StatusEffect>
@@ -80,13 +80,13 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in1"/> <input name="signal_in1"/>
<input name="signal_in2"/> <input name="signal_in2"/>
@@ -108,12 +108,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in1"/> <input name="signal_in1"/>
<input name="signal_in2"/> <input name="signal_in2"/>
@@ -135,12 +135,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in"/> <input name="signal_in"/>
<output name="signal_out"/> <output name="signal_out"/>
@@ -163,11 +163,11 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="toggle"/> <input name="toggle"/>
<input name="set_state"/> <input name="set_state"/>
@@ -188,12 +188,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<output name="signal_out"/> <output name="signal_out"/>
</ConnectionPanel> </ConnectionPanel>
@@ -212,12 +212,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in"/> <input name="signal_in"/>
<input name="set_output"/> <input name="set_output"/>
@@ -239,12 +239,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable aimpos="35,-10" handle1="0,0" attachable="true" aimable="true" <Holdable selectkey="ActionHit" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"> slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in"/> <input name="signal_in"/>
<output name="signal_out"/> <output name="signal_out"/>
@@ -264,12 +264,12 @@
<Body width="16" height="16"/> <Body width="16" height="16"/>
<Holdable aimpos="35,-10" handle1="0,0" attachable="true" aimable="true" <Holdable selectkey="ActionHit" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"> slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="signal_in"/> <input name="signal_in"/>
<output name="signal_out"/> <output name="signal_out"/>
+21 -2
View File
@@ -13,7 +13,7 @@
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/> <sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
</Engine> </Engine>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/> <input name="power_in"/>
<input name="set_force"/> <input name="set_force"/>
@@ -38,7 +38,7 @@
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/> <ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
</Radar> </Radar>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/> <input name="power_in"/>
<input name="velocity_in"/> <input name="velocity_in"/>
@@ -46,4 +46,23 @@
<output name="velocity_y_out"/> <output name="velocity_y_out"/>
</ConnectionPanel> </ConnectionPanel>
</Item> </Item>
<Item
name="Sonar Monitor"
linkable="true"
pickdistance="150">
<Sprite texture ="fabricator.png" depth="0.8"/>
<Radar canbeselected = "true" powerconsumption="100">
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.6"/>
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
</Radar>
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/>
</ConnectionPanel>
</Item>
</Items> </Items>
+1 -1
View File
@@ -10,7 +10,7 @@
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.8"/> <GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.8"/>
</MiniMap> </MiniMap>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/> <input name="power_in"/>
</ConnectionPanel> </ConnectionPanel>
@@ -17,7 +17,7 @@
<Containable name="Oxygen Tank"/> <Containable name="Oxygen Tank"/>
</ItemContainer> </ItemContainer>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/> <input name="power_in"/>
</ConnectionPanel> </ConnectionPanel>
+1 -1
View File
@@ -10,7 +10,7 @@
<sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrFlow" volumemultiplier="0.01" loop="true"/> <sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrFlow" volumemultiplier="0.01" loop="true"/>
</Pump> </Pump>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/> <input name="power_in"/>
<input name="toggle"/> <input name="toggle"/>
+1 -1
View File
@@ -31,7 +31,7 @@
</StatusEffect> </StatusEffect>
</Reactor> </Reactor>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver" type="Equipped"/> <requireditem name="Screwdriver" type="Equipped"/>
<output name="power_out"/> <output name="power_out"/>
<output name="temperature_out"/> <output name="temperature_out"/>
@@ -12,7 +12,7 @@
<Pickable slots="Any"> <Pickable slots="Any">
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg"> <StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="500.0" structuredamage="300" damage="200" stun="5" force="20.0"/> <Explosion range="500.0" structuredamage="250" damage="200" stun="5" force="20.0"/>
</StatusEffect> </StatusEffect>
</Pickable> </Pickable>
</Item> </Item>
@@ -27,7 +27,7 @@
<Body width="16" height="9"/> <Body width="16" height="9"/>
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"> <Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
@@ -35,7 +35,7 @@
<Containable name="explosive"/> <Containable name="explosive"/>
</ItemContainer> </ItemContainer>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="activate"> <input name="activate">
<StatusEffect type="OnUse" target="Contained" Condition="-100.0"/> <StatusEffect type="OnUse" target="Contained" Condition="-100.0"/>
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.1")] [assembly: AssemblyVersion("0.2.3.0")]
[assembly: AssemblyFileVersion("0.0.0.1")] [assembly: AssemblyFileVersion("0.2.3.0")]
+3 -3
View File
@@ -165,8 +165,8 @@ namespace Barotrauma
try try
{ {
targetDir = message.ReadBoolean(); targetDir = message.ReadBoolean();
targetMovement.X = message.ReadRangedSingle(-10.0f, 10.0f, 8); targetMovement.X = message.ReadRangedSingle(-10.0f, 10.0f, 16);
targetMovement.Y = message.ReadRangedSingle(-10.0f, 10.0f, 8); targetMovement.Y = message.ReadRangedSingle(-10.0f, 10.0f, 16);
} }
catch catch
@@ -236,7 +236,7 @@ namespace Barotrauma
catch { return; } catch { return; }
//error
AnimController.RefLimb.body.TargetPosition = pos; AnimController.RefLimb.body.TargetPosition = pos;
AnimController.RefLimb.body.TargetVelocity = vel; AnimController.RefLimb.body.TargetVelocity = vel;
+24 -12
View File
@@ -626,8 +626,7 @@ namespace Barotrauma
selectedCharacter = null; selectedCharacter = null;
if (createNetworkEvent) if (createNetworkEvent) new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, (ushort)0);
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, 0);
} }
/// <summary> /// <summary>
@@ -723,9 +722,10 @@ namespace Barotrauma
if (closestItem != null) if (closestItem != null)
{ {
closestItem.IsHighlighted = true; closestItem.IsHighlighted = true;
if (GetInputState(InputType.Select) && closestItem.Pick(this, false)) if (closestItem.Pick(this))
{ {
new NetworkEvent(NetworkEventType.PickItem, ID, true, closestItem.ID); new NetworkEvent(NetworkEventType.PickItem, ID, true,
new int[] { closestItem.ID, GetInputState(InputType.Select) ? 1 : 0, GetInputState(InputType.ActionHit) ? 1 : 0 });
} }
} }
} }
@@ -801,7 +801,7 @@ namespace Barotrauma
if (!(this is AICharacter)) Control(deltaTime, cam); if (!(this is AICharacter)) Control(deltaTime, cam);
UpdateSightRange(); UpdateSightRange();
aiTarget.SoundRange = 0.0f; if (aiTarget != null) aiTarget.SoundRange = 0.0f;
lowPassMultiplier = MathHelper.Lerp(lowPassMultiplier, 1.0f, 0.1f); lowPassMultiplier = MathHelper.Lerp(lowPassMultiplier, 1.0f, 0.1f);
@@ -830,6 +830,8 @@ namespace Barotrauma
private void UpdateSightRange() private void UpdateSightRange()
{ {
if (aiTarget == null) return;
aiTarget.SightRange = 0.0f; aiTarget.SightRange = 0.0f;
//distance is approximated based on the mass of the character //distance is approximated based on the mass of the character
@@ -1088,10 +1090,17 @@ namespace Barotrauma
{ {
if (type == NetworkEventType.PickItem) if (type == NetworkEventType.PickItem)
{ {
message.Write((ushort)data); int[] pickData = (int[])data;
if (pickData.Length != 3) return false;
message.Write((ushort)pickData[0]);
message.Write((int)pickData[1] == 1);
message.Write((int)pickData[2] == 1);
message.WritePadBits();
return true; return true;
} }
else if (type== NetworkEventType.SelectCharacter) else if (type == NetworkEventType.SelectCharacter)
{ {
message.Write((ushort)data); message.Write((ushort)data);
return true; return true;
@@ -1193,12 +1202,15 @@ namespace Barotrauma
itemId = message.ReadUInt16(); itemId = message.ReadUInt16();
bool pickHit = message.ReadBoolean();
bool actionHit = message.ReadBoolean();
System.Diagnostics.Debug.WriteLine("item id: "+itemId); System.Diagnostics.Debug.WriteLine("item id: "+itemId);
Item item = FindEntityByID(itemId) as Item; Item item = FindEntityByID(itemId) as Item;
if (item != null) if (item != null)
{ {
item.Pick(this); item.Pick(this, false, pickHit, actionHit);
} }
return; return;
@@ -1249,9 +1261,9 @@ namespace Barotrauma
bool hasInputs = message.ReadBoolean(); bool hasInputs = message.ReadBoolean();
sendingTime = message.ReadFloat(); sendingTime = message.ReadFloat();
if (!hasInputs && sendingTime > LastNetworkUpdate) if (!hasInputs)
{ {
ClearInputs(); if (sendingTime > LastNetworkUpdate) ClearInputs();
return; return;
} }
@@ -1266,7 +1278,7 @@ namespace Barotrauma
runState = message.ReadBoolean(); runState = message.ReadBoolean();
} }
catch catch (Exception e)
{ {
return; return;
} }
@@ -1310,7 +1322,7 @@ namespace Barotrauma
} }
if (secondaryKeyState) if (secondaryKeyState)
{ {
cursorPosition = cursorPos; cursorPosition = MathUtils.IsValid(cursorPos) ? cursorPos : Vector2.Zero;
} }
else else
{ {
+9 -1
View File
@@ -531,7 +531,15 @@ namespace Barotrauma
{ {
if (limb.ignoreCollisions) continue; if (limb.ignoreCollisions) continue;
limb.body.CollidesWith = collisionCategory; try
{
limb.body.CollidesWith = collisionCategory;
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to update ragdoll limb collisioncategories", e);
}
} }
} }
+5 -5
View File
@@ -159,15 +159,15 @@ namespace Barotrauma
public void GiveReward() public void GiveReward()
{ {
if (!string.IsNullOrWhiteSpace(successMessage))
{
new GUIMessageBox("Quest completed successfully", successMessage);
}
var mode = GameMain.GameSession.gameMode as SinglePlayerMode; var mode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (mode == null) return; if (mode == null) return;
mode.Money += reward; mode.Money += reward;
if (!string.IsNullOrWhiteSpace(successMessage))
{
new GUIMessageBox("Quest completed", successMessage);
}
} }
} }
} }
+3 -3
View File
@@ -185,10 +185,10 @@ namespace Barotrauma
public bool IsParentOf(GUIComponent component) public bool IsParentOf(GUIComponent component)
{ {
foreach (GUIComponent child in children) for(int i = children.Count - 1; i >= 0; i--)
{ {
if (child == component) return true; if (children[i] == component) return true;
if (child.IsParentOf(component)) return true; if (children[i].IsParentOf(component)) return true;
} }
return false; return false;
+5 -2
View File
@@ -305,7 +305,8 @@ namespace Barotrauma
if (titleScreenOpen) if (titleScreenOpen)
{ {
TitleScreen.Draw(spriteBatch, GraphicsDevice, (float)deltaTime); TitleScreen.Draw(spriteBatch, GraphicsDevice, (float)deltaTime);
if (TitleScreen.LoadState>=100.0f && (PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked())) if (TitleScreen.LoadState>=100.0f &&
(!waitForKeyHit || PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked()))
{ {
titleScreenOpen = false; titleScreenOpen = false;
} }
@@ -325,8 +326,10 @@ namespace Barotrauma
Stopwatch sw; Stopwatch sw;
public static void ShowLoading(IEnumerable<object> loader) static bool waitForKeyHit = true;
public static void ShowLoading(IEnumerable<object> loader, bool waitKeyHit = true)
{ {
waitForKeyHit = waitKeyHit;
titleScreenOpen = true; titleScreenOpen = true;
CoroutineManager.StartCoroutine(TitleScreen.DoLoading(loader)); CoroutineManager.StartCoroutine(TitleScreen.DoLoading(loader));
@@ -213,7 +213,7 @@ namespace Barotrauma
yield return new WaitForSeconds(5.0f); yield return new WaitForSeconds(5.0f);
infoBox = CreateInfoFrame("You need a screwdriver to check the wiring of the terminal." infoBox = CreateInfoFrame("You need a screwdriver to check the wiring of the terminal."
+ " Equip a screwdriver by pulling it to either of the slots with a hand symbol, and then select the terminal again by pressing E."); + " Equip a screwdriver by pulling it to either of the slots with a hand symbol, and then use it on the terminal by left clicking.");
while (Character.Controlled.SelectedConstruction != steering.Item || while (Character.Controlled.SelectedConstruction != steering.Item ||
Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.Name == "Screwdriver") == null) Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.Name == "Screwdriver") == null)
@@ -215,7 +215,7 @@ namespace Barotrauma.Items.Components
attached = true; attached = true;
item.NewComponentEvent(this, true, true); if (character != null) item.NewComponentEvent(this, true, true);
return true; return true;
} }
@@ -37,7 +37,7 @@ namespace Barotrauma.Items.Components
if (picker == null) return false; if (picker == null) return false;
if (picker.Inventory == 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; if (!picker.HasSelectedItem(item) && item.body!=null) item.body.Enabled = false;
this.picker = picker; this.picker = picker;
@@ -108,6 +108,18 @@ namespace Barotrauma.Items.Components
set { canBeSelected = value; } set { canBeSelected = value; }
} }
public InputType PickKey
{
get;
private set;
}
public InputType SelectKey
{
get;
private set;
}
[HasDefaultValue(false, false)] [HasDefaultValue(false, false)]
public bool DeleteOnUse public bool DeleteOnUse
{ {
@@ -166,24 +178,26 @@ namespace Barotrauma.Items.Components
statusEffects = new List<StatusEffect>(); statusEffects = new List<StatusEffect>();
//var initableProperties = ObjectProperty.GetProperties<Initable>(this); SelectKey = InputType.Select;
//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;
// }
// }
// initableProperty.TrySetValue(value); try
//}
if (item.Name=="Welding Tool")
{ {
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); properties = ObjectProperty.InitProperties(this, element);
@@ -77,7 +77,7 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage) return; 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; IsActive = !IsActive;
item.NewComponentEvent(this, true, false); item.NewComponentEvent(this, true, false);
@@ -119,11 +119,31 @@ namespace Barotrauma.Items.Components
{ {
if (stickTarget!=null) 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; 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; stickJoint = null;
IsActive = false; IsActive = false;
@@ -420,11 +420,17 @@ namespace Barotrauma.Items.Components
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message) public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
{ {
Nodes.Clear(); Nodes.Clear();
List<Vector2> newNodes = new List<Vector2>();
int nodeCount = message.ReadByte(); int nodeCount = message.ReadByte();
for (int i = 0; i<nodeCount; i++) 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;
} }
} }
} }
+12 -7
View File
@@ -147,11 +147,11 @@ namespace Barotrauma
item.Drop(null, false); item.Drop(null, false);
return; return;
} }
public void DropItem(int i) //public void DropItem(int i)
{ //{
items[i].Drop(); // items[i].Drop();
items[i] = null; // items[i] = null;
} //}
public virtual void Draw(SpriteBatch spriteBatch) public virtual void Draw(SpriteBatch spriteBatch)
{ {
@@ -194,8 +194,7 @@ namespace Barotrauma
{ {
if (Owner!=null) if (Owner!=null)
{ {
ushort[] data = { draggingItem.ID, 0 }; new NetworkEvent(NetworkEventType.InventoryUpdate, Owner.ID, true);
new NetworkEvent(NetworkEventType.InventoryUpdate, Owner.ID, true, data);
} }
DropItem(draggingItem); DropItem(draggingItem);
@@ -281,8 +280,14 @@ namespace Barotrauma
Vector2 pos = new Vector2(rect.X + rect.Width / 2, rect.Y - rect.Height + 20) - GUI.Font.MeasureString(item.Name) * 0.5f; Vector2 pos = new Vector2(rect.X + rect.Width / 2, rect.Y - rect.Height + 20) - GUI.Font.MeasureString(item.Name) * 0.5f;
pos.X = (int)pos.X; pos.X = (int)pos.X;
pos.Y = (int)pos.Y; pos.Y = (int)pos.Y;
#if DEBUG
spriteBatch.DrawString(GUI.Font, item.Name+" - "+item.ID, pos - new Vector2(1.0f, 1.0f), Color.Black);
spriteBatch.DrawString(GUI.Font, item.Name+" - "+item.ID, pos, Color.White);
#else
spriteBatch.DrawString(GUI.Font, item.Name, pos - new Vector2(1.0f, 1.0f), Color.Black); spriteBatch.DrawString(GUI.Font, item.Name, pos - new Vector2(1.0f, 1.0f), Color.Black);
spriteBatch.DrawString(GUI.Font, item.Name, pos, Color.White); spriteBatch.DrawString(GUI.Font, item.Name, pos, Color.White);
#endif
} }
if (item.Condition < 100.0f) if (item.Condition < 100.0f)
+44 -8
View File
@@ -853,9 +853,9 @@ namespace Barotrauma
return closest; return closest;
} }
public bool Pick(Character picker, bool forcePick=false) public bool Pick(Character picker, bool ignoreRequiredItems=false, bool forceSelectKey=false, bool forceActionKey=false)
{ {
System.Diagnostics.Debug.WriteLine("Item.Pick("+picker+", "+forcePick+")");
bool hasRequiredSkills = true; bool hasRequiredSkills = true;
bool picked = false, selected = false; bool picked = false, selected = false;
@@ -864,13 +864,42 @@ namespace Barotrauma
foreach (ItemComponent ic in components) foreach (ItemComponent ic in components)
{ {
bool pickHit = false, selectHit = false;
if (Screen.Selected == GameMain.EditMapScreen)
{
pickHit = picker.GetInputState(InputType.Select);
selectHit = picker.GetInputState(InputType.Select);
}
else
{
if (forceSelectKey)
{
if (ic.PickKey == InputType.Select) pickHit = true;
if (ic.SelectKey == InputType.Select) selectHit = true;
}
else if (forceActionKey)
{
if (ic.PickKey == InputType.ActionHit) pickHit = true;
if (ic.SelectKey == InputType.ActionHit) selectHit = true;
}
else
{
pickHit = picker.GetInputState(ic.PickKey);
selectHit = picker.GetInputState(ic.SelectKey);
}
}
if (!pickHit && !selectHit) continue;
Skill tempRequiredSkill; Skill tempRequiredSkill;
if (!ic.HasRequiredSkills(picker, out tempRequiredSkill)) hasRequiredSkills = false; if (!ic.HasRequiredSkills(picker, out tempRequiredSkill)) hasRequiredSkills = false;
if (tempRequiredSkill != null) requiredSkill = tempRequiredSkill; if (tempRequiredSkill != null) requiredSkill = tempRequiredSkill;
if (!forcePick && !ic.HasRequiredItems(picker, picker == Character.Controlled)) continue; if (!ignoreRequiredItems && !ic.HasRequiredItems(picker, picker == Character.Controlled)) continue;
if ((ic.CanBePicked && ic.Pick(picker)) || (ic.CanBeSelected && ic.Select(picker))) if ((ic.CanBePicked && pickHit && ic.Pick(picker)) ||
(ic.CanBeSelected && selectHit && ic.Select(picker)))
{ {
picked = true; picked = true;
ic.ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker); ic.ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
@@ -879,9 +908,16 @@ namespace Barotrauma
} }
if (!picked) return false; if (!picked) return false;
if (selected)
System.Diagnostics.Debug.WriteLine("Item.Pick(" + picker + ", " + forceSelectKey + ")");
if (picker.SelectedConstruction == this)
{ {
picker.SelectedConstruction = (picker.SelectedConstruction == this) ? null : this; if (picker.GetInputState(InputType.Select)) picker.SelectedConstruction = null;
}
else if (selected)
{
picker.SelectedConstruction = this;
} }
if (!hasRequiredSkills && Character.Controlled==picker) if (!hasRequiredSkills && Character.Controlled==picker)
@@ -1177,7 +1213,7 @@ namespace Barotrauma
public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data) public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
{ {
message.Write(condition); message.Write((byte)MathHelper.Clamp(condition*2.55f,0.0f,255.0f));
switch (type) switch (type)
{ {
@@ -1244,7 +1280,7 @@ namespace Barotrauma
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message) public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
{ {
Condition = message.ReadFloat(); Condition = (float)message.ReadByte()/2.55f;
switch (type) switch (type)
{ {
+7 -4
View File
@@ -173,7 +173,7 @@ namespace Barotrauma.Networking
// When this is set to true, we are approved and ready to go // When this is set to true, we are approved and ready to go
bool CanStart = false; bool CanStart = false;
DateTime timeOut = DateTime.Now + new TimeSpan(0,0,15); DateTime timeOut = DateTime.Now + new TimeSpan(0,0,20);
// Loop until we are approved // Loop until we are approved
while (!CanStart && !connectCanceled) while (!CanStart && !connectCanceled)
@@ -247,9 +247,9 @@ namespace Barotrauma.Networking
} }
break; break;
case NetIncomingMessageType.StatusChanged: case NetIncomingMessageType.StatusChanged:
NetConnectionStatus connectionStatus = (NetConnectionStatus)inc.ReadByte(); DebugConsole.NewMessage("Connection status changed: " + client.ConnectionStatus.ToString(), Color.Orange);
Debug.WriteLine(connectionStatus);
NetConnectionStatus connectionStatus = (NetConnectionStatus)inc.ReadByte();
if (connectionStatus == NetConnectionStatus.Disconnected) if (connectionStatus == NetConnectionStatus.Disconnected)
{ {
string denyMessage = inc.ReadString(); string denyMessage = inc.ReadString();
@@ -284,6 +284,9 @@ namespace Barotrauma.Networking
if (client.ConnectionStatus != NetConnectionStatus.Connected) if (client.ConnectionStatus != NetConnectionStatus.Connected)
{ {
var reconnect = new GUIMessageBox("CONNECTION FAILED", "Failed to connect to server.", new string[] { "Retry", "Cancel" }); var reconnect = new GUIMessageBox("CONNECTION FAILED", "Failed to connect to server.", new string[] { "Retry", "Cancel" });
DebugConsole.NewMessage("Failed to connect to server - connection status: "+client.ConnectionStatus.ToString(), Color.Orange);
reconnect.Buttons[0].OnClicked += RetryConnection; reconnect.Buttons[0].OnClicked += RetryConnection;
reconnect.Buttons[0].OnClicked += reconnect.Close; reconnect.Buttons[0].OnClicked += reconnect.Close;
reconnect.Buttons[1].OnClicked += SelectMainMenu; reconnect.Buttons[1].OnClicked += SelectMainMenu;
@@ -412,7 +415,7 @@ namespace Barotrauma.Networking
case (byte)PacketTypes.StartGame: case (byte)PacketTypes.StartGame:
if (gameStarted) continue; if (gameStarted) continue;
GameMain.ShowLoading(StartGame(inc)); GameMain.ShowLoading(StartGame(inc), false);
break; break;
case (byte)PacketTypes.EndGame: case (byte)PacketTypes.EndGame:
+2 -1
View File
@@ -248,6 +248,7 @@ namespace Barotrauma.Networking
{ {
EndButtonHit(null, null); EndButtonHit(null, null);
AutoRestartTimer = 20.0f; AutoRestartTimer = 20.0f;
UpdateNetLobby(null,null);
return; return;
} }
} }
@@ -705,7 +706,7 @@ namespace Barotrauma.Networking
return false; return false;
} }
GameMain.ShowLoading(StartGame(selectedSub)); GameMain.ShowLoading(StartGame(selectedSub), false);
return true; return true;
} }
+22 -6
View File
@@ -19,14 +19,23 @@ namespace Barotrauma.Networking.ReliableMessages
receiver = new ReliableReceiver(host); receiver = new ReliableReceiver(host);
} }
public ReliableMessage CreateMessage(int lengthBytes = 0) public ReliableMessage CreateMessage()
{ {
return sender.CreateMessage(); return sender.CreateMessage();
} }
public void SendMessage(ReliableMessage message, NetConnection receiver) public void SendMessage(ReliableMessage message, NetConnection receiver)
{ {
sender.SendMessage(message, receiver); try
{
sender.SendMessage(message, receiver);
}
catch (Exception e)
{
#if DEBUG
DebugConsole.ThrowError("Sending a reliable message failed", e);
#endif
}
} }
public void HandleResendRequest(NetIncomingMessage inc) public void HandleResendRequest(NetIncomingMessage inc)
@@ -348,27 +357,34 @@ namespace Barotrauma.Networking.ReliableMessages
return; return;
} }
Debug.WriteLine("Received ack message: " + messageId + ", need to rerequest messages"); Debug.WriteLine("Received ack message: " + messageId + ", need to rerequest messages (last id: "+lastMessageID+")");
if (lastMessageID > ushort.MaxValue / 2 && messageId < short.MaxValue / 2) if (lastMessageID > ushort.MaxValue / 2 && messageId < short.MaxValue / 2)
{ {
for (ushort i = (ushort)Math.Min((int)lastMessageID + 1, ushort.MaxValue); i <= ushort.MaxValue; i++) for (ushort i = (ushort)Math.Min((int)lastMessageID + 1, ushort.MaxValue); i <= ushort.MaxValue; i++)
{ {
if (i == ushort.MaxValue && lastMessageID == ushort.MaxValue) break; if (i == ushort.MaxValue && lastMessageID == ushort.MaxValue) break;
if (!missingMessages.ContainsKey(i)) missingMessages.Add(i, new MissingMessage(i)); QueueMissingMessage(i);
if (i == ushort.MaxValue) break; if (i == ushort.MaxValue) break;
} }
for (ushort i = 1; i < messageId; i++) for (ushort i = 1; i < messageId; i++)
{ {
if (!missingMessages.ContainsKey(i)) missingMessages.Add(i, new MissingMessage(i)); QueueMissingMessage(i);
} }
} }
else else
{ {
//we already wrapped around but message hasn't, so it's an old message
if (lastMessageID < ushort.MaxValue / 2 && messageId > ushort.MaxValue / 2)
{
Debug.WriteLine("old already received message, ignore");
return;
}
for (ushort i = (ushort)Math.Min((int)lastMessageID+1, ushort.MaxValue); i <= messageId; i++) for (ushort i = (ushort)Math.Min((int)lastMessageID+1, ushort.MaxValue); i <= messageId; i++)
{ {
if (!missingMessages.ContainsKey(i)) missingMessages.Add(i, new MissingMessage(i)); QueueMissingMessage(i);
if (i == ushort.MaxValue) break; if (i == ushort.MaxValue) break;
} }
} }
+1 -1
View File
@@ -391,7 +391,7 @@ namespace Barotrauma
GUI.Draw((float)deltaTime, spriteBatch, null); GUI.Draw((float)deltaTime, spriteBatch, null);
spriteBatch.DrawString(GUI.Font, "Barotrauma chat lag test build", new Vector2(10, GameMain.GraphicsHeight-20), Color.White); spriteBatch.DrawString(GUI.Font, "Barotrauma v"+GameMain.Version, new Vector2(10, GameMain.GraphicsHeight-20), Color.White);
spriteBatch.End(); spriteBatch.End();
} }
Binary file not shown.