(7df498c13) Fixed: Doors being weldable in the tutorial with no access to crowbar or info on how to open shut doors, thus causing the player to get stuck

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:40:45 +03:00
parent 39a9e1cc72
commit 8e65bd62b9
4 changed files with 19 additions and 2 deletions
@@ -126,6 +126,20 @@ namespace Barotrauma.Tutorials
idCard.AddTag("com"); idCard.AddTag("com");
idCard.AddTag("eng"); idCard.AddTag("eng");
List<Entity> entities = Entity.GetEntityList();
for (int i = 0; i < entities.Count; i++)
{
if (entities[i] is Item)
{
Door door = (entities[i] as Item).GetComponent<Door>();
if (door != null)
{
door.CanBeWelded = false;
}
}
}
tutorialCoroutine = CoroutineManager.StartCoroutine(UpdateState()); tutorialCoroutine = CoroutineManager.StartCoroutine(UpdateState());
} }
@@ -74,7 +74,7 @@ namespace Barotrauma.Sounds
public override SoundChannel Play() public override SoundChannel Play()
{ {
return Play(0.5f); return Play(1.0f);
} }
public override int FillStreamBuffer(int samplePos, short[] buffer) public override int FillStreamBuffer(int samplePos, short[] buffer)
@@ -59,6 +59,8 @@ namespace Barotrauma.Items.Components
get { return item.GetComponent<Repairable>()?.ShowRepairUIThreshold ?? 0.0f; } get { return item.GetComponent<Repairable>()?.ShowRepairUIThreshold ?? 0.0f; }
} }
public bool CanBeWelded = true;
private float stuck; private float stuck;
[Serialize(0.0f, false)] [Serialize(0.0f, false)]
public float Stuck public float Stuck
@@ -66,7 +68,7 @@ namespace Barotrauma.Items.Components
get { return stuck; } get { return stuck; }
set set
{ {
if (isOpen || isBroken) return; if (isOpen || isBroken || !CanBeWelded) return;
stuck = MathHelper.Clamp(value, 0.0f, 100.0f); stuck = MathHelper.Clamp(value, 0.0f, 100.0f);
if (stuck <= 0.0f) isStuck = false; if (stuck <= 0.0f) isStuck = false;
if (stuck >= 100.0f) isStuck = true; if (stuck >= 100.0f) isStuck = true;
@@ -427,6 +427,7 @@ namespace Barotrauma.Items.Components
{ {
if (target is Door door) if (target is Door door)
{ {
if (!door.CanBeWelded) continue;
for (int i = 0; i < effect.propertyNames.Length; i++) for (int i = 0; i < effect.propertyNames.Length; i++)
{ {
string propertyName = effect.propertyNames[i]; string propertyName = effect.propertyNames[i];