(965c31410a) Unstable v0.10.4.0
This commit is contained in:
@@ -6,6 +6,8 @@ namespace Barotrauma
|
||||
{
|
||||
partial class HumanAIController : AIController
|
||||
{
|
||||
public static bool debugai;
|
||||
|
||||
partial void InitProjSpecific()
|
||||
{
|
||||
/*if (GameMain.GameSession != null && GameMain.GameSession.CrewManager != null)
|
||||
@@ -18,6 +20,8 @@ namespace Barotrauma
|
||||
|
||||
public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||
{
|
||||
if (Character == Character.Controlled) { return; }
|
||||
if (!debugai) { return; }
|
||||
Vector2 pos = Character.WorldPosition;
|
||||
pos.Y = -pos.Y;
|
||||
Vector2 textOffset = new Vector2(-40, -160);
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace Barotrauma
|
||||
}
|
||||
else if (body.UserData is Limb || body == Collider.FarseerBody)
|
||||
{
|
||||
if (!character.IsRemotePlayer && impact > ImpactTolerance)
|
||||
if (!character.IsRemotelyControlled && impact > ImpactTolerance)
|
||||
{
|
||||
SoundPlayer.PlayDamageSound("LimbBlunt", strongestImpact, Collider);
|
||||
}
|
||||
@@ -460,21 +460,14 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public float GetDepthOffset()
|
||||
{
|
||||
float maxDepth = 0.0f;
|
||||
float minDepth = 1.0f;
|
||||
float depthOffset = 0.0f;
|
||||
var ladder = character.SelectedConstruction?.GetComponent<Ladder>();
|
||||
|
||||
if (ladder != null)
|
||||
{
|
||||
float maxDepth = 0.0f;
|
||||
float minDepth = 1.0f;
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
var activeSprite = limb.ActiveSprite;
|
||||
if (activeSprite != null)
|
||||
{
|
||||
maxDepth = Math.Max(activeSprite.Depth, maxDepth);
|
||||
minDepth = Math.Min(activeSprite.Depth, minDepth);
|
||||
}
|
||||
}
|
||||
CalculateLimbDepths();
|
||||
if (character.WorldPosition.X < character.SelectedConstruction.WorldPosition.X)
|
||||
{
|
||||
//at the left side of the ladder, needs to be drawn in front of the rungs
|
||||
@@ -486,6 +479,36 @@ namespace Barotrauma
|
||||
depthOffset = Math.Max(ladder.BackgroundSpriteDepth + 0.01f - minDepth, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CalculateLimbDepths();
|
||||
var controller = character.SelectedConstruction?.GetComponent<Controller>();
|
||||
if (controller != null && controller.ControlCharacterPose && controller.User == character)
|
||||
{
|
||||
if (controller.Item.SpriteDepth > maxDepth)
|
||||
{
|
||||
depthOffset = Math.Max(controller.Item.SpriteDepth - 0.0001f - maxDepth, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
depthOffset = Math.Max(controller.Item.SpriteDepth + 0.0001f - minDepth, -minDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateLimbDepths()
|
||||
{
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
var activeSprite = limb.ActiveSprite;
|
||||
if (activeSprite != null)
|
||||
{
|
||||
maxDepth = Math.Max(activeSprite.Depth, maxDepth);
|
||||
minDepth = Math.Min(activeSprite.Depth, minDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return depthOffset;
|
||||
}
|
||||
|
||||
@@ -498,10 +521,15 @@ namespace Barotrauma
|
||||
{
|
||||
if (limb.PullJointEnabled)
|
||||
{
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.PullJointWorldAnchorA);
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.PullJointWorldAnchorB);
|
||||
if (currentHull?.Submarine != null) pos += currentHull.Submarine.DrawPosition;
|
||||
pos.Y = -pos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), GUI.Style.Red, true, 0.01f);
|
||||
|
||||
pos = ConvertUnits.ToDisplayUnits(limb.PullJointWorldAnchorA);
|
||||
if (currentHull?.Submarine != null) pos += currentHull.Submarine.DrawPosition;
|
||||
pos.Y = -pos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Cyan, true, 0.01f);
|
||||
}
|
||||
|
||||
limb.body.DebugDraw(spriteBatch, inWater ? (currentHull == null ? Color.Blue : Color.Cyan) : Color.White);
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Barotrauma
|
||||
|
||||
protected float soundTimer;
|
||||
protected float soundInterval;
|
||||
protected float hudInfoTimer;
|
||||
protected bool hudInfoVisible;
|
||||
protected float hudInfoTimer = 1.0f;
|
||||
protected bool hudInfoVisible = false;
|
||||
|
||||
private float pressureParticleTimer;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Barotrauma
|
||||
|
||||
protected float lastRecvPositionUpdateTime;
|
||||
|
||||
private float hudInfoHeight;
|
||||
private float hudInfoHeight = 100.0f;
|
||||
|
||||
private List<CharacterSound> sounds;
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Barotrauma
|
||||
}
|
||||
else if (Lights.LightManager.ViewTarget is Item item && item.Prefab.FocusOnSelected)
|
||||
{
|
||||
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected;
|
||||
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected * item.OffsetOnSelectedMultiplier;
|
||||
}
|
||||
else if (SelectedConstruction != null && ViewTarget == null &&
|
||||
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
|
||||
@@ -549,11 +549,12 @@ namespace Barotrauma
|
||||
public bool ShouldLockHud()
|
||||
{
|
||||
if (this != controlled) { return false; }
|
||||
|
||||
if (GameMain.GameSession?.Campaign != null && GameMain.GameSession.Campaign.ShowCampaignUI) { return true; }
|
||||
var controller = SelectedConstruction?.GetComponent<Controller>();
|
||||
//lock if using a controller, except if we're also using a connection panel in the same item
|
||||
return
|
||||
SelectedConstruction != null &&
|
||||
SelectedConstruction?.GetComponent<Controller>()?.User == this &&
|
||||
controller?.User == this && controller.HideHUD &&
|
||||
SelectedConstruction?.GetComponent<ConnectionPanel>()?.User != this;
|
||||
}
|
||||
|
||||
@@ -661,7 +662,7 @@ namespace Barotrauma
|
||||
public void DrawHUD(SpriteBatch spriteBatch, Camera cam, bool drawHealth = true)
|
||||
{
|
||||
CharacterHUD.Draw(spriteBatch, this, cam);
|
||||
if (drawHealth) CharacterHealth.DrawHUD(spriteBatch);
|
||||
if (drawHealth && !CharacterHUD.IsCampaignInterfaceOpen) { CharacterHealth.DrawHUD(spriteBatch); }
|
||||
}
|
||||
|
||||
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
|
||||
@@ -672,8 +673,8 @@ namespace Barotrauma
|
||||
{
|
||||
AnimController.DebugDraw(spriteBatch);
|
||||
}
|
||||
|
||||
if (GUI.DisableHUD) return;
|
||||
|
||||
if (GUI.DisableHUD) { return; }
|
||||
|
||||
if (Controlled != null &&
|
||||
Controlled != this &&
|
||||
@@ -756,19 +757,23 @@ namespace Barotrauma
|
||||
float hoverRange = 300.0f;
|
||||
float fadeOutRange = 200.0f;
|
||||
float cursorDist = Vector2.Distance(WorldPosition, cam.ScreenToWorld(PlayerInput.MousePosition));
|
||||
float hudInfoAlpha = MathHelper.Clamp(1.0f - (cursorDist - (hoverRange - fadeOutRange)) / fadeOutRange, 0.2f, 1.0f);
|
||||
float hudInfoAlpha =
|
||||
CampaignInteractionType == CampaignMode.InteractionType.None ?
|
||||
MathHelper.Clamp(1.0f - (cursorDist - (hoverRange - fadeOutRange)) / fadeOutRange, 0.2f, 1.0f) :
|
||||
1.0f;
|
||||
|
||||
if (!GUI.DisableCharacterNames && hudInfoVisible && info != null &&
|
||||
(controlled == null || this != controlled.FocusedCharacter))
|
||||
(controlled == null || this != controlled.FocusedCharacter) && cam.Zoom > 0.4f)
|
||||
{
|
||||
string name = Info.DisplayName;
|
||||
if (controlled == null && name != Info.Name) name += " " + TextManager.Get("Disguised");
|
||||
if (controlled == null && name != Info.Name) { name += " " + TextManager.Get("Disguised"); }
|
||||
|
||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 10.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom;
|
||||
Vector2 nameSize = GUI.Font.MeasureString(name);
|
||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 10.0f - (5.0f / cam.Zoom)) - nameSize * 0.5f / cam.Zoom;
|
||||
|
||||
Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height);
|
||||
namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y;
|
||||
namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y;
|
||||
namePos *= screenSize / viewportSize;
|
||||
namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y);
|
||||
namePos *= viewportSize / screenSize;
|
||||
@@ -779,16 +784,30 @@ namespace Barotrauma
|
||||
{
|
||||
nameColor = TeamID == TeamType.FriendlyNPC ? Color.SkyBlue : GUI.Style.Red;
|
||||
}
|
||||
if (CampaignInteractionType != CampaignMode.InteractionType.None && AllowCustomInteract)
|
||||
{
|
||||
var iconStyle = GUI.Style.GetComponentStyle("CampaignInteractionIcon." + CampaignInteractionType);
|
||||
if (iconStyle != null)
|
||||
{
|
||||
Vector2 headPos = AnimController.GetLimb(LimbType.Head)?.WorldPosition ?? WorldPosition + Vector2.UnitY * 100.0f;
|
||||
Vector2 iconPos = headPos;
|
||||
iconPos.Y = -iconPos.Y;
|
||||
nameColor = iconStyle.Color;
|
||||
var icon = iconStyle.Sprites[GUIComponent.ComponentState.None].First();
|
||||
float iconScale = 30.0f / icon.Sprite.size.X / cam.Zoom;
|
||||
icon.Sprite.Draw(spriteBatch, iconPos + new Vector2(-35.0f, -25.0f), iconStyle.Color * hudInfoAlpha, scale: iconScale);
|
||||
}
|
||||
}
|
||||
|
||||
GUI.Font.DrawString(spriteBatch, name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f);
|
||||
GUI.Font.DrawString(spriteBatch, name, namePos, nameColor * hudInfoAlpha, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f);
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsDead) return;
|
||||
if (IsDead) { return; }
|
||||
|
||||
if (CharacterHealth.DisplayedVitality < MaxVitality * 0.98f && hudInfoVisible)
|
||||
{
|
||||
|
||||
@@ -41,13 +41,21 @@ namespace Barotrauma
|
||||
private static bool shouldRecreateHudTexts = true;
|
||||
private static bool heldDownShiftWhenGotHudTexts;
|
||||
|
||||
public static bool IsCampaignInterfaceOpen =>
|
||||
GameMain.GameSession?.Campaign != null &&
|
||||
(GameMain.GameSession.Campaign.ShowCampaignUI || GameMain.GameSession.Campaign.ForceMapUI);
|
||||
|
||||
private static bool ShouldDrawInventory(Character character)
|
||||
{
|
||||
var controller = character.SelectedConstruction?.GetComponent<Controller>();
|
||||
|
||||
return
|
||||
character?.Inventory != null &&
|
||||
character.AllowInput &&
|
||||
!character.LockHands &&
|
||||
character.SelectedConstruction?.GetComponent<Controller>()?.User != character;
|
||||
!character.LockHands &&
|
||||
(controller?.User != character || !controller.HideHUD) &&
|
||||
!IsCampaignInterfaceOpen &&
|
||||
!ConversationAction.FadeScreenToBlack;
|
||||
}
|
||||
|
||||
private static string GetCachedHudText(string textTag, string keyBind)
|
||||
@@ -65,7 +73,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GUI.DisableHUD) return;
|
||||
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f)
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f && !IsCampaignInterfaceOpen)
|
||||
{
|
||||
if (character.Inventory != null)
|
||||
{
|
||||
@@ -92,9 +100,17 @@ namespace Barotrauma
|
||||
|
||||
public static void Update(float deltaTime, Character character, Camera cam)
|
||||
{
|
||||
if (GUI.DisableHUD) { return; }
|
||||
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f)
|
||||
if (GUI.DisableHUD)
|
||||
{
|
||||
if (character.Inventory != null && !LockInventory(character))
|
||||
{
|
||||
character.Inventory.UpdateSlotInput();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f && !IsCampaignInterfaceOpen)
|
||||
{
|
||||
if (character.Info != null && !character.ShouldLockHud() && character.SelectedCharacter == null)
|
||||
{
|
||||
@@ -163,7 +179,7 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.Submarine == null || item.Submarine.TeamID != character.TeamID || item.Submarine.Info.IsWreck) { continue; }
|
||||
if (!item.Repairables.Any(r => item.ConditionPercentage <= r.RepairThreshold)) { continue; }
|
||||
if (!item.Repairables.Any(r => item.ConditionPercentage <= r.RepairIconThreshold)) { continue; }
|
||||
if (Submarine.VisibleEntities != null && !Submarine.VisibleEntities.Contains(item)) { continue; }
|
||||
|
||||
Vector2 diff = item.WorldPosition - character.WorldPosition;
|
||||
@@ -211,7 +227,7 @@ namespace Barotrauma
|
||||
Color.Lerp(GUI.Style.Red, GUI.Style.Orange * 0.5f, brokenItem.Condition / brokenItem.MaxCondition) * alpha);
|
||||
}
|
||||
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f)
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f && !IsCampaignInterfaceOpen)
|
||||
{
|
||||
if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
|
||||
{
|
||||
@@ -299,6 +315,8 @@ namespace Barotrauma
|
||||
character.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
|
||||
}
|
||||
|
||||
if (IsCampaignInterfaceOpen) { return; }
|
||||
|
||||
if (character.Inventory != null)
|
||||
{
|
||||
for (int i = 0; i < character.Inventory.Items.Length - 1; i++)
|
||||
@@ -308,10 +326,11 @@ namespace Barotrauma
|
||||
|
||||
foreach (ItemComponent ic in item.Components)
|
||||
{
|
||||
if (ic.DrawHudWhenEquipped) ic.DrawHUD(spriteBatch, character);
|
||||
if (ic.DrawHudWhenEquipped) { ic.DrawHUD(spriteBatch, character); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool mouseOnPortrait = false;
|
||||
if (character.Stun <= 0.1f && !character.IsDead)
|
||||
{
|
||||
@@ -421,7 +440,7 @@ namespace Barotrauma
|
||||
GUI.Style.Green, Color.Black, 2, GUI.SmallFont);
|
||||
textPos.Y += textSize.Y;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(character.FocusedCharacter.customInteractHUDText))
|
||||
if (!string.IsNullOrEmpty(character.FocusedCharacter.customInteractHUDText) && character.FocusedCharacter.AllowCustomInteract)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, textPos, character.FocusedCharacter.customInteractHUDText, GUI.Style.Green, Color.Black, 2, GUI.SmallFont);
|
||||
textPos.Y += textSize.Y;
|
||||
@@ -430,7 +449,7 @@ namespace Barotrauma
|
||||
|
||||
private static bool LockInventory(Character character)
|
||||
{
|
||||
if (character?.Inventory == null || !character.AllowInput || character.LockHands) { return true; }
|
||||
if (character?.Inventory == null || !character.AllowInput || character.LockHands || IsCampaignInterfaceOpen) { return true; }
|
||||
|
||||
return character.ShouldLockHud();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -12,9 +13,11 @@ namespace Barotrauma
|
||||
{
|
||||
private static Sprite infoAreaPortraitBG;
|
||||
|
||||
public bool LastControlled;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
infoAreaPortraitBG = GUI.Style.GetComponentStyle("InfoAreaPortraitBG")?.Sprites[GUIComponent.ComponentState.None][0].Sprite;
|
||||
infoAreaPortraitBG = GUI.Style.GetComponentStyle("InfoAreaPortraitBG")?.GetDefaultSprite();
|
||||
new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
}
|
||||
|
||||
@@ -117,6 +120,7 @@ namespace Barotrauma
|
||||
|
||||
private void DrawInfoFrameCharacterIcon(SpriteBatch sb, Rectangle componentRect)
|
||||
{
|
||||
if (headSprite == null) { return; }
|
||||
Vector2 targetAreaSize = componentRect.Size.ToVector2();
|
||||
float scale = Math.Min(targetAreaSize.X / headSprite.size.X, targetAreaSize.Y / headSprite.size.Y);
|
||||
DrawIcon(sb, componentRect.Location.ToVector2() + headSprite.size / 2 * scale, targetAreaSize);
|
||||
@@ -140,6 +144,9 @@ namespace Barotrauma
|
||||
|
||||
partial void OnSkillChanged(string skillIdentifier, float prevLevel, float newLevel, Vector2 textPopupPos)
|
||||
{
|
||||
if (TeamID == Character.TeamType.FriendlyNPC) { return; }
|
||||
if (Character.Controlled != null && Character.Controlled.TeamID != TeamID) { return; }
|
||||
|
||||
if (newLevel - prevLevel > 0.1f)
|
||||
{
|
||||
GUI.AddMessage(
|
||||
|
||||
@@ -75,8 +75,15 @@ namespace Barotrauma
|
||||
states = newInput,
|
||||
intAim = intAngle
|
||||
};
|
||||
if (focusedItem != null && !CharacterInventory.DraggingItemToWorld &&
|
||||
(!newMem.states.HasFlag(InputNetFlags.Grab) && !newMem.states.HasFlag(InputNetFlags.Health)))
|
||||
|
||||
if (FocusedCharacter != null &&
|
||||
FocusedCharacter.CampaignInteractionType != CampaignMode.InteractionType.None &&
|
||||
newMem.states.HasFlag(InputNetFlags.Use))
|
||||
{
|
||||
newMem.interact = FocusedCharacter.ID;
|
||||
}
|
||||
else if (focusedItem != null && !CharacterInventory.DraggingItemToWorld &&
|
||||
!newMem.states.HasFlag(InputNetFlags.Grab) && !newMem.states.HasFlag(InputNetFlags.Health))
|
||||
{
|
||||
newMem.interact = focusedItem.ID;
|
||||
}
|
||||
@@ -278,10 +285,10 @@ namespace Barotrauma
|
||||
break;
|
||||
case ServerNetObject.ENTITY_EVENT:
|
||||
|
||||
int eventType = msg.ReadRangedInteger(0, 4);
|
||||
int eventType = msg.ReadRangedInteger(0, 5);
|
||||
switch (eventType)
|
||||
{
|
||||
case 0:
|
||||
case 0: //NetEntityEvent.Type.InventoryState
|
||||
if (Inventory == null)
|
||||
{
|
||||
string errorMsg = "Received an inventory update message for an entity with no inventory (" + Name + ", removed: " + Removed + ")";
|
||||
@@ -301,7 +308,7 @@ namespace Barotrauma
|
||||
Inventory.ClientRead(type, msg, sendingTime);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 1: //NetEntityEvent.Type.Control
|
||||
byte ownerID = msg.ReadByte();
|
||||
ResetNetState();
|
||||
if (ownerID == GameMain.Client.ID)
|
||||
@@ -326,10 +333,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 2: //NetEntityEvent.Type.Status
|
||||
ReadStatus(msg);
|
||||
break;
|
||||
case 3:
|
||||
case 3: //NetEntityEvent.Type.UpdateSkills
|
||||
int skillCount = msg.ReadByte();
|
||||
for (int i = 0; i < skillCount; i++)
|
||||
{
|
||||
@@ -338,17 +345,17 @@ namespace Barotrauma
|
||||
info?.SetSkillLevel(skillIdentifier, skillLevel, WorldPosition + Vector2.UnitY * 150.0f);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 4: //NetEntityEvent.Type.ExecuteAttack
|
||||
int attackLimbIndex = msg.ReadByte();
|
||||
UInt16 targetEntityID = msg.ReadUInt16();
|
||||
int targetLimbIndex = msg.ReadByte();
|
||||
|
||||
//255 = entity already removed, no need to do anything
|
||||
if (attackLimbIndex == 255) { break; }
|
||||
if (attackLimbIndex == 255 || Removed) { break; }
|
||||
|
||||
if (attackLimbIndex >= AnimController.Limbs.Length)
|
||||
{
|
||||
DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Limb index out of bounds ({attackLimbIndex})");
|
||||
DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Limb index out of bounds (character: {Name}, limb index: {attackLimbIndex}, limb count: {AnimController.Limbs.Length})");
|
||||
break;
|
||||
}
|
||||
Limb attackLimb = AnimController.Limbs[attackLimbIndex];
|
||||
@@ -362,7 +369,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (targetLimbIndex >= targetCharacter.AnimController.Limbs.Length)
|
||||
{
|
||||
DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Target limb index out of bounds ({targetLimbIndex})");
|
||||
DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Target limb index out of bounds (target character: {targetCharacter.Name}, limb index: {targetLimbIndex}, limb count: {targetCharacter.AnimController.Limbs.Length})");
|
||||
break;
|
||||
}
|
||||
targetLimb = targetCharacter.AnimController.Limbs[targetLimbIndex];
|
||||
@@ -372,6 +379,10 @@ namespace Barotrauma
|
||||
attackLimb.ExecuteAttack(targetEntity, targetLimb, out _);
|
||||
}
|
||||
break;
|
||||
case 5: //NetEntityEvent.Type.AssignCampaignInteraction
|
||||
byte campaignInteractionType = msg.ReadByte();
|
||||
(GameMain.GameSession?.GameMode as CampaignMode)?.AssignNPCMenuInteraction(this, (CampaignMode.InteractionType)campaignInteractionType);
|
||||
break;
|
||||
}
|
||||
msg.ReadPadBits();
|
||||
break;
|
||||
@@ -398,7 +409,7 @@ namespace Barotrauma
|
||||
Character character = null;
|
||||
if (noInfo)
|
||||
{
|
||||
character = Create(speciesName, position, seed, null, true);
|
||||
character = Create(speciesName, position, seed, null, false);
|
||||
character.ID = id;
|
||||
bool containsStatusData = inc.ReadBoolean();
|
||||
if (containsStatusData)
|
||||
@@ -416,9 +427,14 @@ namespace Barotrauma
|
||||
|
||||
CharacterInfo info = CharacterInfo.ClientRead(infoSpeciesName, inc);
|
||||
|
||||
character = Create(speciesName, position, seed, info, GameMain.Client.ID != ownerId, hasAi);
|
||||
character = Create(speciesName, position, seed, info, ownerId > 0 && GameMain.Client.ID != ownerId, hasAi);
|
||||
character.ID = id;
|
||||
character.TeamID = (TeamType)teamID;
|
||||
character.CampaignInteractionType = (CampaignMode.InteractionType)inc.ReadByte();
|
||||
if (character.CampaignInteractionType != CampaignMode.InteractionType.None)
|
||||
{
|
||||
(GameMain.GameSession.GameMode as CampaignMode)?.AssignNPCMenuInteraction(character, character.CampaignInteractionType);
|
||||
}
|
||||
|
||||
// Check if the character has a current order
|
||||
if (inc.ReadBoolean())
|
||||
|
||||
@@ -525,6 +525,7 @@ namespace Barotrauma
|
||||
},
|
||||
TextManager.Get("GiveInButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
Visible = false,
|
||||
ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer"),
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
@@ -944,6 +945,22 @@ namespace Barotrauma
|
||||
|
||||
suicideButton.Visible = Character == Character.Controlled && !Character.IsDead && Character.IsIncapacitated;
|
||||
|
||||
if (GameMain.GameSession?.Campaign is { } campaign)
|
||||
{
|
||||
RectTransform endRoundButton = campaign?.EndRoundButton.RectTransform;
|
||||
if (endRoundButton != null)
|
||||
{
|
||||
if (suicideButton.Visible)
|
||||
{
|
||||
endRoundButton.ScreenSpaceOffset = new Point(0, suicideButton.Rect.Height);
|
||||
}
|
||||
else if (endRoundButton.ScreenSpaceOffset != Point.Zero)
|
||||
{
|
||||
endRoundButton.ScreenSpaceOffset = Point.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cprButton.Visible =
|
||||
Character == Character.Controlled?.SelectedCharacter
|
||||
&& (Character.IsUnconscious || Character.Stun > 0.0f)
|
||||
@@ -965,23 +982,29 @@ namespace Barotrauma
|
||||
|
||||
public void AddToGUIUpdateList()
|
||||
{
|
||||
if (GUI.DisableHUD) return;
|
||||
if (GUI.DisableHUD) { return; }
|
||||
if (OpenHealthWindow == this)
|
||||
{
|
||||
healthInterfaceFrame.AddToGUIUpdateList();
|
||||
afflictionTooltip?.AddToGUIUpdateList();
|
||||
}
|
||||
else if (Character.Controlled == Character)
|
||||
else if (Character.Controlled == Character && !CharacterHUD.IsCampaignInterfaceOpen)
|
||||
{
|
||||
healthBarHolder.AddToGUIUpdateList();
|
||||
}
|
||||
if (suicideButton.Visible && Character == Character.Controlled) suicideButton.AddToGUIUpdateList();
|
||||
if (cprButton != null && cprButton.Visible) cprButton.AddToGUIUpdateList();
|
||||
if (suicideButton.Visible && Character == Character.Controlled)
|
||||
{
|
||||
suicideButton.AddToGUIUpdateList();
|
||||
}
|
||||
if (cprButton != null && cprButton.Visible)
|
||||
{
|
||||
cprButton.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawHUD(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (GUI.DisableHUD) return;
|
||||
if (GUI.DisableHUD) { return; }
|
||||
if (GameMain.GraphicsWidth != screenResolution.X ||
|
||||
GameMain.GraphicsHeight != screenResolution.Y ||
|
||||
Math.Abs(inventoryScale - Inventory.UIScale) > 0.01f ||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Barotrauma
|
||||
{
|
||||
partial class JobPrefab : IPrefab, IDisposable
|
||||
{
|
||||
public GUIButton CreateInfoFrame(int variant)
|
||||
public GUIButton CreateInfoFrame(out GUIComponent buttonContainer)
|
||||
{
|
||||
int width = 500, height = 400;
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Barotrauma
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
buttonContainer = paddedFrame;
|
||||
|
||||
/*if (!ItemIdentifiers.TryGetValue(variant, out var itemIdentifiers)) { return backFrame; }
|
||||
var itemContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.45f, 0.5f), paddedFrame.RectTransform, Anchor.TopRight)
|
||||
{ RelativeOffset = new Vector2(0.0f, 0.2f + descriptionBlock.RectTransform.RelativeSize.Y) })
|
||||
@@ -54,7 +56,6 @@ namespace Barotrauma
|
||||
return frameHolder;
|
||||
}
|
||||
|
||||
|
||||
public class OutfitPreview
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user