(c1468d39d) Overhauled docking interface (WIP)
This commit is contained in:
@@ -98,7 +98,7 @@ namespace Barotrauma
|
||||
if (distSqrd > 10.0f || !character.AllowInput)
|
||||
{
|
||||
Collider.TargetRotation = newRotation;
|
||||
SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false);
|
||||
SetPosition(newPosition, lerp: distSqrd < 5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,16 +238,20 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
float errorMagnitude = positionError.Length();
|
||||
if (errorMagnitude > 0.5f)
|
||||
{
|
||||
character.MemLocalState.Clear();
|
||||
SetPosition(serverPos.Position, lerp: true, ignorePlatforms: false);
|
||||
}
|
||||
else if (errorMagnitude > 0.01f)
|
||||
if (errorMagnitude > 0.01f)
|
||||
{
|
||||
Collider.TargetPosition = Collider.SimPosition + positionError;
|
||||
Collider.TargetRotation = Collider.Rotation + rotationError;
|
||||
Collider.MoveToTargetPosition(lerp: true);
|
||||
if (errorMagnitude > 0.5f)
|
||||
{
|
||||
character.MemLocalState.Clear();
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
limb.body.TargetPosition = limb.body.SimPosition + positionError;
|
||||
limb.body.MoveToTargetPosition(lerp: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,15 +440,14 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
Color? color = null;
|
||||
if (character.ExternalHighlight)
|
||||
{
|
||||
color = Color.Lerp(Color.White, Color.OrangeRed, (float)Math.Sin(Timing.TotalTime * 3.5f));
|
||||
}
|
||||
//foreach (Limb limb in Limbs)
|
||||
//{
|
||||
// limb.Draw(spriteBatch, cam);
|
||||
//}
|
||||
|
||||
for (int i = 0; i < limbs.Length; i++)
|
||||
{
|
||||
inversedLimbDrawOrder[i].Draw(spriteBatch, cam, color);
|
||||
inversedLimbDrawOrder[i].Draw(spriteBatch, cam);
|
||||
}
|
||||
LimbJoints.ForEach(j => j.Draw(spriteBatch));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace Barotrauma
|
||||
if (controlled == value) return;
|
||||
controlled = value;
|
||||
if (controlled != null) controlled.Enabled = true;
|
||||
CharacterHealth.OpenHealthWindow = null;
|
||||
CharacterHealth.OpenHealthWindow = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,33 +111,6 @@ namespace Barotrauma
|
||||
get { return gibEmitters; }
|
||||
}
|
||||
|
||||
public class ObjectiveEntity
|
||||
{
|
||||
public Entity Entity;
|
||||
public Sprite Sprite;
|
||||
public Color Color;
|
||||
|
||||
public ObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
|
||||
{
|
||||
Entity = entity;
|
||||
Sprite = sprite;
|
||||
if (color.HasValue)
|
||||
{
|
||||
Color = color.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color = Color.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<ObjectiveEntity> activeObjectiveEntities = new List<ObjectiveEntity>();
|
||||
public IEnumerable<ObjectiveEntity> ActiveObjectiveEntities
|
||||
{
|
||||
get { return activeObjectiveEntities; }
|
||||
}
|
||||
|
||||
partial void InitProjSpecific(XDocument doc)
|
||||
{
|
||||
soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f);
|
||||
@@ -164,6 +138,7 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hudProgressBars = new Dictionary<object, HUDProgressBar>();
|
||||
}
|
||||
@@ -760,20 +735,6 @@ namespace Barotrauma
|
||||
soundTimer = soundInterval;
|
||||
}
|
||||
|
||||
public void AddActiveObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
|
||||
{
|
||||
if (activeObjectiveEntities.Any(aoe => aoe.Entity == entity)) return;
|
||||
ObjectiveEntity objectiveEntity = new ObjectiveEntity(entity, sprite, color);
|
||||
activeObjectiveEntities.Add(objectiveEntity);
|
||||
}
|
||||
|
||||
public void RemoveActiveObjectiveEntity(Entity entity)
|
||||
{
|
||||
ObjectiveEntity found = activeObjectiveEntities.Find(aoe => aoe.Entity == entity);
|
||||
if (found == null) return;
|
||||
activeObjectiveEntities.Remove(found);
|
||||
}
|
||||
|
||||
partial void ImplodeFX()
|
||||
{
|
||||
Vector2 centerOfMass = AnimController.GetCenterOfMass();
|
||||
|
||||
@@ -85,8 +85,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (character.Inventory != null)
|
||||
{
|
||||
if (!character.LockHands && character.Stun < 0.1f &&
|
||||
(character.SelectedConstruction == null || character.SelectedConstruction.GetComponent<Controller>() == null))
|
||||
if (!character.LockHands && character.Stun < 0.1f)
|
||||
{
|
||||
character.Inventory.Update(deltaTime, cam);
|
||||
}
|
||||
@@ -169,12 +168,7 @@ namespace Barotrauma
|
||||
DrawOrderIndicator(spriteBatch, cam, character, character.CurrentOrder, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Character.ObjectiveEntity objectiveEntity in character.ActiveObjectiveEntities)
|
||||
{
|
||||
DrawObjectiveIndicator(spriteBatch, cam, character, objectiveEntity, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
foreach (Item brokenItem in brokenItems)
|
||||
{
|
||||
float dist = Vector2.Distance(character.WorldPosition, brokenItem.WorldPosition);
|
||||
@@ -321,7 +315,6 @@ namespace Barotrauma
|
||||
}
|
||||
if (character.Inventory != null && !character.LockHands)
|
||||
{
|
||||
character.Inventory.Locked = (character.SelectedConstruction != null && character.SelectedConstruction.GetComponent<Controller>() != null);
|
||||
character.Inventory.DrawOwn(spriteBatch);
|
||||
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
||||
CharacterInventory.Layout.Default :
|
||||
@@ -366,33 +359,17 @@ namespace Barotrauma
|
||||
|
||||
private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f)
|
||||
{
|
||||
if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) { return; }
|
||||
if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) return;
|
||||
|
||||
Entity target = order.ConnectedController != null ? order.ConnectedController.Item : order.TargetEntity;
|
||||
if (target == null) { return; }
|
||||
if (target == null) return;
|
||||
|
||||
//don't show the indicator if far away and not inside the same sub
|
||||
//prevents exploiting the indicators in locating the sub
|
||||
if (character.Submarine != target.Submarine &&
|
||||
Vector2.DistanceSquared(character.WorldPosition, target.WorldPosition) > 1000.0f * 1000.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!orderIndicatorCount.ContainsKey(target)) { orderIndicatorCount.Add(target, 0); }
|
||||
if (!orderIndicatorCount.ContainsKey(target)) orderIndicatorCount.Add(target, 0);
|
||||
|
||||
Vector2 drawPos = target.WorldPosition + Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target];
|
||||
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha);
|
||||
|
||||
orderIndicatorCount[target] = orderIndicatorCount[target] + 1;
|
||||
}
|
||||
|
||||
private static void DrawObjectiveIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Character.ObjectiveEntity objectiveEntity, float iconAlpha = 1.0f)
|
||||
{
|
||||
if (objectiveEntity == null) return;
|
||||
|
||||
Vector2 drawPos = objectiveEntity.Entity.WorldPosition;// + Vector2.UnitX * objectiveEntity.Sprite.size.X * 1.5f;
|
||||
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, objectiveEntity.Sprite, objectiveEntity.Color * iconAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,17 +136,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public GUIButton CPRButton
|
||||
{
|
||||
get { return cprButton; }
|
||||
}
|
||||
|
||||
public float HealthBarPulsateTimer
|
||||
{
|
||||
get { return healthBarPulsateTimer; }
|
||||
set { healthBarPulsateTimer = MathHelper.Clamp(value, 0.0f, 10.0f); }
|
||||
}
|
||||
|
||||
static CharacterHealth()
|
||||
{
|
||||
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
|
||||
|
||||
Reference in New Issue
Block a user