Example #1
0
        // Note: this is a recursive method.
        private void ReadBook(ConnectedPlayer player, int pageToRead = 0)
        {
            if (pageToRead >= pagesToRead || pageToRead > 10)
            {
                FinishReading(player);
                return;
            }

            StandardProgressActionConfig cfg = new StandardProgressActionConfig(
                StandardProgressActionType.Construction,
                false,
                false
                );

            StandardProgressAction.Create(cfg, ReadPage).ServerStartProgress(
                player.GameObject.RegisterTile(),
                timeToReadPage,
                player.GameObject
                );

            void ReadPage()
            {
                readerProgress[player]++;

                // TODO: play random page-turning sound => pageturn1.ogg || pageturn2.ogg || pageturn3.ogg
                string remark = remarks[Random.Range(0, remarks.Length)];

                Chat.AddExamineMsgFromServer(player.GameObject, remark);

                ReadBook(player, readerProgress[player]);
            }
        }
    public void ServerPerformInteraction(InventoryApply interaction)
    {
        if (activated)
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "You can't adjust the sword while it's on!");
            return;
        }

        if (color == (int)SwordColor.Rainbow)
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "It's already fabulous!");
            return;
        }

        if (Validations.HasItemTrait(interaction.UsedObject, CommonTraits.Instance.Screwdriver))
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "You adjust the crystalline beam emitter...");
            var c = color + 1;
            if (c >= (int)SwordColor.Rainbow)
            {
                c = (int)SwordColor.Red;
            }

            SyncColor(c);
        }
        else if (Validations.HasItemTrait(interaction.UsedObject, CommonTraits.Instance.Multitool))
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "RNBW_ENGAGE");
            SyncColor((int)SwordColor.Rainbow);
        }
    }
Example #3
0
        private void TryToggleOnOff(HandApply interaction)
        {
            if (isLocked)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "The emitter needs to be unlocked first");
                return;
            }

            if (isOn)
            {
                Chat.AddActionMsgToChat(interaction.Performer, "You turn the emitter off",
                                        $"{interaction.Performer.ExpensiveName()} turns the emitter off");

                TogglePower(false);
            }
            else if (isWelded)
            {
                Chat.AddActionMsgToChat(interaction.Performer, "You turn the emitter on",
                                        $"{interaction.Performer.ExpensiveName()} turns the emitter on");

                TogglePower(true);
            }
            else
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "Emitter needs to be wrench and welded down first");
            }
        }
Example #4
0
        public void TeleportTo(TeleportDestination destination)
        {
            ConnectedPlayer teleportingPlayer = GetLastReader();

            if (!HasChargesRemaining(teleportingPlayer.GameObject))
            {
                return;
            }

            if (teleport.IsBusy)
            {
                Chat.AddExamineMsgFromServer(teleportingPlayer.GameObject, $"You are already teleporting!");
                return;
            }

            Transform spawnTransform = SpawnPoint.GetRandomPointForJob((JobType)destination);

            teleport.ServerTeleportWizard(teleportingPlayer.GameObject, spawnTransform.position.CutToInt());

            SpellData teleportSpell = SpellList.Instance.Spells.Find(spell => spell.Name == "Teleport");

            SoundManager.PlayNetworkedAtPos(
                teleportSpell.CastSound, teleportingPlayer.Script.WorldPos, sourceObj: teleportingPlayer.GameObject);

            var incantation = $"{teleportSpell.InvocationMessage.Trim('!')} {destination.ToString().ToUpper()}!";

            Chat.AddChatMsgToChat(teleportingPlayer, incantation, ChatChannel.Local);

            ChargesRemaining--;
        }
Example #5
0
    public virtual void ServerPerformInteraction(HandApply interaction)
    {
        var LHB = interaction.TargetObject.GetComponent <LivingHealthMasterBase>();

        if (LHB.ZoneHasDamageOf(interaction.TargetBodyPart, healType))
        {
            if (interaction.TargetObject != interaction.Performer)
            {
                ServerApplyHeal(LHB, interaction);
            }
            else
            {
                ServerSelfHeal(interaction.Performer, LHB, interaction);
            }
        }
        else
        {
            //If there is no limb in this Zone, check if it's bleeding from limb loss.
            if (CheckForBleedingBodyContainers(LHB, interaction) && StopsExternalBleeding)
            {
                RemoveLimbLossBleed(LHB, interaction);
            }
            else
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"The {interaction.TargetBodyPart} does not need to be healed.");
            }
        }
    }
