public void AddDeployable(Deployable deployable, DeployableSlot slot) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.CharacterMaster::AddDeployable(RoR2.Deployable,RoR2.DeployableSlot)' called on client"); return; } if (deployable.ownerMaster) { Debug.LogErrorFormat("Attempted to add deployable {0} which already belongs to master {1} to master {2}.", new object[] { deployable.gameObject, deployable.ownerMaster.gameObject, base.gameObject }); } if (this.deployablesList == null) { this.deployablesList = new List <DeployableInfo>(); } int num = 0; int deployableSameSlotLimit = this.GetDeployableSameSlotLimit(slot); for (int i = this.deployablesList.Count - 1; i >= 0; i--) { if (this.deployablesList[i].slot == slot) { num++; if (num >= deployableSameSlotLimit) { Deployable deployable2 = this.deployablesList[i].deployable; this.deployablesList.RemoveAt(i); deployable2.ownerMaster = null; deployable2.onUndeploy.Invoke(); } } } this.deployablesList.Add(new DeployableInfo { deployable = deployable, slot = slot }); deployable.ownerMaster = this; }
public void RemoveDeployable(Deployable deployable) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.CharacterMaster::RemoveDeployable(RoR2.Deployable)' called on client"); return; } if (this.deployablesList == null || deployable.ownerMaster != this) { return; } deployable.ownerMaster = null; for (int i = this.deployablesList.Count - 1; i >= 0; i--) { if (this.deployablesList[i].deployable == deployable) { this.deployablesList.RemoveAt(i); } } }
public void AddDeployable(Deployable deployable, DeployableSlot slot) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.CharacterMaster::AddDeployable(RoR2.Deployable,RoR2.DeployableSlot)' called on client"); return; } if (deployable.ownerMaster) { Debug.LogErrorFormat("Attempted to add deployable {0} which already belongs to master {1} to master {2}.", new object[] { deployable.gameObject, deployable.ownerMaster.gameObject, base.gameObject }); } if (this.deployablesList == null) { this.deployablesList = new List <DeployableInfo>(); } int num = 0; int num2 = 0; switch (slot) { case DeployableSlot.EngiMine: num2 = 10; break; case DeployableSlot.EngiTurret: num2 = 2; break; case DeployableSlot.BeetleGuardAlly: num2 = this.inventory.GetItemCount(ItemIndex.BeetleGland); break; case DeployableSlot.EngiBubbleShield: num2 = 1; break; } for (int i = this.deployablesList.Count - 1; i >= 0; i--) { if (this.deployablesList[i].slot == slot) { num++; if (num >= num2) { Deployable deployable2 = this.deployablesList[i].deployable; this.deployablesList.RemoveAt(i); deployable2.ownerMaster = null; deployable2.onUndeploy.Invoke(); } } } this.deployablesList.Add(new DeployableInfo { deployable = deployable, slot = slot }); deployable.ownerMaster = this; }