public void Examine(GameObject sentByPlayer)
        {
            // if distance is too big or is self-examination, send normal examine message
            if (Vector3.Distance(sentByPlayer.WorldPosServer(), gameObject.WorldPosServer()) >= maxInteractionDistance ||
                sentByPlayer == gameObject)
            {
                Chat.AddExamineMsg(sentByPlayer,
                                   $"This is <b>{VisibleName}</b>.\n" +
                                   $"{Equipment.Examine()}" +
                                   $"<color={LILAC_COLOR}>{Health.GetExamineText()}</color>");
                return;
            }

            // start itemslot observation
            interactableStorage.ItemStorage.ServerAddObserverPlayer(sentByPlayer);
            // send message to enable examination window
            PlayerExaminationMessage.Send(sentByPlayer, this, true);

            //stop observing when target player is too far away
            var relationship = RangeRelationship.Between(
                sentByPlayer,
                gameObject,
                maxInteractionDistance,
                ServerOnObservationEnded
                );

            SpatialRelationship.ServerActivate(relationship);
        }
Esempio n. 2
0
 private void ServerOnObservationEnded(RangeRelationship cancelled)
 {
     // stop observing item storage
     this.GetComponent <DynamicItemStorage>().ServerRemoveObserverPlayer(cancelled.obj1.gameObject);
     // send message to disable examination window
     PlayerExaminationMessage.Send(cancelled.obj1.gameObject, this, false);
 }
Esempio n. 3
0
 private void ServerOnObservationEndedd(RangeRelationship cancelled)
 {
     // stop observing item storage
     interactableStorage.ItemStorage.ServerRemoveObserverPlayer(cancelled.obj1.gameObject);
     // send message to disable examination window
     PlayerExaminationMessage.Send(cancelled.obj1.gameObject, this, false);
 }
Esempio n. 4
0
    public static void Send(GameObject recipient, ExaminablePlayer examinablePlayer, bool observed)
    {
        var msg = new PlayerExaminationMessage()
        {
            ItemStorage            = examinablePlayer.gameObject.NetId(),
            VisibleName            = examinablePlayer.GetPlayerNameString(),
            Species                = examinablePlayer.GetPlayerSpeciesString(),
            Job                    = examinablePlayer.GetPlayerJobString(),
            Status                 = examinablePlayer.GetPlayerStatusString(),
            AdditionalInformations = examinablePlayer.GetAdditionalInformations(),
            Observed               = observed
        };

        msg.SendTo(recipient);
    }
Esempio n. 5
0
    /// <summary>
    /// Informs the recipient that they can now show/hide the player examination UI
    /// </summary>
    public static void Send(GameObject recipient, ItemStorage itemStorage, string visibleName, string species, string job, string status, string additionalInformations, bool observed)
    {
        var msg = new PlayerExaminationMessage()
        {
            ItemStorage            = itemStorage.gameObject.NetId(),
            VisibleName            = visibleName,
            Species                = species,
            Job                    = job,
            Status                 = status,
            AdditionalInformations = additionalInformations,
            Observed               = observed
        };

        msg.SendTo(recipient);
    }
Esempio n. 6
0
        public void Examine(GameObject sentByPlayer)
        {
            if (sentByPlayer.TryGetComponent <PlayerScript>(out var sentByPlayerScript) == false)
            {
                return;
            }

            if (sentByPlayerScript.PlayerState != PlayerScript.PlayerStates.Ghost)
            {
                // if distance is too big or is self-examination, send normal examine message
                if (Vector3.Distance(sentByPlayer.WorldPosServer(), gameObject.WorldPosServer()) >= maxInteractionDistance || sentByPlayer == gameObject)
                {
                    BasicExamine(sentByPlayer);
                    return;
                }
            }

            //If youre not normal or ghost then only allow basic examination
            //TODO maybe in future have this be a separate setting for each player type?
            if (sentByPlayerScript.PlayerState != PlayerScript.PlayerStates.Normal &&
                sentByPlayerScript.PlayerState != PlayerScript.PlayerStates.Ghost)
            {
                BasicExamine(sentByPlayer);
                return;
            }

            // start itemslot observation
            this.GetComponent <DynamicItemStorage>().ServerAddObserverPlayer(sentByPlayer);
            // send message to enable examination window
            PlayerExaminationMessage.Send(sentByPlayer, this, true);

            //Allow ghosts to keep the screen open even if player moves away
            if (sentByPlayerScript.PlayerState == PlayerScript.PlayerStates.Ghost)
            {
                return;
            }

            //stop observing when target player is too far away
            var relationship = RangeRelationship.Between(
                sentByPlayer,
                gameObject,
                maxInteractionDistance,
                ServerOnObservationEnded
                );

            SpatialRelationship.ServerActivate(relationship);
        }
Esempio n. 7
0
        public void Examine(GameObject SentByPlayer)
        {
            // if player is not inspecting self and distance is not too big
            if (SentByPlayer != gameObject && Vector3.Distance(SentByPlayer.WorldPosServer(), gameObject.WorldPosServer()) <= maxInteractionDistance)
            {
                // start itemslot observation
                interactableStorage.ItemStorage.ServerAddObserverPlayer(SentByPlayer);
                // send message to enable examination window
                PlayerExaminationMessage.Send(SentByPlayer, this, true);

                //stop observing when target player is too far away
                var relationship = RangeRelationship.Between(
                    SentByPlayer,
                    gameObject,
                    maxInteractionDistance,
                    ServerOnObservationEndedd
                    );
                SpatialRelationship.ServerActivate(relationship);
            }
        }