public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) { if (objective.Override) { if (user != character && user != null && user.SelectedConstruction == item) { character.Speak(TextManager.Get("DialogSteeringTaken"), null, 0.0f, "steeringtaken", 10.0f); } } user = character; if (!AutoPilot) { unsentChanges = true; AutoPilot = true; } switch (objective.Option.ToLowerInvariant()) { case "maintainposition": if (objective.Override) { if (!MaintainPos) { unsentChanges = true; MaintainPos = true; } if (!posToMaintain.HasValue) { unsentChanges = true; posToMaintain = controlledSub != null ? controlledSub.WorldPosition : item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; } } break; case "navigateback": if (objective.Override) { if (MaintainPos || LevelEndSelected || !LevelStartSelected) { unsentChanges = true; } SetDestinationLevelStart(); } break; case "navigatetodestination": if (objective.Override) { if (MaintainPos || !LevelEndSelected || LevelStartSelected) { unsentChanges = true; } SetDestinationLevelEnd(); } break; } sonar?.AIOperate(deltaTime, character, objective); return(false); }
public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) { if (objective.Override) { if (user != character && user != null && user.SelectedConstruction == item && character.IsOnPlayerTeam) { character.Speak(TextManager.Get("DialogSteeringTaken"), null, 0.0f, "steeringtaken", 10.0f); } } user = character; if (!AutoPilot) { unsentChanges = true; AutoPilot = true; } IncreaseSkillLevel(user, deltaTime); switch (objective.Option.ToLowerInvariant()) { case "maintainposition": if (objective.Override) { if (!MaintainPos) { unsentChanges = true; MaintainPos = true; } if (!posToMaintain.HasValue) { unsentChanges = true; posToMaintain = controlledSub != null ? controlledSub.WorldPosition : item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; } } break; case "navigateback": if (Level.IsLoadedOutpost) { break; } if (DockingSources.Any(d => d.Docked)) { item.SendSignal("1", "toggle_docking"); } if (objective.Override) { if (MaintainPos || LevelEndSelected || !LevelStartSelected) { unsentChanges = true; } SetDestinationLevelStart(); } break; case "navigatetodestination": if (Level.IsLoadedOutpost) { break; } if (DockingSources.Any(d => d.Docked)) { item.SendSignal("1", "toggle_docking"); } if (objective.Override) { if (MaintainPos || !LevelEndSelected || LevelStartSelected) { unsentChanges = true; } SetDestinationLevelEnd(); } break; } sonar?.AIOperate(deltaTime, character, objective); if (!MaintainPos && showIceSpireWarning && character.IsOnPlayerTeam) { character.Speak(TextManager.Get("dialogicespirespottedsonar"), null, 0.0f, "icespirespottedsonar", 60.0f); } return(false); }
public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) { character.AIController.SteeringManager.Reset(); if (objective.Override) { if (user != character && user != null && user.SelectedConstruction == item && character.IsOnPlayerTeam) { character.Speak(TextManager.Get("DialogSteeringTaken"), null, 0.0f, "steeringtaken", 10.0f); } } user = character; if (Item.ConditionPercentage <= 0 && AIObjectiveRepairItems.IsValidTarget(Item, character)) { if (Item.Repairables.Average(r => r.DegreeOfSuccess(character)) > 0.4f) { objective.AddSubObjective(new AIObjectiveRepairItem(character, Item, objective.objectiveManager, isPriority: true)); return(false); } else { character.Speak(TextManager.Get("DialogNavTerminalIsBroken"), identifier: "navterminalisbroken", minDurationBetweenSimilar: 30.0f); } } if (!AutoPilot) { unsentChanges = true; AutoPilot = true; } IncreaseSkillLevel(user, deltaTime); switch (objective.Option.ToLowerInvariant()) { case "maintainposition": if (objective.Override) { SetMaintainPosition(); } break; case "navigateback": if (Level.IsLoadedOutpost) { break; } if (DockingSources.Any(d => d.Docked)) { item.SendSignal("1", "toggle_docking"); } if (objective.Override) { if (MaintainPos || LevelEndSelected || !LevelStartSelected || navigateTactically) { unsentChanges = true; } SetDestinationLevelStart(); } break; case "navigatetodestination": if (Level.IsLoadedOutpost) { break; } if (DockingSources.Any(d => d.Docked)) { item.SendSignal("1", "toggle_docking"); } if (objective.Override) { if (MaintainPos || !LevelEndSelected || LevelStartSelected || navigateTactically) { unsentChanges = true; } SetDestinationLevelEnd(); } break; case "navigatetactical": if (Level.IsLoadedOutpost) { break; } if (DockingSources.Any(d => d.Docked)) { item.SendSignal("1", "toggle_docking"); } if (objective.Override) { if (MaintainPos || LevelEndSelected || LevelStartSelected || !navigateTactically) { unsentChanges = true; } SetDestinationTactical(); } break; } sonar?.AIOperate(deltaTime, character, objective); if (!MaintainPos && showIceSpireWarning && character.IsOnPlayerTeam) { character.Speak(TextManager.Get("dialogicespirespottedsonar"), null, 0.0f, "icespirespottedsonar", 60.0f); } return(false); }