diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index 0df081dfa..9b73026a4 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -114,7 +114,6 @@ - diff --git a/Subsurface/Content/Items/Clothes/clothes.xml b/Subsurface/Content/Items/Clothes/clothes.xml index abb23988d..8e6a536b8 100644 --- a/Subsurface/Content/Items/Clothes/clothes.xml +++ b/Subsurface/Content/Items/Clothes/clothes.xml @@ -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."> + + + + + diff --git a/Subsurface/Content/Items/Fabricators/materials.xml b/Subsurface/Content/Items/Fabricators/materials.xml index 023f9eb70..68c315c4f 100644 --- a/Subsurface/Content/Items/Fabricators/materials.xml +++ b/Subsurface/Content/Items/Fabricators/materials.xml @@ -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"> diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml index 8383f4073..173fdc52d 100644 --- a/Subsurface/Content/Items/Weapons/weapons.xml +++ b/Subsurface/Content/Items/Weapons/weapons.xml @@ -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."> + + + + + @@ -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."> + + + + + + @@ -124,6 +135,12 @@ tags="smallitem,loadable" description="A battery cell contructed of the rare and poorly understood compound Fulgurium."> + + + + + + diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs index 03a2078b0..8616ac8a7 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs @@ -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 ignoredBodies = new List(); foreach (Limb limb in character.AnimController.Limbs) diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index a77535b64..d5794beeb 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -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() diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index fb2b199e7..c99c5fc14 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -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); } } diff --git a/Subsurface/Source/GameSession/CrewManager.cs b/Subsurface/Source/GameSession/CrewManager.cs index d5d39643d..439e7e921 100644 --- a/Subsurface/Source/GameSession/CrewManager.cs +++ b/Subsurface/Source/GameSession/CrewManager.cs @@ -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; } diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs index d97848e84..1ef01de41 100644 --- a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs +++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs @@ -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); diff --git a/Subsurface/Source/GameSession/ShiftSummary.cs b/Subsurface/Source/GameSession/ShiftSummary.cs index 330044795..d8a773423 100644 --- a/Subsurface/Source/GameSession/ShiftSummary.cs +++ b/Subsurface/Source/GameSession/ShiftSummary.cs @@ -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; diff --git a/Subsurface/Source/Items/CharacterInventory.cs b/Subsurface/Source/Items/CharacterInventory.cs index aebb6ddc7..28ed5c998 100644 --- a/Subsurface/Source/Items/CharacterInventory.cs +++ b/Subsurface/Source/Items/CharacterInventory.cs @@ -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; } diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 34a0c5a3c..94021653e 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -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; diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 5f20852f4..0f46d2664 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -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; } diff --git a/Subsurface/Source/Map/Gap.cs b/Subsurface/Source/Map/Gap.cs index 9f5c8f0e3..10f0f933b 100644 --- a/Subsurface/Source/Map/Gap.cs +++ b/Subsurface/Source/Map/Gap.cs @@ -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); } } diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs index 6c296645e..f32694aa3 100644 --- a/Subsurface/Source/Map/Submarine.cs +++ b/Subsurface/Source/Map/Submarine.cs @@ -349,7 +349,7 @@ namespace Barotrauma /// check visibility between two points (in sim units) /// /// a physics body that was between the points (or null) - 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) { diff --git a/Subsurface/Source/Map/SubmarineBody.cs b/Subsurface/Source/Map/SubmarineBody.cs index 50f8130bf..335fb4265 100644 --- a/Subsurface/Source/Map/SubmarineBody.cs +++ b/Subsurface/Source/Map/SubmarineBody.cs @@ -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 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 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; diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs index 814cb8cd4..0eedfcac7 100644 --- a/Subsurface/Source/Map/WayPoint.cs +++ b/Subsurface/Source/Map/WayPoint.cs @@ -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); diff --git a/Subsurface/Source/Particles/Particle.cs b/Subsurface/Source/Particles/Particle.cs index 3cdf3ea91..79714501d 100644 --- a/Subsurface/Source/Particles/Particle.cs +++ b/Subsurface/Source/Particles/Particle.cs @@ -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) diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 3c2e71c93..dc20b0e45 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