private bool CheckHandApply(GameObject target)
    {
        //call the used object's handapply interaction methods if it has any, for each object we are applying to
        var handApply    = HandApply.ByLocalPlayer(target);
        var posHandApply = PositionalHandApply.ByLocalPlayer(target);

        //if handobj is null, then its an empty hand apply so we only need to check the receiving object
        if (handApply.HandObject != null)
        {
            //get all components that can handapply or PositionalHandApply
            var handAppliables = handApply.HandObject.GetComponents <MonoBehaviour>()
                                 .Where(c => c != null && c.enabled && (c is IBaseInteractable <HandApply> || c is IBaseInteractable <PositionalHandApply>));
            Logger.LogTraceFormat("Checking HandApply / PositionalHandApply interactions from {0} targeting {1}",
                                  Category.Interaction, handApply.HandObject.name, target.name);

            foreach (var handAppliable in handAppliables.Reverse())
            {
                var interacted = false;
                if (handAppliable is IBaseInteractable <HandApply> )
                {
                    var hap = handAppliable as IBaseInteractable <HandApply>;
                    if (hap.CheckInteract(handApply, NetworkSide.Client))
                    {
                        InteractionUtils.RequestInteract(handApply, hap);
                        return(true);
                    }
                }
                else
                {
                    var hap = handAppliable as IBaseInteractable <PositionalHandApply>;
                    if (hap.CheckInteract(posHandApply, NetworkSide.Client))
                    {
                        InteractionUtils.RequestInteract(posHandApply, hap);
                        return(true);
                    }
                }
            }
        }

        //call the hand apply interaction methods on the target object if it has any
        var targetHandAppliables = handApply.TargetObject.GetComponents <MonoBehaviour>()
                                   .Where(c => c != null && c.enabled && (c is IBaseInteractable <HandApply> || c is IBaseInteractable <PositionalHandApply>));

        foreach (var targetHandAppliable in targetHandAppliables.Reverse())
        {
            var interacted = false;
            if (targetHandAppliable is IBaseInteractable <HandApply> )
            {
                var hap = targetHandAppliable as IBaseInteractable <HandApply>;
                if (hap.CheckInteract(handApply, NetworkSide.Client))
                {
                    InteractionUtils.RequestInteract(handApply, hap);
                    return(true);
                }
            }
            else
            {
                var hap = targetHandAppliable as IBaseInteractable <PositionalHandApply>;
                if (hap.CheckInteract(posHandApply, NetworkSide.Client))
                {
                    InteractionUtils.RequestInteract(posHandApply, hap);
                    return(true);
                }
            }
        }

        return(false);
    }
Пример #2
0
 /// <summary>
 /// Validates if the performer is in range and not in crit for a HandApply interaction.
 /// </summary>
 /// <param name="toValidate">interaction to validate</param>
 /// <param name="side">side of the network this is being checked on</param>
 /// <param name="allowSoftCrit">whether to allow interaction while in soft crit</param>
 /// <param name="reachRange">range to allow</param>
 /// <returns></returns>
 public static bool CanApply(HandApply toValidate, NetworkSide side, bool allowSoftCrit = false, ReachRange reachRange = ReachRange.Standard) =>
 CanApply(toValidate.Performer, toValidate.TargetObject, side, allowSoftCrit, reachRange);
Пример #3
0
 public void OnPickupServer(HandApply interaction)
 {
     //Do a sync of the storage items when adding to UI
     storageObj.NotifyPlayer(interaction.Performer);
 }
Пример #4
0
 public override void ClientPredictInteraction(HandApply interaction)
 {
 }
