Ejemplo n.º 1
0
 public override void SyncSprite(ClosetStatus value)
 {
     if (value == ClosetStatus.Open)
     {
         if (!powered)
         {
             spriteRenderer.sprite = doorOpenPowerless;
         }
         else
         {
             spriteRenderer.sprite = doorOpened;
         }
     }
     else if (!powered)
     {
         spriteRenderer.sprite = doorClosedPowerless;
     }
     else if (value == ClosetStatus.Closed)
     {
         spriteRenderer.sprite = doorClosed;
     }
     else if (value == ClosetStatus.ClosedWithOccupant)
     {
         spriteRenderer.sprite = closedWithOccupant;
     }
 }
Ejemplo n.º 2
0
 private void ServerSetIsClosed(bool nowClosed)
 {
     //need to call this before we actually updated the closed status o we can see if we will have any occupants
     //This is only needed because of the weird way DNA scanner was implemented, requiring us to
     //know if there are held players in order to SyncStatus(ClosedWithOccupant)
     //Blame this mess on DNA scanner
     //TODO: FIx this mess, remove the need for a special OccupiedWithPlayer status, move that as a special
     //syncvar inside DNAScanner
     ServerHandleContentsOnStatusChange(nowClosed);
     if (nowClosed)
     {
         if (serverHeldPlayers.Count > 0 && registerTile.closetType == ClosetType.SCANNER)
         {
             statusSync = ClosetStatus.ClosedWithOccupant;
         }
         else
         {
             statusSync = ClosetStatus.Closed;
         }
     }
     else
     {
         statusSync = ClosetStatus.Open;
     }
 }
Ejemplo n.º 3
0
 public override void SyncSprite(ClosetStatus value)
 {
     //Logger.Log("TTTTTTTTTTTTT" + value.ToString());
     if (value == ClosetStatus.Open)
     {
         if (!powered)
         {
             spriteHandler.ChangeSprite(5);
         }
         else
         {
             spriteHandler.ChangeSprite(3);
         }
     }
     else if (!powered)
     {
         spriteHandler.ChangeSprite(6);
     }
     else if (value == ClosetStatus.Closed)
     {
         spriteHandler.ChangeSprite(0);
     }
     else if (value == ClosetStatus.ClosedWithOccupant)
     {
         spriteHandler.ChangeSprite(2);
     }
 }
Ejemplo n.º 4
0
        public void ServerPerformInteraction(HandApply interaction)
        {
            // Locking/Unlocking by alt clicking
            if (interaction.IsAltClick)
            {
                if (IsLockable && AccessRestrictions != null && ClosetStatus.Equals(ClosetStatus.Closed))
                {
                    // Default CheckAccess will check for the ID slot first
                    // so the default AltClick interaction will prioritize
                    // the ID slot, only when that would fail the hand
                    // will be checked, alternatively the user can also
                    // just click the locker with the ID inhand.
                    if (AccessRestrictions.CheckAccess(interaction.Performer))
                    {
                        if (isLocked)
                        {
                            SyncLocked(isLocked, false);
                            Chat.AddExamineMsg(interaction.Performer, $"You unlock the {closetName}.");
                        }
                        else
                        {
                            SyncLocked(isLocked, true);
                            Chat.AddExamineMsg(interaction.Performer, $"You lock the {closetName}.");
                        }
                    }
                }

                // Alt clicking is the locker's only alt click behaviour.
                return;
            }

            // Is the player trying to put something in the closet?
            if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Emag) &&
                interaction.HandObject.TryGetComponent <Emag>(out var emag) &&
                emag.EmagHasCharges())
            {
                if (IsClosed && !isEmagged)
                {
                    AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: 1f);
                    SoundManager.PlayNetworkedAtPos(soundOnEmag, registerTile.WorldPositionServer, audioSourceParameters, gameObject);
                    //ServerHandleContentsOnStatusChange(false);

                    isEmagged = true;
                    emag.UseCharge(interaction);
                    Chat.AddActionMsgToChat(interaction,
                                            "The access panel errors. A slight amount of smoke pours from behind the panel...",
                                            "You can smell caustic smoke from somewhere...");

                    //SyncStatus(statusSync, ClosetStatus.Open);
                    BreakLock();
                }
            }
Ejemplo n.º 5
0
 private void SyncStatus(ClosetStatus value)
 {
     statusSync = value;
     if (value == ClosetStatus.Open)
     {
         registerTile.IsClosed = false;
     }
     else
     {
         registerTile.IsClosed = true;
     }
     SyncSprite(value);
 }
Ejemplo n.º 6
0
 private void SyncStatus(ClosetStatus value)
 {
     statusSync = value;
     if (value == ClosetStatus.Open)
     {
         OnClosedChanged.Invoke(false);
     }
     else
     {
         OnClosedChanged.Invoke(true);
     }
     UpdateSpritesOnStatusChange();
 }
Ejemplo n.º 7
0
 public void ChangeSprite()
 {
     if (IsClosed)
     {
         if (heldPlayers.Count > 0 && registerTile.closetType == ClosetType.SCANNER)
         {
             statusSync = ClosetStatus.ClosedWithOccupant;
         }
         else
         {
             statusSync = ClosetStatus.Closed;
         }
     }
     else
     {
         statusSync = ClosetStatus.Open;
     }
 }
Ejemplo n.º 8
0
 public void ChangeSprite()
 {
     if (IsClosed)
     {
         if (heldPlayers.Count > 0)
         {
             statusSync = ClosetStatus.ClosedWithOccupant;
         }
         else
         {
             statusSync = ClosetStatus.Closed;
         }
     }
     else
     {
         statusSync = ClosetStatus.Open;
     }
 }
Ejemplo n.º 9
0
 public virtual void SyncSprite(ClosetStatus value)
 {
     if (value == ClosetStatus.Open)
     {
         spriteRenderer.sprite = doorOpened;
         if (lockLight)
         {
             lockLight.Hide();
         }
     }
     else
     {
         spriteRenderer.sprite = doorClosed;
         if (lockLight)
         {
             lockLight.Show();
         }
     }
 }