void ReplaceTurretAtPosition(int id, ItemScript item) { if (Network.isServer) { if (id >= 0 && id <= m_attachedTurretsItemWrappers.Length && item) { //Put the new turret into the item wrapper list m_attachedTurretsItemWrappers[id - 1] = item.gameObject; //Tell the turret holder to spawn the new turret GetCTurretHolderWithId(id).GetComponent <CShipTurretHolder>().ReplaceAttachedTurret(item.GetEquipmentReference()); //Propagate equipped items to clients too for (int i = 0; i < m_attachedTurretsItemWrappers.Length; i++) { networkView.RPC("PropagateAttachTurretItemWrappers", RPCMode.Others, i, m_attachedTurretsItemWrappers[i].GetComponent <ItemScript>().m_equipmentID); } } else { Debug.LogError("Unable to equip " + item + " at ID #" + id + " on " + name); } } else { Debug.LogError("A client attempted to call " + name + ".CapitalShipScript.ReplaceTurretPosition()"); } }