Ejemplo n.º 1
0
        public Brooch()
        {
            var origCost = 25f;

            onBehav += () => {
                broochPrefab = UnityEngine.Object.Instantiate(Resources.Load <InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscChest1"));
                broochPrefab.directorCreditCost = 0;
                broochPrefab.sendOverNetwork    = true;
                broochPrefab.skipSpawnWhenSacrificeArtifactEnabled = false;
                broochPrefab.prefab = PrefabAPI.InstantiateClone(broochPrefab.prefab, "chestBrooch");

                broochPrefab.prefab.AddComponent <CaptainsBroochDroppod>().enabled = !safeMode;

                var pInt = broochPrefab.prefab.GetComponent <PurchaseInteraction>();

                origCost = pInt.cost;

                pInt.cost = Mathf.CeilToInt(origCost * (1f + extraCost));
                pInt.automaticallyScaleCostWithDifficulty = true;
            };

            ConfigEntryChanged += (sender, args) => {
                if (args.target.boundProperty.Name == nameof(safeMode))
                {
                    broochPrefab.prefab.GetComponent <CaptainsBroochDroppod>().enabled = !(bool)args.newValue;
                }
                else if (args.target.boundProperty.Name == nameof(extraCost))
                {
                    broochPrefab.prefab.GetComponent <PurchaseInteraction>().cost = Mathf.CeilToInt(origCost * (1f + extraCost));
                }
            };
        }
Ejemplo n.º 2
0
        public override void SetupBehavior()
        {
            base.SetupBehavior();

            iscBarrel    = (InteractableSpawnCard)Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscBarrel1");
            iscBarrelNew = UnityEngine.Object.Instantiate(iscBarrel); //remove?
            BarrelPrefab = iscBarrelNew.prefab;
            BarrelPrefab = BarrelPrefab.InstantiateClone($"Bulletstorm_Barrel", true);
            BarrelInteraction barrelInteraction = BarrelPrefab.GetComponent <BarrelInteraction>();

            barrelInteraction.expReward  = 0;
            barrelInteraction.goldReward = 0;
            BarrelDestroyOnInteraction barrelDestroyOnInteraction = BarrelPrefab.AddComponent <BarrelDestroyOnInteraction>();

            barrelDestroyOnInteraction.lifetime    = Lifetime;
            barrelDestroyOnInteraction.uselifetime = LifetimeAfterUse;
            iscBarrelNew.prefab = BarrelPrefab;

            if (BarrelPrefab)
            {
                PrefabAPI.RegisterNetworkPrefab(BarrelPrefab);
            }

            //if (HelperPlugin.ClassicItemsCompat.enabled)
            //HelperPlugin.ClassicItemsCompat.RegisterEmbryo(catalogIndex);
        }
Ejemplo n.º 3
0
        protected override void SetupComponents()
        {
            base.SetupComponents();
            AddLanguageTokens();
            InteractableSpawnCard origIsc = drone1SpawnCard;

            brokenObject = origIsc.prefab.InstantiateClone($"{name}Broken", true);
            ModifyBrokenObject();
            iSpawnCard = Object.Instantiate(origIsc);
            ModifyInteractableSpawnCard();
            InitializeDirectorCards();
        }
Ejemplo n.º 4
0
        private SpawnCard.SpawnResult SpawnBarrel(Vector3 center, float angle, float radius = 30f)
        {
            InteractableSpawnCard spawnCard = Resources.Load <InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscBarrel1");

            spawnCard.slightlyRandomizeOrientation          = false;
            spawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
            DirectorPlacementRule rule = new DirectorPlacementRule()
            {
                placementMode = DirectorPlacementRule.PlacementMode.Direct
            };
            DirectorSpawnRequest request = new DirectorSpawnRequest(spawnCard, rule, run.runRNG);
            Vector3 spawnPosition        = FindGroundPosition(center, angle, radius);

            return(spawnCard.DoSpawn(spawnPosition, Quaternion.LookRotation((center - spawnPosition).normalized), request));
        }
Ejemplo n.º 5
0
        private static void CreateGurrenSummonInteractableSpawnCard()
        {
            gurrenInteractSpawnCard = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            var gurrenInteractPrefab = Modules.Assets.LoadAsset <GameObject>("GurrenInteractPrefab");

            gurrenInteractPrefab.AddComponent <NetworkIdentity>();
            var childLocator  = gurrenInteractPrefab.GetComponent <ChildLocator>();
            var model         = childLocator.FindChild("Model");
            var hologramPivot = childLocator.FindChild("HologramPivot");
            var modelLocator  = model.gameObject.AddComponent <ModelLocator>();

            modelLocator.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
            var entityLocator = model.gameObject.AddComponent <EntityLocator>();

            entityLocator.entity = gurrenInteractPrefab;
            var hightlight = gurrenInteractPrefab.AddComponent <Highlight>();

            hightlight.targetRenderer = gurrenInteractPrefab.GetComponentInChildren <Renderer>();
            hightlight.highlightColor = Highlight.HighlightColor.interactive;
            var hologramProjector = gurrenInteractPrefab.AddComponent <HologramProjector>();

            hologramProjector.hologramPivot                    = hologramPivot;
            gurrenInteractPurchaseInteraction                  = gurrenInteractPrefab.AddComponent <PurchaseInteraction>();
            gurrenInteractPurchaseInteraction.available        = true;
            gurrenInteractPurchaseInteraction.displayNameToken = TTGL_SurvivorPlugin.developerPrefix + "_GURREN_INTERACTABLE_NAME";
            gurrenInteractPurchaseInteraction.contextToken     = TTGL_SurvivorPlugin.developerPrefix + "_GURREN_INTERACTABLE_CONTEXT";
            //var summonMasterBehavior = gurrenInteractPrefab.AddComponent<SummonMasterBehavior>();
            //summonMasterBehavior.masterPrefab = CreateGurrenAIMaster();
            gurrenInteractPrefab.AddComponent <GurrenSpawnerBehavior>();
            gurrenInteractSpawnCard.prefab                                = gurrenInteractPrefab;
            gurrenInteractSpawnCard.sendOverNetwork                       = true;
            gurrenInteractSpawnCard.hullSize                              = HullClassification.Golem;
            gurrenInteractSpawnCard.nodeGraphType                         = RoR2.Navigation.MapNodeGroup.GraphType.Ground;
            gurrenInteractSpawnCard.requiredFlags                         = NodeFlags.None;
            gurrenInteractSpawnCard.forbiddenFlags                        = NodeFlags.None;
            gurrenInteractSpawnCard.directorCreditCost                    = 15;
            gurrenInteractSpawnCard.occupyPosition                        = true;
            gurrenInteractSpawnCard.eliteRules                            = SpawnCard.EliteRules.Default;
            gurrenInteractSpawnCard.orientToFloor                         = true;
            gurrenInteractSpawnCard.slightlyRandomizeOrientation          = false;
            gurrenInteractSpawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
            if (gurrenInteractPrefab == null)
            {
                TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load GurrenInteractPrefab");
            }
            PrefabAPI.RegisterNetworkPrefab(gurrenInteractPrefab);
            //TTGL_SurvivorPlugin.networkPrefabs.Add(gurrenInteractPrefab);
        }
Ejemplo n.º 6
0
        private static void AddInteractableTest(ConCommandArgs args)
        {
            _iscCategoryChest2DamageSpawnCard = Addressables.LoadAssetAsync <InteractableSpawnCard>(iscCategoryChest2Damage).WaitForCompletion();
            _iscCategoryChest2DamageSpawnCard = UnityObject.Instantiate(_iscCategoryChest2DamageSpawnCard);
            _iscCategoryChest2DamageSpawnCard.directorCreditCost = 10;

            _my_iscCategoryChest2DamageDirectorCard = new DirectorCard {
                spawnCard               = _iscCategoryChest2DamageSpawnCard,
                selectionWeight         = 1,
                preventOverhead         = false,
                minimumStageCompletions = 0,
                spawnDistance           = DirectorCore.MonsterSpawnDistance.Standard
            };

            DirectorAPI.InteractableActions  += CustomInteractables;
            DirectorAPI.StageSettingsActions += CustomStageSettings;
        }
Ejemplo n.º 7
0
        void SetupSpawnCard()
        {
            bulwarkDroneSpawnCard = TinkersSatchelPlugin.resources.LoadAsset <InteractableSpawnCard>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/iscTkSatBulwarkDrone.asset");

            bulwarkDroneDirectorCard = new DirectorCard {
                spawnCard = bulwarkDroneSpawnCard,
                minimumStageCompletions = 0,
                preventOverhead         = false,
                selectionWeight         = 4, //equip drone is 2, normal drones are 7
                spawnDistance           = DirectorCore.MonsterSpawnDistance.Standard
            };
            bulwarkDroneDCH = new DirectorAPI.DirectorCardHolder {
                Card = bulwarkDroneDirectorCard,
                InteractableCategory = DirectorAPI.InteractableCategory.Drones,
                MonsterCategory      = DirectorAPI.MonsterCategory.Invalid
            };
        }
Ejemplo n.º 8
0
        public override void SetupBehavior()
        {
            base.SetupBehavior();
            broochPrefab = UnityEngine.Object.Instantiate(Resources.Load <InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscChest1"));
            broochPrefab.directorCreditCost = 0;
            broochPrefab.sendOverNetwork    = true;
            broochPrefab.skipSpawnWhenSacrificeArtifactEnabled = false;
            broochPrefab.prefab = PrefabAPI.InstantiateClone(broochPrefab.prefab, "chestBrooch");

            broochPrefab.prefab.AddComponent <CaptainsBroochDroppod>().enabled = !safeMode;

            var pInt = broochPrefab.prefab.GetComponent <PurchaseInteraction>();

            baseCost = pInt.cost;

            pInt.cost = Mathf.CeilToInt(baseCost * (1f + extraCost));
            pInt.automaticallyScaleCostWithDifficulty = true;
        }
        public static void Init()
        {
            Material voidCellBaseInidicatorMat = UnityEngine.Object.Instantiate <Material>(Resources.Load <GameObject>("Prefabs/Networkedobjects/NullSafeWard").transform.Find("Indicator").Find("IndicatorSphere").GetComponentInChildren <MeshRenderer>().material);
            Material voidCellReaverFoamMat     = UnityEngine.Object.Instantiate <Material>(Resources.Load <GameObject>("Prefabs/Networkedobjects/NullSafeWard").transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>().material);
            Material distortionMat             = UnityEngine.Object.Instantiate <Material>(Resources.Load <GameObject>("Prefabs/Networkedobjects/NullSafeWard").transform.GetChild(3).GetChild(1).GetChild(3).GetComponent <ParticleSystemRenderer>().material);

            #region CorruptedTeleporter
            corruptedTeleporter = GameObject.Instantiate(Resources.Load <GameObject>("prefabs/networkedobjects/teleporters/Teleporter1"));
            corruptedTeleporter.SetActive(false);
            CRMissionController missionController = corruptedTeleporter.AddComponent <CRMissionController>();
            corruptedTeleporter.SetActive(true);
            missionController.target = corruptedTeleporter.GetComponent <TeleporterInteraction>();
            missionController.target.holdoutZoneController.radiusIndicator.material = UnityEngine.Object.Instantiate <Material>(voidCellBaseInidicatorMat);
            missionController.target.holdoutZoneController.radiusIndicator.material.SetVector("_TintColor", new Vector4(0.5f, 0.0f, 1.0f, 0.75f));

            GameObject teleRift = GameObject.Instantiate(Assets.teleporterRift);
            teleRift.transform.SetParent(corruptedTeleporter.transform);
            teleRift.transform.localPosition = new Vector3(0.0f, 8.0f, 0.0f);

            RotateObject teleEffectRotator = teleRift.AddComponent <RotateObject>();
            teleEffectRotator.rotationSpeed = new Vector3(0.0f, 35.0f, 0.0f);

            ChildLocator teleporterChildLocator = teleRift.GetComponent <ChildLocator>();
            teleporterChildLocator.FindChild("DistortionParticle").GetComponent <ParticleSystemRenderer>().material = UnityEngine.Object.Instantiate <Material>(distortionMat);
            teleporterChildLocator.FindChild("OrbsModel").GetComponent <MeshRenderer>().material      = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);
            teleporterChildLocator.FindChild("OrbN").GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);
            teleporterChildLocator.FindChild("OrbE").GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);
            teleporterChildLocator.FindChild("OrbS").GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);
            teleporterChildLocator.FindChild("OrbW").GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);

            missionController.orbLocator = teleporterChildLocator;


            var teleporterDirectors = corruptedTeleporter.GetComponents <CombatDirector>();

            foreach (CombatDirector targetTeleporterDirector in teleporterDirectors)
            {
                if (targetTeleporterDirector.customName == "Monsters")
                {
                    UnityEngine.Object.Destroy(targetTeleporterDirector);
                }
                if (targetTeleporterDirector.customName == "Boss")
                {
                    missionController.bossDirector = targetTeleporterDirector;
                }
            }
            ;


            var protectionWardGO = new GameObject();
            protectionWardGO.transform.parent        = corruptedTeleporter.transform;
            protectionWardGO.transform.localPosition = Vector3.zero;

            var teamFilter1 = protectionWardGO.AddComponent <TeamFilter>();
            teamFilter1.defaultTeam = TeamIndex.Player;

            missionController.protectionWard                    = protectionWardGO.AddComponent <BuffWard>();
            missionController.protectionWard.buffDef            = CRContentPackProvider.protectionBuffDef;
            missionController.protectionWard.buffDuration       = 0.5f;
            missionController.protectionWard.interval           = 0.25f;
            missionController.protectionWard.radius             = 15;
            missionController.protectionWard.floorWard          = false;
            missionController.protectionWard.expires            = false;
            missionController.protectionWard.invertTeamFilter   = false;
            missionController.protectionWard.expireDuration     = 0;
            missionController.protectionWard.removalTime        = 0;
            missionController.protectionWard.removalSoundString = "";
            missionController.protectionWard.requireGrounded    = false;


            var voidWardGO = new GameObject();
            voidWardGO.transform.parent        = corruptedTeleporter.transform;
            voidWardGO.transform.localPosition = Vector3.zero;

            var teamFilter2 = voidWardGO.AddComponent <TeamFilter>();
            teamFilter2.defaultTeam = TeamIndex.Player;

            missionController.voidWard                    = voidWardGO.AddComponent <BuffWard>();
            missionController.voidWard.buffDef            = CRContentPackProvider.voidDebuffDef;
            missionController.voidWard.buffDuration       = 0.5f;
            missionController.voidWard.interval           = 0.25f;
            missionController.voidWard.radius             = 75;
            missionController.voidWard.floorWard          = false;
            missionController.voidWard.expires            = false;
            missionController.voidWard.invertTeamFilter   = false;
            missionController.voidWard.expireDuration     = 0;
            missionController.voidWard.removalTime        = 0;
            missionController.voidWard.removalSoundString = "";
            missionController.voidWard.requireGrounded    = false;

            GameObject voidWardIndicator = GameObject.Instantiate(Resources.Load <GameObject>("prefabs/networkedobjects/NullSafeWard").transform.GetChild(1).gameObject);
            voidWardIndicator.transform.SetParent(voidWardGO.transform);
            voidWardIndicator.transform.localPosition = Vector3.zero;
            missionController.voidWard.rangeIndicator = voidWardIndicator.transform;

            voidWardIndicator.GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellBaseInidicatorMat);
            voidWardIndicator.GetComponentInChildren <MeshRenderer>().material.SetVector("_TintColor", new Vector4(1.0f, 0.0f, 0.25f, 0.35f));

            /*foreach (CombatDirector director in corruptedTeleporter.GetComponents<CombatDirector>())
             * {
             *  Component.DestroyImmediate(director);
             * }*/

            missionController.directors = new CombatDirector[4];
            for (int i = 0; i < 4; i++)
            {
                missionController.directors[i]                      = corruptedTeleporter.AddComponent <CombatDirector>();
                missionController.directors[i].enabled              = false;
                missionController.directors[i].customName           = "CRDirector" + i.ToString();
                missionController.directors[i].monsterCredit        = 0;
                missionController.directors[i].expRewardCoefficient = 0.2f;
                missionController.directors[i].moneyWaveIntervals   = new RangeFloat[1] {
                    new RangeFloat()
                    {
                        min = 0.75f, max = 0.75f
                    }
                };
                missionController.directors[i].minSeriesSpawnInterval = 0.1f;
                missionController.directors[i].maxSeriesSpawnInterval = 1;
                missionController.directors[i].minRerollSpawnInterval = 2.333f;
                missionController.directors[i].maxRerollSpawnInterval = 4.333f;
                missionController.directors[i].teamIndex                          = TeamIndex.Monster;
                missionController.directors[i].creditMultiplier                   = 1f;
                missionController.directors[i].spawnDistanceMultiplier            = 1;
                missionController.directors[i].shouldSpawnOneWave                 = false;
                missionController.directors[i].targetPlayers                      = true;
                missionController.directors[i].skipSpawnIfTooCheap                = false;
                missionController.directors[i].resetMonsterCardIfFailed           = false;
                missionController.directors[i].maximumNumberToSpawnBeforeSkipping = 6;
                missionController.directors[i].eliteBias                          = 1f;
                missionController.directors[i].spawnEffectPrefab                  = Resources.Load <GameObject>("prefabs/effects/NullifierExplosion");
            }

            missionController.inventory = corruptedTeleporter.AddComponent <Inventory>();
            corruptedTeleporter.AddComponent <EnemyInfoPanelInventoryProvider>();

            corruptedTeleporter = PrefabAPI.InstantiateClone(corruptedTeleporter, "CRTeleporter", true);
            Debug.Log("[CRCore3]: Created prefab: " + corruptedTeleporter.name);
            #endregion
            //////////
            #region VoidRifts
            // add custom position indicator and radar scannar icon
            voidRift = GameObject.Instantiate(Assets.voidRift);
            voidRift.transform.GetChild(0).GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(missionController.target.holdoutZoneController.radiusIndicator.material);

            ChildLocator childLocator = voidRift.GetComponent <ChildLocator>(); ///todo: convert all to child locator

            childLocator.FindChild("PhysicalOrb").GetComponent <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidCellReaverFoamMat);
            childLocator.FindChild("DistortionParticle1").GetComponent <ParticleSystemRenderer>().material = UnityEngine.Object.Instantiate <Material>(distortionMat);
            childLocator.FindChild("DistortionParticle2").GetComponent <ParticleSystemRenderer>().material = UnityEngine.Object.Instantiate <Material>(distortionMat);
            childLocator.FindChild("DistortionParticle3").GetComponent <ParticleSystemRenderer>().material = UnityEngine.Object.Instantiate <Material>(distortionMat);
            childLocator.FindChild("DistortionParticle4").GetComponent <ParticleSystemRenderer>().material = UnityEngine.Object.Instantiate <Material>(distortionMat);

            var voidRiftHoldoutZone = voidRift.AddComponent <HoldoutZoneController>();
            voidRiftHoldoutZone.enabled                   = false;
            voidRiftHoldoutZone.baseRadius                = 22;
            voidRiftHoldoutZone.minimumRadius             = 4;
            voidRiftHoldoutZone.chargeRadiusDelta         = 0;
            voidRiftHoldoutZone.baseChargeDuration        = 35;
            voidRiftHoldoutZone.radiusSmoothTime          = 1;
            voidRiftHoldoutZone.healingNovaRoot           = voidRift.transform.GetChild(0).GetChild(1);
            voidRiftHoldoutZone.inBoundsObjectiveToken    = "OBJECTIVE_RIFT_CHARGING_TOKEN";
            voidRiftHoldoutZone.outOfBoundsObjectiveToken = "OBJECTIVE_RIFT_INACTIVE_TOKEN";
            voidRiftHoldoutZone.applyFocusConvergence     = true;
            voidRiftHoldoutZone.applyHealingNova          = true;
            voidRiftHoldoutZone.playerCountScaling        = 1;
            voidRiftHoldoutZone.radiusIndicator           = voidRift.transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>();
            voidRiftHoldoutZone.baseIndicatorColor        = new Color(0.5f, 0.0f, 1.0f, 0.75f);

            var teamFilter = voidRift.AddComponent <TeamFilter>();
            teamFilter.defaultTeam = TeamIndex.Player;

            var riftNetworkMachine = voidRift.AddComponent <NetworkStateMachine>();
            var stateMachine       = voidRift.AddComponent <EntityStateMachine>();
            stateMachine.customName          = "CRRiftStateMachine";
            stateMachine.initialStateType    = new SerializableEntityStateType(typeof(RiftOffState));
            stateMachine.mainStateType       = new SerializableEntityStateType(typeof(RiftOnState));
            riftNetworkMachine.stateMachines = new EntityStateMachine[] { stateMachine };


            var riftInteraction = voidRift.AddComponent <PurchaseInteraction>();
            riftInteraction.displayNameToken = "CRRIFT_INTERACT_NAME";
            riftInteraction.contextToken     = "CRRIFT_INTERACT_CONTEXT";
            riftInteraction.costType         = CostTypeIndex.None;
            riftInteraction.available        = true;
            riftInteraction.automaticallyScaleCostWithDifficulty = false;
            riftInteraction.requiredUnlockable = "";
            riftInteraction.ignoreSpherecastForInteractability  = false;
            riftInteraction.setUnavailableOnTeleporterActivated = false;
            riftInteraction.isShrine     = false;
            riftInteraction.isGoldShrine = false;

            var riftEntityLocator = voidRift.transform.GetChild(0).GetChild(4).GetChild(0).gameObject.AddComponent <EntityLocator>();
            riftEntityLocator.entity = voidRift;

            var voidProtectionWard = voidRift.AddComponent <BuffWard>();
            voidProtectionWard.buffDef            = CRContentPackProvider.protectionBuffDef;
            voidProtectionWard.buffDuration       = 0.5f;
            voidProtectionWard.interval           = 0.25f;
            voidProtectionWard.radius             = 0;
            voidProtectionWard.floorWard          = false;
            voidProtectionWard.expires            = false;
            voidProtectionWard.invertTeamFilter   = false;
            voidProtectionWard.expireDuration     = 0;
            voidProtectionWard.removalTime        = 0;
            voidProtectionWard.removalSoundString = "";
            voidProtectionWard.requireGrounded    = false;
            voidProtectionWard.rangeIndicator     = voidRift.transform.GetChild(0).GetChild(0);

            var voidRiftWard = voidRift.AddComponent <BuffWard>();
            voidRiftWard.buffDef            = CRContentPackProvider.voidDebuffDef;
            voidRiftWard.buffDuration       = 0.5f;
            voidRiftWard.interval           = 0.25f;
            voidRiftWard.radius             = 75;
            voidRiftWard.floorWard          = false;
            voidRiftWard.expires            = false;
            voidRiftWard.invertTeamFilter   = false;
            voidRiftWard.expireDuration     = 0;
            voidRiftWard.removalTime        = 0;
            voidRiftWard.removalSoundString = "";
            voidRiftWard.requireGrounded    = false;
            voidRiftWard.rangeIndicator     = voidRift.transform.GetChild(0).GetChild(3);
            voidRiftWard.rangeIndicator.gameObject.GetComponentInChildren <MeshRenderer>().material = UnityEngine.Object.Instantiate <Material>(voidWardIndicator.GetComponentInChildren <MeshRenderer>().material);
            voidRiftWard.rangeIndicator.gameObject.GetComponentInChildren <MeshRenderer>().material.SetVector("_TintColor", new Vector4(1.0f, 0.0f, 0.0f, 0.1f));


            VoidRiftTracker voidRiftComponentTracker = voidRift.AddComponent <VoidRiftTracker>();
            voidRiftComponentTracker.protectionWard = voidProtectionWard;
            voidRiftComponentTracker.voidWard       = voidRiftWard;


            voidRift = PrefabAPI.InstantiateClone(voidRift, "CRVoidRift", true);
            Debug.Log("[CRCore3]: Created prefab: " + voidRift.name);
            #endregion
            //////////
            #region ISCs
            InteractableSpawnCard interactableSpawnCard = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            interactableSpawnCard.sendOverNetwork                       = true;
            interactableSpawnCard.hullSize                              = HullClassification.Human;
            interactableSpawnCard.nodeGraphType                         = RoR2.Navigation.MapNodeGroup.GraphType.Ground;
            interactableSpawnCard.requiredFlags                         = RoR2.Navigation.NodeFlags.TeleporterOK;
            interactableSpawnCard.forbiddenFlags                        = RoR2.Navigation.NodeFlags.None;
            interactableSpawnCard.directorCreditCost                    = 0;
            interactableSpawnCard.occupyPosition                        = true;
            interactableSpawnCard.eliteRules                            = SpawnCard.EliteRules.Default;
            interactableSpawnCard.orientToFloor                         = false;
            interactableSpawnCard.slightlyRandomizeOrientation          = false;
            interactableSpawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
            interactableSpawnCard.prefab = corruptedTeleporter;
            iscCorruptedTeleporter       = interactableSpawnCard;

            Debug.Log("[CRCore3]: Created isc: " + iscCorruptedTeleporter.ToString());

            InteractableSpawnCard riftSpawnCard = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            riftSpawnCard.sendOverNetwork                       = true;
            riftSpawnCard.hullSize                              = HullClassification.Human;
            riftSpawnCard.nodeGraphType                         = RoR2.Navigation.MapNodeGroup.GraphType.Ground;
            riftSpawnCard.requiredFlags                         = RoR2.Navigation.NodeFlags.TeleporterOK;
            riftSpawnCard.forbiddenFlags                        = RoR2.Navigation.NodeFlags.None;
            riftSpawnCard.directorCreditCost                    = 0;
            riftSpawnCard.occupyPosition                        = false;
            riftSpawnCard.eliteRules                            = SpawnCard.EliteRules.Default;
            riftSpawnCard.orientToFloor                         = false;
            riftSpawnCard.slightlyRandomizeOrientation          = false;
            riftSpawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
            riftSpawnCard.prefab = voidRift;
            iscVoidRift          = riftSpawnCard;

            Debug.Log("[CRCore3]: Created isc: " + riftSpawnCard.ToString());
            #endregion
            /////////
            #region PostProcessing
            voidSickEffect = new GameObject();
            voidSickEffect.SetActive(false);

            var sickCameraEffectPPBase = new GameObject();
            sickCameraEffectPPBase.transform.parent        = voidSickEffect.transform;
            sickCameraEffectPPBase.transform.localPosition = Vector3.zero;

            var sickCameraEffectPP = new GameObject();
            sickCameraEffectPP.transform.parent        = sickCameraEffectPPBase.transform;
            sickCameraEffectPP.transform.localPosition = Vector3.zero;

            var sickVolume = sickCameraEffectPP.AddComponent <PostProcessVolume>();
            sickVolume.isGlobal      = true;
            sickVolume.blendDistance = 1000;
            sickVolume.priority      = 500;
            sickVolume.weight        = 1;
            sickVolume.profile       = Assets.voidSafePPP;
            sickVolume.sharedProfile = Assets.voidSafePPP;
            sickVolume.enabled       = true;

            sickCameraEffectPP.layer = 20;
            var sickSphereCollider = sickCameraEffectPP.AddComponent <SphereCollider>();
            sickSphereCollider.center    = Vector3.zero;
            sickSphereCollider.radius    = 1;
            sickSphereCollider.isTrigger = false;

            var voidSickPPD = sickCameraEffectPP.AddComponent <PostProcessDuration>();
            voidSickPPD.enabled       = false;
            voidSickPPD.ppVolume      = sickVolume;
            voidSickPPD.maxDuration   = 0.4f;
            voidSickPPD.ppWeightCurve = new AnimationCurve();
            voidSickPPD.ppWeightCurve.AddKey(0f, 0f);
            voidSickPPD.ppWeightCurve.AddKey(0.5f, 0.75f);
            voidSickPPD.ppWeightCurve.AddKey(1f, 1f);
            voidSickPPD.ppWeightCurve.preWrapMode  = WrapMode.ClampForever;
            voidSickPPD.ppWeightCurve.postWrapMode = WrapMode.ClampForever;

            /*var voidSickPPD2 = voidSickEffect.AddComponent<PostProcessDuration>();
             * voidSickPPD2.enabled = false;
             * voidSickPPD2.ppVolume = sickVolume;
             * voidSickPPD2.maxDuration = 0.4f;
             * voidSickPPD2.ppWeightCurve = new AnimationCurve();
             * voidSickPPD2.ppWeightCurve.AddKey(1f, 1f);
             * voidSickPPD2.ppWeightCurve.AddKey(0.5f, 0.1f);
             * voidSickPPD2.ppWeightCurve.AddKey(0f, 0f);
             * voidSickPPD2.ppWeightCurve.preWrapMode = WrapMode.ClampForever;
             * voidSickPPD2.ppWeightCurve.postWrapMode = WrapMode.ClampForever;*/

            var destroyOnTimerSick = voidSickEffect.AddComponent <DestroyOnTimer>();
            destroyOnTimerSick.duration          = 0.1f;
            destroyOnTimerSick.resetAgeOnDisable = true;

            var sickCameraEffect = voidSickEffect.AddComponent <LocalCameraEffect>();
            sickCameraEffect.effectRoot = sickCameraEffectPPBase.gameObject;

            var sickTemporaryVFX = voidSickEffect.AddComponent <TemporaryVisualEffect>();
            sickTemporaryVFX.visualState        = TemporaryVisualEffect.VisualState.Enter;
            sickTemporaryVFX.enterComponents    = new MonoBehaviour[1];
            sickTemporaryVFX.enterComponents[0] = voidSickPPD;
            sickTemporaryVFX.exitComponents     = new MonoBehaviour[1];
            sickTemporaryVFX.exitComponents[0]  = destroyOnTimerSick;

            voidSickEffect.SetActive(true);
            voidSickEffect = PrefabAPI.InstantiateClone(voidSickEffect, "CRVoidSickEffect", false);
            Debug.Log("[CRCore3]: Created prefab: " + voidSickEffect.name);

            /////////////////////

            voidSafeEffect = new GameObject();
            voidSafeEffect.SetActive(false);

            var safeCameraEffectPPBase = new GameObject();
            safeCameraEffectPPBase.transform.parent        = voidSafeEffect.transform;
            safeCameraEffectPPBase.transform.localPosition = Vector3.zero;

            var safeCameraEffectPP = new GameObject();
            safeCameraEffectPP.transform.parent        = safeCameraEffectPPBase.transform;
            safeCameraEffectPP.transform.localPosition = Vector3.zero;

            var safeVolume = safeCameraEffectPP.AddComponent <PostProcessVolume>();
            safeVolume.isGlobal      = true;
            safeVolume.blendDistance = 1000;
            safeVolume.priority      = 501;
            safeVolume.weight        = 1;
            safeVolume.profile       = Assets.voidSickPPP;
            safeVolume.sharedProfile = Assets.voidSickPPP;
            safeVolume.enabled       = true;

            safeCameraEffectPP.layer = 20;
            var safeSphereCollider = safeCameraEffectPP.AddComponent <SphereCollider>();
            safeSphereCollider.center    = Vector3.zero;
            safeSphereCollider.radius    = 1;
            safeSphereCollider.isTrigger = false;

            var voidSafePPD = safeCameraEffectPP.AddComponent <PostProcessDuration>();
            voidSafePPD.enabled       = false;
            voidSafePPD.maxDuration   = 0.4f;
            voidSafePPD.ppVolume      = safeVolume;
            voidSafePPD.ppWeightCurve = new AnimationCurve();
            voidSafePPD.ppWeightCurve.AddKey(0f, 0f);
            voidSafePPD.ppWeightCurve.AddKey(0.5f, 0.75f);
            voidSafePPD.ppWeightCurve.AddKey(1f, 1f);
            voidSafePPD.ppWeightCurve.preWrapMode  = WrapMode.ClampForever;
            voidSafePPD.ppWeightCurve.postWrapMode = WrapMode.ClampForever;

            /*var voidSafePPD2 = voidSafeEffect.AddComponent<PostProcessDuration>();
             * voidSafePPD2.enabled = false;
             * voidSafePPD2.ppVolume = safeVolume;
             * voidSafePPD2.maxDuration = 0.4f;
             * voidSafePPD2.ppWeightCurve = new AnimationCurve();
             * voidSafePPD2.ppWeightCurve.AddKey(1f, 1f);
             * voidSafePPD2.ppWeightCurve.AddKey(0.5f, 0.1f);
             * voidSafePPD2.ppWeightCurve.AddKey(0f, 0f);
             * voidSafePPD2.ppWeightCurve.preWrapMode = WrapMode.ClampForever;
             * voidSafePPD2.ppWeightCurve.postWrapMode = WrapMode.ClampForever;*/

            var destroyOnTimerSafe = voidSafeEffect.AddComponent <DestroyOnTimer>();
            destroyOnTimerSafe.duration          = 0.1f;
            destroyOnTimerSafe.resetAgeOnDisable = true;

            var safeCameraEffect = voidSafeEffect.AddComponent <LocalCameraEffect>();
            safeCameraEffect.effectRoot = safeCameraEffectPPBase.gameObject;

            var safeTemporaryVFX = voidSafeEffect.AddComponent <TemporaryVisualEffect>();
            safeTemporaryVFX.visualState        = TemporaryVisualEffect.VisualState.Enter;
            safeTemporaryVFX.enterComponents    = new MonoBehaviour[1];
            safeTemporaryVFX.enterComponents[0] = voidSafePPD;
            safeTemporaryVFX.exitComponents     = new MonoBehaviour[1];
            safeTemporaryVFX.exitComponents[0]  = destroyOnTimerSafe;

            voidSafeEffect.SetActive(true);
            voidSafeEffect = PrefabAPI.InstantiateClone(voidSafeEffect, "CRVoidSafeEffect", false);
            Debug.Log("[CRCore3]: Created prefab: " + voidSafeEffect.name);
            #endregion
        }
