public static void swapseats(ConsoleSystem.Arg arg) { int num = 0; BasePlayer basePlayer = arg.Player(); if (basePlayer == null) { return; } if (basePlayer.SwapSeatCooldown()) { return; } BaseMountable mounted = basePlayer.GetMounted(); if (mounted == null) { return; } BaseVehicle component = mounted.GetComponent <BaseVehicle>(); if (component == null) { component = mounted.VehicleParent(); } if (component == null) { return; } component.SwapSeats(basePlayer, num); }
private object CanMountEntity(BaseMountable mountable, BasePlayer player) { CarController controller = mountable.GetComponent <CarController>(); if (controller != null) { if (player.isMounted) { return(false); } if (controller.isDying) { return(false); } CarController.MountPoint mountPoint = controller.GetClosestMountPoint(player.transform.position); if (mountPoint != null && !mountPoint.Entity.IsMounted()) { mountPoint.MountPlayer(player); return(false); } } return(null); }
private void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { CarController controller = mountable.GetComponent <CarController>(); if (controller != null && controller.Driver?.userID == player.userID) { controller.Driver = null; controller.mountPoints[0].OnEntityDismounted(); return; } CarController.InvisibleMount invisibleMount = mountable.GetComponent <CarController.InvisibleMount>(); if (invisibleMount != null) { invisibleMount.MountPosition.OnEntityDismounted(); } }
private void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { CarController controller = mountable.GetComponent <CarController>(); if (controller != null && controller.player == player) { controller.OnDriverExit(); } }
private void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { _MagicCarpet mc = mountable.GetComponent <_MagicCarpet>(); if (!mc) { return; } mc.player = null; }
private void OnEntityDismounted(BaseMountable entity, BasePlayer player) { var FuelVehicle = entity.GetComponent <FuelVehicle>(); if (!FuelVehicle) { return; } FuelVehicle.End(true); }
public void GeneratePrefab() { entity = (BaseMountable)GameManager.server.CreateEntity(controller.car.chairRef.resourcePath, controller.transform.position); entity.enableSaving = false; entity.skinID = (ulong)1169930802; entity.Spawn(); entity.maxMountDistance = 2f; Destroy(entity.GetComponent <DestroyOnGroundMissing>()); Destroy(entity.GetComponent <GroundWatch>()); entity.GetComponent <MeshCollider>().convex = true; InvisibleMount invisibleMount = entity.gameObject.AddComponent <InvisibleMount>(); invisibleMount.MountPosition = this; entity.SetParent(controller.car); entity.transform.localPosition = offset; }
private object CanDismountEntity(BaseMountable mountable, BasePlayer player) { CarController.InvisibleMount invisibleMount = mountable.GetComponent <CarController.InvisibleMount>(); if (invisibleMount != null) { invisibleMount.MountPosition.DismountPlayer(); return(false); } return(null); }
void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { var activecarpet = mountable.GetComponentInParent <CarpetEntity>() ?? null; if (activecarpet != null) { #if DEBUG Puts("OnEntityMounted: player dismounted copter!"); #endif if (mountable.GetComponent <BaseEntity>() != activecarpet.entity) { return; } } }
void OnEntityMounted(BaseMountable mountable, BasePlayer player) { var activecarpet = mountable.GetComponentInParent <CarpetEntity>() ?? null; if (activecarpet != null) { #if DEBUG Puts("OnEntityMounted: player mounted copter!"); #endif if (mountable.GetComponent <BaseEntity>() != activecarpet.entity) { return; } activecarpet.lantern1.SetFlag(BaseEntity.Flags.On, false); } }
public void DestroyMountPoint() { if (isDriver) { return; } if (entity.IsMounted()) { DismountPlayer(); } if (entity != null && !entity.IsDestroyed) { Destroy(entity.GetComponent <InvisibleMount>()); entity.Kill(BaseNetworkable.DestroyMode.None); } }
private object CanMountEntity(BaseMountable mountable, BasePlayer player) { CarController controller = mountable.GetComponent <CarController>(); if (controller != null) { if (player.isMounted) { return(false); } if (controller.isDieing) { return(false); } if (!HasPermission(player, "carcommanderlite.use")) { SendReply(player, msg("nopermission", player.UserIDString)); return(false); } } return(null); }
public static void swapseats(Arg arg) { int targetSeat = 0; BasePlayer basePlayer = ArgEx.Player(arg); if (basePlayer == null || basePlayer.SwapSeatCooldown()) { return; } BaseMountable mounted = basePlayer.GetMounted(); if (!(mounted == null)) { BaseVehicle baseVehicle = mounted.GetComponent <BaseVehicle>(); if (baseVehicle == null) { baseVehicle = mounted.VehicleParent(); } if (!(baseVehicle == null)) { baseVehicle.SwapSeats(basePlayer, targetSeat); } } }