Merge remote-tracking branch 'refs/remotes/barotrauma/master'
Conflicts: Subsurface/Properties/AssemblyInfo.cs Subsurface/Source/Characters/Character.cs Subsurface/Source/GUI/GUI.cs Subsurface/Source/GameMain.cs Subsurface/Source/GameSettings.cs Subsurface/Source/Items/CharacterInventory.cs Subsurface/Source/Items/Components/ItemComponent.cs Subsurface/Source/Items/Components/Machines/Pump.cs Subsurface/Source/Items/Components/Machines/Radar.cs Subsurface/Source/Items/Components/Machines/Steering.cs Subsurface/Source/Items/Components/Power/PowerContainer.cs Subsurface/Source/Items/Inventory.cs Subsurface/Source/Items/Item.cs Subsurface/Source/Items/ItemSpawner.cs Subsurface/Source/Map/Levels/WaterRenderer.cs Subsurface/Source/Map/LinkedSubmarine.cs Subsurface/Source/Map/Map/Map.cs Subsurface/Source/Map/Structure.cs Subsurface/Source/Map/Submarine.cs Subsurface/Source/Map/WayPoint.cs Subsurface/Source/Networking/GameClient.cs Subsurface/Source/Networking/GameServer.cs Subsurface/Source/Physics/PhysicsBody.cs Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
@@ -56,10 +56,15 @@ namespace Barotrauma.Items.Components
|
||||
get
|
||||
{
|
||||
if (linkedGap != null) return linkedGap;
|
||||
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
linkedGap = e as Gap;
|
||||
if (linkedGap != null) return linkedGap;
|
||||
linkedGap = e as Gap;
|
||||
if (linkedGap != null)
|
||||
{
|
||||
linkedGap.PassAmbientLight = window != Rectangle.Empty;
|
||||
return linkedGap;
|
||||
}
|
||||
}
|
||||
Rectangle rect = item.Rect;
|
||||
if (isHorizontal)
|
||||
@@ -75,6 +80,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
linkedGap = new Gap(rect, Item.Submarine);
|
||||
linkedGap.Submarine = item.Submarine;
|
||||
linkedGap.PassAmbientLight = window != Rectangle.Empty;
|
||||
linkedGap.Open = openState;
|
||||
item.linkedTo.Add(linkedGap);
|
||||
return linkedGap;
|
||||
@@ -95,6 +101,11 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle WindowRect
|
||||
{
|
||||
get { return window; }
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
public bool IsOpen
|
||||
{
|
||||
|
||||
@@ -585,6 +585,8 @@ namespace Barotrauma.Items.Components
|
||||
return (average+100.0f)/2.0f;
|
||||
}
|
||||
|
||||
public virtual void FlipX() { }
|
||||
|
||||
public bool HasRequiredContainedItems(bool addMessage)
|
||||
{
|
||||
List<RelatedItem> requiredContained = requiredItems.FindAll(ri=> ri.Type == RelatedItem.RelationType.Contained);
|
||||
|
||||
@@ -11,6 +11,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
public LimbType limbType;
|
||||
public Vector2 position;
|
||||
|
||||
public LimbPos(LimbType limbType, Vector2 position)
|
||||
{
|
||||
this.limbType = limbType;
|
||||
this.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
class Controller : ItemComponent
|
||||
@@ -243,5 +249,31 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void FlipX()
|
||||
{
|
||||
if (dir != Direction.None)
|
||||
{
|
||||
dir = dir == Direction.Left ? Direction.Right : Direction.Left;
|
||||
}
|
||||
|
||||
if (userPos != 0.0f)
|
||||
{
|
||||
float diff = (item.Rect.X + UserPos) - item.Rect.Center.X;
|
||||
userPos = item.Rect.Center.X - diff - item.Rect.X;
|
||||
}
|
||||
|
||||
for (int i = 0; i < limbPositions.Count; i++)
|
||||
{
|
||||
float diff = (item.Rect.X + limbPositions[i].position.X) - item.Rect.Center.X;
|
||||
|
||||
Vector2 flippedPos =
|
||||
new Vector2(
|
||||
item.Rect.Center.X - diff - item.Rect.X,
|
||||
limbPositions[i].position.Y);
|
||||
|
||||
limbPositions[i] = new LimbPos(limbPositions[i].limbType, flippedPos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float lastUpdate;
|
||||
|
||||
private Hull hull1;
|
||||
public Hull hull1;
|
||||
|
||||
private GUITickBox isActiveTickBox;
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace Barotrauma.Items.Components
|
||||
private List<RadarBlip> radarBlips;
|
||||
private float prevPingRadius;
|
||||
|
||||
public static string StartMarker = "Start";
|
||||
public static string EndMarker = "End";
|
||||
|
||||
[HasDefaultValue(10000.0f, false)]
|
||||
public float Range
|
||||
{
|
||||
@@ -100,6 +103,11 @@ namespace Barotrauma.Items.Components
|
||||
return pingState > 1.0f;
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update((float)Timing.Step);
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
@@ -263,11 +271,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
|
||||
(GameMain.GameSession.Map == null) ? StartMarker : GameMain.GameSession.Map.CurrentLocation.Name,
|
||||
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
|
||||
(GameMain.GameSession.Map == null) ? EndMarker : GameMain.GameSession.Map.SelectedLocation.Name,
|
||||
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
|
||||
|
||||
if (GameMain.GameSession.Mission != null)
|
||||
@@ -284,6 +292,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (Submarine sub in Submarine.Loaded)
|
||||
{
|
||||
if (!sub.OnRadar) continue;
|
||||
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
|
||||
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ namespace Barotrauma.Items.Components
|
||||
item.body.CollisionCategories = Physics.CollisionProjectile;
|
||||
item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall | Physics.CollisionLevel;
|
||||
|
||||
IsActive = true;
|
||||
|
||||
if (stickJoint == null || !doesStick) return;
|
||||
|
||||
if (stickTarget != null)
|
||||
@@ -111,6 +113,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||
|
||||
if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
|
||||
{
|
||||
if (stickTarget != null)
|
||||
@@ -174,6 +178,8 @@ namespace Barotrauma.Items.Components
|
||||
ApplyStatusEffects(ActionType.OnUse, 1.0f);
|
||||
ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
||||
|
||||
IsActive = false;
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
item.body.FarseerBody.IsBullet = false;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
|
||||
base.Update(deltaTime, cam);
|
||||
|
||||
light.ParentSub = item.Submarine;
|
||||
|
||||
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime);
|
||||
|
||||
if (item.Container != null)
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
private float maxPower;
|
||||
|
||||
private float lastReceivedMessage;
|
||||
|
||||
[Editable, HasDefaultValue(1000.0f, true)]
|
||||
public float MaxPower
|
||||
{
|
||||
@@ -73,13 +75,43 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else if (connection.Name == "toggle")
|
||||
{
|
||||
IsOn = !IsOn;
|
||||
SetState(!IsOn,false,true);
|
||||
}
|
||||
else if (connection.Name == "set_state")
|
||||
{
|
||||
IsOn = signal != "0";
|
||||
SetState(signal != "0", false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetState(bool on, bool isNetworkMessage, bool sendNetworkMessage = false)
|
||||
{
|
||||
if (GameMain.Client != null && !isNetworkMessage) return;
|
||||
|
||||
IsOn = on;
|
||||
if (sendNetworkMessage)
|
||||
{
|
||||
item.NewComponentEvent(this, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write(IsOn);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
|
||||
{
|
||||
if (sendingTime < lastReceivedMessage) return;
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastReceivedMessage = sendingTime;
|
||||
|
||||
SetState(message.ReadBoolean(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,6 +470,14 @@ namespace Barotrauma.Items.Components
|
||||
wireSprite.Depth + ((item.ID % 100) * 0.00001f));
|
||||
}
|
||||
|
||||
public override void FlipX()
|
||||
{
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
{
|
||||
Nodes[i] = new Vector2(-Nodes[i].X, Nodes[i].Y);
|
||||
}
|
||||
}
|
||||
|
||||
public override XElement Save(XElement parentElement)
|
||||
{
|
||||
XElement componentElement = base.Save(parentElement);
|
||||
|
||||
@@ -347,6 +347,22 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
return projectiles;
|
||||
}
|
||||
|
||||
public override void FlipX()
|
||||
{
|
||||
minRotation = (float)Math.PI - minRotation;
|
||||
maxRotation = (float)Math.PI - maxRotation;
|
||||
|
||||
var temp = minRotation;
|
||||
minRotation = maxRotation;
|
||||
maxRotation = temp;
|
||||
|
||||
while (minRotation < 0)
|
||||
{
|
||||
minRotation += MathHelper.TwoPi;
|
||||
maxRotation += MathHelper.TwoPi;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user