Fixed spectators joining messing up the game, textboxes are deselected when switching the screen, nerfed engineer construction level, tickboxes or textboxes cannot be selected through other ui elements
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<Job name="Engineer" description="Engineers have above-average construction and mechanic skills, but fixing complex mechanical devices is still usually out of their skill set. They are competent at fixing electrical devices however, and are the ones to turn to when the power grid starts failing." minnumber="1">
|
<Job name="Engineer" description="Engineers have above-average construction and mechanic skills, but fixing complex mechanical devices is still usually out of their skill set. They are competent at fixing electrical devices however, and are the ones to turn to when the power grid starts failing." minnumber="1">
|
||||||
<Skills>
|
<Skills>
|
||||||
<Skill name="Weapons" level="10,30"/>
|
<Skill name="Weapons" level="10,30"/>
|
||||||
<Skill name="Construction" level="30,40"/>
|
<Skill name="Construction" level="30,30"/>
|
||||||
<Skill name="Electrical Engineering" level="50,60"/>
|
<Skill name="Electrical Engineering" level="50,60"/>
|
||||||
</Skills>
|
</Skills>
|
||||||
<Item name="ID Card"/>
|
<Item name="ID Card"/>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<Skills>
|
<Skills>
|
||||||
<Skill name="Weapons" level="10,30"/>
|
<Skill name="Weapons" level="10,30"/>
|
||||||
<Skill name="Construction" level="50,60"/>
|
<Skill name="Construction" level="50,60"/>
|
||||||
<Skill name="Electrical Engineering" level="30,40"/>
|
<Skill name="Electrical Engineering" level="30,35"/>
|
||||||
</Skills>
|
</Skills>
|
||||||
<Item name="ID Card"/>
|
<Item name="ID Card"/>
|
||||||
<Item name="Wrench"/>
|
<Item name="Wrench"/>
|
||||||
|
|||||||
@@ -109,9 +109,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Character.AnimController is HumanoidAnimController)
|
if (Character.AnimController is HumanoidAnimController)
|
||||||
{
|
{
|
||||||
if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater)
|
if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater)
|
||||||
{
|
{
|
||||||
Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left;
|
Character.AnimController.TargetDir = Character.AnimController.movement.X > 0.0f ? Direction.Right : Direction.Left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.Item.Inventory == character.Inventory)
|
if (container.Item.ParentInventory == character.Inventory)
|
||||||
{
|
{
|
||||||
var containedItems = container.Inventory.Items;
|
var containedItems = container.Inventory.Items;
|
||||||
//if there's already something in the mask (empty oxygen tank?), drop it
|
//if there's already something in the mask (empty oxygen tank?), drop it
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue;
|
if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue;
|
||||||
if (IgnoreContainedItems && Item.ItemList[currSearchIndex].Container != null) continue;
|
if (IgnoreContainedItems && Item.ItemList[currSearchIndex].Container != null) continue;
|
||||||
if (Item.ItemList[currSearchIndex].Inventory is CharacterInventory) continue;
|
if (Item.ItemList[currSearchIndex].ParentInventory is CharacterInventory) continue;
|
||||||
|
|
||||||
targetItem = Item.ItemList[currSearchIndex];
|
targetItem = Item.ItemList[currSearchIndex];
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
//item.body.LinearVelocity = Vector2.Zero;
|
//item.body.LinearVelocity = Vector2.Zero;
|
||||||
if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false;
|
if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false;
|
||||||
if (item.CurrentHull == null) return;
|
if (item.CurrentHull == null) return;
|
||||||
|
|
||||||
state = 2;
|
state = 2;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
//item.body.LinearVelocity = Vector2.Zero;
|
//item.body.LinearVelocity = Vector2.Zero;
|
||||||
if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false;
|
if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false;
|
||||||
if (item.CurrentHull == null) return;
|
if (item.CurrentHull == null) return;
|
||||||
|
|
||||||
ShowMessage(state);
|
ShowMessage(state);
|
||||||
|
|||||||
@@ -183,18 +183,21 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
||||||
if (!Enabled) return;
|
if (!Enabled) return;
|
||||||
|
|
||||||
if (CaretEnabled)
|
if (CaretEnabled)
|
||||||
{
|
{
|
||||||
caretTimer += deltaTime;
|
caretTimer += deltaTime;
|
||||||
caretVisible = ((caretTimer*1000.0f) % 1000) < 500;
|
caretVisible = ((caretTimer * 1000.0f) % 1000) < 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect.Contains(PlayerInput.MousePosition))
|
if (rect.Contains(PlayerInput.MousePosition))
|
||||||
{
|
{
|
||||||
|
|
||||||
state = ComponentState.Hover;
|
state = ComponentState.Hover;
|
||||||
if (PlayerInput.LeftButtonClicked())
|
if (PlayerInput.LeftButtonClicked())
|
||||||
{
|
{
|
||||||
|
if (MouseOn != null && MouseOn != this && MouseOn!=textBlock && !MouseOn.IsParentOf(this)) return;
|
||||||
|
|
||||||
Select();
|
Select();
|
||||||
if (OnSelected != null) OnSelected(this, Keys.None);
|
if (OnSelected != null) OnSelected(this, Keys.None);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!Visible || !Enabled) return;
|
if (!Visible || !Enabled) return;
|
||||||
|
|
||||||
|
if (MouseOn != null && MouseOn != this && !MouseOn.IsParentOf(this)) return;
|
||||||
|
|
||||||
if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
|
if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
|
||||||
|
|
||||||
if (box.Rect.Contains(PlayerInput.MousePosition))
|
if (box.Rect.Contains(PlayerInput.MousePosition))
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ namespace Barotrauma
|
|||||||
System.Diagnostics.Debug.Assert(false);
|
System.Diagnostics.Debug.Assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Inventory otherInventory = Items[index].Inventory;
|
Inventory otherInventory = Items[index].ParentInventory;
|
||||||
if (otherInventory != null && createNetworkEvent)
|
if (otherInventory != null && otherInventory.Owner!=null && createNetworkEvent)
|
||||||
{
|
{
|
||||||
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true);
|
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true);
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ namespace Barotrauma
|
|||||||
string toolTip = "";
|
string toolTip = "";
|
||||||
Rectangle highlightedSlot = Rectangle.Empty;
|
Rectangle highlightedSlot = Rectangle.Empty;
|
||||||
|
|
||||||
if (doubleClickedItem!=null && doubleClickedItem.Inventory!=this)
|
if (doubleClickedItem!=null && doubleClickedItem.ParentInventory!=this)
|
||||||
{
|
{
|
||||||
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
|
|||||||
[HasDefaultValue(false, true)]
|
[HasDefaultValue(false, true)]
|
||||||
public bool Attached
|
public bool Attached
|
||||||
{
|
{
|
||||||
get { return attached && item.Inventory == null; }
|
get { return attached && item.ParentInventory == null; }
|
||||||
set { attached = value; }
|
set { attached = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (item.Inventory != null)
|
if (item.ParentInventory != null)
|
||||||
{
|
{
|
||||||
if (body != null)
|
if (body != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -125,11 +125,11 @@ namespace Barotrauma
|
|||||||
if (removeItem)
|
if (removeItem)
|
||||||
{
|
{
|
||||||
item.Drop(null, false);
|
item.Drop(null, false);
|
||||||
if (item.Inventory != null) item.Inventory.RemoveItem(item);
|
if (item.ParentInventory != null) item.ParentInventory.RemoveItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
Items[i] = item;
|
Items[i] = item;
|
||||||
item.Inventory = this;
|
item.ParentInventory = this;
|
||||||
if (item.body != null)
|
if (item.body != null)
|
||||||
{
|
{
|
||||||
item.body.Enabled = false;
|
item.body.Enabled = false;
|
||||||
@@ -154,7 +154,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Items[n] != item) continue;
|
if (Items[n] != item) continue;
|
||||||
Items[n] = null;
|
Items[n] = null;
|
||||||
item.Inventory = null;
|
item.ParentInventory = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,20 +63,20 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool inWater;
|
private bool inWater;
|
||||||
|
|
||||||
private Inventory inventory;
|
private Inventory parentInventory;
|
||||||
|
|
||||||
//the inventory in which the item is contained in
|
//the inventory in which the item is contained in
|
||||||
public Inventory Inventory
|
public Inventory ParentInventory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return inventory;
|
return parentInventory;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
inventory = value;
|
parentInventory = value;
|
||||||
|
|
||||||
if (inventory != null) Container = inventory.Owner as Item;
|
if (parentInventory != null) Container = parentInventory.Owner as Item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace Barotrauma
|
|||||||
foreach (Item item in Item.ItemList)
|
foreach (Item item in Item.ItemList)
|
||||||
{
|
{
|
||||||
if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue;
|
if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue;
|
||||||
if (item.Inventory != null) return;
|
if (item.ParentInventory != null) return;
|
||||||
|
|
||||||
float range = (float)Math.Sqrt(size.X) * 10.0f;
|
float range = (float)Math.Sqrt(size.X) * 10.0f;
|
||||||
if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue;
|
if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue;
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ namespace Barotrauma.Networking
|
|||||||
(myCharacter == null || myCharacter.IsDead);
|
(myCharacter == null || myCharacter.IsDead);
|
||||||
|
|
||||||
//restart if all characters are dead or submarine is at the end of the level
|
//restart if all characters are dead or submarine is at the end of the level
|
||||||
if ((AutoRestart && isCrewDead)
|
if ((autoRestart && isCrewDead)
|
||||||
||
|
||
|
||||||
(endRoundAtLevelEnd && Submarine.Loaded!=null && Submarine.Loaded.AtEndPosition))
|
(endRoundAtLevelEnd && Submarine.Loaded!=null && Submarine.Loaded.AtEndPosition))
|
||||||
{
|
{
|
||||||
@@ -716,7 +716,7 @@ namespace Barotrauma.Networking
|
|||||||
yield return new WaitForSeconds(3.0f);
|
yield return new WaitForSeconds(3.0f);
|
||||||
|
|
||||||
//save all the current events to a list and clear them
|
//save all the current events to a list and clear them
|
||||||
var existingEvents = NetworkEvent.Events;
|
var existingEvents = new List<NetworkEvent>(NetworkEvent.Events);
|
||||||
NetworkEvent.Events.Clear();
|
NetworkEvent.Events.Clear();
|
||||||
|
|
||||||
foreach (Hull hull in Hull.hullList)
|
foreach (Hull hull in Hull.hullList)
|
||||||
@@ -740,7 +740,7 @@ namespace Barotrauma.Networking
|
|||||||
item.NewComponentEvent(item.components[i], false, true);
|
item.NewComponentEvent(item.components[i], false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.body == null || item.body.Enabled == false) continue;
|
if (item.body == null || !item.body.Enabled || item.ParentInventory!=null) continue;
|
||||||
new NetworkEvent(NetworkEventType.DropItem, item.ID, false);
|
new NetworkEvent(NetworkEventType.DropItem, item.ID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +758,7 @@ namespace Barotrauma.Networking
|
|||||||
yield return new WaitForSeconds(0.1f);
|
yield return new WaitForSeconds(0.1f);
|
||||||
|
|
||||||
//save "normal" events again
|
//save "normal" events again
|
||||||
existingEvents = NetworkEvent.Events;
|
existingEvents = new List<NetworkEvent>(NetworkEvent.Events);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
|
|||||||
@@ -134,10 +134,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
|
//new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 50, 0, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
||||||
portBox.Text = NetConfig.DefaultPort.ToString();
|
portBox.Text = NetConfig.DefaultPort.ToString();
|
||||||
portBox.ToolTip = "Server port";
|
portBox.ToolTip = "Server port";
|
||||||
@@ -155,7 +155,7 @@ namespace Barotrauma
|
|||||||
plusPlayersBox.UserData = 1;
|
plusPlayersBox.UserData = 1;
|
||||||
plusPlayersBox.OnClicked = ChangeMaxPlayers;
|
plusPlayersBox.OnClicked = ChangeMaxPlayers;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 150, 0, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
|
||||||
|
|
||||||
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||||
|
|||||||
@@ -668,11 +668,20 @@ namespace Barotrauma
|
|||||||
//GameMain.GameScreen.Cam.TargetPos = pos;
|
//GameMain.GameScreen.Cam.TargetPos = pos;
|
||||||
//GameMain.GameScreen.Cam.MoveCamera((float)deltaTime);
|
//GameMain.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
|
if (jobInfoFrame != null)
|
||||||
|
{
|
||||||
|
jobInfoFrame.Update((float)deltaTime);
|
||||||
|
}
|
||||||
|
else if (playerFrame != null)
|
||||||
|
{
|
||||||
|
playerFrame.Update((float)deltaTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
menu.Update((float)deltaTime);
|
menu.Update((float)deltaTime);
|
||||||
|
|
||||||
if (jobInfoFrame != null) jobInfoFrame.Update((float)deltaTime);
|
}
|
||||||
|
|
||||||
if (playerFrame != null) playerFrame.Update((float)deltaTime);
|
|
||||||
|
|
||||||
if (autoRestartTimer != 0.0f && autoRestartBox.Selected)
|
if (autoRestartTimer != 0.0f && autoRestartBox.Selected)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public virtual void Select()
|
public virtual void Select()
|
||||||
{
|
{
|
||||||
if (selected != null && selected!=this) selected.Deselect();
|
if (selected != null && selected != this)
|
||||||
|
{
|
||||||
|
selected.Deselect();
|
||||||
|
GUIComponent.KeyboardDispatcher.Subscriber = null;
|
||||||
|
}
|
||||||
selected = this;
|
selected = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,9 +197,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
||||||
{
|
{
|
||||||
//for (int x = -1; x < 3; x += 2)
|
//for (int x = -1; x <= 1; x += 2)
|
||||||
//{
|
//{
|
||||||
// for (int y = -1; y < 3; y += 2)
|
// for (int y = -1; y <= 1; y += 2)
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// spriteBatch.Draw(texture, pos + offset + new Vector2(x, y) * 1.0f, sourceRect, Color.Black, rotation + rotate, origin, scale, spriteEffect, (depth == null ? this.depth : (float)depth) + 0.0001f);
|
// spriteBatch.Draw(texture, pos + offset + new Vector2(x, y) * 1.0f, sourceRect, Color.Black, rotation + rotate, origin, scale, spriteEffect, (depth == null ? this.depth : (float)depth) + 0.0001f);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user