Unstable 0.1300.0.9

This commit is contained in:
Markus Isberg
2021-04-13 16:58:13 +03:00
parent 86597456ca
commit f48dfb5862
30 changed files with 245 additions and 57 deletions
@@ -141,7 +141,8 @@ namespace Barotrauma
{
DialogueIdentifier = "dialogcannotreachtarget",
TargetName = container.Item.Name,
abortCondition = obj => !ItemToContain.IsOwnedBy(character)
abortCondition = obj => !ItemToContain.IsOwnedBy(character),
SpeakIfFails = !objectiveManager.IsCurrentOrder<AIObjectiveCleanupItems>()
},
onAbandon: () => Abandon = true,
onCompleted: () => RemoveSubObjective(ref goToObjective));
@@ -87,6 +87,7 @@ namespace Barotrauma
},
onAbandon: () =>
{
getOxygen = null;
int remainingTanks = ReportOxygenTankCount();
// Try to seek any oxygen sources.
TryAddSubObjective(ref getOxygen, () =>
@@ -354,6 +354,7 @@ namespace Barotrauma
#if DEBUG
DebugConsole.NewMessage($"{character.Name}: Cannot find an item with the following identifier(s) or tag(s): {string.Join(", ", identifiersOrTags)}", Color.Yellow);
#endif
SpeakCannotFind();
Abandon = true;
}
}
@@ -415,6 +416,24 @@ namespace Barotrauma
#if DEBUG
DebugConsole.NewMessage($"{character.Name}: Get item failed to reach {moveToTarget}", Color.Yellow);
#endif
}
private void SpeakCannotFind()
{
// TODO: Use the item name as the variable here.
if (character.IsOnPlayerTeam && objectiveManager.CurrentOrder == objectiveManager.CurrentObjective)
{
string msg = TextManager.Get("dialogcannotreachtarget", true);
if (msg != null)
{
character.Speak(msg, identifier: "dialogcannotfinditem", minDurationBetweenSimilar: 20.0f);
}
}
}
// TODO: remove?
private void SpeakCannotReach()
{
if (character.IsOnPlayerTeam && objectiveManager.CurrentOrder == objectiveManager.CurrentObjective)
{
string TargetName = (moveToTarget as MapEntity)?.Name ?? (moveToTarget as Character)?.Name ?? moveToTarget.ToString();
@@ -166,7 +166,11 @@ namespace Barotrauma
coroutine = CoroutineManager.InvokeAfter(() =>
{
//round ended before the coroutine finished
#if CLIENT
if (GameMain.GameSession == null || Level.Loaded == null && !(GameMain.GameSession.GameMode is TestGameMode)) { return; }
#else
if (GameMain.GameSession == null || Level.Loaded == null) { return; }
#endif
DelayedObjectives.Remove(objective);
AddObjective(objective);
callback?.Invoke();
@@ -612,10 +612,11 @@ namespace Barotrauma
set
{
#if CLIENT
HintManager.OnSetSelectedConstruction(this, _selectedConstruction, value);
var prevSelectedConstruction = _selectedConstruction;
#endif
_selectedConstruction = value;
#if CLIENT
HintManager.OnSetSelectedConstruction(this, prevSelectedConstruction, _selectedConstruction);
if (Controlled == this)
{
if (_selectedConstruction == null)
@@ -3815,6 +3816,10 @@ namespace Barotrauma
}
}
}
else
{
canBePutInOriginalInventory = inventory.CanBePut(newItem, slotIndices[0]);
}
if (canBePutInOriginalInventory)
{
@@ -898,11 +898,11 @@ namespace Barotrauma
case HitDetection.Distance:
if (dist < attack.DamageRange)
{
structureBody = Submarine.PickBody(simPos, attackSimPos, collisionCategory: Physics.CollisionWall | Physics.CollisionLevel, allowInsideFixture: true);
if (structureBody?.UserData as string == "ruinroom")
structureBody = Submarine.PickBody(simPos, attackSimPos, collisionCategory: Physics.CollisionWall | Physics.CollisionLevel, allowInsideFixture: true, customPredicate:
(Fixture f) =>
{
structureBody = null;
}
return f?.Body?.UserData as string != "ruinroom";
});
if (damageTarget is Item i && i.GetComponent<Items.Components.Door>() != null)
{
// If the attack is aimed to an item and hits an item, it's successful.