(b00ce5ec2) Fixed character's feet levitating when standing at the base of a staircase without climbing it. Closes #1275
This commit is contained in:
@@ -66,121 +66,6 @@ namespace Barotrauma
|
|||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
|
||||||
|
|
||||||
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
|
|
||||||
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
|
||||||
"", style: "UIToggleButton");
|
|
||||||
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
|
||||||
{
|
|
||||||
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
|
||||||
foreach (GUIComponent child in btn.Children)
|
|
||||||
{
|
|
||||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
|
|
||||||
{
|
|
||||||
//Spacing = (int)(3 * GUI.Scale),
|
|
||||||
ScrollBarEnabled = false,
|
|
||||||
ScrollBarVisible = false,
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
scrollButtonUp = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.TopLeft, Pivot.TopLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
|
||||||
{
|
|
||||||
Visible = false,
|
|
||||||
UserData = -1,
|
|
||||||
OnClicked = ScrollCharacterList
|
|
||||||
};
|
|
||||||
scrollButtonDown = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
|
||||||
{
|
|
||||||
Visible = false,
|
|
||||||
UserData = 1,
|
|
||||||
OnClicked = ScrollCharacterList
|
|
||||||
};
|
|
||||||
scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
|
|
||||||
|
|
||||||
if (isSinglePlayer)
|
|
||||||
{
|
|
||||||
chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
|
||||||
{
|
|
||||||
OnEnterMessage = (textbox, text) =>
|
|
||||||
{
|
|
||||||
if (Character.Controlled?.Info == null)
|
|
||||||
{
|
|
||||||
textbox.Deselect();
|
|
||||||
textbox.Text = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
textbox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(text))
|
|
||||||
{
|
|
||||||
string msgCommand = ChatMessage.GetChatMessageCommand(text, out string msg);
|
|
||||||
AddSinglePlayerChatMessage(
|
|
||||||
Character.Controlled.Info.Name,
|
|
||||||
msg,
|
|
||||||
((msgCommand == "r" || msgCommand == "radio") && ChatMessage.CanUseRadio(Character.Controlled)) ? ChatMessageType.Radio : ChatMessageType.Default,
|
|
||||||
Character.Controlled);
|
|
||||||
var headset = GetHeadset(Character.Controlled, true);
|
|
||||||
if (headset != null && headset.CanTransmit())
|
|
||||||
{
|
|
||||||
headset.TransmitSignal(stepsTaken: 0, signal: msg, source: headset.Item, sender: Character.Controlled, sendToChat: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
textbox.Deselect();
|
|
||||||
textbox.Text = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
|
||||||
reportButtonFrame = new GUILayoutGroup(new RectTransform(
|
|
||||||
new Point((HUDLayoutSettings.CrewArea.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform))
|
|
||||||
{
|
|
||||||
AbsoluteSpacing = (int)(5 * GUI.Scale),
|
|
||||||
UserData = "reportbuttons",
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
//report buttons
|
|
||||||
foreach (Order order in reports)
|
|
||||||
{
|
|
||||||
if (!order.TargetAllCharacters || order.SymbolSprite == null) continue;
|
|
||||||
var btn = new GUIButton(new RectTransform(new Point(reportButtonFrame.Rect.Width), reportButtonFrame.RectTransform), style: null)
|
|
||||||
{
|
|
||||||
OnClicked = (GUIButton button, object userData) =>
|
|
||||||
{
|
|
||||||
if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
|
|
||||||
SetCharacterOrder(null, order, null, Character.Controlled);
|
|
||||||
HumanAIController.PropagateHullSafety(Character.Controlled, Character.Controlled.CurrentHull);
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
UserData = order,
|
|
||||||
ToolTip = order.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
|
||||||
{
|
|
||||||
Color = Color.Red * 0.8f,
|
|
||||||
HoverColor = Color.Red * 1.0f,
|
|
||||||
PressedColor = Color.Red * 0.6f,
|
|
||||||
UserData = "highlighted",
|
|
||||||
CanBeFocused = false,
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
foreach (XElement invElement in subElement.Elements())
|
foreach (XElement invElement in subElement.Elements())
|
||||||
|
|||||||
@@ -234,6 +234,85 @@ namespace Barotrauma.Items.Components
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool useAlternativeLayout;
|
||||||
|
public bool UseAlternativeLayout
|
||||||
|
{
|
||||||
|
get { return useAlternativeLayout; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (AlternativeLayout != null)
|
||||||
|
{
|
||||||
|
if (value == useAlternativeLayout) { return; }
|
||||||
|
useAlternativeLayout = value;
|
||||||
|
if (useAlternativeLayout)
|
||||||
|
{
|
||||||
|
AlternativeLayout?.ApplyTo(GuiFrame.RectTransform);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DefaultLayout?.ApplyTo(GuiFrame.RectTransform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyTo(RectTransform target)
|
||||||
|
{
|
||||||
|
if (RelativeOffset.HasValue)
|
||||||
|
{
|
||||||
|
target.RelativeOffset = RelativeOffset.Value;
|
||||||
|
}
|
||||||
|
else if (AbsoluteOffset.HasValue)
|
||||||
|
{
|
||||||
|
target.AbsoluteOffset = AbsoluteOffset.Value;
|
||||||
|
}
|
||||||
|
if (RelativeSize.HasValue)
|
||||||
|
{
|
||||||
|
target.RelativeSize = RelativeSize.Value;
|
||||||
|
}
|
||||||
|
else if (AbsoluteSize.HasValue)
|
||||||
|
{
|
||||||
|
target.NonScaledSize = AbsoluteSize.Value;
|
||||||
|
}
|
||||||
|
if (Anchor.HasValue)
|
||||||
|
{
|
||||||
|
target.Anchor = Anchor.Value;
|
||||||
|
}
|
||||||
|
if (Pivot.HasValue)
|
||||||
|
{
|
||||||
|
target.Pivot = Pivot.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target.Pivot = RectTransform.MatchPivotToAnchor(target.Anchor);
|
||||||
|
}
|
||||||
|
target.RecalculateChildren(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GUIFrame GuiFrame { get; protected set; }
|
||||||
|
|
||||||
|
[Serialize(false, false)]
|
||||||
|
public bool AllowUIOverlap
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemComponent linkToUIComponent;
|
||||||
|
[Serialize("", false)]
|
||||||
|
public string LinkUIToComponent
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serialize(0, false)]
|
||||||
|
public int HudPriority
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
private bool shouldMuffleLooping;
|
private bool shouldMuffleLooping;
|
||||||
private float lastMuffleCheckTime;
|
private float lastMuffleCheckTime;
|
||||||
private ItemSound loopingSound;
|
private ItemSound loopingSound;
|
||||||
|
|||||||
@@ -344,6 +344,10 @@ namespace Barotrauma.Items.Components
|
|||||||
crosshairSprite?.Draw(spriteBatch, crosshairPos, readyToFire ? Color.White : Color.White * 0.2f, 0, zoom);
|
crosshairSprite?.Draw(spriteBatch, crosshairPos, readyToFire ? Color.White : Color.White * 0.2f, 0, zoom);
|
||||||
crosshairPointerSprite?.Draw(spriteBatch, crosshairPointerPos, 0, zoom);
|
crosshairPointerSprite?.Draw(spriteBatch, crosshairPointerPos, 0, zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crosshairSprite?.Draw(spriteBatch, crosshairPos, readyToFire ? Color.White : Color.White * 0.2f, 0, zoom);
|
||||||
|
crosshairPointerSprite?.Draw(spriteBatch, crosshairPointerPos, 0, zoom);
|
||||||
|
}
|
||||||
|
|
||||||
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ namespace Barotrauma
|
|||||||
waist.PullJointEnabled = true;
|
waist.PullJointEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
|
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f), ignoreStairs: Stairs == null);
|
||||||
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
||||||
|
|
||||||
if (Stairs != null || onSlope)
|
if (Stairs != null || onSlope)
|
||||||
|
|||||||
@@ -1391,14 +1391,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void Splash(Limb limb, Hull limbHull);
|
partial void Splash(Limb limb, Hull limbHull);
|
||||||
|
|
||||||
protected float GetFloorY(Limb refLimb = null)
|
protected float GetFloorY(Limb refLimb = null, bool ignoreStairs = false)
|
||||||
{
|
{
|
||||||
PhysicsBody refBody = refLimb == null ? Collider : refLimb.body;
|
PhysicsBody refBody = refLimb == null ? Collider : refLimb.body;
|
||||||
|
|
||||||
return GetFloorY(refBody.SimPosition);
|
return GetFloorY(refBody.SimPosition, ignoreStairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float GetFloorY(Vector2 simPosition)
|
protected float GetFloorY(Vector2 simPosition, bool ignoreStairs = false)
|
||||||
{
|
{
|
||||||
Vector2 rayStart = simPosition;
|
Vector2 rayStart = simPosition;
|
||||||
float height = ColliderHeightFromFloor;
|
float height = ColliderHeightFromFloor;
|
||||||
@@ -1415,6 +1415,7 @@ namespace Barotrauma
|
|||||||
switch (fixture.CollisionCategories)
|
switch (fixture.CollisionCategories)
|
||||||
{
|
{
|
||||||
case Physics.CollisionStairs:
|
case Physics.CollisionStairs:
|
||||||
|
if (ignoreStairs) return -1;
|
||||||
if (inWater && TargetMovement.Y < 0.5f) return -1;
|
if (inWater && TargetMovement.Y < 0.5f) return -1;
|
||||||
break;
|
break;
|
||||||
case Physics.CollisionPlatform:
|
case Physics.CollisionPlatform:
|
||||||
|
|||||||
Reference in New Issue
Block a user