(98501b696) Reduce the max accepted distance for repair tool ai operate.
This commit is contained in:
@@ -39,10 +39,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch, pos + textOffset, $"ORDER: {currentOrder.DebugTag} ({currentOrder.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
GUI.DrawString(spriteBatch, pos + textOffset, $"ORDER: {currentOrder.DebugTag} ({currentOrder.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||||
}
|
}
|
||||||
else if (ObjectiveManager.WaitTimer > 0)
|
|
||||||
{
|
|
||||||
GUI.DrawString(spriteBatch, pos + textOffset, $"Waiting... {ObjectiveManager.WaitTimer.FormatZeroDecimal()}", Color.White, Color.Black);
|
|
||||||
}
|
|
||||||
var currentObjective = ObjectiveManager.CurrentObjective;
|
var currentObjective = ObjectiveManager.CurrentObjective;
|
||||||
if (currentObjective != null)
|
if (currentObjective != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,6 +152,32 @@ namespace Barotrauma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (character.MemLocalState.Count > 120) character.MemLocalState.RemoveRange(0, character.MemLocalState.Count - 120);
|
||||||
|
character.MemState.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void ImpactProjSpecific(float impact, Body body)
|
||||||
|
{
|
||||||
|
float volume = MathHelper.Clamp(impact - 3.0f, 0.5f, 1.0f);
|
||||||
|
|
||||||
|
if (body.UserData is Limb limb && character.Stun <= 0f)
|
||||||
|
{
|
||||||
|
if (impact > 3.0f) { PlayImpactSound(limb); }
|
||||||
|
}
|
||||||
|
else if (body.UserData is Limb || body == Collider.FarseerBody)
|
||||||
|
{
|
||||||
|
if (!character.IsRemotePlayer && impact > ImpactTolerance)
|
||||||
|
{
|
||||||
|
SoundPlayer.PlayDamageSound("LimbBlunt", strongestImpact, Collider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Character.Controlled == character)
|
||||||
|
{
|
||||||
|
GameMain.GameScreen.Cam.Shake = Math.Min(Math.Max(strongestImpact, GameMain.GameScreen.Cam.Shake), 3.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (character.MemState.Count < 1) return;
|
if (character.MemState.Count < 1) return;
|
||||||
|
|
||||||
overrideTargetMovement = Vector2.Zero;
|
overrideTargetMovement = Vector2.Zero;
|
||||||
|
|||||||
@@ -74,12 +74,17 @@ namespace Barotrauma
|
|||||||
public CrewManager(XElement element, bool isSinglePlayer)
|
public CrewManager(XElement element, bool isSinglePlayer)
|
||||||
: this(isSinglePlayer)
|
: this(isSinglePlayer)
|
||||||
{
|
{
|
||||||
if (!isSinglePlayer)
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Cannot add messages to single player chat box in multiplayer mode!\n" + Environment.StackTrace);
|
//let the server create random conversations in MP
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(text)) { return; }
|
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
||||||
|
c.AIController is HumanAIController &&
|
||||||
|
!c.IsDead &&
|
||||||
|
c.SpeechImpediment <= 100.0f);
|
||||||
|
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
||||||
|
}
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
@@ -90,7 +95,6 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void InitProjectSpecific()
|
partial void InitProjectSpecific()
|
||||||
@@ -238,27 +242,24 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public IEnumerable<Character> GetCharacters()
|
public IEnumerable<Character> GetCharacters()
|
||||||
{
|
{
|
||||||
if (character?.Inventory == null) return null;
|
if (characterInfos.Contains(characterInfo))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var radioItem = character.Inventory.Items.FirstOrDefault(it => it != null && it.GetComponent<WifiComponent>() != null);
|
characterInfos.Add(characterInfo);
|
||||||
if (radioItem == null) return null;
|
|
||||||
if (requireEquipped && !character.HasEquippedItem(radioItem)) return null;
|
|
||||||
|
|
||||||
return radioItem.GetComponent<WifiComponent>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<CharacterInfo> GetCharacterInfos()
|
public IEnumerable<CharacterInfo> GetCharacterInfos()
|
||||||
{
|
{
|
||||||
if (GameMain.Client != null)
|
if (character == null)
|
||||||
{
|
{
|
||||||
//let the server create random conversations in MP
|
DebugConsole.ThrowError("Tried to remove a null character from CrewManager.\n" + Environment.StackTrace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
characters.Remove(character);
|
||||||
c.AIController is HumanAIController &&
|
if (removeInfo) characterInfos.Remove(character.Info);
|
||||||
!c.IsDead &&
|
|
||||||
c.SpeechImpediment <= 100.0f);
|
|
||||||
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCharacter(Character character)
|
public void AddCharacter(Character character)
|
||||||
@@ -632,9 +633,183 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
characterListBox.BarScroll = roundedPos;
|
characterListBox.BarScroll = roundedPos;
|
||||||
}
|
}
|
||||||
soundIcon.Visible = !muted && !mutedLocally;
|
var characterArea = new GUIButton(new RectTransform(new Point(characterInfoWidth, frame.Rect.Height), frame.RectTransform, Anchor.CenterLeft), style: "GUITextBox")
|
||||||
soundIconDisabled.Visible = muted || mutedLocally;
|
{
|
||||||
soundIconDisabled.ToolTip = TextManager.Get(mutedLocally ? "MutedLocally" : "MutedGlobally");
|
UserData = character,
|
||||||
|
Color = frame.Color,
|
||||||
|
SelectedColor = frame.SelectedColor,
|
||||||
|
HoverColor = frame.HoverColor,
|
||||||
|
ToolTip = characterToolTip
|
||||||
|
};
|
||||||
|
|
||||||
|
var soundIcon = new GUIImage(new RectTransform(new Point((int)(characterArea.Rect.Height * 0.5f)), characterArea.RectTransform, Anchor.CenterRight) { AbsoluteOffset = new Point(5, 0) },
|
||||||
|
"GUISoundIcon")
|
||||||
|
{
|
||||||
|
UserData = "soundicon",
|
||||||
|
CanBeFocused = false,
|
||||||
|
Visible = true
|
||||||
|
};
|
||||||
|
soundIcon.Color = new Color(soundIcon.Color, 0.0f);
|
||||||
|
new GUIImage(new RectTransform(new Point((int)(characterArea.Rect.Height * 0.5f)), characterArea.RectTransform, Anchor.CenterRight) { AbsoluteOffset = new Point(5, 0) },
|
||||||
|
"GUISoundIconDisabled")
|
||||||
|
{
|
||||||
|
UserData = "soundicondisabled",
|
||||||
|
CanBeFocused = true,
|
||||||
|
Visible = false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isSinglePlayer)
|
||||||
|
{
|
||||||
|
characterArea.OnClicked = CharacterClicked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
characterArea.CanBeFocused = false;
|
||||||
|
characterArea.CanBeSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var characterImage = new GUICustomComponent(new RectTransform(new Point(characterArea.Rect.Height), characterArea.RectTransform, Anchor.CenterLeft),
|
||||||
|
onDraw: (sb, component) => character.Info.DrawIcon(sb, component.Rect.Center.ToVector2(), targetAreaSize: component.Rect.Size.ToVector2()))
|
||||||
|
{
|
||||||
|
CanBeFocused = false,
|
||||||
|
HoverColor = Color.White,
|
||||||
|
SelectedColor = Color.White,
|
||||||
|
ToolTip = characterToolTip
|
||||||
|
};
|
||||||
|
|
||||||
|
var characterName = new GUITextBlock(new RectTransform(new Point(characterArea.Rect.Width - characterImage.Rect.Width - soundIcon.Rect.Width - 10, characterArea.Rect.Height),
|
||||||
|
characterArea.RectTransform, Anchor.CenterRight) { AbsoluteOffset = new Point(soundIcon.Rect.Width + 10, 0) },
|
||||||
|
character.Name, textColor: frame.Color, font: GUI.SmallFont, wrap: true)
|
||||||
|
{
|
||||||
|
Color = frame.Color,
|
||||||
|
HoverColor = Color.Transparent,
|
||||||
|
SelectedColor = Color.Transparent,
|
||||||
|
CanBeFocused = false,
|
||||||
|
ToolTip = characterToolTip,
|
||||||
|
AutoScale = true
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------- order buttons ----------------
|
||||||
|
|
||||||
|
var orderButtonFrame = new GUILayoutGroup(new RectTransform(new Point(100, frame.Rect.Height), frame.RectTransform)
|
||||||
|
{ AbsoluteOffset = new Point(characterInfoWidth + spacing, 0) },
|
||||||
|
isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||||
|
{
|
||||||
|
AbsoluteSpacing = (int)(10 * GUI.Scale),
|
||||||
|
UserData = "orderbuttons",
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
//listbox for holding the orders inappropriate for this character
|
||||||
|
//(so we can easily toggle their visibility)
|
||||||
|
var wrongOrderList = new GUIListBox(new RectTransform(new Point(50, orderButtonFrame.Rect.Height), orderButtonFrame.RectTransform), isHorizontal: true, style: null)
|
||||||
|
{
|
||||||
|
ScrollBarEnabled = false,
|
||||||
|
ScrollBarVisible = false,
|
||||||
|
Enabled = false,
|
||||||
|
Spacing = spacing,
|
||||||
|
ClampMouseRectToParent = false
|
||||||
|
};
|
||||||
|
wrongOrderList.Content.ClampMouseRectToParent = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < orders.Count; i++)
|
||||||
|
{
|
||||||
|
var order = orders[i];
|
||||||
|
if (order.TargetAllCharacters) continue;
|
||||||
|
|
||||||
|
RectTransform btnParent = (i >= correctOrderCount + neutralOrderCount) ?
|
||||||
|
wrongOrderList.Content.RectTransform :
|
||||||
|
orderButtonFrame.RectTransform;
|
||||||
|
|
||||||
|
var btn = new GUIButton(new RectTransform(new Point(iconSize, iconSize), btnParent, Anchor.CenterLeft),
|
||||||
|
style: null)
|
||||||
|
{
|
||||||
|
UserData = order
|
||||||
|
};
|
||||||
|
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
||||||
|
{
|
||||||
|
Color = Color.Lerp(order.Color, frame.Color, 0.5f) * 0.8f,
|
||||||
|
HoverColor = Color.Lerp(order.Color, frame.Color, 0.5f) * 1.0f,
|
||||||
|
PressedColor = Color.Lerp(order.Color, frame.Color, 0.5f) * 0.6f,
|
||||||
|
UserData = "selected",
|
||||||
|
CanBeFocused = false,
|
||||||
|
Visible = false
|
||||||
|
};
|
||||||
|
|
||||||
|
var img = new GUIImage(new RectTransform(Vector2.One, btn.RectTransform), order.Prefab.SymbolSprite);
|
||||||
|
img.Scale = iconSize / (float)img.SourceRect.Width;
|
||||||
|
img.Color = Color.Lerp(order.Color, frame.Color, 0.5f);
|
||||||
|
img.ToolTip = order.Name;
|
||||||
|
img.HoverColor = Color.Lerp(img.Color, Color.White, 0.5f);
|
||||||
|
|
||||||
|
btn.OnClicked += (GUIButton button, object userData) =>
|
||||||
|
{
|
||||||
|
if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
|
||||||
|
|
||||||
|
if (btn.GetChildByUserData("selected").Visible)
|
||||||
|
{
|
||||||
|
SetCharacterOrder(character, Order.PrefabList.Find(o => o.AITag == "dismissed"), null, Character.Controlled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (order.ItemComponentType != null || order.ItemIdentifiers.Length > 0 || order.Options.Length > 1)
|
||||||
|
{
|
||||||
|
CreateOrderTargetFrame(button, character, order);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCharacterOrder(character, order, null, Character.Controlled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
btn.UserData = order;
|
||||||
|
btn.ToolTip = order.Name;
|
||||||
|
|
||||||
|
//divider between different groups of orders
|
||||||
|
if (i == correctOrderCount - 1 || i == correctOrderCount + neutralOrderCount - 1)
|
||||||
|
{
|
||||||
|
//TODO: divider sprite
|
||||||
|
new GUIFrame(new RectTransform(new Point(8, iconSize), orderButtonFrame.RectTransform), style: "GUIButton");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var toggleWrongOrderBtn = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), wrongOrderList.Rect.Height), wrongOrderList.Content.RectTransform),
|
||||||
|
"", style: "UIToggleButton")
|
||||||
|
{
|
||||||
|
UserData = "togglewrongorder",
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
wrongOrderList.RectTransform.NonScaledSize = new Point(
|
||||||
|
wrongOrderList.Content.Children.Sum(c => c.Rect.Width + wrongOrderList.Spacing),
|
||||||
|
wrongOrderList.RectTransform.NonScaledSize.Y);
|
||||||
|
wrongOrderList.RectTransform.SetAsLastChild();
|
||||||
|
|
||||||
|
new GUIFrame(new RectTransform(new Point(
|
||||||
|
wrongOrderList.Rect.Width - toggleWrongOrderBtn.Rect.Width - wrongOrderList.Spacing * 2,
|
||||||
|
wrongOrderList.Rect.Height), wrongOrderList.Content.RectTransform),
|
||||||
|
style: null)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
//scale to fit the content
|
||||||
|
orderButtonFrame.RectTransform.NonScaledSize = new Point(
|
||||||
|
orderButtonFrame.Children.Sum(c => c.Rect.Width + orderButtonFrame.AbsoluteSpacing),
|
||||||
|
orderButtonFrame.RectTransform.NonScaledSize.Y);
|
||||||
|
|
||||||
|
frame.RectTransform.NonScaledSize = new Point(
|
||||||
|
characterInfoWidth + spacing + (orderButtonFrame.Rect.Width - wrongOrderList.Rect.Width),
|
||||||
|
frame.RectTransform.NonScaledSize.Y);
|
||||||
|
|
||||||
|
characterListBox.RectTransform.NonScaledSize = new Point(
|
||||||
|
characterListBox.Content.Children.Max(c => c.Rect.Width) + wrongOrderList.Rect.Width,
|
||||||
|
characterListBox.RectTransform.NonScaledSize.Y);
|
||||||
|
characterListBox.Content.RectTransform.NonScaledSize = characterListBox.RectTransform.NonScaledSize;
|
||||||
|
characterListBox.UpdateScrollBarSize();
|
||||||
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> KillCharacterAnim(GUIComponent component)
|
private IEnumerable<object> KillCharacterAnim(GUIComponent component)
|
||||||
@@ -778,6 +953,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
||||||
|
c.AIController is HumanAIController &&
|
||||||
|
!c.IsDead &&
|
||||||
|
c.SpeechImpediment <= 100.0f);
|
||||||
|
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
||||||
|
}
|
||||||
|
|
||||||
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
||||||
if (IsSinglePlayer)
|
if (IsSinglePlayer)
|
||||||
@@ -835,19 +1016,23 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//only one target (or an order with no particular targets), just show options
|
|
||||||
else
|
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
||||||
|
if (IsSinglePlayer)
|
||||||
{
|
{
|
||||||
orderTargetFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.2f + order.Options.Length * 0.1f, 0.18f), GUI.Canvas)
|
orderGiver?.Speak(
|
||||||
{ AbsoluteOffset = new Point(orderButton.Rect.Center.X, orderButton.Rect.Bottom) },
|
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
||||||
isHorizontal: true, childAnchor: Anchor.BottomLeft)
|
}
|
||||||
|
else if (orderGiver != null)
|
||||||
|
{
|
||||||
|
OrderChatMessage msg = new OrderChatMessage(order, option, order.TargetItemComponent?.Item, character, orderGiver);
|
||||||
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
UserData = character,
|
GameMain.Client.SendChatMessage(msg);
|
||||||
Stretch = true
|
}
|
||||||
};
|
}
|
||||||
//line connecting the order button to the option buttons
|
DisplayCharacterOrder(character, order);
|
||||||
//TODO: sprite
|
}
|
||||||
new GUIFrame(new RectTransform(new Vector2(0.5f, 1.0f), orderTargetFrame.RectTransform), style: null);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create the UI panel that's used to select the target and options for a given order
|
/// Create the UI panel that's used to select the target and options for a given order
|
||||||
@@ -1145,7 +1330,7 @@ namespace Barotrauma
|
|||||||
ChatBox.Update(deltaTime);
|
ChatBox.Update(deltaTime);
|
||||||
ChatBox.InputBox.Visible = Character.Controlled != null;
|
ChatBox.InputBox.Visible = Character.Controlled != null;
|
||||||
|
|
||||||
if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible && GUI.KeyboardDispatcher.Subscriber == null)
|
if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible)
|
||||||
{
|
{
|
||||||
if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected)
|
if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ namespace Barotrauma.Items.Components
|
|||||||
AutoScale = true
|
AutoScale = true
|
||||||
};
|
};
|
||||||
autoTempSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 0.15f), columnRight.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.1f) },
|
autoTempSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 0.15f), columnRight.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.1f) },
|
||||||
barSize: 0.55f, style: "OnOffSlider", isHorizontal: true)
|
barSize: 0.55f, style: "OnOffSlider")
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ReactorTipAutoTemp"),
|
ToolTip = TextManager.Get("ReactorTipAutoTemp"),
|
||||||
IsBooleanSwitch = true,
|
IsBooleanSwitch = true,
|
||||||
@@ -233,10 +233,10 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
var sliderSprite = autoTempSlider.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
var sliderSprite = autoTempSlider.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
||||||
autoTempSlider.RectTransform.MaxSize = sliderSprite.Sprite.SourceRect.Size;
|
autoTempSlider.RectTransform.MaxSize = sliderSprite.Sprite.size.ToPoint();
|
||||||
|
|
||||||
onOffSwitch = new GUIScrollBar(new RectTransform(new Vector2(0.4f, 0.3f), columnRight.RectTransform, Anchor.TopRight),
|
onOffSwitch = new GUIScrollBar(new RectTransform(new Vector2(0.4f, 0.3f), columnRight.RectTransform, Anchor.TopRight),
|
||||||
barSize: 0.2f, style: "OnOffLever", isHorizontal: false)
|
barSize: 0.2f, style: "OnOffLever")
|
||||||
{
|
{
|
||||||
IsBooleanSwitch = true,
|
IsBooleanSwitch = true,
|
||||||
MinValue = 0.25f,
|
MinValue = 0.25f,
|
||||||
@@ -249,7 +249,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
var switchSprite = onOffSwitch.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
var switchSprite = onOffSwitch.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
||||||
onOffSwitch.RectTransform.MaxSize = switchSprite.Sprite.SourceRect.Size;
|
onOffSwitch.RectTransform.MaxSize = switchSprite.Sprite.size.ToPoint();
|
||||||
|
|
||||||
var lever = onOffSwitch.GetChild<GUIButton>();
|
var lever = onOffSwitch.GetChild<GUIButton>();
|
||||||
lever.RectTransform.NonScaledSize = new Point(lever.Rect.Width + 30, lever.Rect.Height);
|
lever.RectTransform.NonScaledSize = new Point(lever.Rect.Width + 30, lever.Rect.Height);
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ namespace Barotrauma.Items.Components
|
|||||||
Passive
|
Passive
|
||||||
};
|
};
|
||||||
|
|
||||||
private bool dynamicDockingIndicator = true;
|
|
||||||
|
|
||||||
private bool unsentChanges;
|
private bool unsentChanges;
|
||||||
private float networkUpdateTimer;
|
private float networkUpdateTimer;
|
||||||
|
|
||||||
@@ -655,7 +653,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
Vector2 dockingDir = sourcePortPos - targetPortPos;
|
Vector2 dockingDir = sourcePortPos - targetPortPos;
|
||||||
Vector2 normalizedDockingDir = Vector2.Normalize(dockingDir);
|
Vector2 normalizedDockingDir = Vector2.Normalize(dockingDir);
|
||||||
if (!dynamicDockingIndicator)
|
if (!DynamicDockingIndicator)
|
||||||
{
|
{
|
||||||
if (steering.DockingSource.IsHorizontal)
|
if (steering.DockingSource.IsHorizontal)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -775,37 +775,6 @@ namespace Barotrauma
|
|||||||
ic.DrawHUD(spriteBatch, character);
|
ic.DrawHUD(spriteBatch, character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
List<ColoredText> texts = new List<ColoredText>();
|
|
||||||
public List<ColoredText> GetHUDTexts(Character character)
|
|
||||||
{
|
|
||||||
texts.Clear();
|
|
||||||
foreach (ItemComponent ic in components)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(ic.DisplayMsg)) continue;
|
|
||||||
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
|
||||||
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
|
||||||
|
|
||||||
Color color = Color.Gray;
|
|
||||||
bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
|
|
||||||
if (hasRequiredSkillsAndItems)
|
|
||||||
{
|
|
||||||
if (ic is Repairable repairable)
|
|
||||||
{
|
|
||||||
if (Condition < repairable.ShowRepairUIThreshold)
|
|
||||||
{
|
|
||||||
color = Color.Cyan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
color = Color.Cyan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
|
|
||||||
}
|
|
||||||
return texts;
|
return texts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private GUILayoutGroup subPreviewContainer;
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
private GUIButton loadGameButton;
|
private GUIButton loadGameButton;
|
||||||
|
|
||||||
public Action<Submarine, string, string> StartNewGame;
|
public Action<Submarine, string, string> StartNewGame;
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ namespace Barotrauma
|
|||||||
//These will be visible through the LOS effect.
|
//These will be visible through the LOS effect.
|
||||||
//Could be drawn with one Submarine.DrawBack call, but we can avoid sorting by depth by doing it like this.
|
//Could be drawn with one Submarine.DrawBack call, but we can avoid sorting by depth by doing it like this.
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
Submarine.DrawBack(spriteBatch, false, e => e is Structure s && (s.ResizeVertical || s.ResizeHorizontal) && !s.DrawDamageEffect);
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.ResizeVertical && s.ResizeHorizontal);
|
||||||
Submarine.DrawBack(spriteBatch, false, e => e is Structure s && !(s.ResizeVertical && s.ResizeHorizontal) && s.Prefab.BackgroundSprite != null);
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && !(s.ResizeVertical && s.ResizeHorizontal) && ((Structure)s).Prefab.BackgroundSprite != null);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
graphics.SetRenderTarget(null);
|
graphics.SetRenderTarget(null);
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (dummyCharacter != null) RemoveDummyCharacter();
|
if (dummyCharacter != null) RemoveDummyCharacter();
|
||||||
|
|
||||||
dummyCharacter = Character.Create(Character.HumanConfigFile, Vector2.Zero, "", hasAi: false);
|
dummyCharacter = Character.Create(Character.HumanConfigFile, Vector2.Zero, "");
|
||||||
|
|
||||||
//make space for the entity menu
|
//make space for the entity menu
|
||||||
for (int i = 0; i < dummyCharacter.Inventory.SlotPositions.Length; i++)
|
for (int i = 0; i < dummyCharacter.Inventory.SlotPositions.Length; i++)
|
||||||
@@ -2282,11 +2282,6 @@ namespace Barotrauma
|
|||||||
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam);
|
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.Loaded)
|
|
||||||
{
|
|
||||||
sub.UpdateTransform();
|
|
||||||
}
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
|
|||||||
@@ -320,8 +320,6 @@ namespace Barotrauma
|
|||||||
var door = node.ConnectedDoor;
|
var door = node.ConnectedDoor;
|
||||||
if (door != null)
|
if (door != null)
|
||||||
{
|
{
|
||||||
if (door.IsOpen) { return true; }
|
|
||||||
if (door.IsStuck) { return false; }
|
|
||||||
if (door.HasIntegratedButtons)
|
if (door.HasIntegratedButtons)
|
||||||
{
|
{
|
||||||
if (!door.HasRequiredItems(character, false))
|
if (!door.HasRequiredItems(character, false))
|
||||||
@@ -398,7 +396,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (door == null) { return; }
|
if (door == null) return;
|
||||||
|
|
||||||
//toggle the door if it's the previous node and open, or if it's current node and closed
|
//toggle the door if it's the previous node and open, or if it's current node and closed
|
||||||
if (door.IsOpen != shouldBeOpen)
|
if (door.IsOpen != shouldBeOpen)
|
||||||
|
|||||||
@@ -115,20 +115,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public virtual void Update(float deltaTime)
|
public virtual void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
var subObjective = objectiveManager.CurrentObjective?.CurrentSubObjective;
|
||||||
if (objectiveManager.CurrentOrder == this)
|
if (objectiveManager.CurrentOrder == this)
|
||||||
{
|
{
|
||||||
Priority = AIObjectiveManager.OrderPriority;
|
Priority = AIObjectiveManager.OrderPriority;
|
||||||
}
|
}
|
||||||
else if (objectiveManager.WaitTimer <= 0)
|
else if (objectiveManager.CurrentObjective == this || subObjective == this)
|
||||||
{
|
{
|
||||||
var subObjective = objectiveManager.CurrentObjective?.CurrentSubObjective;
|
Priority += Devotion * PriorityModifier * deltaTime;
|
||||||
if ((objectiveManager.CurrentObjective == this || subObjective == this))
|
|
||||||
{
|
|
||||||
Priority += Devotion * PriorityModifier * deltaTime;
|
|
||||||
}
|
|
||||||
Priority = MathHelper.Clamp(Priority, 0, 100);
|
|
||||||
subObjectives.ForEach(so => so.Update(deltaTime));
|
|
||||||
}
|
}
|
||||||
|
Priority = MathHelper.Clamp(Priority, 0, 100);
|
||||||
|
subObjectives.ForEach(so => so.Update(deltaTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+1
-1
@@ -261,7 +261,7 @@ namespace Barotrauma
|
|||||||
if (character.CurrentHull == null)
|
if (character.CurrentHull == null)
|
||||||
{
|
{
|
||||||
currenthullSafety = 0;
|
currenthullSafety = 0;
|
||||||
Priority = 100;
|
Priority = 5;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (character.OxygenAvailable < CharacterHealth.LowOxygenThreshold) { Priority = 100; }
|
if (character.OxygenAvailable < CharacterHealth.LowOxygenThreshold) { Priority = 100; }
|
||||||
|
|||||||
@@ -40,44 +40,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override bool IsLoop { get => true; set => throw new System.Exception("Trying to set the value for IsLoop from: " + System.Environment.StackTrace); }
|
public override bool IsLoop { get => true; set => throw new System.Exception("Trying to set the value for IsLoop from: " + System.Environment.StackTrace); }
|
||||||
|
|
||||||
private float randomTimer;
|
|
||||||
private float randomUpdateInterval = 5;
|
|
||||||
public float Random { get; private set; }
|
|
||||||
|
|
||||||
public void SetRandom()
|
|
||||||
{
|
|
||||||
Random = Rand.Range(0.5f, 1.5f);
|
|
||||||
randomTimer = randomUpdateInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float GetPriority()
|
|
||||||
{
|
|
||||||
float max = Math.Min(Math.Min(AIObjectiveManager.RunPriority, AIObjectiveManager.OrderPriority) - 1, 100);
|
|
||||||
float initiative = character.GetSkillLevel("initiative");
|
|
||||||
Priority = MathHelper.Lerp(1, max, MathUtils.InverseLerp(100, 0, initiative * Random));
|
|
||||||
return Priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
if (objectiveManager.CurrentObjective == this)
|
|
||||||
{
|
|
||||||
if (randomTimer > 0)
|
|
||||||
{
|
|
||||||
randomTimer -= deltaTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetRandom();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsCompleted() => false;
|
|
||||||
public override bool CanBeCompleted => true;
|
|
||||||
|
|
||||||
public override bool IsLoop { get => true; set => throw new System.Exception("Trying to set the value for IsLoop from: " + System.Environment.StackTrace); }
|
|
||||||
|
|
||||||
// TODO: take the initiative into account
|
// TODO: take the initiative into account
|
||||||
public override float GetPriority() => 1;
|
public override float GetPriority() => 1;
|
||||||
|
|
||||||
@@ -95,10 +57,24 @@ namespace Barotrauma
|
|||||||
character.SelectedConstruction = null;
|
character.SelectedConstruction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool currentHullForbidden = IsForbidden(character.CurrentHull);
|
||||||
|
if (!currentHullForbidden && !character.AnimController.InWater && !character.IsClimbing && HumanAIController.ObjectiveManager.WaitTimer > 0)
|
||||||
|
{
|
||||||
|
SteeringManager.Reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!character.IsClimbing)
|
||||||
|
{
|
||||||
|
character.SelectedConstruction = null;
|
||||||
|
}
|
||||||
|
|
||||||
bool currentTargetIsInvalid = currentTarget == null || IsForbidden(currentTarget) ||
|
bool currentTargetIsInvalid = currentTarget == null || IsForbidden(currentTarget) ||
|
||||||
(PathSteering.CurrentPath != null && PathSteering.CurrentPath.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull)));
|
(PathSteering.CurrentPath != null && PathSteering.CurrentPath.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull)));
|
||||||
|
|
||||||
if (currentTargetIsInvalid || currentTarget == null && IsForbidden(character.CurrentHull))
|
bool currentTargetIsInvalid = currentTarget == null || IsForbidden(currentTarget) ||
|
||||||
|
(PathSteering.CurrentPath != null && PathSteering.CurrentPath.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull)));
|
||||||
|
|
||||||
|
if (currentTargetIsInvalid || (currentTarget == null && currentHullForbidden))
|
||||||
{
|
{
|
||||||
newTargetTimer = 0;
|
newTargetTimer = 0;
|
||||||
standStillTimer = 0;
|
standStillTimer = 0;
|
||||||
@@ -300,7 +276,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsForbidden(Hull hull)
|
private bool IsForbidden(Hull hull)
|
||||||
{
|
{
|
||||||
if (hull == null) { return true; }
|
if (hull == null) { return true; }
|
||||||
string hullName = hull.RoomName?.ToLowerInvariant();
|
string hullName = hull.RoomName?.ToLowerInvariant();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Barotrauma
|
|||||||
private Character character;
|
private Character character;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When set above zero, the character will stand still doing nothing until the timer runs out. Does not affect orders.
|
/// When set above zero, the character will stand still doing nothing until the timer runs out. Only affects idling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float WaitTimer;
|
public float WaitTimer;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ namespace Barotrauma
|
|||||||
public AIObjectiveManager(Character character)
|
public AIObjectiveManager(Character character)
|
||||||
{
|
{
|
||||||
this.character = character;
|
this.character = character;
|
||||||
CreateAutonomousObjectives();
|
CreateAutomaticObjectives();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddObjective(AIObjective objective)
|
public void AddObjective(AIObjective objective)
|
||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Dictionary<AIObjective, CoroutineHandle> DelayedObjectives { get; private set; } = new Dictionary<AIObjective, CoroutineHandle>();
|
public Dictionary<AIObjective, CoroutineHandle> DelayedObjectives { get; private set; } = new Dictionary<AIObjective, CoroutineHandle>();
|
||||||
|
|
||||||
public void CreateAutonomousObjectives()
|
public void CreateAutomaticObjectives()
|
||||||
{
|
{
|
||||||
Objectives.Clear();
|
Objectives.Clear();
|
||||||
AddObjective(new AIObjectiveFindSafety(character, this));
|
AddObjective(new AIObjectiveFindSafety(character, this));
|
||||||
@@ -109,7 +109,6 @@ namespace Barotrauma
|
|||||||
if (previousObjective != CurrentObjective)
|
if (previousObjective != CurrentObjective)
|
||||||
{
|
{
|
||||||
CurrentObjective?.OnSelected();
|
CurrentObjective?.OnSelected();
|
||||||
GetObjective<AIObjectiveIdle>().SetRandom();
|
|
||||||
}
|
}
|
||||||
return CurrentObjective;
|
return CurrentObjective;
|
||||||
}
|
}
|
||||||
@@ -158,31 +157,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DoCurrentObjective(float deltaTime)
|
public void DoCurrentObjective(float deltaTime)
|
||||||
{
|
{
|
||||||
if (WaitTimer <= 0)
|
if (WaitTimer > 0.0f) { WaitTimer -= deltaTime; }
|
||||||
{
|
CurrentObjective?.TryComplete(deltaTime);
|
||||||
CurrentObjective?.TryComplete(deltaTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (CurrentOrder != null)
|
|
||||||
{
|
|
||||||
CurrentOrder.TryComplete(deltaTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WaitTimer -= deltaTime;
|
|
||||||
if (character.AIController is HumanAIController humanAI && humanAI.SteeringManager != null)
|
|
||||||
{
|
|
||||||
if (!character.AnimController.InWater &&
|
|
||||||
!character.IsClimbing &&
|
|
||||||
!humanAI.UnsafeHulls.Contains(character.CurrentHull) &&
|
|
||||||
!AIObjectiveIdle.IsForbidden(character.CurrentHull))
|
|
||||||
{
|
|
||||||
humanAI.SteeringManager.Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOrder(AIObjective objective)
|
public void SetOrder(AIObjective objective)
|
||||||
@@ -196,7 +172,7 @@ namespace Barotrauma
|
|||||||
if (CurrentOrder == null)
|
if (CurrentOrder == null)
|
||||||
{
|
{
|
||||||
// Recreate objectives, because some of them may be removed, if impossible to complete (e.g. due to path finding)
|
// Recreate objectives, because some of them may be removed, if impossible to complete (e.g. due to path finding)
|
||||||
CreateAutonomousObjectives();
|
CreateAutomaticObjectives();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ namespace Barotrauma
|
|||||||
if (limpAmount > 0.0f)
|
if (limpAmount > 0.0f)
|
||||||
{
|
{
|
||||||
//make the footpos oscillate when limping
|
//make the footpos oscillate when limping
|
||||||
footMid += (Math.Max(Math.Abs(walkPosX) * limpAmount, 0.0f) * Math.Min(Math.Abs(TargetMovement.X), 0.3f));
|
footMid += ((float)Math.Max(Math.Abs(walkPosX) * limpAmount, 0.0f) * 0.3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
movement = overrideTargetMovement == Vector2.Zero ?
|
movement = overrideTargetMovement == Vector2.Zero ?
|
||||||
@@ -788,19 +788,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//get the upper arm to point downwards
|
//get the upper arm to point downwards
|
||||||
var arm = GetLimb(armType);
|
var arm = GetLimb(armType);
|
||||||
if (Math.Abs(arm.body.AngularVelocity) < 10.0f)
|
arm.body.SmoothRotate(MathHelper.Clamp(-arm.body.AngularVelocity, -0.1f, 0.1f), arm.Mass * 10.0f);
|
||||||
{
|
|
||||||
arm.body.SmoothRotate(MathHelper.Clamp(-arm.body.AngularVelocity, -0.1f, 0.1f), arm.Mass * 10.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
//get the elbow to a neutral rotation
|
//get the elbow to a neutral rotation
|
||||||
if (Math.Abs(hand.body.AngularVelocity) < 10.0f)
|
LimbJoint elbow =
|
||||||
{
|
|
||||||
LimbJoint elbow =
|
|
||||||
GetJointBetweenLimbs(armType, hand.type) ??
|
GetJointBetweenLimbs(armType, hand.type) ??
|
||||||
GetJointBetweenLimbs(armType, foreArmType);
|
GetJointBetweenLimbs(armType, foreArmType);
|
||||||
hand.body.ApplyTorque(MathHelper.Clamp(-elbow.JointAngle, -MathHelper.PiOver2, MathHelper.PiOver2) * hand.Mass * 10.0f);
|
hand.body.ApplyTorque(-elbow.JointAngle * hand.Mass * 10.0f);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -674,6 +674,8 @@ namespace Barotrauma
|
|||||||
velocity -= ((Submarine)f2.Body.UserData).Velocity;
|
velocity -= ((Submarine)f2.Body.UserData).Velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (character.Submarine == null && f2.Body.UserData is Submarine) velocity -= ((Submarine)f2.Body.UserData).Velocity;
|
||||||
|
|
||||||
float impact = Vector2.Dot(velocity, -normal);
|
float impact = Vector2.Dot(velocity, -normal);
|
||||||
if (f1.Body == Collider.FarseerBody || !Collider.Enabled)
|
if (f1.Body == Collider.FarseerBody || !Collider.Enabled)
|
||||||
{
|
{
|
||||||
@@ -692,11 +694,6 @@ namespace Barotrauma
|
|||||||
character.AddDamage(impactPos, new List<Affliction>() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true);
|
character.AddDamage(impactPos, new List<Affliction>() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true);
|
||||||
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
|
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
|
||||||
character.ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
character.ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
||||||
//briefly disable impact damage
|
|
||||||
//otherwise the character will take damage multiple times when for example falling,
|
|
||||||
//because we use the velocity of the collider to determine the impact
|
|
||||||
//(i.e. the character would take damage until the collider hits the floor and stops)
|
|
||||||
character.DisableImpactDamageTimer = 0.25f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -729,8 +729,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void LoadAttachmentSprites();
|
partial void LoadAttachmentSprites();
|
||||||
|
|
||||||
// TODO: change the formula so that it's not linear and so that it takes into account the usefulness of the skill
|
|
||||||
// -> give a weight to each skill, because some are much more valuable than others?
|
|
||||||
private int CalculateSalary()
|
private int CalculateSalary()
|
||||||
{
|
{
|
||||||
if (Name == null || Job == null) return 0;
|
if (Name == null || Job == null) return 0;
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ namespace Barotrauma.Items.Components
|
|||||||
private bool autoOrientGap;
|
private bool autoOrientGap;
|
||||||
|
|
||||||
private bool isStuck;
|
private bool isStuck;
|
||||||
public bool IsStuck => isStuck;
|
|
||||||
|
|
||||||
private float resetPredictionTimer;
|
private float resetPredictionTimer;
|
||||||
|
|
||||||
private Rectangle doorRect;
|
private Rectangle doorRect;
|
||||||
@@ -229,7 +227,9 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
msg = msg ?? (HasIntegratedButtons ? accessDeniedTxt : cannotOpenText);
|
msg = msg ?? (HasIntegratedButtons ? accessDeniedTxt : cannotOpenText);
|
||||||
}
|
}
|
||||||
return isBroken || base.HasRequiredItems(character, addMessage, msg);
|
if (item.Condition <= RepairThreshold) { return true; }
|
||||||
|
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
|
||||||
|
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Pick(Character picker)
|
public override bool Pick(Character picker)
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ namespace Barotrauma.Items.Components
|
|||||||
float dist = fromItemToLeak.Length();
|
float dist = fromItemToLeak.Length();
|
||||||
|
|
||||||
//too far away -> consider this done and hope the AI is smart enough to move closer
|
//too far away -> consider this done and hope the AI is smart enough to move closer
|
||||||
if (dist > Range * 5.0f) return true;
|
if (dist > Range * 3.0f) { return true; }
|
||||||
|
|
||||||
// TODO: use the collider size?
|
// TODO: use the collider size?
|
||||||
if (!character.AnimController.InWater && character.AnimController is HumanoidAnimController &&
|
if (!character.AnimController.InWater && character.AnimController is HumanoidAnimController &&
|
||||||
@@ -412,8 +412,7 @@ namespace Barotrauma.Items.Components
|
|||||||
object value = property.GetValue(target);
|
object value = property.GetValue(target);
|
||||||
if (value.GetType() == typeof(float))
|
if (value.GetType() == typeof(float))
|
||||||
{
|
{
|
||||||
var progressBar = user.UpdateHUDProgressBar(door, door.Item.WorldPosition, (float)value / 100, Color.DarkGray * 0.5f, Color.White);
|
user.UpdateHUDProgressBar(door, door.Item.WorldPosition, (float)value / 100, Color.DarkGray * 0.5f, Color.White);
|
||||||
if (progressBar != null) { progressBar.Size = new Vector2(60.0f, 20.0f); }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -639,6 +639,25 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetItem.Prefab.DeconstructItems.Any())
|
||||||
|
{
|
||||||
|
inputContainer.Inventory.RemoveItem(targetItem);
|
||||||
|
Entity.Spawner.AddToRemoveQueue(targetItem);
|
||||||
|
MoveInputQueue();
|
||||||
|
PutItemsToLinkedContainer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (outputContainer.Inventory.Items.All(i => i != null))
|
||||||
|
{
|
||||||
|
targetItem.Drop(dropper: null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outputContainer.Inventory.TryPutItem(targetItem, user: null, createNetworkEvent: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (targetItem.Prefab.DeconstructItems.Any())
|
if (targetItem.Prefab.DeconstructItems.Any())
|
||||||
{
|
{
|
||||||
inputContainer.Inventory.RemoveItem(targetItem);
|
inputContainer.Inventory.RemoveItem(targetItem);
|
||||||
|
|||||||
@@ -86,7 +86,17 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
get { return zoom; }
|
get { return zoom; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: remove, only for testing
|
||||||
|
#if DEBUG
|
||||||
|
[Serialize(false, false), Editable]
|
||||||
|
public bool DynamicDockingIndicator
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public override bool IsActive
|
public override bool IsActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -212,33 +212,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2? PosToMaintain
|
|
||||||
{
|
|
||||||
get { return posToMaintain; }
|
|
||||||
set { posToMaintain = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ObstacleDebugInfo
|
|
||||||
{
|
|
||||||
public Vector2 Point1;
|
|
||||||
public Vector2 Point2;
|
|
||||||
|
|
||||||
public Vector2? Intersection;
|
|
||||||
|
|
||||||
public float Dot;
|
|
||||||
|
|
||||||
public Vector2 AvoidStrength;
|
|
||||||
|
|
||||||
public ObstacleDebugInfo(GraphEdge edge, Vector2? intersection, float dot, Vector2 avoidStrength)
|
|
||||||
{
|
|
||||||
Point1 = edge.Point1;
|
|
||||||
Point2 = edge.Point2;
|
|
||||||
Intersection = intersection;
|
|
||||||
Dot = dot;
|
|
||||||
AvoidStrength = avoidStrength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//edge point 1, edge point 2, avoid strength
|
//edge point 1, edge point 2, avoid strength
|
||||||
private List<ObstacleDebugInfo> debugDrawObstacles = new List<ObstacleDebugInfo>();
|
private List<ObstacleDebugInfo> debugDrawObstacles = new List<ObstacleDebugInfo>();
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Barotrauma.Items.Components
|
|||||||
for (int i = 0; i < labels.Length; i++)
|
for (int i = 0; i < labels.Length; i++)
|
||||||
{
|
{
|
||||||
labels[i] = i < newLabels.Length ? newLabels[i] : customInterfaceElementList[i].Label;
|
labels[i] = i < newLabels.Length ? newLabels[i] : customInterfaceElementList[i].Label;
|
||||||
customInterfaceElementList[i].Label = TextManager.Get(labels[i], returnNull: true) ?? labels[i];
|
customInterfaceElementList[i].Label = labels[i];
|
||||||
}
|
}
|
||||||
UpdateLabelsProjSpecific();
|
UpdateLabelsProjSpecific();
|
||||||
}
|
}
|
||||||
@@ -170,12 +170,5 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override XElement Save(XElement parentElement)
|
|
||||||
{
|
|
||||||
labels = customInterfaceElementList.Select(ci => ci.Label).ToArray();
|
|
||||||
signals = customInterfaceElementList.Select(ci => ci.Signal).ToArray();
|
|
||||||
return base.Save(parentElement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1424,6 +1424,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||||
}
|
}
|
||||||
|
if (!broken)
|
||||||
|
{
|
||||||
|
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||||
|
}
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||||
|
|
||||||
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
||||||
@@ -1950,6 +1954,29 @@ namespace Barotrauma
|
|||||||
if (remove) { Spawner?.AddToRemoveQueue(this); }
|
if (remove) { Spawner?.AddToRemoveQueue(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ColoredText> texts = new List<ColoredText>();
|
||||||
|
public List<ColoredText> GetHUDTexts(Character character)
|
||||||
|
{
|
||||||
|
texts.Clear();
|
||||||
|
foreach (ItemComponent ic in components)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(ic.DisplayMsg)) continue;
|
||||||
|
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
||||||
|
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
||||||
|
|
||||||
|
Color color = Color.Gray;
|
||||||
|
bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
|
||||||
|
if (hasRequiredSkillsAndItems)
|
||||||
|
{
|
||||||
|
color = Color.Cyan;
|
||||||
|
}
|
||||||
|
|
||||||
|
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remove) { Spawner?.AddToRemoveQueue(this); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool Combine(Item item)
|
public bool Combine(Item item)
|
||||||
{
|
{
|
||||||
bool isCombined = false;
|
bool isCombined = false;
|
||||||
|
|||||||
@@ -455,6 +455,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
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ namespace Barotrauma
|
|||||||
DisallowedAdjacentLocations = element.GetAttributeStringArray("disallowedadjacentlocations", new string[0]).ToList();
|
DisallowedAdjacentLocations = element.GetAttributeStringArray("disallowedadjacentlocations", new string[0]).ToList();
|
||||||
RequiredAdjacentLocations = element.GetAttributeStringArray("requiredadjacentlocations", new string[0]).ToList();
|
RequiredAdjacentLocations = element.GetAttributeStringArray("requiredadjacentlocations", new string[0]).ToList();
|
||||||
|
|
||||||
string messageTag = element.GetAttributeString("messagetag", "LocationChange." + currentType + ".ChangeTo." + ChangeToType);
|
Messages = TextManager.GetAll("LocationChange." + currentType + ".ChangeTo." + ChangeToType);
|
||||||
|
|
||||||
Messages = TextManager.GetAll(messageTag);
|
|
||||||
if (Messages == null)
|
if (Messages == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("No messages defined for the location type change " + currentType + " -> " + ChangeToType);
|
DebugConsole.ThrowError("No messages defined for the location type change " + currentType + " -> " + ChangeToType);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (obj is KeyOrMouse keyOrMouse)
|
if (obj is KeyOrMouse keyOrMouse )
|
||||||
{
|
{
|
||||||
if (MouseButton.HasValue)
|
if (MouseButton.HasValue)
|
||||||
{
|
{
|
||||||
@@ -162,6 +162,21 @@ namespace Barotrauma
|
|||||||
get { return binding; }
|
get { return binding; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetState()
|
||||||
|
{
|
||||||
|
hit = binding.IsHit();
|
||||||
|
if (hit) hitQueue = true;
|
||||||
|
|
||||||
|
held = binding.IsDown();
|
||||||
|
if (held) heldQueue = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public KeyOrMouse State
|
||||||
|
{
|
||||||
|
get { return binding; }
|
||||||
|
}
|
||||||
|
|
||||||
public void SetState()
|
public void SetState()
|
||||||
{
|
{
|
||||||
hit = binding.IsHit();
|
hit = binding.IsHit();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user