Esempio n. 1
0
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    ///
    private void InitEscapeStuff()
    {
        //Primary escape shuttle lookup
        if (!PrimaryEscapeShuttle)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length != 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene");
            primaryEscapeShuttle = shuttles[0];
        }

        //later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        //Starting up at Centcom coordinates
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(PrimaryEscapeShuttle.CentcomDest.Position);

        bool beenToStation = false;

        PrimaryEscapeShuttle.OnShuttleUpdate?.AddListener(status =>
        {
            //status display ETA tracking
            if (status == ShuttleStatus.OnRouteStation)
            {
                PrimaryEscapeShuttle.OnTimerUpdate.AddListener(TrackETA);
            }
            else
            {
                PrimaryEscapeShuttle.OnTimerUpdate.RemoveListener(TrackETA);
                CentComm.UpdateStatusDisplay(StatusDisplayChannel.EscapeShuttle, string.Empty);
            }

            if (status == ShuttleStatus.DockedCentcom && beenToStation)
            {
                Logger.Log("Shuttle arrived at Centcom", Category.Round);
                Chat.AddSystemMsgToChat("<color=white>Escape shuttle has docked at Centcomm! Round will restart in 1 minute.</color>", MatrixManager.MainStationMatrix);
                StartCoroutine(WaitForRoundEnd());
            }

            IEnumerator WaitForRoundEnd()
            {
                Logger.Log("Shuttle docked to Centcom, Round will end in 1 minute", Category.Round);
                yield return(WaitFor.Seconds(1f));

                EndRound();
            }

            if (status == ShuttleStatus.DockedStation)
            {
                beenToStation = true;
                SoundManager.PlayNetworked("ShuttleDocked");
                Chat.AddSystemMsgToChat("<color=white>Escape shuttle has arrived! Crew has 3 minutes to get on it.</color>", MatrixManager.MainStationMatrix);
                //should be changed to manual send later
                StartCoroutine(SendEscapeShuttle(180));
            }
        });
    }
Esempio n. 2
0
    private void FinishHack(HandApply interaction)
    {
        if (DMMath.Prob(chanceToFailHack))
        {
            Chat.AddActionMsgToChat(interaction.Performer, "Your attempt to hack the shuttle console failed",
                                    $"{interaction.Performer.ExpensiveName()} failed to hack the shuttle console");
            return;
        }

        Chat.AddActionMsgToChat(interaction.Performer, "You hack the shuttle console",
                                $"{interaction.Performer.ExpensiveName()} hacked the shuttle console");

        beenEmagged = true;

        if (GameManager.Instance.ShuttleSent)
        {
            return;
        }

        Chat.AddSystemMsgToChat("\n\n<color=#FF151F><size=40><b>Escape Shuttle Emergency Launch Triggered!</b></size></color>\n\n",
                                MatrixManager.MainStationMatrix);

        Chat.AddSystemMsgToChat("\n\n<color=#FF151F><size=40><b>Escape Shuttle Emergency Launch Triggered!</b></size></color>\n\n",
                                GameManager.Instance.PrimaryEscapeShuttle.MatrixInfo);

        SoundManager.PlayNetworked(SingletonSOSounds.Instance.Notice1);

        GameManager.Instance.ForceSendEscapeShuttleFromStation(10);
    }
Esempio n. 3
0
        /// <summary>
        /// Text can be empty
        /// </summary>
        public static void MakeShuttleRecallAnnouncement(string text)
        {
            var message = string.Format(ChatTemplates.PriorityAnnouncement, string.Format(ChatTemplates.ShuttleRecallSub, text));

            Chat.AddSystemMsgToChat(message, MatrixManager.MainStationMatrix);

            _ = SoundManager.PlayNetworked(CommonSounds.Instance.ShuttleRecalled);
        }
Esempio n. 4
0
    /// <summary>
    /// Makes an announcement for all players, no sound. Must be called on server.
    /// </summary>
    /// <param name="template">String that will be the header of the annoucement. We have a couple ready to use </param>
    /// <param name="text">String that will be the message body</param>
    /// <param name="type">Value from the UpdateSound enum to play as sound when announcing</param>
    public static void MakeAnnouncementNoSound(string template, string text)
    {
        if (text.Trim() == string.Empty)
        {
            return;
        }

        Chat.AddSystemMsgToChat(string.Format(template, text), MatrixManager.MainStationMatrix);
    }
