Unstable 0.17.0.0
This commit is contained in:
@@ -8,42 +8,39 @@ namespace Barotrauma
|
||||
{
|
||||
class TriggerAction : EventAction
|
||||
{
|
||||
[Serialize("", true, description: "Tag of the first entity that will be used for trigger checks.")]
|
||||
public string Target1Tag { get; set; }
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Tag of the first entity that will be used for trigger checks.")]
|
||||
public Identifier Target1Tag { get; set; }
|
||||
|
||||
[Serialize("", true, description: "Tag of the second entity that will be used for trigger checks.")]
|
||||
public string Target2Tag { get; set; }
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Tag of the second entity that will be used for trigger checks.")]
|
||||
public Identifier Target2Tag { get; set; }
|
||||
|
||||
[Serialize("", true, description: "If set, the first target has to be within an outpost module of this type.")]
|
||||
public string TargetModuleType { get; set; }
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "If set, the first target has to be within an outpost module of this type.")]
|
||||
public Identifier TargetModuleType { get; set; }
|
||||
|
||||
[Serialize("", true, description: "Tag to apply to the first entity when the trigger check succeeds.")]
|
||||
public string ApplyToTarget1 { get; set; }
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Tag to apply to the first entity when the trigger check succeeds.")]
|
||||
public Identifier ApplyToTarget1 { get; set; }
|
||||
|
||||
[Serialize("", true, description: "Tag to apply to the second entity when the trigger check succeeds.")]
|
||||
public string ApplyToTarget2 { get; set; }
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Tag to apply to the second entity when the trigger check succeeds.")]
|
||||
public Identifier ApplyToTarget2 { get; set; }
|
||||
|
||||
[Serialize(0.0f, true, description: "Range both entities must be within to activate the trigger.")]
|
||||
[Serialize(0.0f, IsPropertySaveable.Yes, description: "Range both entities must be within to activate the trigger.")]
|
||||
public float Radius { get; set; }
|
||||
|
||||
[Serialize(true, true, description: "If true, characters who are being targeted by some enemy cannot trigger the action.")]
|
||||
[Serialize(true, IsPropertySaveable.Yes, description: "If true, characters who are being targeted by some enemy cannot trigger the action.")]
|
||||
public bool DisableInCombat { get; set; }
|
||||
|
||||
[Serialize(true, true, description: "If true, dead/unconscious characters cannot trigger the action.")]
|
||||
[Serialize(true, IsPropertySaveable.Yes, description: "If true, dead/unconscious characters cannot trigger the action.")]
|
||||
public bool DisableIfTargetIncapacitated { get; set; }
|
||||
|
||||
[Serialize(false, true, description: "If true, one target must interact with the other to trigger the action.")]
|
||||
[Serialize(false, IsPropertySaveable.Yes, description: "If true, one target must interact with the other to trigger the action.")]
|
||||
public bool WaitForInteraction { get; set; }
|
||||
|
||||
[Serialize(false, true, description: "If true, the action can be triggered by interacting with any matching target (not just the 1st one).")]
|
||||
[Serialize(false, IsPropertySaveable.Yes, description: "If true, the action can be triggered by interacting with any matching target (not just the 1st one).")]
|
||||
public bool AllowMultipleTargets { get; set; }
|
||||
|
||||
private float distance;
|
||||
|
||||
public TriggerAction(ScriptedEvent parentEvent, XElement element) : base(parentEvent, element)
|
||||
{
|
||||
TargetModuleType = TargetModuleType?.ToLowerInvariant();
|
||||
}
|
||||
|
||||
public TriggerAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
|
||||
|
||||
private bool isFinished = false;
|
||||
public override bool IsFinished(ref string goTo)
|
||||
@@ -74,7 +71,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (DisableInCombat && IsInCombat(e1)) { continue; }
|
||||
if (DisableIfTargetIncapacitated && e1 is Character character1 && (character1.IsDead || character1.IsIncapacitated)) { continue; }
|
||||
if (!string.IsNullOrEmpty(TargetModuleType))
|
||||
if (!TargetModuleType.IsEmpty)
|
||||
{
|
||||
if (IsCloseEnoughToHull(e1, out Hull hull))
|
||||
{
|
||||
@@ -143,7 +140,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
npc.SetCustomInteract(
|
||||
(speaker, player) => { if (e1 == speaker) { Trigger(speaker, player); } else { Trigger(player, speaker); } },
|
||||
TextManager.GetWithVariable("CampaignInteraction.Examine", "[key]", GameMain.Config.KeyBindText(InputType.Use)));
|
||||
TextManager.GetWithVariable("CampaignInteraction.Examine", "[key]", GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Use)));
|
||||
#else
|
||||
npc.SetCustomInteract(
|
||||
(speaker, player) => { if (e1 == speaker) { Trigger(speaker, player); } else { Trigger(player, speaker); } },
|
||||
@@ -226,7 +223,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Hull potentialHull in Hull.hullList)
|
||||
foreach (Hull potentialHull in Hull.HullList)
|
||||
{
|
||||
if (!potentialHull.OutpostModuleTags.Contains(TargetModuleType)) { continue; }
|
||||
|
||||
@@ -270,11 +267,11 @@ namespace Barotrauma
|
||||
private void Trigger(Entity entity1, Entity entity2)
|
||||
{
|
||||
ResetTargetIcons();
|
||||
if (!string.IsNullOrEmpty(ApplyToTarget1))
|
||||
if (!ApplyToTarget1.IsEmpty)
|
||||
{
|
||||
ParentEvent.AddTarget(ApplyToTarget1, entity1);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ApplyToTarget2))
|
||||
if (!ApplyToTarget2.IsEmpty)
|
||||
{
|
||||
ParentEvent.AddTarget(ApplyToTarget2, entity2);
|
||||
}
|
||||
@@ -285,7 +282,7 @@ namespace Barotrauma
|
||||
|
||||
public override string ToDebugString()
|
||||
{
|
||||
if (string.IsNullOrEmpty(TargetModuleType))
|
||||
if (TargetModuleType.IsEmpty)
|
||||
{
|
||||
return
|
||||
$"{ToolBox.GetDebugSymbol(isFinished, isRunning)} {nameof(TriggerAction)} -> (" +
|
||||
|
||||
Reference in New Issue
Block a user