Example #6
0
        private void StartState()
        {
            string message;

            switch (bodyPart)
            {
            case BlobBody.Head:
                message = "You have a killer headache today. Wonder whats caused that.";
                break;

            case BlobBody.Ass:
                message = "Feels like you've sat on something strange recently.";
                break;

            case BlobBody.Stomach:
                message = "You feel nauseous, its probably nothing to worry about.";
                break;

            default:
                message = "You feel nauseous, its probably nothing to worry about.";
                break;
            }

            Chat.AddExamineMsgFromServer(gameObject, message);

            stateTimer = 0f;
            state      = BlobStates.Middle;
        }
Example #7
0
    /// <summary>
    /// Players can check the remaining microwave time or insert something into the microwave.
    /// </summary>
    public void ServerPerformInteraction(HandApply interaction)
    {
        if (microwave.microwaveTimer > 0)
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, $"{microwave.microwaveTimer:0} seconds until the {microwave.meal} is cooked.");
        }
        else if (interaction.HandObject != null)
        {
            // Check if the player is holding food that can be cooked
            ItemAttributesV2 attr       = interaction.HandObject.GetComponent <ItemAttributesV2>();
            Ingredient       ingredient = new Ingredient(attr.ArticleName);
            GameObject       meal       = CraftingManager.Meals.FindRecipe(new List <Ingredient> {
                ingredient
            });

            if (meal)
            {
                microwave.ServerSetOutputMeal(meal.name);
                Despawn.ServerSingle(interaction.HandObject);
                microwave.RpcStartCooking();
                Chat.AddExamineMsgFromServer(interaction.Performer, $"You microwave the {microwave.meal} for {microwave.COOK_TIME} seconds.");
            }
            else
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"Your {attr.ArticleName} can not be microwaved.");
                // Alternative suggestions:
                // "$"The microwave is not programmed to cook your {attr.ArticleName}."
                // "$"The microwave does not know how to cook your{attr.ArticleName}."
            }
        }
        else
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "The microwave is empty.");
        }
    }
 public void ServerTryOpen(GameObject Originator)
 {
     if (isWelded)
     {
         Chat.AddExamineMsgFromServer(Originator, "This door is welded shut.");
         return;
     }
     if (AccessRestrictions != null)
     {
         if (AccessRestrictions.CheckAccess(Originator))
         {
             if (!IsOpened && !isPerformingAction)
             {
                 ServerOpen();
             }
         }
         else
         {
             if (!IsOpened && !isPerformingAction)
             {
                 ServerAccessDenied();
             }
         }
     }
     else
     {
         Logger.LogError("Door lacks access restriction component!", Category.Doors);
     }
 }
    /// <summary>
    /// Used on the server to switch the pickup mode of this InteractableStorage
    /// </summary>
    public void ServerSwitchPickupMode(GameObject player)
    {
        pickupMode = pickupMode.Next();

        string msg = "Nothing happens.";

        switch (pickupMode)
        {
        case PickupMode.Single:
            msg = $"The {gameObject.ExpensiveName()} now picks up one item at a time.";
            break;

        case PickupMode.Same:
            msg = $"The {gameObject.ExpensiveName()} now picks up all items of a single type at once.";
            break;

        case PickupMode.All:
            msg = $"The {gameObject.ExpensiveName()} now picks up all items in a tile at once.";
            break;

        default:
            Logger.LogError($"Unknown pickup mode set! Found: {pickupMode}", Category.Inventory);
            break;
        }
        Chat.AddExamineMsgFromServer(player, msg);
    }
