コード例 #1
0
ファイル: EnergySword.cs プロジェクト: mgbowman1/unitystation
    private void ServerUpdateValues()
    {
        if (originalVerbs.Count == 0)
        {         // Get the initial values before we replace
            originalHitDamage   = itemAttributes.ServerHitDamage;
            originalThrowDamage = itemAttributes.ServerThrowDamage;
            originalVerbs       = new List <string>(itemAttributes.ServerAttackVerbs);
            originalSize        = itemAttributes.Size;
            originalHitSound    = itemAttributes.ServerHitSound;
        }

        if (activated)
        {
            itemAttributes.ServerHitDamage   = activatedHitDamage;
            itemAttributes.ServerThrowDamage = activatedThrowDamage;
            itemAttributes.ServerAttackVerbs = activatedVerbs;
            itemAttributes.ServerSetSize(activatedSize);
            itemAttributes.ServerHitSound = activatedHitSound;
        }
        else
        {
            itemAttributes.ServerHitDamage   = originalHitDamage;
            itemAttributes.ServerThrowDamage = originalThrowDamage;
            itemAttributes.ServerAttackVerbs = originalVerbs;
            itemAttributes.ServerSetSize(originalSize);
            itemAttributes.ServerHitSound = originalHitSound;
        }
    }
コード例 #2
0
 private void SetDeactivatedAttributes()
 {
     itemAttributes.ServerSetSize(offSize);
     itemAttributes.ServerHitSound    = offHitSound;
     itemAttributes.ServerHitDamage   = offHitDamage;
     itemAttributes.ServerThrowDamage = offThrowDamage;
     itemAttributes.ServerAttackVerbs = offAttackVerbs;
 }
コード例 #3
0
ファイル: SawnOff.cs プロジェクト: ewy0/unitystation
    public void ServerPerformInteraction(InventoryApply interaction)
    {
        if (interaction.TargetObject != gameObject && !interaction.IsFromHandSlot)
        {
            return;
        }

        //TODO: switch this trait to the circular saw when that is implemented
        if (Validations.HasItemTrait(interaction.UsedObject, CommonTraits.Instance.Welder) && gunComp.FireCountDown == 0)
        {
            if (isSawn)
            {
                Chat.AddExamineMsg(interaction.Performer, $"The {gameObject.ExpensiveName()} is already shortened!");
            }

            if (ammoBackfire && gunComp.CurrentMagazine.ServerAmmoRemains != 0)
            {
                gunComp.ServerShoot(interaction.Performer, Vector2.zero, BodyPartType.Head, true);
                Chat.AddActionMsgToChat(interaction.Performer,
                                        $"The {gameObject.ExpensiveName()} goes off in your face!",
                                        $"The {gameObject.ExpensiveName()} goes off in {interaction.Performer.ExpensiveName()}'s face!");
            }
            else
            {
                Chat.AddActionMsgToChat(interaction.Performer,
                                        $"You shorten the {gameObject.ExpensiveName()}.",
                                        $"{interaction.Performer.ExpensiveName()} shortens the {gameObject.ExpensiveName()}");

                itemAttComp.ServerSetSize(sawnSize);
                spriteHandler.ChangeSprite(1);

                // Don't overwrite recoil conf if it isn't setup
                if (SawnCameraRecoilConfig.Distance != 0f)
                {
                    gunComp.SyncCameraRecoilConfig(gunComp.CameraRecoilConfig, SawnCameraRecoilConfig);
                }

                gunComp.MaxRecoilVariance = sawnMaxRecoilVariance;
                isSawn = true;
            }
        }

        // Propagates the InventoryApply Interaction to the Gun component for all basic gun InventoryApply interactions.
        gunComp.ServerPerformInteraction(interaction);
    }
コード例 #4
0
 public void SetSize(ItemSize size)
 {
     itemAttributesV2.ServerSetSize(size);
 }