Пример #1
0
    public void TryCrowbar()
    {
        if (Controller == null)
        {
            return;
        }

        if (Controller.IsHackable)
        {
            HackingNode onAttemptClose = Controller.HackingProcess.GetNodeWithInternalIdentifier("OnAttemptClose");
            onAttemptClose.SendOutputToConnectedNodes(interaction.Performer);
        }
        else
        {
            //TODO: force the opening/close if powerless but make sure firelocks are unaffected

            if (!Controller.IsClosed)
            {
                Controller.ServerTryClose();
            }
            else
            {
                Controller.ServerTryOpen(interaction.Performer);
            }
        }
    }
Пример #2
0
    public void ServerPerformInteraction(HandApply interaction)
    {
        this.interaction = interaction;

        if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Crowbar))
        {
            TryCrowbar();
        }
        else if (!Controller.IsClosed)
        {
            TryClose();             // Close the door if it's open
        }
        else if (Validations.HasUsedActiveWelder(interaction))
        {
            TryWelder();             // Repair or un/weld door, or deconstruct false wall
        }
        // Attempt to open if it's closed
        //Tell the OnAttemptOpen node to activate.
        else if (Controller.IsHackable)
        {
            HackingNode onAttemptOpen = Controller.HackingProcess.GetNodeWithInternalIdentifier("OnAttemptOpen");
            onAttemptOpen.SendOutputToConnectedNodes(interaction.Performer);
        }
        else
        {
            TryOpen(interaction.Performer);
        }
    }
Пример #3
0
    public void ServerOpen()
    {
        if (this == null || gameObject == null)
        {
            return;                                             // probably destroyed by a shuttle crash
        }
        if (Time.time < delayStartTime + inputDelay)
        {
            return;
        }

        delayStartTime = Time.time;

        ResetWaiting();
        IsClosed = false;

        if (isHackable && hackingLoaded)
        {
            HackingNode onDoorOpened = hackingProcess.GetNodeWithInternalIdentifier("OnDoorOpened");
            onDoorOpened.SendOutputToConnectedNodes();
        }

        if (!isPerformingAction)
        {
            DoorUpdateMessage.SendToAll(gameObject, DoorUpdateType.Open);
        }
    }
Пример #4
0
    public void ServerTryClose()
    {
        if (Time.time < delayStartTimeTryOpen + inputDelay)
        {
            return;
        }

        delayStartTimeTryOpen = Time.time;

        // Sliding door is not passable according to matrix
        if (!IsClosed && !isPerformingAction && (matrix.CanCloseDoorAt(registerTile.LocalPositionServer, true) || doorType == DoorType.sliding))
        {
            if (isHackable && hackingLoaded)
            {
                HackingNode onShouldClose = hackingProcess.GetNodeWithInternalIdentifier("OnShouldClose");
                onShouldClose.SendOutputToConnectedNodes();
            }
            // Sliding door is not passable according to matrix
            if (!IsClosed && !isPerformingAction && (ignorePassableChecks || matrix.CanCloseDoorAt(registerTile.LocalPositionServer, true) || doorType == DoorType.sliding))
            {
                ServerClose();
            }
            else
            {
                ServerClose();
            }
        }
        else
        {
            ResetWaiting();
        }
    }
Пример #5
0
 /// <summary>
 /// Invoke this on server when player bumps into door to try to open it.
 /// </summary>
 public void Bump(GameObject byPlayer)
 {
     if (Controller.IsClosed && Controller.IsAutomatic)
     {
         if (Controller.IsHackable)
         {
             HackingNode onAttemptOpen = Controller.HackingProcess.GetNodeWithInternalIdentifier("OnAttemptOpen");
             onAttemptOpen.SendOutputToConnectedNodes(byPlayer);
         }
         else
         {
             TryOpen(byPlayer);
         }
     }
 }
Пример #6
0
    public void SendOutputToConnectedNodes(HackingIdentifier identifier, GameObject originator = null)
    {
        HackingNode node = GetNodeWithInternalIdentifier(identifier);

        node.SendOutputToConnectedNodes(originator);
    }
Пример #7
0
 public void SendOutputSignal()
 {
     outputNode.SendOutputToConnectedNodes();
 }
