Characters can be left behind in levels and they will stay there until the player returns, other subs visible in sonar
This commit is contained in:
@@ -22,6 +22,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private List<ushort> pickedItems;
|
private List<ushort> pickedItems;
|
||||||
|
|
||||||
|
public ushort? HullID = null;
|
||||||
|
|
||||||
private Vector2[] headSpriteRange;
|
private Vector2[] headSpriteRange;
|
||||||
|
|
||||||
private Gender gender;
|
private Gender gender;
|
||||||
@@ -295,6 +297,9 @@ namespace Barotrauma
|
|||||||
headSpriteId = ToolBox.GetAttributeInt(element, "headspriteid", 1);
|
headSpriteId = ToolBox.GetAttributeInt(element, "headspriteid", 1);
|
||||||
StartItemsGiven = ToolBox.GetAttributeBool(element, "startitemsgiven", false);
|
StartItemsGiven = ToolBox.GetAttributeBool(element, "startitemsgiven", false);
|
||||||
|
|
||||||
|
int hullId = ToolBox.GetAttributeInt(element, "hull", -1);
|
||||||
|
if (hullId > 0 && hullId <= ushort.MaxValue) this.HullID = (ushort)hullId;
|
||||||
|
|
||||||
pickedItems = new List<ushort>();
|
pickedItems = new List<ushort>();
|
||||||
|
|
||||||
string pickedItemString = ToolBox.GetAttributeString(element, "items", "");
|
string pickedItemString = ToolBox.GetAttributeString(element, "items", "");
|
||||||
@@ -342,9 +347,18 @@ namespace Barotrauma
|
|||||||
new XAttribute("headspriteid", HeadSpriteId),
|
new XAttribute("headspriteid", HeadSpriteId),
|
||||||
new XAttribute("startitemsgiven", StartItemsGiven));
|
new XAttribute("startitemsgiven", StartItemsGiven));
|
||||||
|
|
||||||
if (Character != null && Character.Inventory != null)
|
if (Character != null)
|
||||||
{
|
{
|
||||||
UpdateCharacterItems();
|
if (Character.Inventory != null)
|
||||||
|
{
|
||||||
|
UpdateCharacterItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Character.AnimController.CurrentHull != null)
|
||||||
|
{
|
||||||
|
HullID = Character.AnimController.CurrentHull.ID;
|
||||||
|
charElement.Add(new XAttribute("hull", Character.AnimController.CurrentHull.ID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pickedItems.Count > 0)
|
if (pickedItems.Count > 0)
|
||||||
@@ -360,6 +374,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Remove()
|
public void Remove()
|
||||||
{
|
{
|
||||||
|
Character = null;
|
||||||
//if (headSprite != null)
|
//if (headSprite != null)
|
||||||
//{
|
//{
|
||||||
// headSprite.Remove();
|
// headSprite.Remove();
|
||||||
|
|||||||
@@ -281,16 +281,24 @@ namespace Barotrauma
|
|||||||
|
|
||||||
for (int i = 0; i < waypoints.Length; i++)
|
for (int i = 0; i < waypoints.Length; i++)
|
||||||
{
|
{
|
||||||
//WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Human);
|
Character character;
|
||||||
//Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition;
|
|
||||||
|
|
||||||
Character character = Character.Create(characterInfos[i], waypoints[i].WorldPosition);
|
if (characterInfos[i].HullID != null)
|
||||||
Character.Controlled = character;
|
|
||||||
|
|
||||||
if (character.Info!=null && !character.Info.StartItemsGiven)
|
|
||||||
{
|
{
|
||||||
character.GiveJobItems(waypoints[i]);
|
var hull = Entity.FindEntityByID((ushort)characterInfos[i].HullID) as Hull;
|
||||||
character.Info.StartItemsGiven = true;
|
if (hull == null) continue;
|
||||||
|
character = Character.Create(characterInfos[i], hull.WorldPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
character = Character.Create(characterInfos[i], waypoints[i].WorldPosition);
|
||||||
|
Character.Controlled = character;
|
||||||
|
|
||||||
|
if (character.Info != null && !character.Info.StartItemsGiven)
|
||||||
|
{
|
||||||
|
character.GiveJobItems(waypoints[i]);
|
||||||
|
character.Info.StartItemsGiven = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddCharacter(character);
|
AddCharacter(character);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
||||||
{
|
{
|
||||||
Vector2 center = new Vector2(rect.Center.X, rect.Center.Y);
|
Vector2 center = new Vector2(rect.X + rect.Width*0.75f, rect.Center.Y);
|
||||||
|
|
||||||
if (!IsActive) return;
|
if (!IsActive) return;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ namespace Barotrauma.Items.Components
|
|||||||
CreateBlipsForLine(
|
CreateBlipsForLine(
|
||||||
new Vector2(item.WorldPosition.X - range, Level.Loaded.Size.Y),
|
new Vector2(item.WorldPosition.X - range, Level.Loaded.Size.Y),
|
||||||
new Vector2(item.WorldPosition.X + range, Level.Loaded.Size.Y),
|
new Vector2(item.WorldPosition.X + range, Level.Loaded.Size.Y),
|
||||||
radius, displayScale, 300.0f, 1.0f);
|
radius, displayScale, 500.0f, 10.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<VoronoiCell> cells = Level.Loaded.GetCells(item.WorldPosition, 7);
|
List<VoronoiCell> cells = Level.Loaded.GetCells(item.WorldPosition, 7);
|
||||||
@@ -254,11 +254,11 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
|
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
|
||||||
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.55f));
|
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
|
||||||
|
|
||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
|
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
|
||||||
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.55f));
|
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
|
||||||
|
|
||||||
if (GameMain.GameSession.Mission != null)
|
if (GameMain.GameSession.Mission != null)
|
||||||
{
|
{
|
||||||
@@ -272,6 +272,13 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (Submarine sub in Submarine.Loaded)
|
||||||
|
{
|
||||||
|
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
|
||||||
|
|
||||||
|
DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.45f));
|
||||||
|
}
|
||||||
|
|
||||||
if (!GameMain.DebugDraw) return;
|
if (!GameMain.DebugDraw) return;
|
||||||
|
|
||||||
var steering = item.GetComponent<Steering>();
|
var steering = item.GetComponent<Steering>();
|
||||||
@@ -362,14 +369,26 @@ namespace Barotrauma.Items.Components
|
|||||||
position *= scale;
|
position *= scale;
|
||||||
position.Y = -position.Y;
|
position.Y = -position.Y;
|
||||||
|
|
||||||
Vector2 markerPos = (dist*scale>radius) ? Vector2.Normalize(position) * radius : position;
|
float textAlpha = MathHelper.Clamp(1.5f - dist / 50000.0f, 0.5f, 1.0f);
|
||||||
|
|
||||||
|
Vector2 dir = Vector2.Normalize(position);
|
||||||
|
|
||||||
|
Vector2 markerPos = (dist*scale>radius) ? dir * radius : position;
|
||||||
markerPos += center;
|
markerPos += center;
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightGreen);
|
markerPos.X = (int)markerPos.X;
|
||||||
|
markerPos.Y = (int)markerPos.Y;
|
||||||
|
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightGreen * textAlpha);
|
||||||
|
|
||||||
|
if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X+10;
|
||||||
|
|
||||||
|
GUI.DrawString(spriteBatch, new Vector2(markerPos.X + 10, markerPos.Y), label, Color.LightGreen * textAlpha, Color.Black * textAlpha*0.5f, 2, GUI.SmallFont);
|
||||||
|
|
||||||
|
GUI.DrawString(spriteBatch, new Vector2(markerPos.X + 10, markerPos.Y + 15), (int)(dist * Physics.DisplayToRealWorldRatio) + " m",
|
||||||
|
Color.LightGreen * textAlpha,
|
||||||
|
Color.Black * textAlpha, 2, GUI.SmallFont);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, label, new Vector2(markerPos.X + 10, markerPos.Y), Color.LightGreen);
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, (int)(dist * Physics.DisplayToRealWorldRatio) + " m",
|
|
||||||
new Vector2(markerPos.X + 10, markerPos.Y + 15), Color.LightGreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RemoveComponentSpecific()
|
protected override void RemoveComponentSpecific()
|
||||||
|
|||||||
Reference in New Issue
Block a user