Ejemplo n.º 10
0
        private static void SetupInteractable(SurvivorDef survivorDef)
        {
            // getting his model references
            var mdlBody    = survivorDef.bodyPrefab.GetComponent <ModelLocator>().modelTransform;
            var shield     = mdlBody.Find("meshSpecials/meshEnforcerShield").gameObject;
            var skateboard = mdlBody.Find("meshSpecials/meshEnforcerSkamteBord").gameObject;

            void setupShield()
            {
                var iscBarrel = (InteractableSpawnCard)Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscBarrel1");

                iscShieldCard = UnityEngine.Object.Instantiate(iscBarrel); //remove?
                //ShieldInteractablePrefab = iscShieldCard.prefab;
                ShieldInteractablePrefab = R2API.PrefabAPI.InstantiateClone(iscShieldCard.prefab, $"Personalized_Enforcer_SelectShield", true);
                BarrelInteraction barrelInteraction = ShieldInteractablePrefab.GetComponent <BarrelInteraction>();

                barrelInteraction.expReward        = 0;
                barrelInteraction.goldReward       = 0;
                barrelInteraction.displayNameToken = "INTERACTABLE_SHIELD_NAME";
                barrelInteraction.contextToken     = "INTERACTABLE_SHIELD_CONTEXT";
                EnforcerSelectSpecialComponent enforcerSelectSpecialComponent = ShieldInteractablePrefab.AddComponent <EnforcerSelectSpecialComponent>();

                enforcerSelectSpecialComponent.slotIndex = 0;
                iscShieldCard.prefab = ShieldInteractablePrefab;
                ShieldInteractablePrefab.GetComponent <GenericDisplayNameProvider>().displayToken = "INTERACTABLE_SHIELD_NAME";
                //EntityLocator entityLocator = ShieldInteractablePrefab.GetComponentInChildren<EntityLocator>();
                //var newShield = Object.Instantiate(shield, entityLocator.transform.parent);
                //newShield.AddComponent<EntityLocator>().entity = entityLocator.entity;
                //Object.Destroy(entityLocator.gameObject);
                //newShield.AddComponent<MeshCollider>().sharedMesh = newShield.GetComponent<SkinnedMeshRenderer>().sharedMesh;
            }

            void setupSwag()
            {
                var iscBarrel = (InteractableSpawnCard)Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscBarrel1");

                iscSwagCard = UnityEngine.Object.Instantiate(iscBarrel); //remove?
                                                                         //ShieldInteractablePrefab = iscShieldCard.prefab;
                SwagInteractablePrefab = R2API.PrefabAPI.InstantiateClone(iscSwagCard.prefab, $"Personalized_Enforcer_SelectSwag", true);
                BarrelInteraction barrelInteraction = SwagInteractablePrefab.GetComponent <BarrelInteraction>();

                barrelInteraction.expReward        = 0;
                barrelInteraction.goldReward       = 0;
                barrelInteraction.displayNameToken = "INTERACTABLE_SWAG_NAME";
                barrelInteraction.contextToken     = "INTERACTABLE_SWAG_CONTEXT";
                EnforcerSelectSpecialComponent enforcerSelectSpecialComponent = SwagInteractablePrefab.AddComponent <EnforcerSelectSpecialComponent>();

                enforcerSelectSpecialComponent.slotIndex = 1;
                iscSwagCard.prefab = SwagInteractablePrefab;
                SwagInteractablePrefab.GetComponent <GenericDisplayNameProvider>().displayToken = "INTERACTABLE_SWAG_NAME";
                //EntityLocator entityLocator = ShieldInteractablePrefab.GetComponentInChildren<EntityLocator>();
                //var newShield = Object.Instantiate(skateboard, entityLocator.transform.parent);
                //newShield.AddComponent<EntityLocator>().entity = entityLocator.entity;
                //Object.Destroy(entityLocator.gameObject);
                //newShield.AddComponent<MeshCollider>().sharedMesh = newShield.GetComponent<SkinnedMeshRenderer>().sharedMesh;
            }

            //sfxlocator.openSound = Play_UI_barrel_open

            //if (BarrelPrefab) PrefabAPI.RegisterNetworkPrefab(BarrelPrefab);
            placementRule = new DirectorPlacementRule
            {
                placementMode   = DirectorPlacementRule.PlacementMode.Approximate,
                maxDistance     = 10f,
                minDistance     = 5f,
                preventOverhead = true
            };

            setupShield();
            setupSwag();

            /*
             * iscSwagCard = Object.Instantiate(iscShieldCard);
             * SwagInteractablePrefab = R2API.PrefabAPI.InstantiateClone(iscSwagCard.prefab, $"Personalized_Enforcer_SelectSwag", true);
             * SwagInteractablePrefab.GetComponent<EnforcerSelectSpecialComponent>().slotIndex = 1;
             * var swagbarrelInteraction = SwagInteractablePrefab.GetComponent<BarrelInteraction>();
             * swagbarrelInteraction.displayNameToken = "INTERACTABLE_SWAG_NAME";
             * swagbarrelInteraction.contextToken = "INTERACTABLE_SWAG_CONTEXT";
             * SwagInteractablePrefab.GetComponent<GenericDisplayNameProvider>().displayToken = "INTERACTABLE_SWAG_NAME";
             * var swagentityLocator = SwagInteractablePrefab.GetComponentInChildren<EntityLocator>();
             * var newSwag = Object.Instantiate(skateboard, swagentityLocator.transform.parent);
             * newSwag.AddComponent<EntityLocator>().entity = swagentityLocator.entity;
             * Object.Destroy(swagentityLocator.gameObject);
             * newSwag.AddComponent<MeshCollider>().sharedMesh = newSwag.GetComponent<SkinnedMeshRenderer>().sharedMesh;*/
        }
