Esempio n. 1
0
        // Remake of the StartSystem Coroutine from original player. Some Methods are not used from the original coroutine
        // For example no temporaryClose as this will be initiated anyway from the originating Player
        // Also the fire extiguishing will not start cause the initial player is already extiguishing the fires. Else this could double/triple/... the extinguishing
        private IEnumerator StartFireSuppressionSystem(SubFire fire)
        {
            fire.subRoot.voiceNotificationManager.PlayVoiceNotification(fire.subRoot.fireSupressionNotification, false, true);
            yield return(new WaitForSeconds(3f));

            fire.ReflectionSet("fireSuppressionActive", true);
            fire.subRoot.fireSuppressionState = true;
            fire.subRoot.BroadcastMessage("NewAlarmState", null, SendMessageOptions.DontRequireReceiver);
            fire.Invoke("CancelFireSuppression", fire.fireSuppressionSystemDuration);
            float doorCloseDuration = 30f;

            fire.gameObject.BroadcastMessage("TemporaryLock", doorCloseDuration, SendMessageOptions.DontRequireReceiver);
            yield break;
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new <see cref="Fire"/>. Majority of code copied from <see cref="SubFire.CreateFire(SubFire.RoomFire)"/>. Currently does not support Fires created outside of a Cyclops
        /// </summary>
        /// <param name="fireGuid">Guid of the Fire. Used for identification when dousing the fire</param>
        /// <param name="subRootGuid">Guid of the Cyclops <see cref="SubRoot"/></param>
        /// <param name="room">The room the Fire will be spawned in</param>
        /// <param name="spawnNodeIndex">Each <see cref="CyclopsRooms"/> has multiple static Fire spawn points called spawnNodes. If the wrong index is provided,
        ///     the clients will see fires in different places from the owner</param>
        public void Create(CyclopsFireData fireData)
        {
            SubFire subFire = GuidHelper.RequireObjectFrom(fireData.CyclopsGuid).GetComponent <SubRoot>().damageManager.subFire;
            Dictionary <CyclopsRooms, SubFire.RoomFire> roomFiresDict = (Dictionary <CyclopsRooms, SubFire.RoomFire>)subFire.ReflectionGet("roomFires");
            // Copied from SubFire_CreateFire_Patch, which copies from SubFire.CreateFire()
            Transform transform2 = roomFiresDict[fireData.Room].spawnNodes[fireData.NodeIndex];

            // If a fire already exists at the node, replace the old Guid with the new one
            if (transform2.childCount > 0)
            {
                Fire existingFire = transform2.GetComponentInChildren <Fire>();

                if (GuidHelper.GetGuid(existingFire.gameObject) != fireData.CyclopsGuid)
                {
                    Log.Error("[Fires.Create Fire already exists at node index " + fireData.NodeIndex
                              + "! Replacing existing Fire Guid " + GuidHelper.GetGuid(existingFire.gameObject)
                              + " with Guid " + fireData.CyclopsGuid
                              + "]");

                    GuidHelper.SetNewGuid(existingFire.gameObject, fireData.CyclopsGuid);
                }

                return;
            }

            List <Transform> availableNodes = (List <Transform>)subFire.ReflectionGet("availableNodes");

            availableNodes.Clear();
            foreach (Transform transform in roomFiresDict[fireData.Room].spawnNodes)
            {
                if (transform.childCount == 0)
                {
                    availableNodes.Add(transform);
                }
            }
            roomFiresDict[fireData.Room].fireValue++;
            PrefabSpawn component = transform2.GetComponent <PrefabSpawn>();

            if (component == null)
            {
                return;
            }
            else
            {
                Log.Error("[FireCreatedProcessor Cannot create new Cyclops fire! PrefabSpawn component could not be found in fire node!"
                          + " Fire Guid: " + fireData.FireGuid
                          + " SubRoot Guid: " + fireData.CyclopsGuid
                          + " Room: " + fireData.Room
                          + " NodeIndex: " + fireData.NodeIndex
                          + "]");
            }
            GameObject gameObject          = component.SpawnManual();
            Fire       componentInChildren = gameObject.GetComponentInChildren <Fire>();

            if (componentInChildren)
            {
                componentInChildren.fireSubRoot = subFire.subRoot;
                GuidHelper.SetNewGuid(componentInChildren.gameObject, fireData.FireGuid);
            }

            subFire.ReflectionSet("roomFires", roomFiresDict);
            subFire.ReflectionSet("availableNodes", availableNodes);
        }