コード例 #1
0
    protected void Awake()
    {
        directional  = GetComponent <Directional>();
        playerHealth = GetComponent <PlayerHealthV2>();

        foreach (ClothingItem c in GetComponentsInChildren <ClothingItem>())
        {
            clothes[c.name] = c;
            // add listener in case clothing was changed
            c.OnClothingEquipped += OnClothingEquipped;
        }

        for (int i = 0; i < BodyParts.transform.childCount; i++)
        {
            //TODO: Do we need to add listeners for implant removalv
            bodyParts[BodyParts.transform.GetChild(i).name] = BodyParts.transform.GetChild(i).gameObject;
        }


        AddOverlayGameObjects();

        directional.OnDirectionChange.AddListener(OnDirectionChange);
        //TODO: Need to reimplement fire stacks on players.
        playerHealth.EnsureInit();
        playerHealth.OnClientFireStacksChange.AddListener(OnClientFireStacksChange);
        OnClientFireStacksChange(playerHealth.FireStacks);
    }
コード例 #2
0
        private IEnumerator Coitus(PlayerHealthV2 player)
        {
            yield return(WaitFor.Seconds(coitusTime));

            _ = Pregnancy(player);
            yield return(WaitFor.EndOfFrame);
        }
コード例 #3
0
ファイル: PlayerSprites.cs プロジェクト: ktndrnl/unitystation
    protected void Awake()
    {
        directional  = GetComponent <Directional>();
        playerHealth = GetComponent <PlayerHealthV2>();

        foreach (var clothingItem in GetComponentsInChildren <ClothingItem>())
        {
            clothes.Add(clothingItem.Slot, clothingItem);
        }

        for (var i = 0; i < BodyParts.transform.childCount; i++)
        {
            //TODO: Do we need to add listeners for implant removalv
            bodyParts[BodyParts.transform.GetChild(i).name] = BodyParts.transform.GetChild(i).gameObject;
        }

        AddOverlayGameObjects();

        directional.OnDirectionChange.AddListener(OnDirectionChange);
        //TODO: Need to reimplement fire stacks on players.
        playerHealth.OnClientFireStacksChange.AddListener(OnClientFireStacksChange);
        var healthStateController = GetComponent <HealthStateController>();

        OnClientFireStacksChange(healthStateController.FireStacks);
    }
コード例 #4
0
ファイル: PlayerMove.cs プロジェクト: ewy0/unitystation
    private bool CanUnBuckleSelf()
    {
        PlayerHealthV2 playerHealth = playerScript.playerHealth;

        return(!(playerHealth == null ||
                 playerHealth.ConsciousState == ConsciousState.DEAD ||
                 playerHealth.ConsciousState == ConsciousState.UNCONSCIOUS ||
                 playerHealth.ConsciousState == ConsciousState.BARELY_CONSCIOUS));
    }
コード例 #5
0
        protected void Awake()
        {
            directional  = GetComponent <Rotatable>();
            playerHealth = GetComponent <PlayerHealthV2>();

            foreach (var clothingItem in GetComponentsInChildren <ClothingItem>())
            {
                clothes.Add(clothingItem.Slot, clothingItem);
            }

            AddOverlayGameObjects();
        }
コード例 #6
0
    private static bool CanInteractByConsciousState(PlayerHealthV2 playerHealth, bool allowSoftCrit, NetworkSide side)
    {
        if (side == NetworkSide.Client)
        {
            //we only know our own conscious state, so assume true if it's not our local player
            if (playerHealth.gameObject != PlayerManager.LocalPlayer)
            {
                return(true);
            }
        }

        return(playerHealth.ConsciousState == ConsciousState.CONSCIOUS ||
               playerHealth.ConsciousState == ConsciousState.BARELY_CONSCIOUS && allowSoftCrit);
    }
コード例 #7
0
        private async Task Pregnancy(PlayerHealthV2 player)
        {
            KillHugger();
            await Task.Delay(TimeSpan.FromSeconds(pregnancyTime));

            //TODO check if the larvae was removed from stomach
            player.ApplyDamageToBodyPart(
                gameObject,
                200,
                AttackType.Internal,
                DamageType.Brute,
                BodyPartType.Chest);

            Spawn.ServerPrefab(larvae, player.gameObject.RegisterTile().WorldPositionServer);
        }
