- Larger icon for gap/ladder waypoints

- Creature-sub collision damage improvements (takes velocity of the limb into account)
- In-sub particles move with the sub
- Fixed artifacts spawning to non-pickable positions
- Fixed ItemInventories not being drawn if the item is in a subslot
- CauseOfDeath = Drowning if the character is in water while running out of oxy
- Some more deconstructable items
This commit is contained in:
Regalis
2016-01-20 23:31:37 +02:00
parent 75b8e44d3c
commit 97b3d8451c
19 changed files with 104 additions and 39 deletions
-1
View File
@@ -114,7 +114,6 @@
<Compile Include="Source\GUI\TitleScreen.cs" />
<Compile Include="Source\Items\Components\Holdable\MeleeWeapon.cs" />
<Compile Include="Source\Items\Components\Holdable\Propulsion.cs" />
<Compile Include="Source\Items\Components\Label.cs" />
<Compile Include="Source\Items\Components\Machines\Deconstructor.cs" />
<Compile Include="Source\Items\Components\Signal\WaterDetector.cs" />
<Compile Include="Source\Items\Components\Signal\WifiComponent.cs" />
@@ -81,6 +81,11 @@
tags="smallitem"
description="While the helmet won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board.">
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="securitygear.png" sourcerect="40,32,34,25" depth="0.6"/>
<Body radius="12"/>
@@ -52,7 +52,7 @@
category="Material"
Tags="smallitem"
pickdistance="150"
spritecolor="1.0,1.0,1.0,0.9"
spritecolor="0.9,0.9,1.0,0.9"
canbepicked="true"
price="50">
@@ -79,6 +79,11 @@
price="100"
description="If verbal orders are insufficient, a high-voltage shock from a Stun Baton may be enough to beat an unruly crew member into submission.">
<Deconstruct time="10">
<Item name="Steel Bar"/>
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture="weapons.png" sourcerect="20,0,77,23" depth="0.5"/>
<Body width="90" height="30" density="10"/>
@@ -110,6 +115,12 @@
price="50"
description="Used as a power source for various handheld devices. Most submarines have several stationary backup batteries with recharge docks for battery cells.">
<Deconstruct time="10">
<Item name="Steel Bar"/>
<Item name="FPGA Circuit"/>
<Item name="Copper Bar"/>
</Deconstruct>
<Sprite texture="weapons.png" sourcerect="0,0,20,9" depth="0.8"/>
<Body width="20" height="9" density="15"/>
@@ -124,6 +135,12 @@
tags="smallitem,loadable"
description="A battery cell contructed of the rare and poorly understood compound Fulgurium.">
<Deconstruct time="10">
<Item name="Steel Bar"/>
<Item name="FPGA Circuit"/>
<Item name="Fulgurium Bar"/>
</Deconstruct>
<Sprite texture="weapons.png" sourcerect="0,0,20,9" depth="0.8"/>
<Body width="20" height="9" density="15"/>
@@ -56,8 +56,8 @@ namespace Barotrauma
Vector2 enemyDiff = Vector2.Normalize(enemy.Position - character.Position);
float weaponAngle = ((weapon.body.Dir == 1.0f) ? weapon.body.Rotation : weapon.body.Rotation - MathHelper.Pi);
Vector2 weaponDir = new Vector2((float)Math.Cos(weaponAngle), (float)Math.Sin(weaponAngle));
if (Vector2.Dot(enemyDiff, weaponDir)<0.9f) return;
if (Vector2.Dot(enemyDiff, weaponDir) < 0.9f) return;
List<FarseerPhysics.Dynamics.Body> ignoredBodies = new List<FarseerPhysics.Dynamics.Body>();
foreach (Limb limb in character.AnimController.Limbs)
@@ -96,12 +96,17 @@ namespace Barotrauma
}
}
character.AIController.SteeringManager.SteeringSeek(currTargetPos);
if (Vector2.Distance(currTargetPos, character.SimPosition) < 1.0f)
{
character.AIController.SteeringManager.Reset();
character.AnimController.TargetDir = currTargetPos.X > character.SimPosition.X ? Direction.Right : Direction.Left;
}
else
{
character.AIController.SteeringManager.SteeringSeek(currTargetPos);
}
}
public override bool IsCompleted()
+1 -1
View File
@@ -217,7 +217,7 @@ namespace Barotrauma
{
if (!MathUtils.IsValid(value)) return;
oxygen = MathHelper.Clamp(value, 0.0f, 100.0f);
if (oxygen == 0.0f) Kill(CauseOfDeath.Suffocation);
if (oxygen == 0.0f) Kill(AnimController.InWater ? CauseOfDeath.Drowning : CauseOfDeath.Suffocation);
}
}
@@ -97,6 +97,7 @@ namespace Barotrauma
var img = new GUIImage(new Rectangle(0, 0, 30, 30), order.SymbolSprite, Alignment.Center, orderListBox.children[characterIndex]);
img.Scale = 30.0f / img.SourceRect.Width;
img.Color = order.Color;
img.CanBeFocused = false;
img.ToolTip ="Order: "+ order.Name;
}
@@ -263,9 +263,13 @@ namespace Barotrauma
{
while (cinematic.Running)
{
if (Submarine.Loaded == null) yield return CoroutineStatus.Success;
yield return CoroutineStatus.Running;
}
if (Submarine.Loaded == null) yield return CoroutineStatus.Success;
End("");
yield return new WaitForSeconds(18.0f);
@@ -123,7 +123,7 @@ namespace Barotrauma
y += 30;
new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
(GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage+" asdf asdf rthdrthfgdh dsrt dfgh dftsret dfth dftdthdft sdre sdr ds askjinflaje wwwwwwwwww wwwwwwww wwwwwwwwwwwwwww wwwwwwwwwww",
(GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
GUI.Style, innerFrame, true);
//y += 50;
@@ -270,7 +270,7 @@ namespace Barotrauma
highlightedSlot = slotRect;
}
UpdateSlot(spriteBatch, slotRect, i, Items[i], i > 4);
UpdateSlot(spriteBatch, slotRect, i, Items[i], false, i>4 ? 0.2f : 0.4f);
if (draggingItem!=null && draggingItem == Items[i]) draggingItemSlot = slotRect;
}
+6 -6
View File
@@ -253,7 +253,7 @@ namespace Barotrauma
1.0f, SpriteEffects.None, 0.0f);
}
protected void UpdateSlot(SpriteBatch spriteBatch, Rectangle rect, int slotIndex, Item item, bool isSubSlot, bool drawItem=true)
protected void UpdateSlot(SpriteBatch spriteBatch, Rectangle rect, int slotIndex, Item item, bool isSubSlot, float alpha = 0.4f, bool drawItem=true)
{
bool mouseOn = rect.Contains(PlayerInput.MousePosition) && !Locked;
@@ -326,14 +326,14 @@ namespace Barotrauma
}
DrawSlot(spriteBatch, rect, (draggingItem == item && !mouseOn) ? null : item, mouseOn, isSubSlot, drawItem);
DrawSlot(spriteBatch, rect, (draggingItem == item && !mouseOn) ? null : item, mouseOn, isSubSlot, alpha, drawItem);
}
protected void DrawSlot(SpriteBatch spriteBatch, Rectangle rect, Item item, bool isHighLighted, bool isSubSlot, bool drawItem=true)
protected void DrawSlot(SpriteBatch spriteBatch, Rectangle rect, Item item, bool isHighLighted, bool isSubSlot, float alpha=0.4f, bool drawItem=true)
{
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * ((isSubSlot) ? 0.1f : 0.3f), true);
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * alpha*0.75f, true);
if (item != null && item.Condition < 100.0f)
{
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 4, rect.Width, 4), Color.Black, true);
@@ -342,7 +342,7 @@ namespace Barotrauma
Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f), true);
}
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * ((isSubSlot) ? 0.2f : 0.4f), false);
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * alpha, false);
if (item == null || !drawItem) return;
+10 -2
View File
@@ -806,7 +806,15 @@ namespace Barotrauma
object value = objectProperty.GetValue();
if (value != null)
{
propertyBox.Text = value.ToString();
if (value is float)
{
propertyBox.Text = ((float)value).ToString("G", System.Globalization.CultureInfo.InvariantCulture);
}
else
{
propertyBox.Text = value.ToString();
}
}
propertyBox.UserData = objectProperty;
@@ -924,7 +932,7 @@ namespace Barotrauma
if (!item.prefab.PickThroughWalls)
{
Body body = Submarine.CheckVisibility(item.Submarine == null ? position : position - item.Submarine.SimPosition, item.SimPosition);
Body body = Submarine.CheckVisibility(item.Submarine == null ? position : position - item.Submarine.SimPosition, item.SimPosition, true);
if (body != null && body.UserData as Item != item) continue;
}
+4 -4
View File
@@ -253,7 +253,7 @@ namespace Barotrauma
if (particle != null)
{
particle.Size = particle.Size * Math.Abs(flowForce.X / 1000.0f);
particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f),5.0f);
}
pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
@@ -279,14 +279,14 @@ namespace Barotrauma
var splash = GameMain.ParticleManager.CreateParticle(
"watersplash",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
-velocity);
-velocity, 0, FlowTargetHull);
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
GameMain.ParticleManager.CreateParticle(
"bubbles",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
flowForce / 2.0f);
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
flowForce / 2.0f, 0, FlowTargetHull);
}
}
+3 -1
View File
@@ -349,7 +349,7 @@ namespace Barotrauma
/// check visibility between two points (in sim units)
/// </summary>
/// <returns>a physics body that was between the points (or null)</returns>
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd, bool ignoreLevel = false)
{
Body closestBody = null;
float closestFraction = 1.0f;
@@ -365,6 +365,8 @@ namespace Barotrauma
if (fixture == null ||
(fixture.CollisionCategories != Physics.CollisionWall && fixture.CollisionCategories != Physics.CollisionLevel)) return -1;
if (ignoreLevel && fixture.CollisionCategories == Physics.CollisionLevel) return -1;
Structure structure = fixture.Body.UserData as Structure;
if (structure != null)
{
+22 -12
View File
@@ -353,9 +353,13 @@ namespace Barotrauma
{
Vector2 normal = Vector2.Normalize(body.Position - limb.SimPosition);
normal *= Math.Min(limb.Mass,100)/100.0f;
//normal *= Math.Min(limb.Mass,100)/100.0f;
ApplyImpact(normal, contact);
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal),5.0f);
ApplyImpact(impact * Math.Min(limb.Mass/200.0f, 1), -normal, contact);
//ApplyImpact((-limb.LinearVelocity * Math.Min(limb.Mass, 100)) / 50.0f, contact);
}
return collision;
@@ -365,7 +369,18 @@ namespace Barotrauma
}
var collisionNormal = Vector2.Normalize(ConvertUnits.ToDisplayUnits(body.Position) - cell.Center);
ApplyImpact(collisionNormal, contact);
Vector2 tempNormal;
FarseerPhysics.Common.FixedArray2<Vector2> worldPoints;
contact.GetWorldManifold(out tempNormal, out worldPoints);
Vector2 lastContactPoint = worldPoints[0];
float wallImpact = Vector2.Dot(Velocity, -collisionNormal);
ApplyImpact(wallImpact, -collisionNormal, contact);
//Vector2 u = Vector2.Dot(Velocity, -normal) * normal;
@@ -436,26 +451,21 @@ namespace Barotrauma
return false;
}
private void ApplyImpact(Vector2 normal,Contact contact)
private void ApplyImpact(float impact, Vector2 direction, Contact contact)
{
if (impact < 3.0f) return;
Vector2 tempNormal;
FarseerPhysics.Common.FixedArray2<Vector2> worldPoints;
contact.GetWorldManifold(out tempNormal, out worldPoints);
Vector2 lastContactPoint = worldPoints[0];
float impact = Vector2.Dot(Velocity, -normal);
if (impact < 3.0f) return;
SoundPlayer.PlayDamageSound(DamageSoundType.StructureBlunt, impact * 10.0f, ConvertUnits.ToDisplayUnits(lastContactPoint));
GameMain.GameScreen.Cam.Shake = impact * 2.0f;
Vector2 limbForce = -normal * impact * 0.5f;
Vector2 limbForce = direction * impact * 0.5f;
float length = limbForce.Length();
if (length > 10.0f) limbForce = (limbForce / length) * 10.0f;
+3 -1
View File
@@ -139,8 +139,10 @@ namespace Barotrauma
int iconX = iconIndices[(int)spawnType]*IconSize % iconTexture.Width;
int iconY = (int)(Math.Floor(iconIndices[(int)spawnType]*IconSize / (float)iconTexture.Width))*IconSize;
int iconSize = ConnectedGap == null && Ladders == null ? IconSize : (int)(IconSize * 1.5f);
spriteBatch.Draw(iconTexture,
new Rectangle((int)(drawPos.X - IconSize/2), (int)(drawPos.Y - IconSize/2), IconSize, IconSize),
new Rectangle((int)(drawPos.X - iconSize/2), (int)(drawPos.Y - iconSize/2), iconSize, iconSize),
new Rectangle(iconX, iconY, IconSize,IconSize), clr);
//GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true);
+16 -4
View File
@@ -74,7 +74,16 @@ namespace Barotrauma.Particles
spriteIndex = Rand.Int(prefab.Sprites.Count);
currentHull = Hull.FindHull(position, hullGuess);
if (currentHull != null && currentHull.Submarine != null) speed += ConvertUnits.ToDisplayUnits(currentHull.Submarine.Velocity);
//if (currentHull != null && currentHull.Submarine != null)
//{
// Vector2 subVel = ConvertUnits.ToDisplayUnits(currentHull.Submarine.Velocity);
// //subVel.Y = -subVel.Y;
// speed += subVel;
//}
//else
//{
// int a = 1;
//}
//if (currentHull == null) position = Submarine.Loaded == null ? position : position + Submarine.Loaded.Position;
this.position = position;
@@ -133,9 +142,12 @@ namespace Barotrauma.Particles
public bool Update(float deltaTime)
{
Vector2 subVel = currentHull ==null || currentHull.Submarine==null ? Vector2.Zero : ConvertUnits.ToDisplayUnits(currentHull.Submarine.Velocity);
//over 3 times faster than position += velocity * deltatime
position.X += velocity.X * deltaTime;
position.Y += velocity.Y * deltaTime;
position.X += (velocity.X+subVel.X) * deltaTime;
position.Y += (velocity.Y+subVel.Y) * deltaTime;
if (prefab.RotateToDirection)
{
@@ -237,7 +249,7 @@ namespace Barotrauma.Particles
{
position.Y = prevHullRect.Y - 1.0f;
velocity.X = Math.Abs(velocity.Y) * Math.Sign(velocity.X);
velocity.Y = -velocity.Y*0.1f;
velocity.Y = -velocity.Y * 0.1f;
}
if (position.X < prevHullRect.X)
Binary file not shown.