Пример #5
0
    public static bool CheckHandApply(GameObject target)
    {
        //call the used object's handapply interaction methods if it has any, for each object we are applying to
        var handApply    = HandApply.ByLocalPlayer(target);
        var posHandApply = PositionalHandApply.ByLocalPlayer(target);

        //if handobj is null, then its an empty hand apply so we only need to check the receiving object
        if (handApply.HandObject != null)
        {
            //get all components that can handapply or PositionalHandApply
            var handAppliables = handApply.HandObject.GetComponents <MonoBehaviour>()
                                 .Where(c => c != null && c.enabled && (c is IBaseInteractable <HandApply> || c is IBaseInteractable <PositionalHandApply>));
            Logger.LogTraceFormat("Checking HandApply / PositionalHandApply interactions from {0} targeting {1}",
                                  Category.Interaction, handApply.HandObject.name, target.name);

            foreach (var handAppliable in handAppliables.Reverse())
            {
                if (handAppliable is IBaseInteractable <HandApply> )
                {
                    var hap = handAppliable as IBaseInteractable <HandApply>;
                    if (CheckInteractInternal(hap, handApply, NetworkSide.Client))
                    {
                        Highlight.instance.material.SetColor("_OutlineColor", Color.cyan);
                        return(true);
                    }
                }
                else
                {
                    var hap = handAppliable as IBaseInteractable <PositionalHandApply>;
                    if (CheckInteractInternal(hap, posHandApply, NetworkSide.Client))
                    {
                        Highlight.instance.material.SetColor("_OutlineColor", Color.magenta);
                        return(true);
                    }
                }
            }
        }


        //call the hand apply interaction methods on the target object if it has any
        var targetHandAppliables = handApply.TargetObject.GetComponents <MonoBehaviour>()
                                   .Where(c => c != null && c.enabled && (c is IBaseInteractable <HandApply> || c is IBaseInteractable <PositionalHandApply>));

        foreach (var targetHandAppliable in targetHandAppliables.Reverse())
        {
            if (targetHandAppliable is IBaseInteractable <HandApply> Hap)
            {
                //var hap = targetHandAppliable as IBaseInteractable<HandApply>;
                if (CheckInteractInternal(Hap, handApply, NetworkSide.Client))
                {
                    Highlight.instance.material.SetColor("_OutlineColor", Color.green);
                    return(true);
                }
            }
            else
            {
                var hap = targetHandAppliable as IBaseInteractable <PositionalHandApply>;
                if (CheckInteractInternal(hap, posHandApply, NetworkSide.Client))
                {
                    Highlight.instance.material.SetColor("_OutlineColor", new Color(1, 0.647f, 0));
                    return(true);
                }
            }
        }
        //Highlight.instance.material.SetColor("_OutlineColor", Color.grey);
        return(false);
    }
Пример #6
0
 public override void Interaction(HandApply interaction)
 {
     TabUpdateMessage.Send(interaction.Performer, gameObject, NetTabType.Filter, TabAction.Open);
 }
Пример #7
0
 /// <summary>
 /// Server:
 /// Allows player to open / close bags in reach using alt-click
 /// </summary>
 public void ServerPerformInteraction(HandApply interaction)
 {
     //Reusing mouse drop logic for efficiency
     ServerPerformInteraction(MouseDrop.ByClient(interaction.Performer, interaction.TargetObject, interaction.Performer, interaction.Intent));
 }
    public override IEnumerator Process()
    {
        var performer = SentByPlayer.GameObject;

        if (InteractionType == typeof(PositionalHandApply))
        {
            //look up item in active hand slot
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            yield return(WaitFor(TargetObject, ProcessorObject));

            var targetObj    = NetworkObjects[0];
            var processorObj = NetworkObjects[1];
            var interaction  = PositionalHandApply.ByClient(performer, usedObject, targetObj, TargetVector, usedSlot);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(HandApply))
        {
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            yield return(WaitFor(TargetObject, ProcessorObject));

            var targetObj    = NetworkObjects[0];
            var processorObj = NetworkObjects[1];
            var interaction  = HandApply.ByClient(performer, usedObject, targetObj, TargetBodyPart, usedSlot);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(AimApply))
        {
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            yield return(WaitFor(ProcessorObject));

            var processorObj = NetworkObject;
            var interaction  = AimApply.ByClient(performer, TargetVector, usedObject, usedSlot, MouseButtonState);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(MouseDrop))
        {
            yield return(WaitFor(UsedObject, TargetObject, ProcessorObject));

            var usedObj      = NetworkObjects[0];
            var targetObj    = NetworkObjects[1];
            var processorObj = NetworkObjects[2];
            var interaction  = MouseDrop.ByClient(performer, usedObj, targetObj);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(HandActivate))
        {
            yield return(WaitFor(ProcessorObject));

            var processorObj = NetworkObject;
            var performerObj = SentByPlayer.GameObject;
            //look up item in active hand slot
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            var interaction   = HandActivate.ByClient(performer, usedObject, usedSlot);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(InventoryApply))
        {
            yield return(WaitFor(ProcessorObject, UsedObject, Storage));

            var processorObj = NetworkObjects[0];
            var usedObj      = NetworkObjects[1];
            var storageObj   = NetworkObjects[2];

            ItemSlot targetSlot = null;
            if (SlotIndex == -1)
            {
                targetSlot = ItemSlot.GetNamed(storageObj.GetComponent <ItemStorage>(), NamedSlot);
            }
            else
            {
                targetSlot = ItemSlot.GetIndexed(storageObj.GetComponent <ItemStorage>(), SlotIndex);
            }

            //if used object is null, then empty hand was used
            ItemSlot fromSlot = null;
            if (usedObj == null)
            {
                fromSlot = SentByPlayer.Script.ItemStorage.GetActiveHandSlot();
            }
            else
            {
                fromSlot = usedObj.GetComponent <Pickupable>().ItemSlot;
            }
            var interaction = InventoryApply.ByClient(performer, targetSlot, fromSlot);
            ProcessInteraction(interaction, processorObj);
        }
    }
