void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { var mini = mountable.GetComponentInParent <MiniCopter>() ?? null; if (mini != null) { #if DEBUG Puts($"Player {player.userID.ToString()} dismounted seat id {mountable.net.ID.ToString()}"); #endif var id = mountable.net.ID - 2; for (int i = 0; i < 3; i++) { // Find copter and seats in storedData #if DEBUG Puts($"Is this our copter with ID {id.ToString()}?"); #endif if (storedData.playerminiID.ContainsValue(id)) { #if DEBUG Puts($"Removing {player.displayName}'s ID {player.userID} from currentMounts for seat {mountable.net.ID.ToString()} on {id}"); #endif currentMounts.Remove(mountable.net.ID); break; } id++; } } var myKey = currentMounts.FirstOrDefault(x => x.Value == player.userID).Key; currentMounts.Remove(myKey); }
void OnEntityMounted(BaseMountable mountable, BasePlayer player) { var mini = mountable.GetComponentInParent <MiniCopter>() ?? null; if (mini != null) { #if DEBUG Puts($"Player {player.userID.ToString()} mounted seat id {mountable.net.ID.ToString()}"); #endif // Check this seat's ID to see if the copter is one of ours uint id = mountable.net.ID - 2; // max seat == copter.net.ID + 2, e.g. passenger seat id - 2 == copter id for (int i = 0; i < 3; i++) { // Find copter in storedData #if DEBUG Puts($"Is this our copter with ID {id.ToString()}?"); #endif if (storedData.playerminiID.ContainsValue(id)) { #if DEBUG Puts($"Removing {player.displayName}'s ID {player.userID} from currentMounts for seat {mountable.net.ID.ToString()} on {id}"); #endif currentMounts.Remove(mountable.net.ID); #if DEBUG Puts($"Adding {player.displayName}'s ID {player.userID} to currentMounts for seat {mountable.net.ID.ToString()} on {id}"); #endif currentMounts.Add(mountable.net.ID, player.userID); break; } id++; } } }
void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { var station = mountable.GetComponentInParent <ComputerStation>() ?? null; if (station != null) { #if DEBUG Puts("OnEntityMounted: player dismounted CS!"); #endif } }
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); } }
object CanDismountEntity(BasePlayer player, BaseMountable mountable) { if (player == null) { return(null); } var mini = mountable.GetComponentInParent <MiniCopter>() ?? null; if (mini != null) { if (!Physics.Raycast(new Ray(mountable.transform.position, Vector3.down), minDismountHeight, layerMask)) { // Is this one of ours? if (storedData.playerminiID.ContainsValue(mountable.net.ID - 1)) { if (!allowDriverDismountWhileFlying) { #if DEBUG Puts("DENY PILOT DISMOUNT"); #endif return(false); } var myKey = currentMounts.FirstOrDefault(x => x.Value == player.userID).Key; currentMounts.Remove(myKey); } else if (storedData.playerminiID.ContainsValue(mountable.net.ID - 2)) { if (!allowPassengerDismountWhileFlying) { #if DEBUG Puts("DENY PASSENGER DISMOUNT"); #endif return(false); } var myKey = currentMounts.FirstOrDefault(x => x.Value == player.userID).Key; currentMounts.Remove(myKey); } } return(null); } return(null); }
object CanMountEntity(BasePlayer player, BaseMountable mountable) { if (player == null) { return(null); } var mini = mountable.GetComponentInParent <MiniCopter>() ?? null; if (mini != null) { #if DEBUG Puts($"Player {player.userID.ToString()} wants to mount seat id {mountable.net.ID.ToString()}"); #endif var id = mountable.net.ID - 2; for (int i = 0; i < 3; i++) { // Find copter and seats in storedData #if DEBUG Puts($" Is this our copter with ID {id.ToString()}?"); #endif if (storedData.playerminiID.ContainsValue(id)) { #if DEBUG Puts(" yes, it is..."); #endif if (currentMounts.ContainsValue(player.userID)) { if (!player.GetMounted()) { var myKey = currentMounts.FirstOrDefault(x => x.Value == player.userID).Key; currentMounts.Remove(myKey); } return(false); } } id++; } } return(null); }
void OnEntityMounted(BaseMountable mountable, BasePlayer player) { var station = mountable.GetComponentInParent <ComputerStation>() ?? null; if (station != null && (configData.blockServerCams && !player.IPlayer.HasPermission(permCCTVAdmin))) { #if DEBUG Puts("OnEntityMounted: player mounted CS!"); #endif List <string> toremove = new List <string>(); foreach (KeyValuePair <string, uint> bm in station.controlBookmarks) { var cament = BaseNetworkable.serverEntities.Find(bm.Value); var realcam = cament as IRemoteControllable; var ent = realcam.GetEnt(); if (ent == null) { continue; } var cname = realcam.GetIdentifier(); if (cname == null) { continue; } if (ent.OwnerID == 0) { toremove.Add(cname); } } foreach (string cn in toremove) { station.controlBookmarks.Remove(cn); } station.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); station.SendControlBookmarks(player); } }
private void OnEntityMounted(BaseMountable mountable, BasePlayer player) { if (player == null) { return; } if (mountable == null) { return; } if (!configData.Options.SetOwnerOnFirstMount) { return; } RidableHorse horse = mountable.GetComponentInParent <RidableHorse>(); if (horse != null) { ulong userid = player.userID; if (IsAtLimit(userid)) { if (permission.UserHasPermission(userid.ToString(), permVIP)) { Message(player.IPlayer, "horselimit", configData.Options.VIPLimit); } else { Message(player.IPlayer, "horselimit", configData.Options.Limit); } return; } if (!horses.ContainsKey(mountable.net.ID)) { horse.OwnerID = player.userID; ulong horseid = horse.net.ID; horses.Remove(horseid); horses.Add(horseid, player.userID); SaveData(); if (configData.Options.EnableTimer) { htimer.Add(horseid, new HTimer() { start = Time.realtimeSinceStartup, countdown = configData.Options.ReleaseTime, userid = player.userID }); HandleTimer(horseid, player.userID, true); } Message(player.IPlayer, "horseclaimed"); if (configData.Options.debug) { Puts($"Player {player.userID.ToString()} mounted horse {mountable.net.ID.ToString()} and now owns it."); } } else if (horse.OwnerID == userid) { Message(player.IPlayer, "yourhorse"); } else { Message(player.IPlayer, "horseowned"); } } }