Ejemplo n.º 1
0
        public void MergeCanisterAndTank()
        {
            GasContainer canisterTank = GetComponent <GasContainer>();
            GasContainer externalTank = InsertedContainer.GetComponent <GasContainer>();
            GasMix       canisterGas  = canisterTank.GasMix;
            GasMix       tankGas      = externalTank.GasMix;

            canisterTank.GasMix = tankGas.MergeGasMix(canisterGas);
            externalTank.GasMix = tankGas;
        }
Ejemplo n.º 2
0
 public void UpdateMe()
 {
     if (!IsConnected)
     {
         GasContainer.VentContents();
     }
     if (tankValveOpen)
     {
         MergeCanisterAndTank();
     }
     RefreshPressureIndicator();
 }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        public void OnSpawnServer(SpawnInfo info)
        {
            // Update gas mix manually, in case Canister component loads before GasContainer.
            // This ensures pressure indicator and canister tier are set correctly.
            GasContainer.UpdateGasMix();

            SetCanisterTier();

            // We push pressureIndicatorOverlay ourselves; if not,
            // SpriteHandler will do so but overwrite the current SO when it loads after this component.
            pressureIndicatorOverlay.PushTexture();
            RefreshOverlays();
            SetValve(valveIsInitiallyOpen);
            GasContainer.ServerContainerExplode += OnContainerExploded;
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
 void Awake()
 {
     gasContainer = GetComponent <GasContainer>();
 }