Пример #9
0
 /// <summary>
 /// Uses one charge from the emag, returns true if successful
 /// </summary>
 public bool UseCharge(HandApply interaction)
 {
     return(UseCharge(interaction.TargetObject, interaction.Performer));
 }
Пример #10
0
        public void ServerPerformInteraction(HandApply interaction)
        {
            SoundManager.PlayNetworkedAtPos(SingletonSOSounds.Instance.Click01, interaction.TargetObject.WorldPosServer(), sourceObj: gameObject);

            Unbuckle();
        }
Пример #11
0
 /// <summary>
 /// Checks if the object targeted by the interaction is blocked by anything that would prevent anchoring.
 /// Optionally messages performer telling them why its blocked if it is blocked.
 /// </summary>
 /// <param name="handApply">interaction attempting to anchor the object.</param>
 /// <param name="allowed">If defined, will be used to check each other registertile at the position. It should return
 /// true if this object is allowed to be anchored on top of the given register tile, otherwise false.
 /// If unspecified, all non-floor registertiles will be considered as blockers at the indicated position</param>
 public static bool IsAnchorBlocked(HandApply handApply, Func <RegisterTile, bool> allowed = null, bool messagePerformer = true)
 {
     return(IsConstructionBlocked(handApply.Performer, handApply.TargetObject,
                                  handApply.TargetObject.TileWorldPosition(), allowed, messagePerformer));
 }
Пример #12
0
        public override ModuleSignal ClosedInteraction(HandApply interaction, HashSet <DoorProcessingStates> States)
        {
            var ItemStorage = interaction.Performer.GetComponent <DynamicItemStorage>();

            return(EmagChecks(ItemStorage, interaction, States));
        }
Пример #13
0
 public void ServerPerformInteraction(HandApply interaction)
 {
     Rotate();
 }
Пример #14
0
 protected override bool WillInteract(HandApply interaction, NetworkSide side)
 {
     //only wrench can be used
     return(DefaultWillInteract.HandApply(interaction, side) &&
            Validations.IsTool(interaction.UsedObject, ToolType.Wrench));
 }
Пример #15
0
 private void TryScrewdriver(HandApply interaction)
 {
     Chat.AddActionMsgToChat(interaction.Performer, $"You {(panelOpen ? "close" : "open")} the cameras back panel",
                             $"{interaction.Performer.ExpensiveName()} {(panelOpen ? "closes" : "opens")} the cameras back panel");
     panelOpen = !panelOpen;
 }
Пример #16
0
 private void RightClickInteract()
 {
     //trigger the interaction manually, triggered via the right click menu
     Interact(HandApply.ByLocalPlayer(gameObject), nameof(Pickupable));
 }
Пример #17
0
 public void ServerPerformInteraction(HandApply interaction)
 {
     ServerCombine(interaction.TargetObject.GetComponent <Stackable>());
 }
Пример #18
0
 protected override bool WillInteract(HandApply interaction, NetworkSide side)
 {
     return(Validations.ValidateWithServerRollback(interaction, side, CheckWillInteract, ServerInformClientRollback));
 }
