Exemplo n.º 1
0
        private void UpdateConnected()
        {
            ToolUtils.ServerPlayToolSound(interaction);
            RefreshOverlays();
            objectBehaviour.ServerSetPushable(!IsConnected);
            ServerOnConnectionStatusChange.Invoke(IsConnected);

            // Will release gas if canister valve was not turned off before disconnecting from a connector,
            // or stop the release of gas if canister valve is open and is now connected.
            if (ValveIsOpen)
            {
                GasContainer.SetVent(!IsConnected);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the state of the canister's valve. Will release contents to environment if
        /// the canister is not attached to a connector.
        /// </summary>
        /// <param name="isOpen">If on, gas can be added or removed from the canister.</param>
        public void SetValve(bool isOpen)
        {
            ValveIsOpen = isOpen;
            if (!IsConnected)
            {
                GasContainer.SetVent(isOpen);
            }

            RefreshOverlays();

            if (isOpen)
            {
                UpdateManager.Add(RefreshPressureIndicator, 1);
            }
            else
            {
                UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, RefreshPressureIndicator);
            }
        }