Example #10
0
    public void ServerTryOpen(GameObject Originator)
    {
        if (isWelded)
        {
            Chat.AddExamineMsgFromServer(Originator, "This door is welded shut.");
            return;
        }
        if (AccessRestrictions != null)
        {
            if (!AccessRestrictions.CheckAccess(Originator))
            {
                if (IsClosed && !isPerformingAction)
                {
                    ServerAccessDenied();
                    return;
                }
            }
        }

        if (IsClosed && !isPerformingAction)
        {
            if (!pressureWarnActive && DoorUnderPressure())
            {
                ServerPressureWarn();
            }
            else
            {
                ServerOpen();
            }
        }
    }
Example #11
0
        // Note: this is a recursive method.
        private void ReadBook(ConnectedPlayer player, int pageToRead = 0)
        {
            var playerTile = player.GameObject.RegisterTile();

            if (pageToRead >= pagesToRead || pageToRead > 10)
            {
                FinishReading(player);
                return;
            }

            StandardProgressActionConfig cfg = new StandardProgressActionConfig(
                StandardProgressActionType.Construction,
                false,
                false
                );

            StandardProgressAction.Create(cfg, ReadPage).ServerStartProgress(
                playerTile,
                timeToReadPage,
                player.GameObject
                );

            void ReadPage()
            {
                readerProgress[player]++;

                SoundManager.PlayNetworkedAtPos(pageturnSfx.PickRandom(), playerTile.WorldPositionServer, sourceObj: player.GameObject);
                Chat.AddExamineMsgFromServer(player.GameObject, remarks.PickRandom());

                ReadBook(player, readerProgress[player]);
            }
        }
Example #12
0
        private void TryToggleDoor(PositionalHandApply interaction)
        {
            if (IsLocked)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"The {closetName} is locked!");
                return;
            }

            if (IsWelded)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"The {closetName} is welded shut!");
                return;
            }

            if (IsOpen)
            {
                if (objectContainer.IsAnotherContainerNear())
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer, $"You cannot close {closetName} with another container in the way!");
                }
                else
                {
                    SetDoor(Door.Closed);
                }
            }
            else
            {
                SetDoor(Door.Opened);
            }
        }
Example #13
0
    private void TryRemoveBulb(HandApply interaction)
    {
        var handSlot = interaction.PerformerPlayerScript.ItemStorage.GetNamedItemSlot(NamedSlot.hands);

        if (mState == LightMountState.On && (handSlot.IsOccupied == false ||
                                             !Validations.HasItemTrait(handSlot.ItemObject, CommonTraits.Instance.BlackGloves)))
        {
            var playerHealth  = interaction.PerformerPlayerScript.playerHealth;
            var burntBodyPart = interaction.HandSlot.NamedSlot == NamedSlot.leftHand ? BodyPartType.LeftArm : BodyPartType.RightArm;
            playerHealth.ApplyDamageToBodypart(gameObject, 10f, AttackType.Energy, DamageType.Burn, burntBodyPart);

            Chat.AddExamineMsgFromServer(interaction.Performer,
                                         "<color=red>You burn your hand on the bulb while attempting to remove it!</color>");
            return;
        }

        var      spawnedItem = Spawn.ServerPrefab(itemInMount, interaction.Performer.WorldPosServer()).GameObject;
        ItemSlot bestHand    = interaction.PerformerPlayerScript.ItemStorage.GetBestHand();

        if (bestHand != null && spawnedItem != null)
        {
            Inventory.ServerAdd(spawnedItem, bestHand);
        }

        ServerChangeLightState(LightMountState.MissingBulb);
    }
Example #14
0
 public void ServerPerformInteraction(HandActivate interaction)
 {
     Chat.AddExamineMsgFromServer(interaction.Performer, "You clear the multitool's internal buffer.");
     buffers.Clear();
     isMultipleMaster    = false;
     configurationBuffer = MultitoolConnectionType.Empty;
 }
