Only limbs with enough mass can cause impact damage to the sub, basictutorial changes, prevent ragdolls from teleporting inside submarinebody

This commit is contained in:
Regalis
2016-02-07 23:18:51 +02:00
parent 201dc1b733
commit 6de5bac61b
17 changed files with 53 additions and 21 deletions

View File

@@ -1023,6 +1023,9 @@
<None Include="Content\Items\Weapons\stungrenade.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Map\TutorialSub.sub">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\SmallFont.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@@ -122,7 +122,7 @@
<Holdable slots="Any,RightHand+LeftHand" aimpos="100,0" handle1="0,11" handle2="2,11"/>
<Propulsion force="80" usablein="water" particles="bubbles">
<RequiredItems name="Battery Cell" type="Contained" msg="Battery Cell required"/>
<RequiredItems name="Battery Cell,Fulgurium Battery Cell" type="Contained" msg="Battery Cell required"/>
<StatusEffect type="OnUse" target="Contained" targetnames="Battery Cell" Condition="-1.0"/>
<sound file="scooter.ogg" type="OnUse" range="500.0" loop="true"/>
</Propulsion>
@@ -130,6 +130,7 @@
<ItemContainer capacity="1" hideitems="true">
<Containable name="Battery Cell"/>
<Containable name="Fulgurium Battery Cell"/>
</ItemContainer>
</Item>
</Items>

View File

@@ -68,7 +68,7 @@
category="Electrical"
linkable="true"
pickdistance="150"
description="Can take in and deliver power much faster than batteries.">
description="Can deliver charge much faster than batteries.">
<Sprite texture ="supercapacitor.png" depth="0.8"/>

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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.5")]
[assembly: AssemblyFileVersion("0.3.0.5")]
[assembly: AssemblyVersion("0.3.1.0")]
[assembly: AssemblyFileVersion("0.3.1.0")]

View File

@@ -428,6 +428,7 @@ namespace Barotrauma
if (limb.pullJoint != null)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA);
if (currentHull != null) pos += currentHull.Submarine.Position;
pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);
@@ -455,6 +456,7 @@ namespace Barotrauma
if (limb.body.TargetPosition != Vector2.Zero)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.body.TargetPosition);
if (currentHull != null) pos += currentHull.Submarine.Position;
pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f);
@@ -764,6 +766,19 @@ namespace Barotrauma
//if the limb is closer than alloweddistance, just ignore the difference
float allowedDistance = NetConfig.AllowedRagdollDistance * ((inWater) ? 2.0f : 1.0f);
if (currentHull == null)
{
var overLappingHull = Hull.FindHull(ConvertUnits.ToDisplayUnits(refLimb.body.TargetPosition), null, true);
if (overLappingHull != null)
{
Submarine.PickBody(refLimb.SimPosition, refLimb.body.TargetPosition, null, Physics.CollisionWall);
refLimb.body.TargetPosition = refLimb.SimPosition + (refLimb.body.TargetPosition - refLimb.SimPosition) * Submarine.LastPickedFraction * 0.9f;
}
}
float dist = Vector2.Distance(refLimb.body.SimPosition, refLimb.body.TargetPosition);
//if the limb is further away than resetdistance, all limbs are immediately snapped to their targetpositions
@@ -786,8 +801,6 @@ namespace Barotrauma
{
if (inWater)
{
if (character is AICharacter)
{
correctionMovement =
@@ -802,8 +815,6 @@ namespace Barotrauma
limb.body.SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation);
}
}
}
else
{

View File

@@ -162,7 +162,7 @@ namespace Barotrauma.Tutorials
{
yield return CoroutineStatus.Running;
}
yield return new WaitForSeconds(5.0f);
yield return new WaitForSeconds(1.0f);
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 use it on the terminal by left clicking.");
@@ -275,7 +275,7 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
while (Submarine.Loaded.WorldPosition.Y > 33000.0f)
while (Submarine.Loaded.WorldPosition.Y > 31000.0f)
{
yield return CoroutineStatus.Running;
}
@@ -293,7 +293,7 @@ namespace Barotrauma.Tutorials
{
if (s.CastShadow || !s.HasBody) continue;
if (s.Rect.Right > steering.Item.Position.X) windows.Add(s);
if (s.Rect.Right > steering.Item.CurrentHull.Rect.Right) windows.Add(s);
}
bool broken = false;
@@ -407,8 +407,7 @@ namespace Barotrauma.Tutorials
yield return new WaitForSeconds(1.0f);
}
infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate, so " +
"be careful not to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good " +
infoBox = CreateInfoFrame("The capacitors take some time to recharge, so now is a good " +
"time to head to the room below and load some shells for the railgun.");
@@ -489,7 +488,7 @@ namespace Barotrauma.Tutorials
yield return new WaitForSeconds(1.0f);
} while (broken);
infoBox = CreateInfoFrame("Great! However, there's still quite a bit of water inside the sub. It should be pumped out "
infoBox = CreateInfoFrame("The hull is fixed now, but there's still quite a bit of water inside the sub. It should be pumped out "
+ "using the bilge pump in the room at the bottom of the submarine.");
Pump pump = Item.ItemList.Find(i => i.HasTag("tutorialpump")).GetComponent<Pump>();

View File

@@ -445,7 +445,7 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Output: " + (int)temperature + " kW",
new Vector2(x + 450, y + 30), Color.Red);
spriteBatch.DrawString(GUI.Font, "Grid load: " + (int)load + " kW",
new Vector2(x + 620, y + 30), Color.Yellow);
new Vector2(x + 600, y + 30), Color.Yellow);
DrawGraph(tempGraph, spriteBatch,
new Rectangle(x + 30, y + 30, 400, 250), 10000.0f, xOffset, Color.Red);