Пример #8
0
    public void ServerTryOpen(GameObject Originator)
    {
        if (Time.time < delayStartTimeTryOpen + inputDelay)
        {
            return;
        }

        delayStartTimeTryOpen = Time.time;

        if (isWelded)
        {
            Chat.AddExamineMsgFromServer(Originator, "This door is welded shut.");
            return;
        }
        if (AccessRestrictions != null)
        {
            if (!AccessRestrictions.CheckAccess(Originator))
            {
                if (IsClosed && !isPerformingAction)
                {
                    if (isHackable && hackingLoaded)
                    {
                        HackingNode onIDRejected = hackingProcess.GetNodeWithInternalIdentifier("OnIDRejected");
                        onIDRejected.SendOutputToConnectedNodes(Originator);
                    }
                    else
                    {
                        ServerAccessDenied();
                    }
                    return;
                }
            }
        }

        if (IsClosed && !isPerformingAction)
        {
            if (!pressureWarnActive && DoorUnderPressure())
            {
                if (isHackable && hackingLoaded)
                {
                    HackingNode shouldDoPressureWarn = hackingProcess.GetNodeWithInternalIdentifier("ShouldDoPressureWarning");
                    shouldDoPressureWarn.SendOutputToConnectedNodes(Originator);
                }
                else
                {
                    ServerPressureWarn();
                }
            }
            else
            {
                if (isHackable && hackingLoaded)
                {
                    HackingNode onShouldOpen = hackingProcess.GetNodeWithInternalIdentifier("OnShouldOpen");
                    onShouldOpen.SendOutputToConnectedNodes(Originator);
                }
                else
                {
                    ServerOpen();
                }
            }
        }
    }
Пример #9
0
    public void ServerPerformInteraction(HandApply interaction)
    {
        if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Crowbar))
        {
            if (Controller.IsHackable)
            {
                HackingNode onAttemptClose = Controller.HackingProcess.GetNodeWithInternalIdentifier("OnAttemptClose");
                onAttemptClose.SendOutputToConnectedNodes(interaction.Performer);
            }
            else
            {
                TryCrowbar(interaction.Performer);
            }
        }
        else if (!Controller.IsClosed)
        {
            TryClose();             // Close the door if it's open
        }
        else
        {
            if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Welder))             // welding the door (only if closed and not helping)
            {
                if (Controller.IsWeldable)
                {
                    var welder = interaction.HandObject.GetComponent <Welder>();
                    if (welder.IsOn && interaction.Intent != Intent.Help)
                    {
                        void ProgressComplete()
                        {
                            if (Controller != null)
                            {
                                Chat.AddExamineMsgFromServer(interaction.Performer,
                                                             "You " + (Controller.IsWelded ? "unweld" : "weld") + " the door.");
                                Controller.ServerTryWeld();
                            }
                        }

                        var bar = StandardProgressAction.CreateForWelder(ProgressConfig, ProgressComplete, welder)
                                  .ServerStartProgress(interaction.Performer.transform.position, weldTime, interaction.Performer);
                        if (bar != null)
                        {
                            SoundManager.PlayNetworkedAtPos("Weld", interaction.Performer.transform.position, UnityEngine.Random.Range(0.8f, 1.2f), sourceObj: interaction.Performer);
                            Chat.AddExamineMsgFromServer(interaction.Performer, "You start " + (Controller.IsWelded ? "unwelding" : "welding") + " the door...");
                        }

                        return;
                    }
                }
                else if (!Controller.IsAutomatic)
                {
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 4f,
                                                              "You start to disassemble the false wall...",
                                                              $"{interaction.Performer.ExpensiveName()} starts to disassemble the false wall...",
                                                              "You disassemble the girder.",
                                                              $"{interaction.Performer.ExpensiveName()} disassembles the false wall.",
                                                              () => Controller.ServerDisassemble(interaction));
                    return;
                }
            }

            // Attempt to open if it's closed
            //Tell the OnAttemptOpen node to activate.
            if (Controller.IsHackable)
            {
                HackingNode onAttemptOpen = Controller.HackingProcess.GetNodeWithInternalIdentifier("OnAttemptOpen");
                onAttemptOpen.SendOutputToConnectedNodes(interaction.Performer);
            }
            else
            {
                Controller.ServerTryOpen(interaction.Performer);
            }
        }

        StartInputCoolDown();
    }