Example #15
0
    public void ServerPerformInteraction(PositionalHandApply interaction)
    {
        if (Validations.IsTool(interaction.HandObject, ToolType.Wrench))
        {
            SoundManager.PlayNetworkedAtPos("Wrench", interaction.WorldPositionTarget, 1f);
            ObjectFactory.SpawnMetal(1, interaction.WorldPositionTarget.To2Int(), parent: transform.parent);
            PoolManager.PoolNetworkDestroy(gameObject);

            return;
        }

        var progressFinishAction = new ProgressCompleteAction(() =>
        {
            Chat.AddExamineMsgFromServer(interaction.Performer,
                                         "You assemble a rack.");
            PoolManager.PoolNetworkInstantiate(rackPrefab, interaction.WorldPositionTarget.RoundToInt(),
                                               interaction.Performer.transform.parent);
            var handObj = interaction.HandObject;
            var slot    = InventoryManager.GetSlotFromOriginatorHand(interaction.Performer,
                                                                     interaction.HandSlot.equipSlot);
            handObj.GetComponent <Pickupable>().DisappearObject(slot);
        }
                                                              );

        var bar = UIManager.ServerStartProgress(ProgressAction.Construction, interaction.WorldPositionTarget.RoundToInt(),
                                                5f, progressFinishAction, interaction.Performer);

        if (bar != null)
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "You start constructing a rack...");
        }
    }
Example #16
0
        public void ServerPerformInteraction(MouseDrop interaction)
        {
            var pna = interaction.Performer.GetComponent <PlayerNetworkActions>();

            var closetControl = GetComponent <ClosetControl>();

            if (!closetControl.IsClosed)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer,
                                             "You wrestle with the body bag, but it won't fold while unzipped.");
                return;
            }

            if (!closetControl.ServerIsEmpty())
            {
                Chat.AddExamineMsgFromServer(interaction.Performer,
                                             "There are too many things inside of the body bag to fold it up!");
                return;
            }

            // Add folded to player inventory (note, this is actually a new object, not this object)
            //TODO: This means that body bag integrity gets reset every time it is picked up. Should be converted to be the same object instead.
            var folded = Spawn.ServerPrefab(prefabVariant).GameObject;

            Inventory.ServerAdd(folded,
                                interaction.Performer.GetComponent <ItemStorage>().GetActiveHandSlot());
            // Remove from world
            _ = Despawn.ServerSingle(gameObject);
        }
    public void ServerPerformInteraction(HandActivate interaction)
    {
        string toShow        = "";
        var    metaDataLayer = MatrixManager.AtPoint(interaction.PerformerPlayerScript.registerTile.WorldPositionServer, true).MetaDataLayer;

        if (metaDataLayer != null)
        {
            var node = metaDataLayer.Get(interaction.Performer.transform.localPosition.RoundToInt());
            if (node != null)
            {
                toShow = $"Pressure : {node.GasMix.Pressure:0.###} kPa \n"
                         + $"Temperature : {node.GasMix.Temperature:0.###} K {node.GasMix.Temperature - Atmospherics.Reactions.KOffsetC:0.###} C)" +
                         " \n"                 //You want Fahrenheit? HAHAHAHA
                         + $"Total Moles of gas : {node.GasMix.Moles:0.###} \n";

                foreach (var gas in Gas.All)
                {
                    var ratio = node.GasMix.GasRatio(gas);

                    if (ratio != 0)
                    {
                        toShow += $"{gas.Name} : {ratio * 100:0.###} %\n";
                    }
                }
            }
        }
        Chat.AddExamineMsgFromServer(interaction.Performer, toShow);
    }
        private bool VerboseDisposalMachineExists(TileApply interaction)
        {
            Matrix matrix = interaction.TileChangeManager.MetaTileMap.Layers[LayerType.Underfloor].matrix;

            if ((interaction.BasicTile as DisposalPipe).PipeType == DisposalPipeType.Terminal)
            {
                DisposalMachine disposalMachine = matrix.GetFirst <DisposalMachine>(interaction.TargetCellPos, true);
                if (disposalMachine != null && disposalMachine.MachineAttachedOrGreater)
                {
                    string machineName = disposalMachine.name;
                    if (disposalMachine.TryGetComponent <ObjectAttributes>(out var attributes) &&
                        string.IsNullOrWhiteSpace(attributes.InitialName) == false)
                    {
                        machineName = attributes.InitialName;
                    }

                    Chat.AddExamineMsgFromServer(
                        interaction.Performer,
                        $"The {machineName} must be removed before you can cut the disposal pipe welds!");
                    return(true);
                }
            }

            return(false);
        }
