NullReferenceException when placing the drone while standing inside the elevatorSolved

To reproduce the issue you must stand inside elevator (behind garage door if that matters) and try to place a drone.

NullReferenceException: Object reference not set to an instance of an object.
  at FirstPersonSpectatorMode.Apply (UnityEngine.Camera cam, BaseEntity target) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayerEyes.DoFirstPersonCamera (UnityEngine.Camera cam) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayerEyes.FrameUpdate (UnityEngine.Camera cam) [0x00000] in <00000000000000000000000000000000>:0 
  at BasePlayer.ClientUpdateLocalPlayer () [0x00000] in <00000000000000000000000000000000>:0 
  at BasePlayer.ClientCycle (System.Single deltaTime) [0x00000] in <00000000000000000000000000000000>:0 
  at Client.Update () [0x00000] in <00000000000000000000000000000000>:0 
 
(Filename: currently not available on il2cpp Line: -1)


In case @k1lly0u will never fix this, you can do it yourself.
find the following line in plugin code:

        private void OnEntityBuilt(Planner planner, GameObject gameObject)​

Add the following code ABOVE that line:

        private object CanBuild(Planner planner, Construction prefab)
        {
            BasePlayer player = planner?.GetOwnerPlayer();
            if (player == null)
            {
                return null;
            }

            if (prefab.fullName == "assets/prefabs/deployable/drone/drone.deployed.prefab")
            {
                if (player.GetMountedVehicle() != null || player.GetParentEntity() != null)
                {
                    player.ChatMessage("You can't place drone while mounted or parented");
                    return false;
                }
            }
            return null;
        }
Locked automatically