Esempio n. 5
0
        /// <summary>
        /// Makes and announce a written report that will spawn at all comms consoles. Must be called on server.
        /// </summary>
        /// <param name="text">String that will be the report body</param>
        /// <param name="type">Value from the UpdateSound enum to play as sound when announcing</param>
        public void MakeCommandReport(string text, UpdateSound type)
        {
            SpawnReports(text);

            Chat.AddSystemMsgToChat(string.Format(ChatTemplates.CentcomAnnounce, ChatTemplates.CommandNewReport), MatrixManager.MainStationMatrix);

            _ = SoundManager.PlayNetworked(updateTypes[type], 1f);
            _ = SoundManager.PlayNetworked(SingletonSOSounds.Instance.AnnouncementCommandReport);
        }
Esempio n. 6
0
    /// <summary>
    /// Makes and announce a written report that will spawn at all comms consoles. Must be called on server.
    /// </summary>
    /// <param name="text">String that will be the report body</param>
    /// <param name="type">Value from the UpdateSound enum to play as sound when announcing</param>
    public void MakeCommandReport(string text, UpdateSound type)
    {
        SpawnReports(text);

        Chat.AddSystemMsgToChat(string.Format(CentCommAnnounceTemplate, CommandNewReportString), MatrixManager.MainStationMatrix);

        SoundManager.PlayNetworked(UpdateTypes[type], 1f);
        SoundManager.PlayNetworked("Commandreport");
    }
Esempio n. 7
0
    /// <summary>
    /// Text should be no less than 10 chars
    /// </summary>
    public static void MakeShuttleCallAnnouncement(int minutes, string text)
    {
        if (text.Trim() == string.Empty || text.Trim().Length < 10)
        {
            return;
        }

        Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleCallSubTemplate, minutes, text)),
                                MatrixManager.MainStationMatrix);
    }
Esempio n. 8
0
    public static void MakeCaptainAnnouncement(string text)
    {
        if (text.Trim() == string.Empty)
        {
            return;
        }

        SoundManager.PlayNetworked("Announce");
        Chat.AddSystemMsgToChat(string.Format(CaptainAnnounceTemplate, text), MatrixManager.MainStationMatrix);
    }
Esempio n. 9
0
    /// <summary>
    /// Makes an announcement for all players. Must be called on server.
    /// </summary>
    /// <param name="template">String that will be the header of the annoucement. We have a couple ready to use </param>
    /// <param name="text">String that will be the message body</param>
    /// <param name="type">Value from the UpdateSound enum to play as sound when announcing</param>
    public static void MakeAnnouncement(string template, string text, UpdateSound type)
    {
        if (text.Trim() == string.Empty)
        {
            return;
        }

        SoundManager.PlayNetworked(UpdateTypes[type]);
        Chat.AddSystemMsgToChat(string.Format(template, text), MatrixManager.MainStationMatrix);
    }
Esempio n. 10
0
    /// <summary>
    /// Text should be no less than 10 chars
    /// </summary>
    public static void MakeShuttleCallAnnouncement(string minutes, string text, bool bypassLength = false)
    {
        if (!bypassLength && (text.Trim() == string.Empty || text.Trim().Length < 10))
        {
            return;
        }

        Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleCallSubTemplate, minutes, text)),
                                MatrixManager.MainStationMatrix);
        SoundManager.PlayNetworked("ShuttleCalled");
    }
Esempio n. 11
0
    /// <summary>
    /// Text should be no less than 10 chars
    /// </summary>
    public static void MakeShuttleCallAnnouncement(string minutes, string text)
    {
        if (text.Trim() == string.Empty || text.Trim().Length < 10)
        {
            return;
        }

        Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleCallSubTemplate, minutes, text)),
                                MatrixManager.MainStationMatrix);
        PlaySoundMessage.SendToAll("ShuttleCalled", Vector3.zero, 1f);
    }
Esempio n. 12
0
        /// <summary>
        /// Makes and announce a written report that will spawn at all comms consoles. Must be called on server.
        /// </summary>
        /// <param name="text">String that will be the report body</param>
        /// <param name="loudAnnouncement">Play as sound when announcing</param>
        public void MakeCommandReport(string text, bool loudAnnouncement = true)
        {
            SpawnReports(text);

            if (loudAnnouncement)
            {
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.CentcomAnnounce, ChatTemplates.CommandNewReport), MatrixManager.MainStationMatrix);

                AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: 1f);
                _ = SoundManager.PlayNetworked(updateTypes[UpdateSound.Notice], audioSourceParameters);
                _ = SoundManager.PlayNetworked(CommonSounds.Instance.AnnouncementCommandReport);
            }
        }
Esempio n. 13
0
    private static void AnnounceNewPlayer(ConnectedPlayer newPlayer)
    {
        if (newPlayer.Job == JobType.SYNDICATE)
        {
            return;
        }

        var msg = $"{newPlayer.Job.JobString()} {newPlayer.Name} has arrived at the station. " +
                  $"Have a pleasant day! Try not to die...";

        Chat.AddSystemMsgToChat($"<color=white>{msg}</color>", MatrixManager.MainStationMatrix);
        AnnouncementMessage.SendToAll(msg);
    }
