public void ServerPerformInteraction(MouseDrop interaction) { if (allowedToInteract == false) { return; } if (interaction.IsFromInventory && interaction.TargetObject == gameObject) { // try to add item to this storage Inventory.ServerTransfer(interaction.FromSlot, itemStorage.GetBestSlotFor(interaction.UsedObject)); } else { // player can observe this storage itemStorage.ServerAddObserverPlayer(interaction.Performer); ObserveInteractableStorageMessage.Send(interaction.Performer, this, true); // if we are observing a storage not in our inventory (such as another player's top // level inventory or a storage within their inventory, or a box/backpack sitting on the ground), we must stop observing when it // becomes unobservable for whatever reason (such as the owner becoming unobservable) var rootStorage = itemStorage.GetRootStorageOrPlayer(); if (interaction.Performer != rootStorage.gameObject) { // stop observing when it becomes unobservable for whatever reason var relationship = ObserveStorageRelationship.Observe(this, interaction.Performer.GetComponent <RegisterPlayer>(), PlayerScript.interactionDistance, ServerOnObservationEnded); SpatialRelationship.ServerActivate(relationship); } } }
public void ServerOnOpened(ConnectedPlayer connectedPlayer) { HackingProcessBase directHackReference = Provider.GetComponentInChildren<HackingProcessBase>(); ItemStorage hackStorage = hackProcess == null ? Provider.GetComponentInChildren<ItemStorage>() : hackProcess.ItemStorage; if (hackStorage != null) { hackStorage.ServerAddObserverPlayer(connectedPlayer.GameObject); } }
public void ServerPerformInteraction(MouseDrop interaction) { if (interaction.IsFromInventory && interaction.TargetObject == gameObject) { //try to add item to this storage Inventory.ServerTransfer(interaction.FromSlot, itemStorage.GetBestSlotFor(interaction.UsedObject)); } else { //player can observe this storage itemStorage.ServerAddObserverPlayer(interaction.Performer); ObserveInteractableStorageMessage.Send(interaction.Performer, this, true); if (!interaction.IsFromInventory) { SpatialRelationship.ServerActivate(RangeRelationship.Between(interaction.Performer, interaction.UsedObject, PlayerScript.interactionDistance, ServerOnRelationshipEnded)); } } }