View File

@@ -247,7 +247,7 @@ namespace Barotrauma.Items.Components
//GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
spriteBatch.DrawString(GUI.Font,
"Charge: " + (int)charge + "/" + (int)capacity + "kWm (" + (int)((charge / capacity) * 100.0f) + " %)",
"Charge: " + (int)charge + "/" + (int)capacity + " kWm (" + (int)((charge / capacity) * 100.0f) + " %)",
new Vector2(x + 30, y + 30), Color.White);
spriteBatch.DrawString(GUI.Font, "Recharge rate: " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", new Vector2(x + 30, y + 95), Color.White);

View File

@@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components
float wireInterval = 10.0f;
float rightWireX = x+width / 2 + wireInterval;
float rightWireX = x + width / 2 + wireInterval;
float leftWireX = x + width / 2 - wireInterval;
foreach (Connection c in panel.Connections)
{
@@ -291,6 +291,8 @@ namespace Barotrauma.Items.Components
if (draggingConnected != null)
{
DrawWire(spriteBatch, draggingConnected, draggingConnected, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false);
if (!PlayerInput.LeftButtonHeld())
{
panel.Item.NewComponentEvent(panel, true, true);
@@ -313,7 +315,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i<MaxLinked; i++)
{
if (Wires[i]==null) continue;
if (Wires[i]==null || draggingConnected == Wires[i].Item) continue;
Connection recipient = Wires[i].OtherConnection(this);
@@ -358,9 +360,11 @@ namespace Barotrauma.Items.Components
}
}
int screwIndex = (position.Y % 60 < 30) ? 0 : 1;
if (Wires.Any(w => w != null && w.Item != draggingConnected))
{
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(32, 256, 32, 32), Color.White);
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(screwIndex*32, 256, 32, 32), Color.White);
}
}

View File

@@ -50,6 +50,8 @@ namespace Barotrauma
public Md5Hash(XDocument doc)
{
if (doc == null) return;
string docString = Regex.Replace(doc.ToString(), @"\s+", "");
byte[] inputBytes = Encoding.ASCII.GetBytes(docString);

View File

@@ -349,13 +349,13 @@ namespace Barotrauma
{
bool collision = HandleLimbCollision(contact, limb);
if (collision)
if (collision && limb.Mass>100.0f)
{
Vector2 normal = Vector2.Normalize(body.Position - limb.SimPosition);
//normal *= Math.Min(limb.Mass,100)/100.0f;
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal),5.0f);
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal), 5.0f);
ApplyImpact(impact * Math.Min(limb.Mass/200.0f, 1), -normal, contact);

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +1,15 @@
---------------------------------------------------------------------------------------------------------
v0.3.1.0
---------------------------------------------------------------------------------------------------------
- batteries have separate power_in and power_out connections, which allows recharging and powering devices
simultaneously and using separate recharge circuits
- using supercapacitors as a substitute for batteries now longer works: they have a very low energy storage
capacity and are only suitable for providing short high-energy power surges
- improved connection panel graphics
- fixed a bug that caused the submarine to swoop to a random direction when a character enters it
- fixed crashed caused by EntityGrid.GetEntites()
---------------------------------------------------------------------------------------------------------
v0.3.0.5
---------------------------------------------------------------------------------------------------------

Binary file not shown.