Esempio n. 14
0
        /// <summary>
        /// Makes an announcement for all players. Must be called on server.
        /// </summary>
        /// <param name="template">String that will be the header of the annoucement. We have a couple ready to use </param>
        /// <param name="text">String that will be the message body</param>
        /// <param name="soundType">Value from the UpdateSound enum to play as sound when announcing</param>
        public static void MakeAnnouncement(string template, string text, UpdateSound soundType)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }

            if (soundType != UpdateSound.NoSound)
            {
                _ = SoundManager.PlayNetworked(updateTypes[soundType]);
            }

            Chat.AddSystemMsgToChat(string.Format(template, text), MatrixManager.MainStationMatrix);
        }
Esempio n. 15
0
    private void SendReportToStation()
    {
        var commConsoles = FindObjectsOfType <CommsConsole>();

        foreach (CommsConsole console in commConsoles)
        {
            var p     = PoolManager.PoolNetworkInstantiate(paperPrefab, console.transform.position, console.transform.parent);
            var paper = p.GetComponent <Paper>();
            paper.SetServerString(CreateStartGameReport());
        }

        Chat.AddSystemMsgToChat(CommandUpdateAnnouncementString(), MatrixManager.MainStationMatrix);

        SoundManager.PlayNetworked("Notice1", 1f);
        SoundManager.PlayNetworked("InterceptMessage", 1f);
    }
Esempio n. 16
0
    public void MakeCommandReport(string text, UpdateType type)
    {
        var commConsoles = FindObjectsOfType <CommsConsole>();

        foreach (CommsConsole console in commConsoles)
        {
            var p     = Spawn.ServerPrefab(paperPrefab, console.transform.position, console.transform.parent).GameObject;
            var paper = p.GetComponent <Paper>();
            paper.SetServerString(string.Format(CentCommReportTemplate, text));
        }

        Chat.AddSystemMsgToChat(string.Format(CentCommAnnounceTemplate, CommandNewReportString()), MatrixManager.MainStationMatrix);

        SoundManager.PlayNetworked(UpdateTypes[type], 1f);
        SoundManager.PlayNetworked("Commandreport", 1f);
    }
Esempio n. 17
0
        /// <summary>
        /// Text should be no less than 10 chars
        /// </summary>
        public static void MakeShuttleCallAnnouncement(int seconds, string text, bool bypassLength = false)
        {
            if (!bypassLength && (text.Trim() == string.Empty || text.Trim().Length < 10))
            {
                return;
            }

            var timeSpan = TimeSpan.FromSeconds(seconds);
            var timeStr  = timeSpan.Seconds > 0
                                        ? $"{timeSpan.Minutes} minutes and {timeSpan.Seconds} seconds"
                                        : $"{timeSpan.Minutes} minutes";
            var message = string.Format(ChatTemplates.PriorityAnnouncement, string.Format(ChatTemplates.ShuttleCallSub, timeStr, text));

            Chat.AddSystemMsgToChat(message, MatrixManager.MainStationMatrix);

            _ = SoundManager.PlayNetworked(CommonSounds.Instance.ShuttleCalled);
        }
Esempio n. 18
0
    public void OnShuttleUpdate(EscapeShuttleStatus status)
    {
        if (status == EscapeShuttleStatus.DockedCentcom && beenToStation)
        {
            Logger.Log("Shuttle arrived at Centcom", Category.Round);
            Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has docked at Centcomm! Round will restart in {TimeSpan.FromSeconds(RoundEndTime).Minutes} minute.</color>"), MatrixManager.MainStationMatrix);
            StartCoroutine(WaitForRoundEnd());
        }

        if (status == EscapeShuttleStatus.DockedStation && !primaryEscapeShuttle.hostileEnvironment)
        {
            beenToStation = true;
            _             = SoundManager.PlayNetworked(CommonSounds.Instance.ShuttleDocked);
            Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! Crew has {TimeSpan.FromSeconds(ShuttleDepartTime).Minutes} minutes to get on it.</color>"), MatrixManager.MainStationMatrix);
            // should be changed to manual send later
            departCoroutine = StartCoroutine(SendEscapeShuttle(ShuttleDepartTime));
        }
        else if (status == EscapeShuttleStatus.DockedStation && primaryEscapeShuttle.hostileEnvironment)
        {
            beenToStation = true;
            _             = SoundManager.PlayNetworked(CommonSounds.Instance.ShuttleDocked);
            Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! The shuttle <color=#FF151F>cannot</color> leave the station due to the hostile environment!</color>"), MatrixManager.MainStationMatrix);
        }
    }