Example #19
0
        private void MiddleState()
        {
            //Check to see whether middle state should start
            if (stateTimer <= TimeToMiddle)
            {
                return;
            }

            //If middle state has been running 240 seconds, change to end state!
            if (stateTimer >= TimeToEnd)
            {
                state         = BlobStates.End;
                internalTimer = 0f;
                return;
            }

            //Every 20 seconds have chance for message
            if (internalTimer <= MessageFrequency)
            {
                return;
            }

            // 75% theres no message this time this second
            if (Random.Range(0, 100) <= 75)
            {
                return;
            }

            internalTimer = 0f;

            string message;

            if (Random.Range(0, 100) <= 25)
            {
                switch (bodyPart)
                {
                case BlobBody.Head:
                    message = middlePhrasesHead.GetRandom();
                    break;

                case BlobBody.Ass:
                    message = middlePhrasesAss.GetRandom();
                    break;

                case BlobBody.Stomach:
                    message = middlePhrasesStomach.GetRandom();
                    break;

                default:
                    message = middlePhrasesStomach.GetRandom();
                    break;
                }
            }
            else
            {
                message = GenericMiddlePhrases.GetRandom();
            }

            Chat.AddExamineMsgFromServer(gameObject, $"<color=#FF151F>{message}</color>");
        }
        public void ServerPerformInteraction(PositionalHandApply interaction)
        {
            if (interaction.TargetObject != null)
            {
                if (interaction.TargetObject.TryGetComponent(out GasContainer container))
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer, GetGasMixInfo(container.GasMix));
                    return;
                }

                if (interaction.TargetObject.TryGetComponent(out MonoPipe monoPipe))
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer,
                                                 GetGasMixInfo(monoPipe.pipeData.mixAndVolume.GetGasMix()));
                    return;
                }
            }

            Vector3 worldPosition = interaction.WorldPositionTarget;
            var     matrix        = MatrixManager.AtPoint(worldPosition.CutToInt(), true);
            var     localPosition = MatrixManager.WorldToLocal(worldPosition, matrix).CutToInt();
            var     metaDataNode  = matrix.MetaDataLayer.Get(localPosition, false);

            if (metaDataNode.PipeData.Count > 0)
            {
                var gasMix = metaDataNode.PipeData[0].pipeData.GetMixAndVolume.GetGasMix();
                Chat.AddExamineMsgFromServer(interaction.Performer, GetGasMixInfo(gasMix));
            }
        }
        public void TryOpen(GameObject originator = null, bool blockClosing = false)
        {
            if (Time.time < delayStartTimeTryOpen + inputDelay && isEmagged == false)
            {
                return;
            }

            delayStartTimeTryOpen = Time.time;

            if (isWelded)
            {
                if (originator)
                {
                    Chat.AddExamineMsgFromServer(originator, "This door is welded shut.");
                }
                return;
            }
            if (IsClosed && isPerformingAction == false)
            {
                if (pressureWarnActive == false && DoorUnderPressure() && isEmagged == false)
                {
                    ServerPressureWarn();
                }
                else
                {
                    Open(blockClosing);
                }
            }
        }
Example #22
0
    public void ServerPerformInteraction(PositionalHandApply interaction)
    {
        if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Wrench))
        {
            SoundManager.PlayNetworkedAtPos("Wrench", interaction.WorldPositionTarget, 1f);
            Spawn.ServerPrefab("Metal", interaction.WorldPositionTarget.RoundToInt(), transform.parent, count: 1,
                               scatterRadius: Spawn.DefaultScatterRadius, cancelIfImpassable: true);
            Despawn.ServerSingle(gameObject);

            return;
        }

        var progressFinishAction = new ProgressCompleteAction(() =>
        {
            Chat.AddExamineMsgFromServer(interaction.Performer,
                                         "You assemble a rack.");
            Spawn.ServerPrefab(rackPrefab, interaction.WorldPositionTarget.RoundToInt(),
                               interaction.Performer.transform.parent);
            var handObj = interaction.HandObject;
            Inventory.ServerDespawn(interaction.HandSlot);
        }
                                                              );

        var bar = UIManager.ServerStartProgress(ProgressAction.Construction, interaction.WorldPositionTarget.RoundToInt(),
                                                5f, progressFinishAction, interaction.Performer);

        if (bar != null)
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, "You start constructing a rack...");
        }
    }