Ejemplo n.º 11
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_RiftLens";
            SetItemTierWhenAvailable(ItemTier.Lunar);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Utility,
                ItemTag.AIBlacklist,
                ItemTag.CannotCopy,
                ItemTag.OnStageBeginEffect
            };
            MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef());
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens/Icon.png");
            ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>();

            modelPanelParams.minDistance = 2;
            modelPanelParams.maxDistance = 6;
            itemDisplayPrefab            = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(0.1f, 0.25f, 0.15f), new Vector3(20f, 210f, 0f), new Vector3(0.06f, 0.06f, 0.06f));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.0009F, 0.2635F, 0.1117F), new Vector3(0F, 180F, 0F), new Vector3(0.03F, 0.03F, 0.03F));
                AddDisplayRule("Bandit2Body", "Head", new Vector3(0F, 0.057F, 0.135F), new Vector3(0F, 180F, 180F), new Vector3(0.028F, 0.028F, 0.028F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(0.409F, 3.049F, -1.067F), new Vector3(60F, 0F, 180F), new Vector3(0.3F, 0.3F, 0.3F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.098F, 0.019F, 0.127F), new Vector3(1.506F, 213.327F, 354.045F), new Vector3(0.029F, 0.029F, 0.029F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.005F, 0.525F, 2.043F), new Vector3(0F, 180F, 0F), new Vector3(0.108F, 0.083F, 0.083F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.006F, 0.774F, 0.853F), new Vector3(0F, 177.859F, 0F), new Vector3(0.306F, 0.306F, 0.306F));
                AddDisplayRule("MageBody", "Head", new Vector3(0.048F, 0.06F, 0.117F), new Vector3(13.941F, 189.822F, 2.364F), new Vector3(0.026F, 0.026F, 0.026F));
                AddDisplayRule("MercBody", "Head", new Vector3(0.05F, 0.156F, 0.151F), new Vector3(10.716F, 202.078F, 355.897F), new Vector3(0.053F, 0.053F, 0.053F));
                AddDisplayRule("TreebotBody", "HeadCenter", new Vector3(-0.005F, 0.058F, -0.002F), new Vector3(85.226F, 270F, 270F), new Vector3(0.098F, 0.098F, 0.098F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(0.051F, 0.125F, 0.134F), new Vector3(10.267F, 205.465F, 354.736F), new Vector3(0.047F, 0.04F, 0.048F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-1.531F, 1.934F, 0.459F), new Vector3(14.526F, 104.513F, 346.531F), new Vector3(0.236F, 0.236F, 0.236F));
                AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.085F, 0.108F, 0.013F), new Vector3(69.075F, 70.114F, 350.542F), new Vector3(0.026F, 0.03F, 0.042F));
                AddDisplayRule("BrotherBody", "Head", BrotherInfection.blue, new Vector3(0.003F, -0.01F, 0.061F), new Vector3(349.888F, 70.121F, 339.729F), new Vector3(0.133F, 0.133F, 0.133F));
                AddDisplayRule("ScavBody", "Head", new Vector3(5.068F, 4.15F, -0.55F), new Vector3(46.576F, 301.45F, 310.155F), new Vector3(1.363F, 1.363F, 1.363F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "GunBarrel", new Vector3(0.00002F, 0.07266F, -0.32569F), new Vector3(0F, 180F, 0F), new Vector3(0.02325F, 0.02325F, 0.02325F));
                }
                AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(-0.07466F, -0.14553F, 0.31781F), new Vector3(0F, 180F, 0F), new Vector3(0.02909F, 0.02909F, 0.02909F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.00001F, 0.17385F, 0.09392F), new Vector3(58.31651F, 180F, 180F), new Vector3(0.03831F, 0.03831F, 0.03831F));
            };

            MysticsItemsRiftChest component = riftChest.AddComponent <MysticsItemsRiftChest>();

            SfxLocator sfxLocator = riftChest.AddComponent <SfxLocator>();

            sfxLocator.openSound = "Play_env_riftchest_open";

            riftChest.AddComponent <GenericDisplayNameProvider>().displayToken = "MYSTICSITEMS_RIFTCHEST_NAME";

            PurchaseInteraction purchaseInteraction = riftChest.AddComponent <PurchaseInteraction>();

            purchaseInteraction.displayNameToken = "MYSTICSITEMS_RIFTCHEST_NAME";
            purchaseInteraction.contextToken     = "MYSTICSITEMS_RIFTCHEST_CONTEXT";

            ChestBehavior chestBehavior = riftChest.AddComponent <ChestBehavior>();

            chestBehavior.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/Chest1/dtChest1.asset").WaitForCompletion();

            riftChest.transform.Find("InteractionCollider").gameObject.AddComponent <EntityLocator>().entity = riftChest;

            riftChest.transform.Find("RiftOrigin/Sprite").gameObject.AddComponent <Billboard>();

            ObjectScaleCurve objectScaleCurve = riftChest.transform.Find("RiftOrigin").gameObject.AddComponent <ObjectScaleCurve>();

            objectScaleCurve.useOverallCurveOnly = true;
            objectScaleCurve.overallCurve        = new AnimationCurve()
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f),
                    new Keyframe(1f, 0f)
                }
            };
            objectScaleCurve.timeMax = 0.5f;
            objectScaleCurve.enabled = false;

            //post processing
            GameObject ppHolder = Object.Instantiate(PrefabAPI.InstantiateClone(new GameObject("RiftLensPostProcessing"), "RiftLensPostProcessing", false), riftChest.transform);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal      = false;
            pp.weight        = 1f;
            pp.priority      = 50;
            pp.blendDistance = 10f;
            SphereCollider sphereCollider = ppHolder.AddComponent <SphereCollider>();

            sphereCollider.radius    = 5f;
            sphereCollider.isTrigger = true;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppRiftLens";
            LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>();

            lensDistortion.SetAllOverridesTo(true);
            lensDistortion.intensity.value = -30f;
            lensDistortion.scale.value     = 1f;
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();

            colorGrading.colorFilter.value         = new Color32(178, 242, 255, 255);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            PostProcessDuration ppDuration = pp.gameObject.AddComponent <PostProcessDuration>();

            ppDuration.ppVolume      = pp;
            ppDuration.ppWeightCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, 0f, Mathf.Tan(-45f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(135f * Mathf.Deg2Rad), 0f)
                },
                preWrapMode  = WrapMode.Clamp,
                postWrapMode = WrapMode.Clamp
            };
            ppDuration.maxDuration  = 1;
            ppDuration.destroyOnEnd = true;
            ppDuration.enabled      = false;
            component.ppDuration    = ppDuration;

            riftChestSpawnCard      = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            riftChestSpawnCard.name = "iscMysticsItems_UnstableRift";
            riftChestSpawnCard.directorCreditCost = 0;
            riftChestSpawnCard.forbiddenFlags     = NodeFlags.NoChestSpawn;
            riftChestSpawnCard.hullSize           = HullClassification.Human;
            riftChestSpawnCard.nodeGraphType      = MapNodeGroup.GraphType.Ground;
            riftChestSpawnCard.occupyPosition     = true;
            riftChestSpawnCard.orientToFloor      = false;
            riftChestSpawnCard.sendOverNetwork    = true;
            riftChestSpawnCard.prefab             = riftChest;

            GenericGameEvents.OnPopulateScene += (rng) =>
            {
                int riftsToSpawn = 0;
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    if (characterMaster.teamIndex == TeamIndex.Player)
                    {
                        int thisItemCount = characterMaster.inventory.GetItemCount(itemDef);
                        if (thisItemCount > 0)
                        {
                            characterMaster.inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, characterMaster.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff));
                            characterMaster.inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, baseRifts + riftsPerStack * (thisItemCount - 1));
                            riftsToSpawn += baseRifts.Value + riftsPerStack.Value * (thisItemCount - 1);
                        }
                    }
                }
                if (riftsToSpawn > 0)
                {
                    for (int i = 0; i < riftsToSpawn; i++)
                    {
                        GameObject riftChest = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(riftChestSpawnCard, new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, rng));
                    }
                }
                MysticsItemsRiftLensBehaviour.CalculateCountdownForAll();
            };

            On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) =>
            {
                orig(self);
                self.AddItemBehavior <MysticsItemsRiftLensBehaviour>(self.inventory.GetItemCount(itemDef));
            };

            ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources;

            hudPanelPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/UI/HudModules/HudCountdownPanel"), "RiftLensHUDPanel");
            hudPanelPrefab.transform.Find("Juice/Container/CountdownTitleLabel").GetComponent <LanguageTextMeshController>().token = "OBJECTIVE_MYSTICSITEMS_RIFTLENS_FLAVOUR";
            var col = new Color32(0, 157, 255, 255);

            hudPanelPrefab.transform.Find("Juice/Container/Border").GetComponent <Image>().color = col;
            hudPanelPrefab.transform.Find("Juice/Container/CountdownLabel").GetComponent <HGTextMeshProUGUI>().color = col;

            PositionIndicator positionIndicator = riftPositionIndicator.AddComponent <PositionIndicator>();

            positionIndicator.insideViewObject              = riftPositionIndicator.transform.Find("InsideFrame").gameObject;
            positionIndicator.outsideViewObject             = riftPositionIndicator.transform.Find("OutsideFrame").gameObject;
            positionIndicator.alwaysVisibleObject           = riftPositionIndicator.transform.Find("Sprite").gameObject;
            positionIndicator.shouldRotateOutsideViewObject = true;
            positionIndicator.outsideViewRotationOffset     = 90f;

            GenericGameEvents.OnPlayerCharacterDeath += GenericGameEvents_OnPlayerCharacterDeath;
        }