Пример #19
0
    public override void Process()
    {
        var performer = SentByPlayer.GameObject;

        if (SentByPlayer == null || SentByPlayer.Script == null || SentByPlayer.Script.ItemStorage == null)
        {
            return;
        }

        if (InteractionType == typeof(PositionalHandApply))
        {
            //look up item in active hand slot
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            LoadMultipleObjects(new uint[] {
                TargetObject, ProcessorObject
            });
            var targetObj    = NetworkObjects[0];
            var processorObj = NetworkObjects[1];
            var interaction  = PositionalHandApply.ByClient(performer, usedObject, targetObj, TargetVector, usedSlot, Intent, TargetBodyPart);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(HandApply))
        {
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            LoadMultipleObjects(new uint[] {
                TargetObject, ProcessorObject
            });
            var targetObj    = NetworkObjects[0];
            var processorObj = NetworkObjects[1];
            var interaction  = HandApply.ByClient(performer, usedObject, targetObj, TargetBodyPart, usedSlot, Intent, IsAltUsed);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(AimApply))
        {
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            LoadNetworkObject(ProcessorObject);
            var processorObj = NetworkObject;
            var interaction  = AimApply.ByClient(performer, TargetVector, usedObject, usedSlot, MouseButtonState, Intent);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(MouseDrop))
        {
            LoadMultipleObjects(new uint[] { UsedObject,
                                             TargetObject, ProcessorObject });
            var usedObj      = NetworkObjects[0];
            var targetObj    = NetworkObjects[1];
            var processorObj = NetworkObjects[2];
            var interaction  = MouseDrop.ByClient(performer, usedObj, targetObj, Intent);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(HandActivate))
        {
            LoadNetworkObject(ProcessorObject);

            var processorObj = NetworkObject;
            var performerObj = SentByPlayer.GameObject;
            //look up item in active hand slot
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            var interaction   = HandActivate.ByClient(performer, usedObject, usedSlot, Intent);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(InventoryApply))
        {
            LoadMultipleObjects(new uint[] { ProcessorObject, UsedObject,
                                             Storage });
            var processorObj = NetworkObjects[0];
            var usedObj      = NetworkObjects[1];
            var storageObj   = NetworkObjects[2];

            ItemSlot targetSlot = null;
            if (SlotIndex == -1)
            {
                targetSlot = ItemSlot.GetNamed(storageObj.GetComponent <ItemStorage>(), NamedSlot);
            }
            else
            {
                targetSlot = ItemSlot.GetIndexed(storageObj.GetComponent <ItemStorage>(), SlotIndex);
            }

            //if used object is null, then empty hand was used
            ItemSlot fromSlot = null;
            if (usedObj == null)
            {
                fromSlot = SentByPlayer.Script.ItemStorage.GetActiveHandSlot();
            }
            else
            {
                fromSlot = usedObj.GetComponent <Pickupable>().ItemSlot;
            }
            var interaction = InventoryApply.ByClient(performer, targetSlot, fromSlot, Intent, IsAltUsed);
            ProcessInteraction(interaction, processorObj);
        }
        else if (InteractionType == typeof(TileApply))
        {
            var clientStorage = SentByPlayer.Script.ItemStorage;
            var usedSlot      = clientStorage.GetActiveHandSlot();
            var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
            LoadNetworkObject(ProcessorObject);
            var processorObj = NetworkObject;
            processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject,
                                                                                     TargetVector, processorObj, usedSlot, usedObject, Intent,
                                                                                     TileApply.ApplyType.HandApply);
        }
        else if (InteractionType == typeof(TileMouseDrop))
        {
            LoadMultipleObjects(new uint[] { UsedObject,
                                             ProcessorObject });

            var usedObj      = NetworkObjects[0];
            var processorObj = NetworkObjects[1];
            processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject,
                                                                                     TargetVector, processorObj, null, usedObj, Intent,
                                                                                     TileApply.ApplyType.MouseDrop);
        }
    }
Пример #20
0
 private void ServerInformClientRollback(HandApply interaction)
 {
     //Rollback prediction (inform player about item's true state)
     GetComponent <CustomNetTransform>().NotifyPlayer(interaction.Performer);
 }
