(42d13c09f) Merge remote-tracking branch 'origin/tutorial-rework' into dev
This commit is contained in:
@@ -426,7 +426,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool canSpeak;
|
||||
public bool CanSpeak;
|
||||
|
||||
private bool speechImpedimentSet;
|
||||
|
||||
@@ -436,7 +436,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!canSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f;
|
||||
if (!CanSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f;
|
||||
return speechImpediment;
|
||||
}
|
||||
set
|
||||
@@ -710,7 +710,7 @@ namespace Barotrauma
|
||||
displayName = TextManager.Get($"Character.{Path.GetFileName(Path.GetDirectoryName(file))}", true);
|
||||
|
||||
IsHumanoid = doc.Root.GetAttributeBool("humanoid", false);
|
||||
canSpeak = doc.Root.GetAttributeBool("canspeak", false);
|
||||
CanSpeak = doc.Root.GetAttributeBool("canspeak", false);
|
||||
needsAir = doc.Root.GetAttributeBool("needsair", false);
|
||||
Noise = doc.Root.GetAttributeFloat("noise", 100f);
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace Barotrauma
|
||||
{
|
||||
ID = idCounter;
|
||||
idCounter++;
|
||||
Name = element.GetAttributeString("name", "unnamed");
|
||||
Name = element.GetAttributeString("name", "");
|
||||
string genderStr = element.GetAttributeString("gender", "male").ToLowerInvariant();
|
||||
File = element.GetAttributeString("file", "");
|
||||
SourceElement = GetConfig(File).Root;
|
||||
@@ -423,6 +423,29 @@ namespace Barotrauma
|
||||
element.GetAttributeInt("beardindex", -1),
|
||||
element.GetAttributeInt("moustacheindex", -1),
|
||||
element.GetAttributeInt("faceattachmentindex", -1));
|
||||
|
||||
if (string.IsNullOrEmpty(Name))
|
||||
{
|
||||
if (SourceElement.Element("name") != null)
|
||||
{
|
||||
string firstNamePath = SourceElement.Element("name").GetAttributeString("firstname", "");
|
||||
if (firstNamePath != "")
|
||||
{
|
||||
firstNamePath = firstNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male");
|
||||
Name = ToolBox.GetRandomLine(firstNamePath);
|
||||
}
|
||||
|
||||
string lastNamePath = SourceElement.Element("name").GetAttributeString("lastname", "");
|
||||
if (lastNamePath != "")
|
||||
{
|
||||
lastNamePath = lastNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male");
|
||||
if (Name != "") Name += " ";
|
||||
Name += ToolBox.GetRandomLine(lastNamePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StartItemsGiven = element.GetAttributeBool("startitemsgiven", false);
|
||||
string personalityName = element.GetAttributeString("personality", "");
|
||||
ragdollFileName = element.GetAttributeString("ragdoll", string.Empty);
|
||||
|
||||
@@ -801,10 +801,7 @@ namespace Barotrauma.Items.Components
|
||||
string msg = TextManager.Get(Msg, true);
|
||||
if (msg != null)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||
}
|
||||
msg = TextManager.ParseInputTypes(msg);
|
||||
DisplayMsg = msg;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private ItemContainer inputContainer, outputContainer;
|
||||
|
||||
public ItemContainer InputContainer
|
||||
{
|
||||
get { return inputContainer; }
|
||||
}
|
||||
|
||||
public ItemContainer OutputContainer
|
||||
{
|
||||
get { return outputContainer; }
|
||||
|
||||
@@ -23,6 +23,16 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private ItemContainer inputContainer, outputContainer;
|
||||
|
||||
public ItemContainer InputContainer
|
||||
{
|
||||
get { return inputContainer; }
|
||||
}
|
||||
|
||||
public ItemContainer OutputContainer
|
||||
{
|
||||
get { return outputContainer; }
|
||||
}
|
||||
|
||||
private float progressState;
|
||||
|
||||
public Fabricator(Item item, XElement element)
|
||||
@@ -98,7 +108,23 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
return (picker != null);
|
||||
}
|
||||
|
||||
|
||||
public void RemoveFabricationRecipes(List<string> allowedIdentifiers)
|
||||
{
|
||||
for (int i = 0; i < fabricationRecipes.Count; i++)
|
||||
{
|
||||
if (!allowedIdentifiers.Contains(fabricationRecipes[i].TargetItem.Identifier))
|
||||
{
|
||||
fabricationRecipes.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
CreateRecipes();
|
||||
}
|
||||
|
||||
partial void CreateRecipes();
|
||||
|
||||
private void StartFabricating(FabricationRecipe selectedItem, Character user)
|
||||
{
|
||||
if (selectedItem == null) return;
|
||||
|
||||
@@ -206,6 +206,16 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsFull()
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (Items[i] == null) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected bool TrySwapping(int index, Item item, Character user, bool createNetworkEvent)
|
||||
{
|
||||
if (item?.ParentInventory == null || Items[index] == null) return false;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class DummyFireSource : FireSource
|
||||
{
|
||||
private Vector2 maxSize;
|
||||
|
||||
public bool Removed
|
||||
{
|
||||
get { return removed; }
|
||||
}
|
||||
|
||||
public DummyFireSource(Vector2 maxSize, Vector2 worldPosition, Hull spawningHull = null, bool isNetworkMessage = false) : base(worldPosition, spawningHull, isNetworkMessage)
|
||||
{
|
||||
this.maxSize = maxSize;
|
||||
}
|
||||
|
||||
public override float DamageRange
|
||||
{
|
||||
get { return 5f; }
|
||||
}
|
||||
|
||||
protected override void LimitSize()
|
||||
{
|
||||
if (hull == null) return;
|
||||
|
||||
position.X = Math.Max(hull.Rect.X, position.X);
|
||||
position.Y = Math.Min(hull.Rect.Y, position.Y);
|
||||
|
||||
size.X = Math.Min(maxSize.X, size.X);
|
||||
size.Y = Math.Min(maxSize.Y, size.Y);
|
||||
}
|
||||
|
||||
protected override void AdjustXPos(float growModifier, float deltaTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void ReduceOxygen(float deltaTime)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace Barotrauma
|
||||
flames = true;
|
||||
underwaterBubble = true;
|
||||
}
|
||||
|
||||
|
||||
public Explosion(XElement element, string parentDebugName)
|
||||
{
|
||||
attack = new Attack(element, parentDebugName + ", Explosion");
|
||||
@@ -62,6 +62,16 @@ namespace Barotrauma
|
||||
CameraShake = element.GetAttributeFloat("camerashake", attack.Range * 0.1f);
|
||||
}
|
||||
|
||||
public void DisableParticles()
|
||||
{
|
||||
sparks = false;
|
||||
shockwave = false;
|
||||
smoke = false;
|
||||
flash = false;
|
||||
flames = false;
|
||||
underwaterBubble = false;
|
||||
}
|
||||
|
||||
public List<Triplet<Explosion, Vector2, float>> GetRecentExplosions(float maxSecondsAgo)
|
||||
{
|
||||
return prevExplosions.FindAll(e => e.Third >= Timing.TotalTime - maxSecondsAgo);
|
||||
|
||||
@@ -14,15 +14,15 @@ namespace Barotrauma
|
||||
{
|
||||
const float OxygenConsumption = 50.0f;
|
||||
const float GrowSpeed = 5.0f;
|
||||
|
||||
private Hull hull;
|
||||
|
||||
private Vector2 position;
|
||||
private Vector2 size;
|
||||
protected Hull hull;
|
||||
|
||||
protected Vector2 position;
|
||||
protected Vector2 size;
|
||||
|
||||
private Entity Submarine;
|
||||
|
||||
private bool removed;
|
||||
protected bool removed;
|
||||
|
||||
#if CLIENT
|
||||
private List<Decal> burnDecals = new List<Decal>();
|
||||
@@ -59,7 +59,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public float DamageRange
|
||||
public virtual float DamageRange
|
||||
{
|
||||
get { return (float)Math.Sqrt(size.X) * 20.0f; }
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
||||
size = new Vector2(10.0f, 10.0f);
|
||||
}
|
||||
|
||||
private void LimitSize()
|
||||
protected virtual void LimitSize()
|
||||
{
|
||||
if (hull == null) return;
|
||||
|
||||
@@ -160,9 +160,9 @@ namespace Barotrauma
|
||||
if (removed) { return; }
|
||||
}
|
||||
|
||||
hull.Oxygen -= size.X * deltaTime * OxygenConsumption;
|
||||
ReduceOxygen(deltaTime);
|
||||
|
||||
position.X -= GrowSpeed * growModifier * 0.5f * deltaTime;
|
||||
AdjustXPos(growModifier, deltaTime);
|
||||
|
||||
size.X += GrowSpeed * growModifier * deltaTime;
|
||||
size.Y = MathHelper.Clamp(size.Y + GrowSpeed * growModifier * deltaTime, 10.0f, 50.0f);
|
||||
@@ -182,6 +182,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ReduceOxygen(float deltaTime)
|
||||
{
|
||||
hull.Oxygen -= size.X * deltaTime * OxygenConsumption;
|
||||
}
|
||||
|
||||
protected virtual void AdjustXPos(float growModifier, float deltaTime)
|
||||
{
|
||||
position.X -= GrowSpeed * growModifier * 0.5f * deltaTime;
|
||||
}
|
||||
|
||||
partial void UpdateProjSpecific(float growModifier);
|
||||
|
||||
private void OnChangeHull(Vector2 pos, Hull particleHull)
|
||||
|
||||
@@ -138,6 +138,9 @@ namespace Barotrauma
|
||||
public Submarine StartOutpost { get; private set; }
|
||||
public Submarine EndOutpost { get; private set; }
|
||||
|
||||
private Submarine preSelectedStartOutpost;
|
||||
private Submarine preSelectedEndOutpost;
|
||||
|
||||
public string Seed
|
||||
{
|
||||
get { return seed; }
|
||||
@@ -209,7 +212,7 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
/// <param name="difficulty">A scalar between 0-100</param>
|
||||
/// <param name="sizeFactor">A scalar between 0-1 (0 = the minimum width defined in the generation params is used, 1 = the max width is used)</param>
|
||||
public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome)
|
||||
public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome, Submarine startOutpost = null, Submarine endOutPost = null)
|
||||
: base(null)
|
||||
{
|
||||
|
||||
@@ -225,6 +228,9 @@ namespace Barotrauma
|
||||
(width / GridCellSize) * GridCellSize,
|
||||
(generationParams.Height / GridCellSize) * GridCellSize);
|
||||
|
||||
preSelectedStartOutpost = startOutpost;
|
||||
preSelectedEndOutpost = endOutPost;
|
||||
|
||||
//remove from entity dictionary
|
||||
base.Remove();
|
||||
}
|
||||
@@ -1510,14 +1516,24 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
|
||||
//only create a starting outpost in campaign mode
|
||||
if (GameMain.GameSession?.GameMode as CampaignMode == null && ((i == 0) == !Mirrored))
|
||||
//only create a starting outpost in campaign and tutorial modes
|
||||
if (!IsModeStartOutpostCompatible() && ((i == 0) == !Mirrored))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server);
|
||||
var outpost = new Submarine(outpostFile, tryLoad: false);
|
||||
|
||||
Submarine outpost = null;
|
||||
|
||||
if (i == 0 && preSelectedStartOutpost == null || i == 1 && preSelectedEndOutpost == null)
|
||||
{
|
||||
string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server);
|
||||
outpost = new Submarine(outpostFile, tryLoad: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
outpost = (i == 0) ? preSelectedStartOutpost : preSelectedEndOutpost;
|
||||
}
|
||||
|
||||
outpost.Load(unloadPrevious: false);
|
||||
outpost.MakeOutpost();
|
||||
|
||||
@@ -1569,6 +1585,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsModeStartOutpostCompatible()
|
||||
{
|
||||
#if CLIENT
|
||||
return GameMain.GameSession?.GameMode as CampaignMode != null || GameMain.GameSession?.GameMode as TutorialMode != null;
|
||||
#else
|
||||
return GameMain.GameSession?.GameMode as CampaignMode != null;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
base.Remove();
|
||||
|
||||
@@ -30,13 +30,15 @@ namespace Barotrauma
|
||||
|
||||
//the position and dimensions of the entity
|
||||
protected Rectangle rect;
|
||||
|
||||
|
||||
public bool ExternalHighlight = false;
|
||||
|
||||
//is the mouse inside the rect
|
||||
protected bool isHighlighted;
|
||||
private bool isHighlighted;
|
||||
|
||||
public bool IsHighlighted
|
||||
{
|
||||
get { return isHighlighted; }
|
||||
get { return isHighlighted || ExternalHighlight; }
|
||||
set { isHighlighted = value; }
|
||||
}
|
||||
|
||||
|
||||
@@ -431,6 +431,12 @@ namespace Barotrauma
|
||||
else if (ic is Pickable pickable)
|
||||
{
|
||||
//prevent picking up (or deattaching) items
|
||||
#if CLIENT
|
||||
if (GameMain.GameSession.GameMode is TutorialMode)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
pickable.CanBePicked = false;
|
||||
pickable.CanBeSelected = false;
|
||||
}
|
||||
@@ -1426,7 +1432,7 @@ namespace Barotrauma
|
||||
doc.Root.Add(new XAttribute("md5hash", hash.Hash));
|
||||
if (previewImage != null)
|
||||
{
|
||||
doc.Root.Add(new XAttribute("previewimage", Convert.ToBase64String(previewImage.ToArray())));
|
||||
//doc.Root.Add(new XAttribute("previewimage", Convert.ToBase64String(previewImage.ToArray())));
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Barotrauma
|
||||
{
|
||||
for (int dir = -1; dir <= 1; dir += 2)
|
||||
{
|
||||
WayPoint closest = stairPoints[i].FindClosest(dir, true, new Vector2(-30.0f,30f));
|
||||
WayPoint closest = stairPoints[i].FindClosest(dir, true, new Vector2(-30.0f, 30f));
|
||||
if (closest == null) continue;
|
||||
stairPoints[i].ConnectTo(closest);
|
||||
}
|
||||
@@ -412,7 +412,7 @@ namespace Barotrauma
|
||||
|
||||
WayPoint closest = wayPoint.FindClosest(
|
||||
dir, true, new Vector2(-tolerance, tolerance),
|
||||
gap.ConnectedDoor == null ? null : gap.ConnectedDoor.Body.FarseerBody);
|
||||
gap.ConnectedDoor?.Body.FarseerBody);
|
||||
|
||||
if (closest != null)
|
||||
{
|
||||
@@ -423,13 +423,26 @@ namespace Barotrauma
|
||||
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
if (gap.IsHorizontal || gap.IsRoomToRoom) continue;
|
||||
if (gap.IsHorizontal || gap.IsRoomToRoom || !gap.linkedTo.Any(l => l is Hull)) { continue; }
|
||||
|
||||
//too small to walk through
|
||||
if (gap.Rect.Width < 100.0f) continue;
|
||||
if (gap.Rect.Width < 100.0f) { continue; }
|
||||
|
||||
var wayPoint = new WayPoint(
|
||||
new Vector2(gap.Rect.Center.X, gap.Rect.Y - gap.Rect.Height / 2), SpawnType.Path, submarine, gap);
|
||||
|
||||
float tolerance = outSideWaypointInterval / 2.0f;
|
||||
Hull connectedHull = (Hull)gap.linkedTo.First(l => l is Hull);
|
||||
int dir = Math.Sign(connectedHull.Position.Y - gap.Position.Y);
|
||||
|
||||
WayPoint closest = wayPoint.FindClosest(
|
||||
dir, false, new Vector2(-tolerance, tolerance),
|
||||
gap.ConnectedDoor?.Body.FarseerBody);
|
||||
|
||||
if (closest != null)
|
||||
{
|
||||
wayPoint.ConnectTo(closest);
|
||||
}
|
||||
}
|
||||
|
||||
var orphans = WayPointList.FindAll(w => w.spawnType == SpawnType.Path && !w.linkedTo.Any());
|
||||
|
||||
@@ -46,7 +46,15 @@ namespace Barotrauma
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
doc = XDocument.Load(filePath, LoadOptions.SetBaseUri);
|
||||
try
|
||||
{
|
||||
doc = XDocument.Load(filePath, LoadOptions.SetBaseUri);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (doc.Root == null) return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static string ParseInputTypes(string text)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
text = text.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||
text = text.Replace("[InputType." + inputType.ToString() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string GetFormatted(string textTag, bool returnNull = false, params object[] args)
|
||||
{
|
||||
string text = Get(textTag, returnNull);
|
||||
|
||||
Reference in New Issue
Block a user