(22ec3a281) Add a boolean that controls whether or not the enemy attacks outposts and the characters inside it.
This commit is contained in:
@@ -82,31 +82,6 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("ServerIP"));
|
|
||||||
ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "");
|
|
||||||
ipBox.OnTextChanged += RefreshJoinButtonState;
|
|
||||||
ipBox.OnSelected += (sender, key) =>
|
|
||||||
{
|
|
||||||
if (sender.UserData is ServerInfo)
|
|
||||||
{
|
|
||||||
sender.Text = "";
|
|
||||||
sender.UserData = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers"));
|
|
||||||
searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), filterHolder.RectTransform), "");
|
|
||||||
|
|
||||||
var tickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), filterHolder.RectTransform));
|
|
||||||
|
|
||||||
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
|
||||||
filterPassword = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterPassword"));
|
|
||||||
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
|
||||||
filterIncompatible = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterIncompatibleServers"));
|
|
||||||
filterIncompatible.OnSelected += (tickBox) => { FilterServers(); return true; };
|
|
||||||
|
|
||||||
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers"));
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers"));
|
||||||
@@ -177,6 +152,58 @@ namespace Barotrauma
|
|||||||
Enabled = false
|
Enabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
//right column
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 1.0f),
|
||||||
|
paddedFrame.RectTransform, Anchor.CenterRight))
|
||||||
|
{
|
||||||
|
RelativeSpacing = 0.02f,
|
||||||
|
Stretch = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var serverListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), rightColumn.RectTransform)) { Stretch = true, RelativeSpacing = 0.02f };
|
||||||
|
|
||||||
|
serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center))
|
||||||
|
{
|
||||||
|
OnSelected = (btn, obj) => {
|
||||||
|
ServerInfo serverInfo = (ServerInfo)obj;
|
||||||
|
|
||||||
|
serverInfo.CreatePreviewWindow(serverPreview);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
serverList.OnSelected += SelectServer;
|
||||||
|
|
||||||
|
serverPreview = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center));
|
||||||
|
|
||||||
|
columnRelativeWidth = new float[] { 0.04f, 0.02f, 0.044f, 0.77f, 0.02f, 0.075f, 0.06f };
|
||||||
|
|
||||||
|
var buttonContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.075f), rightColumn.RectTransform), style: null);
|
||||||
|
|
||||||
|
GUIButton button = new GUIButton(new RectTransform(new Vector2(0.25f, 0.9f), buttonContainer.RectTransform, Anchor.TopLeft),
|
||||||
|
TextManager.Get("Back"), style: "GUIButtonLarge")
|
||||||
|
{
|
||||||
|
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
|
||||||
|
};
|
||||||
|
|
||||||
|
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
||||||
|
"", style: "GUIButtonRefresh") {
|
||||||
|
|
||||||
|
ToolTip = TextManager.Get("ServerListRefresh"),
|
||||||
|
OnClicked = RefreshServers
|
||||||
|
};
|
||||||
|
|
||||||
|
joinButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.9f), buttonContainer.RectTransform, Anchor.TopRight),
|
||||||
|
TextManager.Get("ServerListJoin"), style: "GUIButtonLarge")
|
||||||
|
{
|
||||||
|
OnClicked = JoinServer,
|
||||||
|
Enabled = false
|
||||||
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
button.SelectedColor = button.Color;
|
button.SelectedColor = button.Color;
|
||||||
@@ -239,6 +266,22 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool RefreshJoinButtonState(GUIComponent component, object obj)
|
||||||
|
{
|
||||||
|
if (obj == null || waitingForRefresh) return false;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
|
||||||
|
{
|
||||||
|
joinButton.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
joinButton.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool SelectServer(GUIComponent component, object obj)
|
private bool SelectServer(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (obj == null || waitingForRefresh) return false;
|
if (obj == null || waitingForRefresh) return false;
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public static bool DisableEnemyAI;
|
public static bool DisableEnemyAI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enable the character to attack the outposts and the characters inside them. Disabled by default.
|
||||||
|
/// </summary>
|
||||||
|
public bool TargetOutposts;
|
||||||
|
|
||||||
class WallTarget
|
class WallTarget
|
||||||
{
|
{
|
||||||
public Vector2 Position;
|
public Vector2 Position;
|
||||||
@@ -1067,11 +1072,11 @@ namespace Barotrauma
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (target.Type == AITarget.TargetType.HumanOnly) { continue; }
|
if (target.Type == AITarget.TargetType.HumanOnly) { continue; }
|
||||||
// Don't attack outposts.
|
if (!TargetOutposts)
|
||||||
if (target.Entity.Submarine != null && target.Entity.Submarine.IsOutpost) { continue; }
|
{
|
||||||
|
if (target.Entity.Submarine != null && target.Entity.Submarine.IsOutpost) { continue; }
|
||||||
|
}
|
||||||
Character targetCharacter = target.Entity as Character;
|
Character targetCharacter = target.Entity as Character;
|
||||||
|
|
||||||
//ignore the aitarget if it is the Character itself
|
//ignore the aitarget if it is the Character itself
|
||||||
if (targetCharacter == character) continue;
|
if (targetCharacter == character) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,25 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string DisplayName
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string roomName;
|
||||||
|
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
|
||||||
|
public string RoomName
|
||||||
|
{
|
||||||
|
get { return roomName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (roomName == value) { return; }
|
||||||
|
roomName = value;
|
||||||
|
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Rectangle Rect
|
public override Rectangle Rect
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user