コード例 #8
0
        private bool CanUncuff()
        {
            PlayerHealthV2 playerHealth = thisPlayerScript.playerHealth;

            if (playerHealth == null ||
                playerHealth.ConsciousState == ConsciousState.DEAD ||
                playerHealth.ConsciousState == ConsciousState.UNCONSCIOUS ||
                thisPlayerScript.registerTile.IsSlippingServer ||
                positionCache != thisPlayerScript.registerTile.LocalPositionServer)
            {
                return(false);
            }

            return(true);
        }
コード例 #9
0
        private async Task Pregnancy(PlayerHealthV2 player)
        {
            await Task.Delay(TimeSpan.FromSeconds(killTime - (killTime / 8)));

            Chat.AddActionMsgToChat(player.gameObject, "Your stomach gurgles uncomfortably...",
                                    $"A dangerous sounding gurgle emanates from " + player.name + "!");
            await Task.Delay(TimeSpan.FromSeconds(killTime / 8));

            player.ApplyDamageToBodyPart(
                gameObject,
                200,
                AttackType.Internal,
                DamageType.Brute,
                BodyPartType.Chest);
            Spawn.ServerPrefab(larvae, player.gameObject.RegisterTile().WorldPositionServer);
        }
コード例 #10
0
    protected void Awake()
    {
        directional  = GetComponent <Directional>();
        playerHealth = GetComponent <PlayerHealthV2>();

        foreach (var clothingItem in GetComponentsInChildren <ClothingItem>())
        {
            clothes.Add(clothingItem.Slot, clothingItem);
        }

        AddOverlayGameObjects();

        directional.OnDirectionChange.AddListener(OnDirectionChange);
        //TODO: Need to reimplement fire stacks on players.
        playerHealth.OnClientFireStacksChange.AddListener(OnClientFireStacksChange);
        var healthStateController = GetComponent <HealthStateController>();

        OnClientFireStacksChange(healthStateController.FireStacks);
    }
コード例 #11
0
    private ObserveStorageRelationship(InteractableStorage observedStorage, RegisterPlayer observer,
                                       float maxRange, Action <ObserveStorageRelationship> onObservationEnded) :
        base(observedStorage.GetComponent <RegisterTile>(), observer, maxRange, (rship) => onObservationEnded.Invoke(rship as ObserveStorageRelationship))
    {
        this.ObservedStorage = observedStorage;
        this.ObserverPlayer  = observer;
        //check if the observed storage is in a player's inventory, and if so, populate the fields / event hooks
        var rootStorage = observedStorage.ItemStorage.GetRootStorage();

        this.observedPlayerMove = rootStorage.GetComponent <PlayerMove>();
        if (observedPlayerMove != null)
        {
            this.observedRegisterPlayer = rootStorage.GetComponent <RegisterPlayer>();

            this.observedPlayerHealth = rootStorage.GetComponent <PlayerHealthV2>();

            //add listeners for non-range-based ways in which the relationship can end
            observedPlayerMove.OnCuffChangeServer.AddListener(OnCuffChangeServer);
            observedRegisterPlayer.OnSlipChangeServer.AddListener(OnSlipChangeServer);
            observedPlayerHealth.OnConsciousStateChangeServer.AddListener(OnConsciousStateChangeServer);
        }
    }
コード例 #12
0
ファイル: WearableArmor.cs プロジェクト: Zeropol/unitystation
    public void OnInventoryMoveServer(InventoryMove info)
    {
        //Wearing
        if (info.ToSlot != null & info.ToSlot?.NamedSlot != null)
        {
            player = info.ToRootPlayer?.PlayerScript.playerHealth;

            if (player != null && info.ToSlot.NamedSlot == slot)
            {
                UpdateBodyPartsArmor();
            }
        }
        //taking off
        if (info.FromSlot != null & info.FromSlot?.NamedSlot != null)
        {
            player = info.FromRootPlayer?.PlayerScript.playerHealth;

            if (player != null && info.FromSlot.NamedSlot == slot)
            {
                UpdateBodyPartsArmor(remove: true);
            }
        }
    }