v1.7.7.0 (Winter Update 2024)

This commit is contained in:
Regalis11
2024-12-11 13:26:13 +02:00
parent 7d5b7a310a
commit f6349b2175
256 changed files with 4794 additions and 1653 deletions
@@ -0,0 +1,84 @@
namespace Barotrauma
{
/// <summary>
/// Modifies the win score of a team in the PvP mode.
/// </summary>
class AddScoreAction : EventAction
{
[Serialize("", IsPropertySaveable.Yes, description: "Tag of a target (character) whose team the score should be given to.")]
public Identifier TargetTag { get; set; }
[Serialize(CharacterTeamType.None, IsPropertySaveable.Yes, description: $"Which team's score to add to? Ignored if {nameof(TargetTag)} is set.")]
public CharacterTeamType Team { get; set; }
[Serialize(1, IsPropertySaveable.Yes, description: "How much to add to the score? Can also be negative.")]
public int Amount { get; set; }
public AddScoreAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
{
if (Amount == 0)
{
DebugConsole.ThrowError($"Error in {nameof(AddScoreAction)}, event {parentEvent.Prefab.Identifier}: score set to 0, the action will do nothing.", contentPackage: element.ContentPackage);
}
if (TargetTag.IsEmpty && Team == CharacterTeamType.None)
{
DebugConsole.ThrowError($"Error in {nameof(AddScoreAction)}, event {parentEvent.Prefab.Identifier}: neither {nameof(Team)} or {nameof(TargetTag)} is set.", contentPackage: element.ContentPackage);
}
}
private bool isFinished = false;
public override bool IsFinished(ref string goTo)
{
return isFinished;
}
public override void Reset()
{
isFinished = false;
}
public override void Update(float deltaTime)
{
if (isFinished) { return; }
CharacterTeamType targetTeam = CharacterTeamType.None;
if (TargetTag.IsEmpty)
{
targetTeam = Team;
}
else
{
foreach (var target in ParentEvent.GetTargets(TargetTag))
{
if (target is Character character)
{
targetTeam = character.TeamID;
break;
}
}
}
if (targetTeam == CharacterTeamType.None) { return; }
#if SERVER
if (GameMain.GameSession?.Missions is { } missions)
{
foreach (var mission in missions)
{
if (mission is CombatMission combatMission)
{
combatMission.AddToScore(targetTeam, Amount);
}
}
}
#endif
isFinished = true;
}
public override string ToDebugString()
{
string target = TargetTag.IsEmpty ? $"team: {Team.ColorizeObject()}" : $"target: {TargetTag}";
return $"{ToolBox.GetDebugSymbol(isFinished)} {nameof(AddScoreAction)} -> ({target}, amount: {Amount.ColorizeObject()})";
}
}
}
@@ -50,7 +50,7 @@ namespace Barotrauma
{
if (!AllowSameEntity && entity == target) { continue; }
if (Vector2.DistanceSquared(target.WorldPosition, entity.WorldPosition) > MaxDistance * MaxDistance) { continue; }
if (Character.IsTargetVisible(target, entity, seeThroughWindows: true, CheckFacing))
if (ISpatialEntity.IsTargetVisible(target, entity, seeThroughWindows: true, CheckFacing))
{
if (!ApplyTagToEntity.IsEmpty)
{
@@ -240,7 +240,7 @@ namespace Barotrauma
{
humanAI.ClearForcedOrder();
if (prevIdleObjective != null) { humanAI.ObjectiveManager.AddObjective(prevIdleObjective); }
if (prevGotoObjective != null) { humanAI.ObjectiveManager.AddObjective(prevGotoObjective); }
if (prevGotoObjective != null && !prevGotoObjective.Abandon) { humanAI.ObjectiveManager.AddObjective(prevGotoObjective); }
humanAI.ObjectiveManager.SortObjectives();
}
}
@@ -402,7 +402,7 @@ namespace Barotrauma
if (!targets.Any() || IsBlockedByAnotherConversation(targets, BlockOtherConversationsDuration)) { return; }
}
if (targetCharacter != null && IsBlockedByAnotherConversation(targetCharacter.ToEnumerable(), 0.1f)) { return; }
if (IsBlockedByAnotherConversation(targetCharacter?.ToEnumerable(), BlockOtherConversationsDuration)) { return; }
if (speaker?.AIController is HumanAIController humanAI)
{
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using Barotrauma.Extensions;
using Barotrauma.Items.Components;
@@ -12,6 +12,11 @@ namespace Barotrauma
/// </summary>
class WaitForItemUsedAction : EventAction
{
/// <summary>
/// Counter used to ensure we have a unique identifier to use for the ItemComponent.OnUsed event
/// </summary>
private static int IdCounter;
[Serialize("", IsPropertySaveable.Yes, description: "Tag of the item that must be used. Note that the item needs to have been tagged by the event - this does not refer to the tags that can be set per-item in the sub editor.")]
public Identifier ItemTag { get; set; }
@@ -50,7 +55,8 @@ namespace Barotrauma
{
if (onUseEventIdentifier.IsEmpty)
{
onUseEventIdentifier = (ParentEvent.Prefab.Identifier + ParentEvent.Actions.IndexOf(this).ToString()).ToIdentifier();
onUseEventIdentifier = (ParentEvent.Prefab.Identifier + ParentEvent.Actions.IndexOf(this).ToString() + IdCounter).ToIdentifier();
IdCounter++;
}
return onUseEventIdentifier;
}