Unstable 0.15.15.0 (and the one before it I forgor)

This commit is contained in:
Markus Isberg
2021-11-18 21:34:30 +09:00
parent 10e5fd5f3e
commit 80f39cd2a3
257 changed files with 4916 additions and 2582 deletions
@@ -68,6 +68,9 @@ namespace Barotrauma.Items.Components
private const float TinkeringDamageIncrease = 0.2f;
private const float TinkeringReloadDecrease = 0.2f;
public Character ActiveUser;
private float resetActiveUserTimer;
public float Rotation
{
get { return rotation; }
@@ -362,7 +365,7 @@ namespace Barotrauma.Items.Components
UpdateTransformedBarrelPos();
}
if (user != null && user.Removed)
if (user is { Removed: true })
{
user = null;
}
@@ -371,6 +374,19 @@ namespace Barotrauma.Items.Components
resetUserTimer -= deltaTime;
if (resetUserTimer <= 0.0f) { user = null; }
}
if (ActiveUser is { Removed: true })
{
ActiveUser = null;
}
else
{
resetActiveUserTimer -= deltaTime;
if (resetActiveUserTimer <= 0.0f)
{
ActiveUser = null;
}
}
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
@@ -744,8 +760,10 @@ namespace Barotrauma.Items.Components
if (projectileComponent != null)
{
projectileComponent.Attacker = projectileComponent.User = user;
projectileComponent.Attack.DamageMultiplier = 1f + (TinkeringDamageIncrease * tinkeringStrength);
if (projectileComponent.Attack != null)
{
projectileComponent.Attack.DamageMultiplier = 1f + (TinkeringDamageIncrease * tinkeringStrength);
}
projectileComponent.Use();
projectile.GetComponent<Rope>()?.Attach(item, projectile);
projectileComponent.User = user;
@@ -956,10 +974,11 @@ namespace Barotrauma.Items.Components
public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective)
{
if (character.AIController.SelectedAiTarget?.Entity is Character previousTarget &&
previousTarget.IsDead)
if (character.AIController.SelectedAiTarget?.Entity is Character previousTarget && previousTarget.IsDead)
{
character.Speak(TextManager.Get("DialogTurretTargetDead"), identifier: "killedtarget" + previousTarget.ID, minDurationBetweenSimilar: 10.0f);
character.Speak(TextManager.Get("DialogTurretTargetDead"),
identifier: "killedtarget" + previousTarget.ID,
minDurationBetweenSimilar: 10.0f);
character.AIController.SelectTarget(null);
}
@@ -986,7 +1005,9 @@ namespace Barotrauma.Items.Components
}
else
{
character.Speak(TextManager.Get("DialogSupercapacitorIsBroken"), identifier: "supercapacitorisbroken", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.Get("DialogSupercapacitorIsBroken"),
identifier: "supercapacitorisbroken",
minDurationBetweenSimilar: 30.0f);
canShoot = false;
}
}
@@ -999,7 +1020,9 @@ namespace Barotrauma.Items.Components
}
if (lowestCharge <= 0 && batteryToLoad.Item.ConditionPercentage > 0)
{
character.Speak(TextManager.Get("DialogTurretHasNoPower"), identifier: "turrethasnopower", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.Get("DialogTurretHasNoPower"),
identifier: "turrethasnopower",
minDurationBetweenSimilar: 30.0f);
canShoot = false;
}
}
@@ -1039,7 +1062,9 @@ namespace Barotrauma.Items.Components
{
if (character.IsOnPlayerTeam)
{
character.Speak(TextManager.GetWithVariable("DialogCannotLoadTurret", "[itemname]", item.Name, formatCapitals: true), identifier: "cannotloadturret", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.GetWithVariable("DialogCannotLoadTurret", "[itemname]", item.Name, formatCapitals: true),
identifier: "cannotloadturret",
minDurationBetweenSimilar: 30.0f);
}
return true;
}
@@ -1049,7 +1074,9 @@ namespace Barotrauma.Items.Components
loadItemsObjective.ignoredContainerIdentifiers = new string[] { containerItem.prefab.Identifier };
if (character.IsOnPlayerTeam)
{
character.Speak(TextManager.GetWithVariable("DialogLoadTurret", "[itemname]", item.Name, formatCapitals: true), identifier: "loadturret", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.GetWithVariable("DialogLoadTurret", "[itemname]", item.Name, formatCapitals: true),
identifier: "loadturret",
minDurationBetweenSimilar: 30.0f);
}
loadItemsObjective.Abandoned += CheckRemainingAmmo;
loadItemsObjective.Completed += CheckRemainingAmmo;
@@ -1063,11 +1090,15 @@ namespace Barotrauma.Items.Components
int remainingAmmo = Submarine.MainSub.GetItems(false).Count(i => i.HasTag(ammoType) && i.Condition > 1);
if (remainingAmmo == 0)
{
character.Speak(TextManager.Get($"DialogOutOf{ammoType}", fallBackTag: "DialogOutOfTurretAmmo"), identifier: "outofammo", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.Get($"DialogOutOf{ammoType}", fallBackTag: "DialogOutOfTurretAmmo"),
identifier: "outofammo",
minDurationBetweenSimilar: 30.0f);
}
else if (remainingAmmo < 3)
{
character.Speak(TextManager.Get($"DialogLowOn{ammoType}"), identifier: "outofammo", minDurationBetweenSimilar: 30.0f);
character.Speak(TextManager.Get($"DialogLowOn{ammoType}"),
identifier: "outofammo",
minDurationBetweenSimilar: 30.0f);
}
}
}
@@ -1090,7 +1121,8 @@ namespace Barotrauma.Items.Components
float closestDistance = maxDistance * maxDistance;
if (currentTarget != null)
bool hadCurrentTarget = currentTarget != null;
if (hadCurrentTarget)
{
if (currentTarget.Removed || currentTarget.IsDead)
{
@@ -1222,24 +1254,32 @@ namespace Barotrauma.Items.Components
{
if (character.IsOnPlayerTeam)
{
if (character.AIController.SelectedAiTarget == null)
if (character.AIController.SelectedAiTarget == null && !hadCurrentTarget)
{
if (GameMain.Config.RecentlyEncounteredCreatures.Contains(closestEnemy.SpeciesName))
{
character.Speak(TextManager.Get("DialogNewTargetSpotted"), null, 0.0f, "newtargetspotted", 30.0f);
character.Speak(TextManager.Get("DialogNewTargetSpotted"),
identifier: "newtargetspotted",
minDurationBetweenSimilar: 30.0f);
}
else if (GameMain.Config.EncounteredCreatures.Any(name => name.Equals(closestEnemy.SpeciesName, StringComparison.OrdinalIgnoreCase)))
{
character.Speak(TextManager.GetWithVariable("DialogIdentifiedTargetSpotted", "[speciesname]", closestEnemy.DisplayName), null, 0.0f, "identifiedtargetspotted", 30.0f);
character.Speak(TextManager.GetWithVariable("DialogIdentifiedTargetSpotted", "[speciesname]", closestEnemy.DisplayName),
identifier: "identifiedtargetspotted",
minDurationBetweenSimilar: 30.0f);
}
else
{
character.Speak(TextManager.Get("DialogUnidentifiedTargetSpotted"), null, 0.0f, "unidentifiedtargetspotted", 5.0f);
character.Speak(TextManager.Get("DialogUnidentifiedTargetSpotted"),
identifier: "unidentifiedtargetspotted",
minDurationBetweenSimilar: 5.0f);
}
}
else if (GameMain.Config.EncounteredCreatures.None(name => name.Equals(closestEnemy.SpeciesName, StringComparison.OrdinalIgnoreCase)))
{
character.Speak(TextManager.Get("DialogUnidentifiedTargetSpotted"), null, 0.0f, "unidentifiedtargetspotted", 5.0f);
character.Speak(TextManager.Get("DialogUnidentifiedTargetSpotted"),
identifier: "unidentifiedtargetspotted",
minDurationBetweenSimilar: 5.0f);
}
character.AddEncounter(closestEnemy);
}
@@ -1247,7 +1287,9 @@ namespace Barotrauma.Items.Components
}
else if (closestEnemy == null && character.IsOnPlayerTeam)
{
character.Speak(TextManager.Get("DialogIceSpireSpotted"), null, 0.0f, "icespirespotted", 60.0f);
character.Speak(TextManager.Get("DialogIceSpireSpotted"),
identifier: "icespirespotted",
minDurationBetweenSimilar: 60.0f);
}
character.CursorPosition = targetPos.Value;
@@ -1289,7 +1331,9 @@ namespace Barotrauma.Items.Components
if (!shoot) { return false; }
if (character.IsOnPlayerTeam)
{
character.Speak(TextManager.Get("DialogFireTurret"), null, 0.0f, "fireturret", 10.0f);
character.Speak(TextManager.Get("DialogFireTurret"),
identifier: "fireturret",
minDurationBetweenSimilar: 30.0f);
}
character.SetInput(InputType.Shoot, true, true);
}
@@ -1389,6 +1433,7 @@ namespace Barotrauma.Items.Components
crosshairSprite?.Remove(); crosshairSprite = null;
crosshairPointerSprite?.Remove(); crosshairPointerSprite = null;
moveSoundChannel?.Dispose(); moveSoundChannel = null;
WeaponIndicatorSprite?.Remove(); WeaponIndicatorSprite = null;
#endif
}
@@ -1503,12 +1548,16 @@ namespace Barotrauma.Items.Components
IsActive = true;
}
user = sender;
ActiveUser = sender;
resetActiveUserTimer = 1f;
resetUserTimer = 10.0f;
break;
case "trigger_in":
if (signal.value == "0") { return; }
item.Use((float)Timing.Step, sender);
user = sender;
ActiveUser = sender;
resetActiveUserTimer = 1f;
resetUserTimer = 10.0f;
//triggering the Use method through item.Use will fail if the item is not characterusable and the signal was sent by a character
//so lets do it manually
@@ -1521,12 +1570,18 @@ namespace Barotrauma.Items.Components
if (lightComponent != null && signal.value != "0")
{
lightComponent.IsOn = !lightComponent.IsOn;
UpdateLightComponent();
}
break;
case "set_light":
if (lightComponent != null)
{
lightComponent.IsOn = signal.value != "0";
bool shouldBeOn = signal.value != "0";
if (shouldBeOn != lightComponent.IsOn)
{
lightComponent.IsOn = shouldBeOn;
UpdateLightComponent();
}
}
break;
}