public void OnReceived() { if (NetworkServer.active) { return; } GameObject owner = Util.FindNetworkObject(ownerNetId); if (!owner) { return; } LunarChimeraComponent lcComponent = LunarChimeraComponent.GetOrCreateComponent(owner); lcComponent.syncIds.Enqueue(minionNetId); }
private void SummonLunarChimera(On.RoR2.CharacterBody.orig_FixedUpdate orig, CharacterBody self) { int inventoryCount = GetCount(self); CharacterMaster master = self.master; if (NetworkServer.active && inventoryCount > 0 && master && !IsMinion(master)) //Check if we're a minion or not. If we are, we don't summon a chimera. { LunarChimeraComponent lcComponent = LunarChimeraComponent.GetOrCreateComponent(master); if (!lcComponent.LastChimeraSpawned || !lcComponent.LastChimeraSpawned.master || !lcComponent.LastChimeraSpawned.master.hasBody) { lcComponent.LastChimeraSpawned = null; lcComponent.ResummonCooldown -= Time.fixedDeltaTime; if (lcComponent.ResummonCooldown <= 0f && SceneCatalog.mostRecentSceneDef != SceneCatalog.GetSceneDefFromSceneName("bazaar")) { DirectorPlacementRule placeRule = new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Approximate, minDistance = 10f, maxDistance = 40f, spawnOnTarget = self.transform }; DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(lunarChimeraSpawnCard, placeRule, RoR2Application.rng) { teamIndexOverride = TeamIndex.Player //summonerBodyObject = self.gameObject }; GameObject gameObject = DirectorCore.instance.TrySpawnObject(directorSpawnRequest); if (gameObject) { CharacterMaster cMaster = gameObject.GetComponent <CharacterMaster>(); if (cMaster) { //RoR2.Chat.AddMessage($"Character Master Found: {component}"); cMaster.teamIndex = TeamIndex.Neutral; cMaster.inventory.GiveItem(ItemIndex.BoostDamage, lunarChimeraBaseDamageBoost + (lunarChimeraAdditionalDamageBoost * inventoryCount - 1)); cMaster.inventory.GiveItem(ItemIndex.BoostHp, lunarChimeraBaseHPBoost * inventoryCount); cMaster.inventory.GiveItem(ItemIndex.BoostAttackSpeed, lunarChimeraBaseAttackSpeedBoost); cMaster.inventory.GiveItem(ItemIndex.Hoof, lunarChimeraBaseMovementSpeedBoost * inventoryCount); cMaster.minionOwnership.SetOwner(master); CharacterBody cBody = cMaster.GetBody(); if (cBody) { //RoR2.Chat.AddMessage($"CharacterBody Found: {component4}"); cBody.teamComponent.teamIndex = TeamIndex.Neutral; cBody.gameObject.AddComponent <LunarChimeraRetargetComponent>(); lcComponent.LastChimeraSpawned = cBody; DeathRewards deathRewards = cBody.GetComponent <DeathRewards>(); if (deathRewards) { //RoR2.Chat.AddMessage($"DeathRewards Found: {component5}"); deathRewards.goldReward = 0; deathRewards.expReward = 0; } NetworkIdentity bodyNet = cBody.GetComponent <NetworkIdentity>(); if (bodyNet) { new AssignOwner(lcComponent.netId, bodyNet.netId).Send(NetworkDestination.Clients); } } } lcComponent.ResummonCooldown = lunarChimeraResummonCooldownDuration; } } } } orig(self); }