public void Update() { if (!Entity.Exists(Shuttle)) { return; } if (PlayerPed.IsInVehicle(new Vehicle(Shuttle.Handle))) { if (Game.IsControlJustPressed(2, Control.Jump)) { Shuttle.Launch(); } } else { EnterShuttle(); } if (Shuttle.HeightAboveGround <= Settings.EnterOrbitHeight) { return; } Shuttle.RemoveAttachments(); Shuttle.HasCollision = true; Shuttle = null; }
public void CreateShuttle() { Shuttle?.Delete(); var m = new Model("shuttle"); m.Request(); while (!m.IsLoaded) { Script.Yield(); } var v = World.CreateVehicle(m, _shuttlePosition, ShuttleHeading); v.Rotation = v.Rotation + new Vector3(90, 0, 0); // Rotate the shuttle upwards. v.Position = _shuttlePosition; v.HasCollision = false; v.FreezePosition = true; Shuttle = new SpaceShuttle(v.Handle); Shuttle.SpawnAttachments(); var b = Shuttle.AddBlip(); b.Sprite = BlipSprite.Rockets; b.Name = "NASA Shuttle"; }