Esempio n. 19
0
 /// <summary>
 /// Text can be empty
 /// </summary>
 public static void MakeShuttleRecallAnnouncement(string text)
 {
     Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleRecallSubTemplate, text)),
                             MatrixManager.MainStationMatrix);
     PlaySoundMessage.SendToAll("ShuttleRecalled", Vector3.zero, 1f);
 }
Esempio n. 20
0
 /// <summary>
 /// Text can be empty
 /// </summary>
 public static void MakeShuttleRecallAnnouncement(string text)
 {
     Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleRecallSubTemplate, text)),
                             MatrixManager.MainStationMatrix);
     SoundManager.PlayNetworked("ShuttleRecalled");
 }
Esempio n. 21
0
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    ///
    private void InitEscapeStuff()
    {
        //Primary escape shuttle lookup
        if (PrimaryEscapeShuttle == null)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length < 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene", Category.Round);
            primaryEscapeShuttle = shuttles[0];
        }

        //later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        if (primaryEscapeShuttle.MatrixInfo == null)
        {
            Logger.LogError("Primary escape shuttle has no associated matrix!", Category.Round);
            return;
        }

        //Starting up at Centcom coordinates
        if (GameManager.Instance.QuickLoad)
        {
            if (primaryEscapeShuttle.MatrixInfo == null)
            {
                return;
            }
            if (primaryEscapeShuttle.MatrixInfo.MatrixMove == null)
            {
                return;
            }
        }

        var   orientation = primaryEscapeShuttle.MatrixInfo.MatrixMove.InitialFacing;
        float width;

        if (orientation == Orientation.Up || orientation == Orientation.Down)
        {
            width = PrimaryEscapeShuttle.MatrixInfo.Bounds.size.x;
        }
        else
        {
            width = PrimaryEscapeShuttle.MatrixInfo.Bounds.size.y;
        }

        Vector3 newPos;

        switch (LandingZoneManager.Instance.centcomDocking.orientation)
        {
        case OrientationEnum.Right:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x + Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        case OrientationEnum.Up:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y + Mathf.Ceil(width / 2f), 0);
            break;

        case OrientationEnum.Left:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x - Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        default:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y - Mathf.Ceil(width / 2f), 0);
            break;
        }

        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.ChangeFacingDirection(Orientation.FromEnum(PrimaryEscapeShuttle.orientationForDockingAtCentcom));
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(newPos);
        primaryEscapeShuttle.InitDestination(newPos);

        bool beenToStation = false;

        PrimaryEscapeShuttle.OnShuttleUpdate?.AddListener(status =>
        {
            //status display ETA tracking
            if (status == EscapeShuttleStatus.OnRouteStation)
            {
                PrimaryEscapeShuttle.OnTimerUpdate.AddListener(TrackETA);
            }
            else
            {
                PrimaryEscapeShuttle.OnTimerUpdate.RemoveListener(TrackETA);
                CentComm.UpdateStatusDisplay(StatusDisplayChannel.EscapeShuttle, string.Empty);
            }

            if (status == EscapeShuttleStatus.DockedCentcom && beenToStation)
            {
                Logger.Log("Shuttle arrived at Centcom", Category.Round);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has docked at Centcomm! Round will restart in {TimeSpan.FromSeconds(RoundEndTime).Minutes} minute.</color>"), MatrixManager.MainStationMatrix);
                StartCoroutine(WaitForRoundEnd());
            }

            IEnumerator WaitForRoundEnd()
            {
                Logger.Log($"Shuttle docked to Centcom, Round will end in {TimeSpan.FromSeconds(RoundEndTime).Minutes} minute", Category.Round);
                yield return(WaitFor.Seconds(1f));

                EndRound();
            }

            if (status == EscapeShuttleStatus.DockedStation && !primaryEscapeShuttle.hostileEnvironment)
            {
                beenToStation = true;
                SoundManager.PlayNetworked(SingletonSOSounds.Instance.ShuttleDocked);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! Crew has {TimeSpan.FromSeconds(ShuttleDepartTime).Minutes} minutes to get on it.</color>"), MatrixManager.MainStationMatrix);
                //should be changed to manual send later
                departCoroutine = StartCoroutine(SendEscapeShuttle(ShuttleDepartTime));
            }
            else if (status == EscapeShuttleStatus.DockedStation && primaryEscapeShuttle.hostileEnvironment)
            {
                beenToStation = true;
                SoundManager.PlayNetworked(SingletonSOSounds.Instance.ShuttleDocked);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! The shuttle <color=#FF151F>cannot</color> leave the station due to the hostile environment!</color>"), MatrixManager.MainStationMatrix);
            }
        });
    }