public override void OnLoad() { equipmentDef.name = "MysticsItems_TuningFork"; ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Ratio Equalizer", 45f); equipmentDef.canDrop = true; ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Ratio Equalizer", true); ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Ratio Equalizer", false); equipmentDef.isLunar = true; equipmentDef.colorIndex = ColorCatalog.ColorIndex.LunarItem; equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Tuning Fork/Model.prefab")); equipmentDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Tuning Fork/Icon.png"); itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false)); equipmentDef.pickupModelPrefab.transform.Find("mdlTuningFork").Rotate(new Vector3(0f, 0f, -45f), Space.Self); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Chest", new Vector3(-0.035F, 0.196F, -0.208F), new Vector3(341.98F, 196.319F, 18.721F), new Vector3(0.042F, 0.042F, 0.042F)); AddDisplayRule("HuntressBody", "Head", new Vector3(0.001F, 0.253F, -0.112F), new Vector3(303.972F, 359.427F, 0.457F), new Vector3(0.053F, 0.023F, 0.052F)); AddDisplayRule("Bandit2Body", "MuzzleShotgun", new Vector3(0.048F, -0.002F, -0.306F), new Vector3(3.659F, 270F, 270F), new Vector3(0.047F, 0.047F, 0.047F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(-2.568F, 2.244F, -0.393F), new Vector3(0F, 90F, 128.784F), new Vector3(0.404F, 0.404F, 0.404F)); AddDisplayRule("EngiBody", "Chest", new Vector3(0.074F, 0.278F, -0.256F), new Vector3(10.736F, 0F, 0F), new Vector3(0.047F, 0.047F, 0.047F)); AddDisplayRule("MageBody", "HandL", new Vector3(-0.018F, -0.007F, 0.069F), new Vector3(348.97F, 0F, 0F), new Vector3(0.044F, 0.044F, 0.044F)); AddDisplayRule("MageBody", "HandR", new Vector3(-0.052F, 0F, -0.059F), new Vector3(2.7F, 32.085F, 0F), new Vector3(0.044F, 0.044F, 0.044F)); AddDisplayRule("MercBody", "HandL", new Vector3(-0.202F, 0.132F, -0.07F), new Vector3(282.883F, 156.523F, 272.905F), new Vector3(0.041F, 0.124F, 0.041F)); AddDisplayRule("TreebotBody", "WeaponPlatform", new Vector3(0F, -0.168F, 0.421F), new Vector3(0F, 0F, 0F), new Vector3(0.146F, 0.087F, 0.146F)); AddDisplayRule("LoaderBody", "MechHandR", new Vector3(0.087F, 0.245F, 0F), new Vector3(0F, 0F, 269.477F), new Vector3(0.076F, 0.076F, 0.076F)); AddDisplayRule("CrocoBody", "SpineChest3", new Vector3(-0.496F, 0.632F, 1.029F), new Vector3(76.142F, 328.553F, 189.334F), new Vector3(0.361F, 0.361F, 0.361F)); AddDisplayRule("CaptainBody", "HandL", new Vector3(0F, 0.197F, -0.042F), new Vector3(0F, 0F, 0F), new Vector3(0.041F, 0.041F, 0.041F)); AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, -4.749F, 0F), new Vector3(90F, 0F, 0F), new Vector3(1.363F, 1.363F, 1.363F)); AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(3.396F, 3.443F, -0.001F), new Vector3(40.988F, 270F, 270F), new Vector3(1.363F, 1.363F, 1.363F)); AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(-3.396F, 3.443F, -0.001F), new Vector3(36.034F, 90F, 90F), new Vector3(1.363F, 1.363F, 1.363F)); AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.069F), new Vector3(52.789F, 0F, 0F), new Vector3(0.267F, 0.267F, 0.267F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Muzzle", new Vector3(-1.3198F, 0.0289F, -0.04268F), new Vector3(0F, 180F, 91.41144F), new Vector3(0.20742F, 0.20742F, 0.20742F)); } AddDisplayRule("RailgunnerBody", "GunBarrel", new Vector3(0F, 0.44626F, -0.00003F), new Vector3(0F, 0F, 0F), new Vector3(0.09836F, 0.09836F, 0.09836F)); AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(-0.23241F, 0.28735F, -0.12019F), new Vector3(340.9082F, 290.4134F, 53.57893F), new Vector3(0.06483F, 0.06483F, 0.06483F)); }; visualEffect = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_TuningForkEffect", false); float time = 1.2f; EffectComponent effectComponent = visualEffect.AddComponent <EffectComponent>(); effectComponent.parentToReferencedTransform = false; effectComponent.applyScale = true; effectComponent.soundName = "Play_item_use_tuningfork"; VFXAttributes vfxAttributes = visualEffect.AddComponent <VFXAttributes>(); vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Always; vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.High; visualEffect.AddComponent <DestroyOnTimer>().duration = time; ShakeEmitter shakeEmitter = visualEffect.AddComponent <ShakeEmitter>(); shakeEmitter.shakeOnStart = true; shakeEmitter.wave = new Wave { frequency = 2f, amplitude = 0.1f }; shakeEmitter.duration = time; shakeEmitter.radius = radius.Value; shakeEmitter.amplitudeTimeDecay = true; GameObject ppHolder = PrefabAPI.InstantiateClone(new GameObject(), "PP", false); ppHolder.AddComponent <MysticsItemsTuningForkPPController>().time = time; SphereCollider ppSphere = ppHolder.AddComponent <SphereCollider>(); ppSphere.radius = radius.Value * 0.3f; ppSphere.isTrigger = true; ppHolder.layer = LayerIndex.postProcess.intVal; PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>(); pp.blendDistance = radius.Value * 0.7f; pp.isGlobal = false; pp.weight = 0f; pp.priority = 4; PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>(); ppProfile.name = "ppLocalTuningFork"; LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>(); lensDistortion.SetAllOverridesTo(true); lensDistortion.intensity.value = -50f; lensDistortion.scale.value = 1f; pp.sharedProfile = ppProfile; ppHolder.transform.SetParent(visualEffect.transform); GameObject radiusIndicator = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/NetworkedObjects/Teleporters/Teleporter1").transform.Find("TeleporterBaseMesh").Find("BuiltInEffects").Find("ChargingEffect").Find("RadiusScaler").Find("ClearAreaIndicator").gameObject, "RadiusIndicator", false); radiusIndicator.AddComponent <MysticsItemsTuningForkRadiusIndicatorController>(); MeshRenderer meshRenderer = radiusIndicator.GetComponent <MeshRenderer>(); meshRenderer.material.SetFloat("_RimPower", 1.2f); meshRenderer.material.SetTexture("_RemapTex", Main.AssetBundle.LoadAsset <Texture2D>("Assets/Equipment/Tuning Fork/texRampTuningFork.png")); for (int i = 0; i < 3; i++) { GameObject radiusIndicator2 = PrefabAPI.InstantiateClone(radiusIndicator, "RadiusIndicator" + (i + 1).ToString(), false); radiusIndicator2.GetComponent <MysticsItemsTuningForkRadiusIndicatorController>().delay = 0.2f * i; radiusIndicator2.GetComponent <MysticsItemsTuningForkRadiusIndicatorController>().time = time - 0.2f * i; radiusIndicator2.transform.SetParent(visualEffect.transform); } MysticsItemsContent.Resources.effectPrefabs.Add(visualEffect); }
public override void OnLoad() { base.OnLoad(); equipmentDef.name = "MysticsItems_GateChalice"; ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Gate Chalice", 60f); equipmentDef.canDrop = true; ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Gate Chalice", false); ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Gate Chalice", false); equipmentDef.isLunar = true; equipmentDef.colorIndex = ColorCatalog.ColorIndex.LunarItem; equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Gate Chalice/Model.prefab")); equipmentDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Gate Chalice/Icon.png"); Material mat = equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").gameObject.GetComponent <MeshRenderer>().sharedMaterial; HopooShaderToMaterial.Standard.Apply(mat); HopooShaderToMaterial.Standard.Gloss(mat, 0.5f); HopooShaderToMaterial.Standard.Emission(mat, 0.02f, new Color(48f / 255f, 127f / 255f, 255f / 255f)); foreach (Transform lightTransform in equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").Find("Lights")) { SetScalableChildEffect(equipmentDef.pickupModelPrefab, lightTransform.gameObject); FlickerLight flickerLight = lightTransform.gameObject.AddComponent <FlickerLight>(); flickerLight.light = lightTransform.gameObject.GetComponent <Light>(); flickerLight.sinWaves = new Wave[] { new Wave { amplitude = 0.3f, frequency = 4f }, new Wave { amplitude = 0.6f, frequency = 2f }, new Wave { amplitude = 0.9f, frequency = 1f } }; } itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.09F, 0.1F, -0.102F), new Vector3(5.862F, 140.357F, 1.915F), new Vector3(0.059F, 0.059F, 0.059F)); AddDisplayRule("HuntressBody", "Pelvis", new Vector3(-0.082F, -0.111F, 0.085F), new Vector3(0.679F, 36.762F, 188.148F), new Vector3(0.047F, 0.047F, 0.048F)); AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.096F, 0.027F, -0.151F), new Vector3(337.162F, 337.663F, 11.532F), new Vector3(0.04F, 0.04F, 0.04F)); AddDisplayRule("ToolbotBody", "Hip", new Vector3(-1.239F, 0.577F, -1.044F), new Vector3(0F, 180F, 180F), new Vector3(0.349F, 0.349F, 0.349F)); AddDisplayRule("EngiBody", "Pelvis", new Vector3(-0.178F, 0.078F, 0.157F), new Vector3(11.745F, 186.295F, 185.936F), new Vector3(0.047F, 0.047F, 0.047F)); AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.128F, -0.131F, 0.024F), new Vector3(6.286F, 3.408F, 167.572F), new Vector3(0.044F, 0.044F, 0.044F)); AddDisplayRule("MercBody", "Chest", new Vector3(0F, 0.193F, -0.286F), new Vector3(71.925F, 180F, 0F), new Vector3(0.027F, 0.027F, 0.027F)); AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.485F, 0.701F, -0.803F), new Vector3(26.173F, 24.306F, 86.838F), new Vector3(0.061F, 0.061F, 0.061F)); AddDisplayRule("LoaderBody", "Pelvis", new Vector3(-0.216F, -0.016F, -0.022F), new Vector3(342.363F, 183.205F, 159.555F), new Vector3(0.045F, 0.045F, 0.045F)); AddDisplayRule("CrocoBody", "SpineStomach1", new Vector3(0.845F, 0.495F, 1.289F), new Vector3(74.633F, 327.618F, 247.859F), new Vector3(0.361F, 0.361F, 0.361F)); AddDisplayRule("CaptainBody", "Stomach", new Vector3(-0.195F, 0.128F, 0.126F), new Vector3(336.504F, 156.734F, 358.159F), new Vector3(0.041F, 0.041F, 0.041F)); AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, 0F, -1.503F), new Vector3(90F, 0F, 0F), new Vector3(2.281F, 2.281F, 2.281F)); AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.069F), new Vector3(0F, 0F, 0F), new Vector3(0.267F, 0.267F, 0.267F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.19432F, 0.18834F, -0.17385F), new Vector3(343.5044F, 339.549F, 357.2065F), new Vector3(0.05181F, 0.05181F, 0.05181F)); } AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.14878F, -0.03065F, 0.10522F), new Vector3(354.5591F, 180F, 180F), new Vector3(0.05639F, 0.05639F, 0.05639F)); AddDisplayRule("VoidSurvivorBody", "Hand", new Vector3(-0.03581F, 0.28639F, -0.00539F), new Vector3(0F, 0F, 4.98446F), new Vector3(0.09781F, 0.09781F, 0.09781F)); }; visualEffectOnUse = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceOnUseEffect", false); EffectComponent effectComponent = visualEffectOnUse.AddComponent <EffectComponent>(); effectComponent.soundName = "Play_env_teleporter_active_button"; effectComponent.positionAtReferencedTransform = true; effectComponent.applyScale = true; effectComponent.disregardZScale = true; VFXAttributes vfxAttributes = visualEffectOnUse.AddComponent <VFXAttributes>(); vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Low; vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low; visualEffectOnUse.AddComponent <DestroyOnTimer>().duration = 2f; GameObject massSparks = PrefabAPI.InstantiateClone(new GameObject(), "MassSparks", false); ParticleSystem particleSystem = massSparks.AddComponent <ParticleSystem>(); massSparks.GetComponent <ParticleSystemRenderer>().material = Object.Instantiate(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ActivateRadarTowerEffect").transform.Find("MassSparks").gameObject.GetComponent <ParticleSystemRenderer>().material); particleSystem.useAutoRandomSeed = true; ParticleSystem.MainModule mainModule = particleSystem.main; mainModule.simulationSpace = ParticleSystemSimulationSpace.World; mainModule.scalingMode = ParticleSystemScalingMode.Local; mainModule.startLifetime = 5f; mainModule.duration = 1f; mainModule.playOnAwake = true; ParticleSystem.MinMaxCurve particleSpeed = mainModule.startSpeed; particleSpeed.mode = ParticleSystemCurveMode.TwoConstants; particleSpeed.constantMin = 10f; particleSpeed.constantMax = 1000f; mainModule.startSize = 0.1f; mainModule.startColor = new Color(48f / 255f, 127f / 255f, 255f / 255f); mainModule.gravityModifier = 0.3f; mainModule.maxParticles = 20; ParticleSystem.EmissionModule emissionModule = particleSystem.emission; emissionModule.enabled = true; emissionModule.rateOverTime = 10; emissionModule.rateOverDistance = 0; emissionModule.SetBursts(new ParticleSystem.Burst[] { new ParticleSystem.Burst { time = 0f, count = 20f, cycleCount = 1, repeatInterval = 0.01f, probability = 1f } }); ParticleSystem.ShapeModule shapeModule = particleSystem.shape; shapeModule.shapeType = ParticleSystemShapeType.Sphere; massSparks.transform.SetParent(visualEffectOnUse.transform); MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectOnUse); visualEffectTeleportOut = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceTeleportOutEffect", false); effectComponent = visualEffectTeleportOut.AddComponent <EffectComponent>(); vfxAttributes = visualEffectTeleportOut.AddComponent <VFXAttributes>(); vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Always; vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium; visualEffectTeleportOut.AddComponent <DestroyOnTimer>().duration = 4f; GameObject ppHolder = PrefabAPI.InstantiateClone(new GameObject(), "PP", false); ppHolder.layer = LayerIndex.postProcess.intVal; ppHolder.AddComponent <MysticsItemsGateChalicePPController>().time = 3f; PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>(); pp.isGlobal = true; pp.weight = 0f; pp.priority = 50; PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>(); ppProfile.name = "ppGateChalice"; LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>(); lensDistortion.SetAllOverridesTo(true); lensDistortion.intensity.value = -100f; lensDistortion.scale.value = 1f; ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>(); colorGrading.colorFilter.value = new Color(97f / 255f, 163f / 255f, 239f / 255f); colorGrading.colorFilter.overrideState = true; pp.sharedProfile = ppProfile; ppHolder.transform.SetParent(visualEffectTeleportOut.transform); MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectTeleportOut); SceneExitController sceneExitController = sceneExitControllerObject.AddComponent <SceneExitController>(); sceneExitController.useRunNextStageScene = true; sceneExitControllerObject.AddComponent <MysticsItemsGateChaliceSceneExit>(); itemDestroyEffectPrefab = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceItemDestroyEffect", false); EntityStateMachine entityStateMachine = itemDestroyEffectPrefab.AddComponent <EntityStateMachine>(); entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsGateChaliceItemDestroyEffect)); PickupDisplay pickupDisplay = itemDestroyEffectPrefab.AddComponent <PickupDisplay>(); Rigidbody rigidbody = itemDestroyEffectPrefab.AddComponent <Rigidbody>(); rigidbody.useGravity = false; rigidbody.drag = 2f; effectComponent = itemDestroyEffectPrefab.AddComponent <EffectComponent>(); effectComponent.applyScale = true; effectComponent.soundName = "Play_moonBrother_phase4_itemSuck_returnSingle"; vfxAttributes = itemDestroyEffectPrefab.AddComponent <VFXAttributes>(); vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.High; vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Always; Highlight highlight = itemDestroyEffectPrefab.AddComponent <Highlight>(); pickupDisplay.highlight = highlight; highlight.highlightColor = Highlight.HighlightColor.pickup; MysticsItemsContent.Resources.effectPrefabs.Add(itemDestroyEffectPrefab); }
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; }