コード例 #1
0
    public void OnSpawnServer(SpawnInfo info)
    {
        if (!info.SpawnItems)
        {
            hasCables  = false;
            stateSync  = MountedMonitorState.OpenEmpty;
            statusText = GameManager.Instance.CentComm.CommandStatusString;
        }

        if (doorControllers.Count > 0)
        {
            OnTextBroadcastReceived(StatusDisplayChannel.DoorTimer);
            foreach (var door in doorControllers)
            {
                if (door.IsHackable)
                {
                    HackingNode outsideSignalOpen = door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OutsideSignalOpen);
                    outsideSignalOpen.AddConnectedNode(door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OpenDoor));
                    outsideSignalOpen.AddConnectedNode(door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.CancelCloseTimer));

                    HackingNode outsideSignalClose = door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OutsideSignalClose);
                    outsideSignalClose.AddConnectedNode(door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.CloseDoor));
                }
            }
        }
        SyncSprite(stateSync, stateSync);
        centComm = GameManager.Instance.CentComm;
        centComm.OnStatusDisplayUpdate.AddListener(OnTextBroadcastReceived);
    }
コード例 #2
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);
        }
コード例 #3
0
    public virtual void AddNodeConnection(int[] connection)
    {
        if (connection.Length != 2)
        {
            return;
        }

        if (hackNodes.ElementAtOrDefault(connection[0]) == null || hackNodes[connection[0]] == null)
        {
            return;
        }

        HackingNode outputNode = hackNodes[connection[0]];

        if (hackNodes.ElementAtOrDefault(connection[1]) == null || hackNodes[connection[1]] == null)
        {
            return;
        }

        HackingNode inputNode = hackNodes[connection[1]];

        bool nodeNotNull = outputNode != null && inputNode != null;

        bool isOutputAndInput = outputNode.IsOutput && inputNode.IsInput;

        bool notAlreadyHasNode = !outputNode.ConnectedInputNodes.Contains(inputNode);

        if (nodeNotNull && isOutputAndInput && notAlreadyHasNode)
        {
            outputNode.AddConnectedNode(inputNode);
        }
    }
コード例 #4
0
    /// <summary>
    /// Add a connection between two nodes in the hacking device. keyOutput is the index of the output node, similar for key input.
    /// </summary>
    /// <param name="keyOutput"></param>
    /// <param name="keyInput"></param>
    public virtual void AddNodeConnection(int keyOutput, int keyInput)
    {
        HackingNode outputNode = GetHackNodes()[keyOutput];
        HackingNode inputNode  = GetHackNodes()[keyInput];

        if (outputNode != null && inputNode != null && outputNode.IsOutput && inputNode.IsInput)
        {
            outputNode.AddConnectedNode(inputNode);
        }
    }
コード例 #5
0
ファイル: DoorSwitch.cs プロジェクト: Basipek/unitystation
    public void OnSpawnServer(SpawnInfo info)
    {
        foreach (var door in doorControllers)
        {
            if (door == null)
            {
                continue;
            }

            if (door.IsHackable)
            {
                HackingNode outsideSignalOpen = door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OutsideSignalOpen);
                outsideSignalOpen.AddConnectedNode(door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OpenDoor));

                HackingNode outsideSignalClose = door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.OutsideSignalClose);
                outsideSignalClose.AddConnectedNode(door.HackingProcess.GetNodeWithInternalIdentifier(HackingIdentifier.CloseDoor));
            }
        }
    }
コード例 #6
0
    public void LinkHackNodes()
    {
        HackingNode openDoor = hackingProcess.GetNodeWithInternalIdentifier("OpenDoor");

        openDoor.AddToInputMethods(ServerOpen);

        HackingNode closeDoor = hackingProcess.GetNodeWithInternalIdentifier("CloseDoor");

        closeDoor.AddToInputMethods(ServerClose);

        HackingNode beginOpenProcedure = hackingProcess.GetNodeWithInternalIdentifier("BeginOpenProcedure");

        beginOpenProcedure.AddToInputMethods(ServerTryOpen);

        HackingNode beginCloseProcedure = hackingProcess.GetNodeWithInternalIdentifier("BeginCloseProcedure");

        beginCloseProcedure.AddToInputMethods(ServerTryClose);

        HackingNode onAttemptOpen = hackingProcess.GetNodeWithInternalIdentifier("OnAttemptOpen");

        onAttemptOpen.AddConnectedNode(beginOpenProcedure);

        HackingNode onAttemptClose = hackingProcess.GetNodeWithInternalIdentifier("OnAttemptClose");

        onAttemptClose.AddConnectedNode(beginCloseProcedure);

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

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

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

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

        HackingNode acceptID = hackingProcess.GetNodeWithInternalIdentifier("AcceptId");

        HackingNode rejectID = hackingProcess.GetNodeWithInternalIdentifier("RejectID");

        rejectID.AddToInputMethods(ServerAccessDenied);

        HackingNode onIDRejected = hackingProcess.GetNodeWithInternalIdentifier("OnIDRejected");

        onIDRejected.AddConnectedNode(rejectID);

        HackingNode doPressureWarning = hackingProcess.GetNodeWithInternalIdentifier("DoPressureWarning");

        doPressureWarning.AddToInputMethods(ServerPressureWarn);

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

        shouldDoPressureWarning.AddConnectedNode(doPressureWarning);

        HackingNode onDoorOpened = hackingProcess.GetNodeWithInternalIdentifier("OnDoorOpened");

        HackingNode onDoorClosed = hackingProcess.GetNodeWithInternalIdentifier("OnDoorClosed");

        HackingNode powerIn = hackingProcess.GetNodeWithInternalIdentifier("PowerIn");

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

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

        HackingNode dummyIn = hackingProcess.GetNodeWithInternalIdentifier("DummyIn");

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

        dummyOut.AddConnectedNode(dummyIn);

        hackingLoaded = true;
    }