Пример #21
0
        public override void Process(NetMessage msg)
        {
            var ComponentType    = msg.ComponentType;
            var InteractionType  = msg.InteractionType;
            var ProcessorObject  = msg.ProcessorObject;
            var Intent           = msg.Intent;
            var TargetObject     = msg.TargetObject;
            var UsedObject       = msg.UsedObject;
            var TargetBodyPart   = msg.TargetBodyPart;
            var TargetVector     = msg.TargetVector;
            var MouseButtonState = msg.MouseButtonState;
            var IsAltUsed        = msg.IsAltUsed;
            var Storage          = msg.Storage;
            var SlotIndex        = msg.SlotIndex;
            var NamedSlot        = msg.NamedSlot;
            var connectionPointA = msg.connectionPointA;
            var connectionPointB = msg.connectionPointB;
            var RequestedOption  = msg.RequestedOption;

            var performer = SentByPlayer.GameObject;

            if (SentByPlayer == null || SentByPlayer.Script == null)
            {
                return;
            }

            if (SentByPlayer.Script.DynamicItemStorage == null)
            {
                if (InteractionType == typeof(AiActivate))
                {
                    LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject });
                    var targetObj    = NetworkObjects[0];
                    var processorObj = NetworkObjects[1];

                    var interaction = new AiActivate(performer, null, targetObj, Intent, msg.ClickTypes);
                    ProcessInteraction(interaction, processorObj, ComponentType);
                }

                return;
            }

            if (InteractionType == typeof(PositionalHandApply))
            {
                //look up item in active hand slot
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedSlot      = clientStorage.GetActiveHandSlot();
                var usedObject    = clientStorage.GetActiveHandSlot()?.ItemObject;
                LoadMultipleObjects(new uint[] {
                    TargetObject, ProcessorObject
                });
                var targetObj    = NetworkObjects[0];
                var processorObj = NetworkObjects[1];
                CheckMatrixSync(ref targetObj);
                CheckMatrixSync(ref processorObj);

                var interaction = PositionalHandApply.ByClient(performer, usedObject, targetObj, TargetVector, usedSlot, Intent, TargetBodyPart);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(HandApply))
            {
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedSlot      = clientStorage.GetActiveHandSlot();
                var usedObject    = clientStorage.GetActiveHandSlot()?.ItemObject;
                LoadMultipleObjects(new uint[] {
                    TargetObject, ProcessorObject
                });
                var targetObj    = NetworkObjects[0];
                var processorObj = NetworkObjects[1];
                CheckMatrixSync(ref targetObj);
                CheckMatrixSync(ref processorObj);

                var interaction = HandApply.ByClient(performer, usedObject, targetObj, TargetBodyPart, usedSlot, Intent, IsAltUsed);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(AimApply))
            {
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedSlot      = clientStorage.GetActiveHandSlot();
                var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
                LoadNetworkObject(ProcessorObject);
                var processorObj = NetworkObject;
                CheckMatrixSync(ref processorObj);

                var interaction = AimApply.ByClient(performer, TargetVector, usedObject, usedSlot, MouseButtonState, Intent);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(MouseDrop))
            {
                LoadMultipleObjects(new uint[] { UsedObject,
                                                 TargetObject, ProcessorObject });

                var usedObj      = NetworkObjects[0];
                var targetObj    = NetworkObjects[1];
                var processorObj = NetworkObjects[2];
                CheckMatrixSync(ref targetObj);
                CheckMatrixSync(ref processorObj);

                var interaction = MouseDrop.ByClient(performer, usedObj, targetObj, Intent);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(HandActivate))
            {
                LoadNetworkObject(ProcessorObject);

                var processorObj = NetworkObject;
                CheckMatrixSync(ref processorObj);

                var performerObj = SentByPlayer.GameObject;
                //look up item in active hand slot
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedSlot      = clientStorage.GetActiveHandSlot();
                var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
                var interaction   = HandActivate.ByClient(performer, usedObject, usedSlot, Intent);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(InventoryApply))
            {
                LoadMultipleObjects(new uint[] { ProcessorObject, UsedObject,
                                                 Storage });
                var processorObj = NetworkObjects[0];
                var usedObj      = NetworkObjects[1];
                var storageObj   = NetworkObjects[2];
                CheckMatrixSync(ref processorObj);

                ItemSlot targetSlot = null;
                if (SlotIndex == -1)
                {
                    targetSlot = ItemSlot.GetNamed(storageObj.GetComponents <ItemStorage>()[msg.StorageIndexOnGameObject], NamedSlot);
                }
                else
                {
                    targetSlot = ItemSlot.GetIndexed(storageObj.GetComponents <ItemStorage>()[msg.StorageIndexOnGameObject], SlotIndex);
                }

                //if used object is null, then empty hand was used
                ItemSlot fromSlot = null;
                if (usedObj == null)
                {
                    fromSlot = SentByPlayer.Script.DynamicItemStorage.GetActiveHandSlot();
                }
                else
                {
                    fromSlot = usedObj.GetComponent <Pickupable>().ItemSlot;
                }
                var interaction = InventoryApply.ByClient(performer, targetSlot, fromSlot, Intent, IsAltUsed);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(TileApply))
            {
                try
                {
                    var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                    var usedSlot      = clientStorage.GetActiveHandSlot();
                    var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
                    LoadNetworkObject(ProcessorObject);
                    var processorObj = NetworkObject;
                    CheckMatrixSync(ref processorObj);

                    processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject,
                                                                                             TargetVector, processorObj, usedSlot, usedObject, Intent,
                                                                                             TileApply.ApplyType.HandApply);
                }
                catch (NullReferenceException exception)
                {
                    Logger.LogError("Caught a NRE in RequestInteractMessage.Process(): " + exception.Message, Category.Interaction);
                }
            }
            else if (InteractionType == typeof(TileMouseDrop))
            {
                LoadMultipleObjects(new uint[] { UsedObject,
                                                 ProcessorObject });

                var usedObj      = NetworkObjects[0];
                var processorObj = NetworkObjects[1];
                CheckMatrixSync(ref processorObj);

                processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject,
                                                                                         TargetVector, processorObj, null, usedObj, Intent,
                                                                                         TileApply.ApplyType.MouseDrop);
            }
            else if (InteractionType == typeof(ConnectionApply))
            {
                //look up item in active hand slot
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedSlot      = clientStorage.GetActiveHandSlot();
                var usedObject    = clientStorage.GetActiveHandSlot().ItemObject;
                LoadMultipleObjects(new uint[] {
                    TargetObject, ProcessorObject
                });
                var targetObj    = NetworkObjects[0];
                var processorObj = NetworkObjects[1];
                CheckMatrixSync(ref targetObj);
                CheckMatrixSync(ref processorObj);

                var interaction = ConnectionApply.ByClient(performer, usedObject, targetObj, connectionPointA, connectionPointB, TargetVector, usedSlot, Intent);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
            else if (InteractionType == typeof(ContextMenuApply))
            {
                LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject });
                var clientStorage = SentByPlayer.Script.DynamicItemStorage;
                var usedObj       = clientStorage.GetActiveHandSlot().ItemObject;
                var targetObj     = NetworkObjects[0];
                var processorObj  = NetworkObjects[1];
                CheckMatrixSync(ref targetObj);
                CheckMatrixSync(ref processorObj);

                var interaction = ContextMenuApply.ByClient(performer, usedObj, targetObj, RequestedOption, Intent);
                ProcessInteraction(interaction, processorObj, ComponentType);
            }
        }