Example #23
0
        public void ServerPerformInteraction(PositionalHandApply interaction)
        {
            var pad = interaction.TargetObject.GetComponent <QuantumPad>();

            if (pad == null)
            {
                return;
            }

            if (pad.disallowLinkChange)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "The link has been hard locked, you cannot change it.");
                return;
            }

            if (pad == padInBuffer)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "You cannot link the same pad together, clear the buffer if you wish to add to it.");
                return;
            }

            if (padInBuffer == null)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "You set the buffer to this quantum pad.");
                padInBuffer = pad;
            }
            else
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "You set this quantum pad to connect to the pad in buffer.");
                pad.connectedPad = padInBuffer;
            }
        }
Example #24
0
        private void TryDeconstruct(HandApply interaction)
        {
            //Only deconstruct if no AI inside
            if (linkedPlayer != null)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "Transfer the Ai to an intelicard before you deconstruct");
                return;
            }

            ToolUtils.ServerUseToolWithActionMessages(interaction, 5f,
                                                      "You start unscrewing in the glass on the Ai core...",
                                                      $"{interaction.Performer.ExpensiveName()} starts unscrewing the glass on the Ai core...",
                                                      "You unscrew the glass on the Ai core.",
                                                      $"{interaction.Performer.ExpensiveName()} unscrews the glass on the Ai core.",
                                                      () =>
            {
                var newCoreFrame = Spawn.ServerPrefab(aiCoreFramePrefab, SpawnDestination.At(gameObject), 1);

                if (newCoreFrame.Successful)
                {
                    newCoreFrame.GameObject.GetComponent <AiCoreFrame>().SetUp();
                }

                _ = Despawn.ServerSingle(gameObject);
            });
        }
Example #25
0
        /// <summary>
        /// Stage 2, Wrench down to continue construction, anchors machine, or wirecutters to move to stage 1
        /// </summary>
        /// <param name="interaction"></param>
        private void CablesAddedStateInteraction(HandApply interaction)
        {
            if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wirecutter))
            {
                //cut out cables
                Chat.AddActionMsgToChat(interaction, $"You remove the cables.",
                                        $"{interaction.Performer.ExpensiveName()} removes the cables.");
                ToolUtils.ServerPlayToolSound(interaction);
                Spawn.ServerPrefab(CommonPrefabs.Instance.SingleCableCoil, SpawnDestination.At(gameObject), 5);
                stateful.ServerChangeState(initialState);

                spriteHandler.ChangeSprite((int)SpriteStates.Box);
            }
            else if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wrench))
            {
                if (!ServerValidations.IsAnchorBlocked(interaction))
                {
                    //wrench in place
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start wrenching the frame into place...",
                                                              $"{interaction.Performer.ExpensiveName()} starts wrenching the frame into place...",
                                                              "You wrench the frame into place.",
                                                              $"{interaction.Performer.ExpensiveName()} wrenches the frame into place.",
                                                              () => objectBehaviour.ServerSetAnchored(true, interaction.Performer));
                    stateful.ServerChangeState(wrenchedState);
                }
                else
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer, "Unable to wrench frame");
                }
            }
        }
        public void WithdrawTeleCrystals(HandApply interaction)
        {
            if (SyndicateOpConsole.Instance.TcReserve == 0)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"There are no telecrystals in reserve");
                return;
            }
            if (interaction.UsedObject == null)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"There are {SyndicateOpConsole.Instance.TcReserve} telecrystals in reserve");
                return;
            }
            PDALogic pdaComp = interaction.UsedObject.GetComponent <PDALogic>();

            if (pdaComp != null)
            {
                if (pdaComp.IsUplinkLocked == false)
                {
                    var amount = Math.Min(TransferAmount, SyndicateOpConsole.Instance.TcReserve);
                    pdaComp.UplinkTC += amount;
                    pdaComp.UpdateTCCountGui();
                    SyndicateOpConsole.Instance.TcReserve -= amount;
                    Chat.AddExamineMsgFromServer(interaction.Performer, $"You successfully transfer {amount} telecrystals into the {interaction.TargetObject.ExpensiveName()}");
                }
                else
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer, $"Your {interaction.TargetObject.ExpensiveName()} must be unlocked to transfer TC!");
                }
            }
        }
