Exemplo n.º 1
0
        static void Prefix(EntityBehaviorPlayerPhysics __instance, Entity entity, float dt)
        {
            // FileLog.Log("Logs onto desktop Logger");

            // Continue if entity is a player
            if (entity is EntityPlayer entityPlayer)
            {
                // Assign useful variables
                EntityControls controls  = entityPlayer.Controls;
                string         playerUID = entity.WatchedAttributes.GetString("playerUID");
                IPlayer        player    = entity.World.PlayerByUid(playerUID);

                if (PlayerManager.Instance == null)
                {
                    return;
                }

                if (player == null)
                {
                    return;
                }

                PlayerData playerData = PlayerManager.Instance.GetOrAddPlayerData(player);

                // Sitting Logic
                if (playerData != null && playerData.IsPlayerSitting())
                {
                    // Disable Movement
                    controls.StopAllMovement();
                }
            }
        }
Exemplo n.º 2
0
 private void onControls(EnumEntityAction action, bool on, ref EnumHandling handled)
 {
     if (action == EnumEntityAction.Sneak && on)
     {
         MountedBy?.TryUnmount();
         controls.StopAllMovement();
     }
 }