internal static void InternalActivation() { if (PlayerCommands.UpdateCurrentPlayerBody(out _, out _currentBody)) { var playerTransform = _currentBody.GetComponentInChildren <KinematicCharacterMotor>().transform; var aimDirection = _currentBody.GetComponentInChildren <InputBankTest>().aimDirection; if (Physics.Raycast(playerTransform.position, aimDirection, out var hit, Mathf.Infinity, 1 << 11)) { _currentBody.GetComponentInChildren <KinematicCharacterMotor>().SetPosition(hit.point + new Vector3(0, 5)); } } }
private void UpdateBarbedWard(CharacterBody body) { var cpt = body.GetComponentInChildren <BarbedWard>()?.gameObject; var icnt = GetCount(body); var idmg = body.damage; if (inclDeploys) { idmg += body.master?.GetComponent <Deployable>()?.ownerMaster?.GetBody()?.damage ?? 0; } if (icnt < 1 || idmg <= 0) { if (cpt) { UnityEngine.Object.Destroy(cpt); } } else { if (!cpt) { cpt = UnityEngine.Object.Instantiate(barbedWardPrefab); cpt.GetComponent <TeamFilter>().teamIndex = body.teamComponent.teamIndex; cpt.GetComponent <BarbedWard>().owner = body.gameObject; cpt.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(body.gameObject); } cpt.GetComponent <BarbedWard>().netRadius = baseRadius + (icnt - 1) * stackRadius; cpt.GetComponent <BarbedWard>().netDamage = (baseDmg + (icnt - 1) * stackDmg) * idmg; } }
void Start() { // swap the model var seph = Instantiate(Assets.MainAssetBundle.LoadAsset <GameObject>("seph_obj")); direction = this.transform.root.GetComponentInChildren <CharacterDirection>(); self = this.transform.root.GetComponentInChildren <CharacterBody>(); motor = this.transform.root.GetComponentInChildren <CharacterMotor>(); // set this stuffs foreach (var thisItem in direction.modelAnimator.GetComponentsInChildren <SkinnedMeshRenderer>()) { thisItem.gameObject.SetActive(false); } foreach (var thisItem in direction.modelAnimator.GetComponentsInChildren <MeshRenderer>()) { thisItem.gameObject.SetActive(false); } self.crosshairPrefab = Resources.Load <GameObject>("prefabs/crosshair/simpledotcrosshair"); seph.transform.position = direction.modelAnimator.transform.position; seph.transform.rotation = direction.modelAnimator.transform.rotation; seph.transform.SetParent(direction.modelAnimator.transform); direction.modelAnimator = seph.GetComponentInChildren <Animator>(); // DISABLE ITEM DISPLAYING var model = self.GetComponentInChildren <CharacterModel>(); if (model != null) { model.itemDisplayRuleSet = null; } }
private void UnConstrictBoss(CharacterBody bossBody) { if (bossBody) { var existingConstrict = bossBody.GetComponentInChildren <GurrenLagannShadesConstrictComponent>(); if (existingConstrict && existingConstrict.visualState == 0) { existingConstrict.durationCounter = 0f; existingConstrict.duration = 0f; } } }
private void On_CBOnInventoryChanged(On.RoR2.CharacterBody.orig_OnInventoryChanged orig, CharacterBody self) { orig(self); if (!NetworkServer.active || GetCount(self) < 1) { return; } var cpt = self.GetComponentInChildren <EmbryoComponent>(); if (!cpt) { var cptInst = GameObject.Instantiate(embryoCptPrefab, self.transform); cptInst.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(self.gameObject); } }
////// Non-Public Methods ////// private void AddWard(CharacterBody body) { if (!body) { return; } var cpt = body.GetComponentInChildren <TacticsWard>(); if (!cpt || !cpt.gameObject) { var cptObj = UnityEngine.Object.Instantiate(tacticsWardPrefab); cptObj.GetComponent <TeamFilter>().teamIndex = body.teamComponent.teamIndex; cptObj.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(body.gameObject); } }
private void ConstrictBoss(CharacterBody bossBody) { var existingConstrict = bossBody.GetComponentInChildren <GurrenLagannShadesConstrictComponent>(); if (!existingConstrict || existingConstrict.visualState == 1) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(TemporaryVisualEffects.gurrenLagannShadesBindingEffect, bossBody.corePosition, Quaternion.identity); var component = gameObject.GetComponent <GurrenLagannShadesConstrictComponent>(); component.duration = 8f; component.parentTransform = bossBody.transform; gameObject.transform.SetParent(bossBody.transform); } else { existingConstrict.durationCounter = 0f; } }
private void CheckBuff(On.RoR2.CharacterBody.orig_UpdateBuffs orig, CharacterBody self, float deltaTime) { orig(self, deltaTime); //#if DEBUG // TurboEdition._logger.LogWarning(EquipmentName + "'s hooks: checking for linkedBuff."); //#endif if (!NetworkServer.active) { return; } //this update apparently runs in server so if server is not active this shouldnt even work? doing a check anyways. if (!self) { return; } //I feel like this is also stupid but ok var cbGameObject = self.gameObject; var linkGameObject = self.GetComponentInChildren <LinkComponent>()?.gameObject; if (!self.HasBuff(linkedBuff)) { if (linkGameObject) { #if DEBUG TurboEdition._logger.LogWarning(EquipmentName + "'s hooks: someone doesn't have link debuff but has LinkComponent, destroying."); #endif UnityEngine.Object.Destroy(linkGameObject); } } else { if (!linkGameObject) { #if DEBUG TurboEdition._logger.LogWarning(EquipmentName + "'s hooks: " + self + " has the link debuff but no LinkComponent, creating."); #endif linkGameObject = UnityEngine.Object.Instantiate(linkManager); linkGameObject.GetComponent <LinkComponent>().ownerBody = self; linkGameObject.GetComponent <LinkComponent>().NetRadius = sphereSearchRadius; linkGameObject.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(self.gameObject); //cbGameObject.AddComponent<LinkComponent>(); #if DEBUG TurboEdition._logger.LogWarning(EquipmentName + "'s hooks: LinkComponent created."); #endif } } }
private void UpdateDebuffPulse(On.RoR2.CharacterBody.orig_FixedUpdate orig, CharacterBody body) { orig(body); var component = body.GetComponentInChildren <DebuffPulse>()?.gameObject; var InventoryCount = GetCount(body); if (InventoryCount <= 0 || body.outOfCombat) //This is going to run constantly what the f**k is this ok? { if (component) { #if DEBUG TurboEdition._logger.LogWarning("Player has either zero items or out of combat, destroying component."); #endif UnityEngine.Object.Destroy(component); } } else { if (!component) { #if DEBUG TurboEdition._logger.LogWarning("Player does not have a component, creating one."); #endif //fixedTime = Run.FixedTimeStamp.now; //I forgot why im using this component = UnityEngine.Object.Instantiate(debuffPulsePrefab); component.GetComponent <TeamFilter>().teamIndex = body.teamComponent.teamIndex; component.GetComponent <DebuffPulse>().owner = body.gameObject; component.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(body.gameObject); } #if DEBUG TurboEdition._logger.LogWarning("Updating component properties."); #endif component.GetComponent <DebuffPulse>().netRadius = baseRadius + (InventoryCount - 1) * stackRadius; component.GetComponent <DebuffPulse>().netPulse = InventoryCount * stackPulse; component.GetComponent <DebuffPulse>().netDuration = pulseDuration; } }
public static void CreateDireseeker() { if (DiggerPlugin.direseekerInstalled) { AddUnlockComponent(); } if (DiggerPlugin.fatAcrid.Value) { PerroGrande(); } CreateProjectiles(); LanguageAPI.Add("DIRESEEKER_BODY_NAME", "Direseeker"); LanguageAPI.Add("DIRESEEKER_BODY_SUBTITLE", "Track and Kill"); //LanguageAPI.Add("DIRESEEKER_BODY_LORE", "Direseeker\n\nDireseeker is a giant Elder Lemurian that acts as a boss in the Stage 4 area Magma Barracks. Upon defeating it, the player will unlock the Miner character for future playthroughs. The path leading to Direseeker's location only appears in one of the three variants of the level, and even then Direseeker may or may not spawn with random chance. Completing the teleporter event will also prevent it from spawning.\nNote that in online co-op the boss may spawn for the Host, but not others, although they can still damage it.\nActivating the Artifact of Kin does not prevent it from appearing.\n\nCategories: Enemies | Bosses | Unlisted Enemies\n\nLanguages: EspaƱol"); LanguageAPI.Add("DIRESEEKER_BODY_LORE", "Legends tell of a monstrous beast that once roamed the underground barracks of Petrichor V.\n\nFeared by the bravest of survivors and the nastiest of monsters, the massive beast was unrivaled. It donned blood-red scales, tempered by hellfire. It had burning yellow eyes, with a glare so intense it made the largest of creatures stop dead in their tracks. It had smoldering breath, hot enough to melt metal in an instant.\n\nOnly once stopped by a survivor strong enough to slay Providence himself, it was believed that the beast had finally met its match.\n\n<style=cIsHealth>Until it showed its terrifying face once again.</style>"); LanguageAPI.Add("DIRESEEKER_BODY_OUTRO_FLAVOR", "..and so it left, in search of new prey."); //skills and states LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.SpawnState)); LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.ChargeUltraFireball)); LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.FireUltraFireball)); if (!DiggerPlugin.direseekerInstalled) { bodyPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/LemurianBruiserBody"), "DireseekerBody"); CharacterBody bodyComponent = bodyPrefab.GetComponent <CharacterBody>(); bodyComponent.name = "DireseekerBody"; bodyComponent.baseNameToken = "DIRESEEKER_BODY_NAME"; bodyComponent.subtitleNameToken = "DIRESEEKER_BODY_SUBTITLE"; bodyComponent.baseMoveSpeed = 11f; bodyComponent.baseMaxHealth = 2800f; bodyComponent.levelMaxHealth = 840f; bodyComponent.baseDamage = 20f; bodyComponent.levelDamage = 4f; bodyComponent.isChampion = true; bodyComponent.portraitIcon = Assets.mainAssetBundle.LoadAsset <Sprite>("texDireseekerIcon").texture; SkillSetup(bodyPrefab); var stateMachine = bodyComponent.GetComponentInChildren <EntityStateMachine>(); if (stateMachine) { stateMachine.initialStateType = new SerializableEntityStateType(typeof(EntityStates.Direseeker.SpawnState)); } //resize bodyPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.localScale *= 1.5f; //bodyPrefab.GetComponent<ModelLocator>().modelBaseTransform.gameObject.transform.Translate(new Vector3(0f, 5.6f, 0f)); foreach (KinematicCharacterMotor kinematicCharacterMotor in bodyPrefab.GetComponentsInChildren <KinematicCharacterMotor>()) { kinematicCharacterMotor.SetCapsuleDimensions(kinematicCharacterMotor.Capsule.radius * 1.5f, kinematicCharacterMotor.Capsule.height * 1.5f, 1.5f); } // CharacterModel model = bodyPrefab.GetComponentInChildren <CharacterModel>(); Material newMat = UnityEngine.Object.Instantiate <Material>(model.baseRendererInfos[0].defaultMaterial); newMat.SetTexture("_MainTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_MainTex")); newMat.SetTexture("_EmTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_EmissionMap")); newMat.SetFloat("_EmPower", 50f); model.baseRendererInfos[0].defaultMaterial = newMat; GameObject horn1 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHorn").InstantiateClone("DireseekerHorn", false); GameObject horn2 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHornBroken").InstantiateClone("DireseekerHornBroken", false); //GameObject rageFlame = Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerRageFlame").InstantiateClone("DireseekerRageFlame", false); GameObject burstFlame = Assets.mainAssetBundle.LoadAsset <GameObject>("DireseekerBurstFlame").InstantiateClone("DireseekerBurstFlame", false); ChildLocator childLocator = bodyPrefab.GetComponentInChildren <ChildLocator>(); horn1.transform.SetParent(childLocator.FindChild("Head")); horn1.transform.localPosition = new Vector3(-2.5f, 1, -0.5f); horn1.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90)); horn1.transform.localScale = new Vector3(100, 100, 100); horn2.transform.SetParent(childLocator.FindChild("Head")); horn2.transform.localPosition = new Vector3(2.5f, 1, -0.5f); horn2.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90)); horn2.transform.localScale = new Vector3(100, -100, 100); /*rageFlame.transform.SetParent(childLocator.FindChild("Head")); * rageFlame.transform.localPosition = new Vector3(0, 1, 0); * rageFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0)); * rageFlame.transform.localScale = new Vector3(5, 5, 5);*/ burstFlame.transform.SetParent(childLocator.FindChild("Head")); burstFlame.transform.localPosition = new Vector3(0, 1, 0); burstFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0)); burstFlame.transform.localScale = new Vector3(5, 5, 5); bodyPrefab.AddComponent <DireseekerController>().burstFlame = burstFlame.GetComponent <ParticleSystem>(); Shader hotpoo = Resources.Load <Shader>("Shaders/Deferred/hgstandard"); Material hornMat = horn1.GetComponentInChildren <MeshRenderer>().material; hornMat.shader = hotpoo; //add horns CharacterModel.RendererInfo[] infos = model.baseRendererInfos; CharacterModel.RendererInfo[] newInfos = new CharacterModel.RendererInfo[] { infos[0], new CharacterModel.RendererInfo { renderer = horn1.GetComponentInChildren <MeshRenderer>(), defaultMaterial = hornMat, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = true }, new CharacterModel.RendererInfo { renderer = horn2.GetComponentInChildren <MeshRenderer>(), defaultMaterial = hornMat, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = true } }; model.baseRendererInfos = newInfos; masterPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterMasters/LemurianBruiserMaster"), "DireseekerMaster"); CharacterMaster master = masterPrefab.GetComponent <CharacterMaster>(); master.bodyPrefab = bodyPrefab; master.isBoss = false; DiggerPlugin.bodyPrefabs.Add(bodyPrefab); DiggerPlugin.masterPrefabs.Add(masterPrefab); if (DiggerPlugin.enableDireseeker.Value && !DiggerPlugin.direseekerInstalled) { CharacterSpawnCard characterSpawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>(); characterSpawnCard.name = "cscDireseeker"; characterSpawnCard.prefab = masterPrefab; characterSpawnCard.sendOverNetwork = true; characterSpawnCard.hullSize = HullClassification.BeetleQueen; characterSpawnCard.nodeGraphType = MapNodeGroup.GraphType.Ground; characterSpawnCard.requiredFlags = NodeFlags.None; characterSpawnCard.forbiddenFlags = NodeFlags.TeleporterOK; characterSpawnCard.directorCreditCost = 800; characterSpawnCard.occupyPosition = false; characterSpawnCard.loadout = new SerializableLoadout(); characterSpawnCard.noElites = true; characterSpawnCard.forbiddenAsBoss = false; DirectorCard card = new DirectorCard { spawnCard = characterSpawnCard, selectionWeight = 1, allowAmbushSpawn = false, preventOverhead = false, minimumStageCompletions = 2, spawnDistance = DirectorCore.MonsterSpawnDistance.Close }; DirectorAPI.DirectorCardHolder direseekerCard = new DirectorAPI.DirectorCardHolder { Card = card, MonsterCategory = DirectorAPI.MonsterCategory.Champions, InteractableCategory = DirectorAPI.InteractableCategory.None }; DirectorAPI.MonsterActions += delegate(List <DirectorAPI.DirectorCardHolder> list, DirectorAPI.StageInfo stage) { if (stage.stage == DirectorAPI.Stage.AbyssalDepths) { if (!list.Contains(direseekerCard)) { list.Add(direseekerCard); } } }; } } if (DiggerPlugin.enableDireseekerSurvivor.Value) { survivorPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/LemurianBruiserBody"), "DireseekerPlayerBody"); CharacterBody bodyComponent2 = survivorPrefab.GetComponent <CharacterBody>(); bodyComponent2.name = "DireseekerPlayerBody"; bodyComponent2.baseNameToken = "DIRESEEKER_BODY_NAME"; bodyComponent2.subtitleNameToken = "DIRESEEKER_BODY_SUBTITLE"; bodyComponent2.baseMoveSpeed = 11f; bodyComponent2.baseMaxHealth = 2200f; bodyComponent2.levelMaxHealth = 800f; bodyComponent2.baseRegen = 0.5f; bodyComponent2.levelRegen = 0.2f; bodyComponent2.baseDamage = 20f; bodyComponent2.levelDamage = 4f; bodyComponent2.isChampion = false; bodyComponent2.portraitIcon = Assets.mainAssetBundle.LoadAsset <Sprite>("texDireseekerPlayerIcon").texture; bodyComponent2.hideCrosshair = true; SkillSetup(survivorPrefab); var stateMachine = survivorPrefab.GetComponentInChildren <EntityStateMachine>(); if (stateMachine) { stateMachine.initialStateType = new SerializableEntityStateType(typeof(EntityStates.Direseeker.SpawnState)); } //resize survivorPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.localScale *= 0.75f; survivorPrefab.transform.GetChild(0).localPosition = new Vector3(0, -2.75f, 0); survivorPrefab.transform.GetChild(2).localPosition = new Vector3(0, 0.8f, 1.5f); foreach (KinematicCharacterMotor kinematicCharacterMotor in survivorPrefab.GetComponentsInChildren <KinematicCharacterMotor>()) { kinematicCharacterMotor.SetCapsuleDimensions(kinematicCharacterMotor.Capsule.radius * 0.75f, kinematicCharacterMotor.Capsule.height * 0.75f, 0.75f); } // CharacterModel model2 = survivorPrefab.GetComponentInChildren <CharacterModel>(); Material newMat = UnityEngine.Object.Instantiate <Material>(model2.baseRendererInfos[0].defaultMaterial); newMat.SetTexture("_MainTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_MainTex")); newMat.SetTexture("_EmTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_EmissionMap")); newMat.SetFloat("_EmPower", 50f); model2.baseRendererInfos[0].defaultMaterial = newMat; GameObject horn1b = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHorn").InstantiateClone("DireseekerHorn", false); GameObject horn2b = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHornBroken").InstantiateClone("DireseekerHornBroken", false); //GameObject rageFlame = Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerRageFlame").InstantiateClone("DireseekerRageFlame", false); GameObject burstFlame2 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireseekerBurstFlame").InstantiateClone("DireseekerBurstFlame", false); ChildLocator childLocator2 = survivorPrefab.GetComponentInChildren <ChildLocator>(); horn1b.transform.SetParent(childLocator2.FindChild("Head")); horn1b.transform.localPosition = new Vector3(-2.5f, 1, -0.5f); horn1b.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90)); horn1b.transform.localScale = new Vector3(100, 100, 100); horn2b.transform.SetParent(childLocator2.FindChild("Head")); horn2b.transform.localPosition = new Vector3(2.5f, 1, -0.5f); horn2b.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90)); horn2b.transform.localScale = new Vector3(100, -100, 100); /*rageFlame.transform.SetParent(childLocator.FindChild("Head")); * rageFlame.transform.localPosition = new Vector3(0, 1, 0); * rageFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0)); * rageFlame.transform.localScale = new Vector3(5, 5, 5);*/ burstFlame2.transform.SetParent(childLocator2.FindChild("Head")); burstFlame2.transform.localPosition = new Vector3(0, 1, 0); burstFlame2.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0)); burstFlame2.transform.localScale = new Vector3(5, 5, 5); survivorPrefab.AddComponent <DireseekerController>().burstFlame = burstFlame2.GetComponent <ParticleSystem>(); Shader hotpoo = Resources.Load <Shader>("Shaders/Deferred/hgstandard"); Material hornMat = horn1b.GetComponentInChildren <MeshRenderer>().material; hornMat.shader = hotpoo; //add horns CharacterModel.RendererInfo[] infos2 = model2.baseRendererInfos; CharacterModel.RendererInfo[] newInfos2 = new CharacterModel.RendererInfo[] { infos2[0], new CharacterModel.RendererInfo { renderer = horn1b.GetComponentInChildren <MeshRenderer>(), defaultMaterial = hornMat, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = true }, new CharacterModel.RendererInfo { renderer = horn2b.GetComponentInChildren <MeshRenderer>(), defaultMaterial = hornMat, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = true } }; model2.baseRendererInfos = newInfos2; survivorPrefab.GetComponent <DeathRewards>().logUnlockableDef = null; survivorPrefab.GetComponent <Interactor>().maxInteractionDistance = 5f; survivorPrefab.tag = "Player"; SkinSetup(); DiggerPlugin.bodyPrefabs.Add(survivorPrefab); GameObject displayPrefab = PrefabAPI.InstantiateClone(survivorPrefab.GetComponent <ModelLocator>().modelTransform.gameObject, "DireseekerDisplay", true); displayPrefab.AddComponent <NetworkIdentity>(); displayPrefab.transform.localScale *= 0.5f; SurvivorDef survivorDef = new SurvivorDef { displayNameToken = "DIRESEEKER_BODY_NAME", descriptionToken = "MINER_DESCRIPTION", primaryColor = Color.red, bodyPrefab = survivorPrefab, displayPrefab = displayPrefab, outroFlavorToken = "DIRESEEKER_BODY_OUTRO_FLAVOR" }; SurvivorAPI.AddSurvivor(survivorDef); } }