示例#1
0
        public void LinkHackNodes()
        {
            //door opening
            HackingNode openDoor = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OpenDoor);

            openDoor.AddToInputMethods(HackingTryOpen);

            HackingNode onShouldOpen = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OnShouldOpen);

            onShouldOpen.AddWireCutCallback(ServerElectrocute);
            onShouldOpen.AddConnectedNode(openDoor);

            //door closing
            HackingNode closeDoor = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.CloseDoor);

            closeDoor.AddToInputMethods(TryClose);

            HackingNode onShouldClose = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OnShouldClose);

            onShouldClose.AddWireCutCallback(ServerElectrocute);
            onShouldClose.AddConnectedNode(closeDoor);

            //ID reject
            HackingNode rejectID = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.RejectId);

            rejectID.AddToInputMethods(ServerAccessDenied);

            HackingNode onIDRejected = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OnIdRejected);

            onIDRejected.AddConnectedNode(rejectID);

            //pressure warning
            HackingNode doPressureWarning = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.DoPressureWarning);

            doPressureWarning.AddToInputMethods(ServerPressureWarn);

            HackingNode shouldDoPressureWarning = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.ShouldDoPressureWarning);

            shouldDoPressureWarning.AddConnectedNode(doPressureWarning);

            //power
            HackingNode powerIn = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.PowerIn);

            HackingNode powerOut = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.PowerOut);

            powerOut.AddConnectedNode(powerIn);
            powerOut.AddWireCutCallback(ServerElectrocute);

            //dummy
            HackingNode dummyIn = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.DummyIn);

            HackingNode dummyOut = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.DummyOut);

            dummyOut.AddConnectedNode(dummyIn);

            //close timer
            HackingNode cancelCloseTimer = hackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.CancelCloseTimer);

            cancelCloseTimer.AddToInputMethods(CancelWaiting);
        }
    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();
        }
    }