Exemplo n.º 1
0
        public static bool ItemTool_CompleteUnsocketItem(OWItem ____heldItem)
        {
            var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem));

            QSBEventManager.FireEvent(EventNames.QSBSocketItem, 0, itemId, SocketEventType.CompleteUnsocket);
            return(true);
        }
Exemplo n.º 2
0
        public static bool ItemTool_StartUnsocketItem(OWItemSocket socket)
        {
            var socketId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(socket));

            QSBEventManager.FireEvent(EventNames.QSBSocketItem, socketId, 0, SocketEventType.StartUnsocket);
            return(true);
        }
Exemplo n.º 3
0
        public static bool ItemTool_MoveItemToCarrySocket(OWItem item)
        {
            var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(item));

            QSBEventManager.FireEvent(EventNames.QSBMoveToCarry, itemId);
            return(true);
        }
        private void OnDisable(Shape s)
        {
            if (!IsEnabled)
            {
                return;
            }
            if (GetAttachedShapes().Any(x => x.gameObject.activeInHierarchy))
            {
                return;
            }
            IsEnabled = false;
            if (!QSBCore.HasWokenUp && !QSBCore.IsServer)
            {
                return;
            }
            if (ControllingPlayer != QSBPlayerManager.LocalPlayerId)
            {
                // not being controlled by us, don't care if we leave area
                return;
            }
            var id = QSBWorldSync.GetIdFromTypeSubset <IQSBQuantumObject>(this);

            // send event to other players that we're releasing authority
            QSBEventManager.FireEvent(EventNames.QSBQuantumAuthority, id, 0u);
        }
        private void Update()
        {
            if (!QSBCore.IsInMultiplayer)
            {
                return;
            }
            var controller = Locator.GetPlayerController();

            if (controller == null)
            {
                return;
            }
            var collidingQuantumObject = controller.GetValue <QuantumObject>("_collidingQuantumObject");

            if (_previousCollidingQuantumObject != collidingQuantumObject)
            {
                var objectIndex = (collidingQuantumObject != null)
                                        ? QSBWorldSync.GetIdFromTypeSubset(QuantumManager.GetObject(collidingQuantumObject))
                                        : -1;

                QSBEventManager.FireEvent(
                    EventNames.QSBPlayerEntangle,
                    objectIndex);
                _previousCollidingQuantumObject = collidingQuantumObject;
            }
        }
        private void OnEnable(Shape s)
        {
            IsEnabled = true;
            if (!QSBCore.HasWokenUp && !QSBCore.IsServer)
            {
                return;
            }
            if (ControllingPlayer != 0)
            {
                // controlled by another player, dont care that we activate it
                return;
            }
            var id = QSBWorldSync.GetIdFromTypeSubset <IQSBQuantumObject>(this);

            // no one is controlling this object right now, request authority
            QSBEventManager.FireEvent(EventNames.QSBQuantumAuthority, id, QSBPlayerManager.LocalPlayerId);
        }
Exemplo n.º 7
0
        public static bool ItemTool_DropItem(RaycastHit hit, OWRigidbody targetRigidbody, DetachableFragment detachableFragment, ref OWItem ____heldItem)
        {
            Locator.GetPlayerAudioController().PlayDropItem(____heldItem.GetItemType());
            var    hitGameObject = hit.collider.gameObject;
            var    gameObject2   = hitGameObject;
            var    sectorGroup   = gameObject2.GetComponent <ISectorGroup>();
            Sector sector        = null;

            while (sectorGroup == null && gameObject2.transform.parent != null)
            {
                gameObject2 = gameObject2.transform.parent.gameObject;
                sectorGroup = gameObject2.GetComponent <ISectorGroup>();
            }
            if (sectorGroup != null)
            {
                sector = sectorGroup.GetSector();
            }
            var parent = (detachableFragment != null)
                                ? detachableFragment.transform
                                : targetRigidbody.transform;
            var objectId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem));

            ____heldItem.DropItem(hit.point, hit.normal, parent, sector, detachableFragment);
            ____heldItem = null;
            Locator.GetToolModeSwapper().UnequipTool();
            var parentSector = parent.GetComponentInChildren <Sector>();

            if (parentSector != null)
            {
                var localPos = parentSector.transform.InverseTransformPoint(hit.point);
                QSBEventManager.FireEvent(EventNames.QSBDropItem, objectId, localPos, hit.normal, parentSector);
                return(false);
            }
            DebugLog.ToConsole($"Error - No sector found for rigidbody {targetRigidbody.name}!.", MessageType.Error);
            return(false);
        }