Пример #22
0
 public abstract ModuleSignal OpenInteraction(HandApply interaction);
Пример #23
0
 public override void ServerRollbackClient(HandApply interaction)
 {
 }
Пример #24
0
 public abstract ModuleSignal ClosedInteraction(HandApply interaction);
Пример #25
0
        private float weldTime = 5f;        //TODO use time multipliers from welder tools

        public override ModuleSignal OpenInteraction(HandApply interaction, HashSet <DoorProcessingStates> States)
        {
            return(ModuleSignal.Continue);
        }
Пример #26
0
 public override ModuleSignal OpenInteraction(HandApply interaction)
 {
     return(ModuleSignal.Continue);
 }
Пример #27
0
 public void ServerDisassemble(HandApply interaction)
 {
     tileChangeManager.RemoveTile(registerTile.LocalPositionServer, LayerType.Walls);
     Spawn.ServerPrefab(CommonPrefabs.Instance.Metal, registerTile.WorldPositionServer, count: 4);
     Despawn.ServerSingle(gameObject);
 }
Пример #28
0
 private void OnPickupServer(HandApply interaction)
 {
     serverIsHeld = true;
 }
Пример #29
0
 /// <summary>
 /// Plays the tool sound for the used object at the target position
 /// </summary>
 /// <param name="handApply"></param>
 public static void ServerPlayToolSound(HandApply handApply)
 {
     ServerPlayToolSound(handApply.UsedObject, handApply.TargetObject.TileWorldPosition(), handApply.Performer);
 }
 public override void DoEffectTouch(HandApply touchSource)
 {
     base.DoEffectTouch(touchSource);
     TrySpawnItem();
 }