Example #27
0
 public void ServerPerformInteraction(HandApply interaction)
 {
     if (interaction.HandObject == null)
     {
         if (printer.TrayOpen)
         {
             Chat.AddExamineMsgFromServer(interaction.Performer, "You close the tray.");
             ToggleTray();
         }
         else if (scanner.ScannerOpen)
         {
             Chat.AddExamineMsgFromServer(interaction.Performer, "You close the scanner lid.");
             ToggleScannerLid();
         }
         else
         {
             OnGuiRenderRequired();
             TabUpdateMessage.Send(interaction.Performer, gameObject, NetTabType, TabAction.Open);
         }
     }
     else if (printer.CanAddPageToTray(interaction.HandObject))
     {
         printer = printer.AddPageToTray(interaction.HandObject);
         Chat.AddExamineMsgFromServer(interaction.Performer, "You place the sheet in the tray.");
     }
     else if (scanner.CanPlaceDocument(interaction.HandObject))
     {
         scanner = scanner.PlaceDocument(interaction.HandObject);
         Chat.AddExamineMsgFromServer(interaction.Performer, "You place the document in the scanner.");
     }
 }
Example #28
0
    public void ServerPerformInteraction(HandApply interaction)
    {
        var LHB = interaction.TargetObject.GetComponent <LivingHealthBehaviour>();

        if (LHB.IsDead)
        {
            return;
        }
        var targetBodyPart = LHB.FindBodyPart(interaction.TargetBodyPart);

        if (targetBodyPart.GetDamageValue(healType) > 0)
        {
            if (interaction.TargetObject != interaction.Performer)
            {
                ServerApplyHeal(targetBodyPart);
            }
            else
            {
                ServerSelfHeal(interaction.Performer, targetBodyPart);
            }
        }
        else
        {
            Chat.AddExamineMsgFromServer(interaction.Performer, $"The {interaction.TargetBodyPart} does not need to be healed.");
        }
    }
        public bool TryDeconstructCore(HandApply interaction)
        {
            if (Validations.HasItemTrait(interaction.UsedObject, CommonTraits.Instance.Welder) &&
                MeltedDown == false)
            {
                if (ReactorRods.All(x => x == null))
                {
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 10,
                                                              "You start to deconstruct the empty core...",
                                                              $"{interaction.Performer.ExpensiveName()} starts to deconstruct the empty core...",
                                                              "You deconstruct the empty core.",
                                                              $"{interaction.Performer.ExpensiveName()} deconstruct the empty core.",
                                                              () => { _ = Despawn.ServerSingle(gameObject); });
                }
                else
                {
                    Chat.AddExamineMsgFromServer(interaction.Performer,
                                                 "The inserted rods make it impossible to deconstruct");
                }

                return(true);
            }

            return(false);
        }
Example #30
0
        public void ServerPerformInteraction(HandApply interaction)
        {
            if (MachineParts == null)
            {
                return;
            }

            if (canNotBeDeconstructed)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, "This machine is too well built to be deconstructed.");
                return;
            }

            if (mustBeUnanchored && gameObject.GetComponent <PushPull>()?.IsPushable == false)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"The {gameObject.ExpensiveName()} needs to be unanchored first.");
                return;
            }

            //unscrew
            ToolUtils.ServerUseToolWithActionMessages(interaction, secondsToScrewdrive,
                                                      $"You start to deconstruct the {gameObject.ExpensiveName()}...",
                                                      $"{interaction.Performer.ExpensiveName()} starts to deconstruct the {gameObject.ExpensiveName()}...",
                                                      $"You deconstruct the {gameObject.ExpensiveName()}.",
                                                      $"{interaction.Performer.ExpensiveName()} deconstructs the {gameObject.ExpensiveName()}.",
                                                      () =>
            {
                WhenDestroyed(null);
            });
        }