private void KillNPCPlayer(BaseNetworkable entity) { if (entity == null || entity.IsDestroyed || !(entity is NPCPlayer)) { return; } var npcApex = entity.gameObject.GetComponent <NPCPlayerApex>(); if (npcApex == null) { return; } var npcLocationType = npcApex?.AiContext?.AiLocationManager?.LocationType; if (npcLocationType == null) { return; } if (npcLocationType == AiLocationSpawner.SquadSpawnerLocation.Compound && disallowCompoundNPC) { entity.Kill(BaseNetworkable.DestroyMode.Gib); } if (npcLocationType == AiLocationSpawner.SquadSpawnerLocation.BanditTown && disallowBanditNPC) { entity.Kill(BaseNetworkable.DestroyMode.Gib); } }
void OnEntityBuilt(Planner plan, GameObject go) { BaseNetworkable baseNet = go.GetComponent <BaseNetworkable>(); string shortName = baseNet.ShortPrefabName; if (shortName.Contains("sleepingbag") || shortName.Contains("bed")) { if (FindBedsNearby(go.GetComponent <SleepingBag>()) > bedsConfig.maxplayers) { BasePlayer baseP = plan.GetOwnerPlayer(); SendReply(baseP, Lang("CantPlaceBed", baseP.UserIDString)); if (shortName.Contains("sleepingbag")) { timer.Once(1f, () => { baseP.inventory.GiveItem(ItemManager.CreateByItemID(1253290621)); }); } else { timer.Once(1f, () => { baseP.inventory.GiveItem(ItemManager.CreateByItemID(97409)); }); } baseNet.Kill(); } } }
void OnEntitySpawned(BaseNetworkable entity) { if (entity == null) { return; } if (entity is CargoShip) { if (_debug) { Puts("Cargo has spawned"); } hasCargoSpawned = true; if (RandomNumber() > probability) { preventNPCSpawning = true; if (canBroadcast) { BroadcastMessage("NoScientistOnCargo"); } } else { preventNPCSpawning = false; if (canBroadcast) { BroadcastMessage("ScientistOnCargo"); } } if (_debug) { Puts("Prevent SpawningNPC: " + preventNPCSpawning); } timer.Once(5f, () => { hasCargoSpawned = false; }); } if (!hasCargoSpawned) { return; } if (preventNPCSpawning) { if (entity.PrefabName.Contains(prefab)) { entity.Kill(); if (_debug) { Puts("NPC Killed"); } } } }
private void CreatePlant(BaseNetworkable seed, string prefab, Vector3 pos, int amount) { RaycastHit hit; Physics.Raycast(pos, Vector3.down, out hit); if (hit.GetEntity() != null) { return; } pos.y = TerrainMeta.HeightMap.GetHeight(seed.transform.position); seed.Kill(); for (var i = 0; i < amount; i++) { if (_config.RandomizePosition) { pos.x += UnityEngine.Random.Range(-_config.RandomizePositionOn, _config.RandomizePositionOn); pos.z += UnityEngine.Random.Range(-_config.RandomizePositionOn, _config.RandomizePositionOn); pos.y = TerrainMeta.HeightMap.GetHeight(pos); } var plant = GameManager.server.CreateEntity(prefab, pos, Quaternion.identity) as PlantEntity; if (plant == null) { continue; } plant.Spawn(); } }
private void OnEntitySpawned(BaseNetworkable entity) { if (!(entity is BaseNpc) && !(entity is NPCPlayer) || _config.Whitelist.Contains(entity.PrefabName)) { return; } //Next Tick for parenting, e.t.c NextTick(() => { entity.Kill(); }); }
private bool ProcessBarrel(BaseNetworkable entity) { if (entity.isActiveAndEnabled && barrels.Contains(entity.LookupShortPrefabName())) { entity.Kill(); return(true); } return(false); }
private bool checkEnt(BaseNetworkable entity) { if (entity.isActiveAndEnabled && animal_list.Contains(entity.LookupPrefab().name)) { entity.Kill(); return(true); } return(false); }
private void OnEntitySpawned(BaseNetworkable entity) { if (isInitialized) { if (configData.deployables.Contains(entity.ShortPrefabName) || configData.deployables.Contains(entity.PrefabName)) { var ownerID = entity.GetComponent <BaseEntity>().OwnerID; if (ownerID != 0) { BasePlayer player = BasePlayer.FindByID(ownerID); if (player == null || player.IsAdmin || IsInPrivilege(player)) { return; } List <ItemAmount> items = new List <ItemAmount>(); if (entity is BuildingBlock && constructionToIngredients.ContainsKey(entity.PrefabName)) { foreach (var ingredient in constructionToIngredients[entity.PrefabName]) { items.Add(ingredient); } } else if (prefabToItem.ContainsKey(entity.PrefabName)) { items.Add(new ItemAmount { amount = 1, startAmount = 1, itemDef = ItemManager.FindItemDefinition(prefabToItem[entity.PrefabName]) }); } if (!pendingItems.ContainsKey(player.userID)) { pendingItems.Add(player.userID, new PendingItem()); } pendingItems[player.userID].items = items; CheckForDuplicate(player); StorageContainer container = entity.GetComponent <StorageContainer>(); if (container != null) { container.inventory.Clear(); } if (entity is BaseTrap || !(entity is BaseCombatEntity)) { entity.Kill(); } else { (entity as BaseCombatEntity).DieInstantly(); } } } } }
void OnEntitySpawned(BaseNetworkable entity) { if (entity is OreResourceEntity) { if (UnityEngine.Random.Range(0, 5) == 3) { entity.Kill(); } } }
void OnEntitySpawned(BaseNetworkable entity) { if (entity as SupplyDrop) { timer.Once(destroyafter, () => { entity.Kill(); Puts("Successfully destroyed " + entity.name.ToString()); }); } }
void OnEntitySpawned(BaseNetworkable entity) { if (entity.GetType() == typeof(BaseHelicopter)) { if (!allowedEntities.Contains((BaseEntity)entity) && heliEnabled == false) { entity.Kill(); } } }
private bool CheckNetworkable(BaseNetworkable networkable) { if (isBlocked(networkable.name, networkable.PrefabName, networkable.ShortPrefabName)) { networkable.Kill(); return(true); } return(false); }
private void OnPlayerDisconnected(BasePlayer player, string reason) { if (!killOnSleep) { return; } if (player == null) { return; } if (storedData.playerminiID.ContainsKey(player.userID) == true) { uint deluint; storedData.playerminiID.TryGetValue(player.userID, out deluint); BaseNetworkable tokill = BaseNetworkable.serverEntities.Find(deluint); if (tokill == null) { return; // Didn't find it } // Check for mounted players BaseVehicle copter = tokill as BaseVehicle; List <BaseVehicle.MountPointInfo> mountpoints = copter.mountPoints; for (int i = 0; i < (int)mountpoints.Count; i++) { // error CS0029: Cannot implicitly convert type `System.Collections.Generic.List<BaseVehicle.MountPointInfo>' to `BaseVehicle.MountPointInfo[]' BaseVehicle.MountPointInfo mountPointInfo = mountpoints[i]; if (mountPointInfo.mountable != null) { BasePlayer mounted = mountPointInfo.mountable.GetMounted(); if (mounted) { #if DEBUG Puts("Copter owner sleeping but another one is mounted - cannot destroy copter"); #endif return; } } } #if DEBUG Puts("Copter owner sleeping - destroying copter"); #endif tokill.Kill(); storedData.playerminiID.Remove(player.userID); var myKey = currentMounts.FirstOrDefault(x => x.Value == player.userID).Key; currentMounts.Remove(myKey); if (storedData.playercounter.ContainsKey(player.userID) & !useCooldown) { storedData.playercounter.Remove(player.userID); } SaveData(); } }
void OnEntitySpawned(BaseNetworkable entity) { if (!configData.Settings.NoCorpses) { return; } if (entity.ShortPrefabName == "player_corpse") { entity.Kill(); } }
void Block(BaseNetworkable block, BasePlayer player, bool Height, bool Water) { if (usePermissions && !IsAllowed(player.UserIDString, permBS) && block && !block.isDestroyed) { Vector3 Pos = block.transform.position; if (Height || Water) { float height = TerrainMeta.HeightMap.GetHeight(Pos); if (Height && Pos.y - height > HeightBlock) { Reply(player, Lang("blockHeight", player.UserIDString, HeightBlock)); block.Kill(BaseNetworkable.DestroyMode.Gib); return; } else if (Water && height < 0 && height < WaterBlock && Pos.y < 2.8f) { Reply(player, Lang("blockWater", player.UserIDString, WaterBlock)); block.Kill(BaseNetworkable.DestroyMode.Gib); return; } } if (BlockInRock) { Pos.y += 200; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 200.0f); Pos.y -= 200; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { if (hit.collider.name == "Mesh") { Reply(player, Lang("block", player.UserIDString)); block.Kill(BaseNetworkable.DestroyMode.Gib); } } } } } }
private void OnEntitySpawned(BaseNetworkable entity) { if (entity != null && entity.name.Contains("item_drop_backpack")) { timer.Once(despawnTimer, () => { if (!entity.IsDestroyed) { entity?.Kill(); } }); } }
void OnEntitySpawned(BaseNetworkable entity) { if (usingCS && hasStarted) { if (entity is BaseEntity) { var entityName = entity.ShortPrefabName; if (entityName.Contains("napalm")) { if (!configData.HelicopterSettings.UseRockets) { entity.Kill(); } } if (entityName.Contains("servergibs_patrolhelicopter")) { entity.Kill(); } } } }
public Task DestroyAsync() { async UniTask DestroyTask() { await UniTask.SwitchToMainThread(); if (!m_BaseNetworkable.IsDestroyed) { m_BaseNetworkable.Kill(); } } return(DestroyTask().AsTask()); }
bool Check(BaseNetworkable entity) { if (entity.isActiveAndEnabled && ((reducerConfig.chicken && entity.ShortPrefabName.Contains("chicken")) || (reducerConfig.cactus && entity.ShortPrefabName.Contains("cactus")) || (reducerConfig.deadlog && entity.ShortPrefabName.Contains("dead_log")) || (reducerConfig.field && entity.ShortPrefabName.Contains("field")) || (reducerConfig.birch && (entity.ShortPrefabName.Contains("birch_small") || entity.ShortPrefabName.Contains("birch_tiny"))) || (reducerConfig.driftwood && entity.ShortPrefabName.Contains("driftwood")) || (reducerConfig.collectable && entity.ShortPrefabName.Contains("collectable")))) { entity.Kill(); return(true); } return(false); }
void OnEntitySpawned(BaseNetworkable entity) { if (!g_spawnBlock) { return; } var controlled = g_config.Animals.Union(g_config.Ores).Union(g_config.Loots); var prefab = entity.PrefabName; if (controlled.Any(c => c.Prefab == prefab && c.Max != -1)) { entity.Kill(); Puts($"BLOCKED OnEntitySpawned {entity.ShortPrefabName}"); } }
private void OnEntitySpawned(BaseNetworkable entity) { uint id = entity.net.ID; if (MAData.Entities.ContainsKey(id)) { if (UnixTimeStampUTC() >= MAData.Entities[id].iExpire) { if (Convert.ToBoolean(Config["Settings", "Debug"])) { Puts("Destroying entity: " + id.ToString() + ". [EXPIRED]"); } entity.Kill(); MAData.Entities.Remove(id); } } }
private void OnEntitySpawned(BaseNetworkable entity) { if (entity.ShortPrefabName != "shelves") { return; } if (!activatedIDs.Contains(entity.GetComponent <BaseEntity>().OwnerID)) { return; } entity.Kill(); RaycastHit hit; UnityEngine.Physics.Raycast(entity.transform.position + new Vector3(0, 0.1f, 0), Vector3.down, out hit, 3f); DecayEntity dEnt = hit.GetEntity()?.GetComponent <DecayEntity>(); if (!dEnt) { return; } BaseEntity ent = SpawnSmallShelves(entity.transform.position - (entity.transform.forward * 0.35f), entity.transform.rotation, dEnt); }
void OnEntitySpawned(BaseNetworkable entity) { if (entity == null) { return; } if (entity.ShortPrefabName.Contains("patrolhelicopter") && !entity.ShortPrefabName.Contains("gibs")) { if (!spawning) { destroy = true; entity.Kill(); Puts("1"); } else { spawning = false; patrol = true; destroyPatrolTimer = timer.Once(PATROL_SECONDS, () => entity?.Kill()); } } }
void OnEntitySpawned(BaseNetworkable entity) { if (!withoutdebris) { return; } if (normalch47kill == true) { if (debug == true) { Puts($"IGNORING DEBRIS REMOVAL - NORMAL CH47 KILLED"); } return; } if (entity == null) { return; } var prefabname = entity.ShortPrefabName; if (string.IsNullOrEmpty(prefabname)) { return; } if (entity is HelicopterDebris && prefabname.Contains("ch47")) { var debris = entity.GetComponent <HelicopterDebris>(); if (debris == null) { return; } entity.Kill(); if (debug == true) { Puts($"REMOVED DEBRIS FROM myCH47 KILLED"); } } }
private void CheckBlock(BaseNetworkable StartBlock, BasePlayer sender, bool CheckHeight, bool CheckWater) { if (StartBlock && sender.net.connection.authLevel < AuthLVL && !StartBlock.isDestroyed) { Vector3 Pos = StartBlock.transform.position; if (StartBlock.name == "foundation.steps(Clone)") { Pos.y += 1.3f; } if (CheckHeight || CheckWater) { float height = TerrainMeta.HeightMap.GetHeight(Pos); if (CheckHeight && Pos.y - height > MaxHeight) { SendReply(sender, MsgHeight); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); return; } else if (CheckWater && height < 0 && height < MaxWater && Pos.y < 2.8) { SendReply(sender, MsgWater); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); return; } } if (BlockHorizontalSigns && StartBlock.GetComponent <Signage>()) { Vector3 euler = StartBlock.transform.rotation.eulerAngles; if (euler.z == 0) { SendReply(sender, MsgSign); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); return; } } Pos.y = Pos.y + 100; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 102.8f); Pos.y = Pos.y - 100; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { string ColName = hit.collider.name; if (UnTerrain && ColName == "Terrain" && hit.point.y > Pos.y || InBase && ColName.StartsWith("base", StringComparison.CurrentCultureIgnoreCase) || InMetalBuilding && ColName == "Metal_building_COL" || UnBridge && ColName == "Bridge_top" || UnRadio && ColName.StartsWith("dish") || InWarehouse && ColName.StartsWith("Warehouse") || InHangar && ColName.StartsWith("Hangar") || InTank && ColName == "howie_spheretank_blockin" || ColName == "COL" && (hit.point.y < Pos.y ? OnRock : hit.collider.bounds.Contains(Pos) ? InRock : InCave)) { SendReply(sender, Msg); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); break; } if (ColName == "Terrain") { break; } } } } }
void KillCoptor(BaseNetworkable entity) { //ConsoleSystem.Broadcast("chat.add", 0, "<color=Red> [Coptor Tracker]</color> Patrol Coptor Has been removed due to lack of something", 1); entity.Kill(); }
private void OnEntitySpawned(BaseNetworkable entity) { var prefabname = entity.name; if (prefabname.Contains("bradleyapc")) { bradleys.Add(entity as BradleyAPC); } if (lastBradleyDeath == 0.0f || Time.realtimeSinceStartup - lastBradleyDeath > 2.0f) // TODO: Check if around a Bradley instead. { lastBradleyDeath = 0.0f; return; } var debris = entity?.GetComponent <HelicopterDebris>() ?? null; gibs.Add(debris); if (prefabname.Contains("servergibs_bradley")) { NextTick(() => { if (debris == null || entity.IsDestroyed) { return; } debris.InitializeHealth(configs.options.gibsHealth, configs.options.gibsHealth); if (configs.options.gibsHotDelay != -1.0f) { tooHotUntil.SetValue(debris, Time.realtimeSinceStartup + configs.options.gibsHotDelay); } if (!configs.options.enableGibs) { entity.Kill(); } debris.SendNetworkUpdate(); }); } if ((prefabname.Contains("napalm") || prefabname.Contains("oilfireball")) && !prefabname.Contains("rocket")) { fireBalls.Add(entity as FireBall); NextTick(() => { var fireball = entity?.GetComponent <FireBall>() ?? null; if (fireball == null || (entity?.IsDestroyed ?? true)) { return; } if (configs.options.lootAccessDelay != -1) { fireball.lifeTimeMin = configs.options.lootAccessDelay - 10.0f; fireball.lifeTimeMax = configs.options.lootAccessDelay + 10.0f; } if (configs.options.napamWaterRequired != -1) { fireball.waterToExtinguish = configs.options.napamWaterRequired; } if (!configs.options.enableNapalm) { fireball.enableSaving = false; entity.Kill(); } fireball.SendNetworkUpdate(); }); } if (prefabname.Contains("bradley_crate")) { var loot = entity?.GetComponent <LootContainer>() ?? null; lockedCrates.Add(entity?.GetComponent <LockedByEntCrate>() ?? null); if (configs.options.customLootTables && configs.lootTables.bradleyCrate.Count != 0) { loot.inventory.itemList.Clear(); for (int i = 0; i < 6; i++) { var keys = Enumerable.ToList(configs.lootTables.bradleyCrate.Keys); int t = i == 0 ? 1 : i < 3 ? 2 : 3; int r = random.Next(keys.Count); var val = configs.lootTables.bradleyCrate[keys[r]]; int j = 0; while ((Convert.ToInt32(val[2]) != t || Convert.ToInt32(val[0]) == 0) && j != 20) { r = random.Next(keys.Count); val = configs.lootTables.bradleyCrate[keys[r]]; j++; } var item = ItemManager.CreateByItemID(ItemManager.FindItemDefinition(keys[r]).itemid, Convert.ToInt32(val[0]), Convert.ToUInt64(val[1])); item.MoveToContainer(loot.inventory); } loot.inventory.MarkDirty(); } if (configs.options.lootAccessDelay != -1.0f) { timer.Once(configs.options.lootAccessDelay, () => { var crate = entity?.GetComponent <LockedByEntCrate>() ?? null; if (crate == null || (entity?.IsDestroyed ?? true)) { return; } var lockingEnt = (crate?.lockingEnt != null) ? crate.lockingEnt.GetComponent <FireBall>() : null; if (lockingEnt != null && !(lockingEnt?.IsDestroyed ?? true)) { lockingEnt.enableSaving = false; lockingEnt.CancelInvoke(lockingEnt.Extinguish); lockingEnt.Invoke(lockingEnt.Extinguish, 30.0f); } crate.CancelInvoke(crate.Think); crate.SetLocked(false); crate.lockingEnt = null; }); } } }
void Block(BaseNetworkable block, BasePlayer player, bool Height, bool Water) { if (usePermissions && !IsAllowed(player.UserIDString, permBS) && player.net.connection.authLevel < AuthLvl && block && !block.IsDestroyed) { Vector3 Pos = block.transform.position; if (Height || Water) { float height = TerrainMeta.HeightMap.GetHeight(Pos); if (Height && Pos.y - height > HeightBlock) { Reply(player, Lang("blockHeight", player.UserIDString, HeightBlock)); block.Kill(BaseNetworkable.DestroyMode.Gib); return; } else if (Water && height < 0 && height < WaterBlock && Pos.y < 2.8f) { Reply(player, Lang("blockWater", player.UserIDString, WaterBlock)); block.Kill(BaseNetworkable.DestroyMode.Gib); return; } } if (BlockInRock) { Pos.y += 200; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 199.0f); Pos.y -= 200; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { string ColName = hit.collider.name; if ((ColName.StartsWith("rock", StringComparison.CurrentCultureIgnoreCase) || ColName.StartsWith("cliff", StringComparison.CurrentCultureIgnoreCase)) && (hit.point.y < Pos.y ? BlockInRock : hit.collider.bounds.Contains(Pos))) { var buildingBlock = block.GetComponent <BuildingBlock>(); if (buildingBlock != null) { foreach (ItemAmount item in buildingBlock.blockDefinition.grades[(int)buildingBlock.grade].costToBuild) { player.inventory.GiveItem(ItemManager.CreateByItemID(item.itemid, (int)item.amount)); } } Reply(player, Lang("block", player.UserIDString)); block.Kill(BaseNetworkable.DestroyMode.Gib); break; } } } } if (BlockOnIceberg) { Pos.y += 200; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 202.8f); Pos.y -= 200; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { string ColName = hit.collider.name; if (BlockOnIceberg && ColName == "iceberg_COL") { var buildingBlock = block.GetComponent <BuildingBlock>(); if (buildingBlock != null) { foreach (ItemAmount item in buildingBlock.blockDefinition.grades[(int)buildingBlock.grade].costToBuild) { player.inventory.GiveItem(ItemManager.CreateByItemID(item.itemid, (int)item.amount)); } } Reply(player, Lang("blockIce", player.UserIDString)); block.Kill(BaseNetworkable.DestroyMode.Gib); break; } } } } if (BlockUnTerrain) { Pos.y += 200; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 199.0f); Pos.y -= 200; bool isMining = block is MiningQuarry; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { string ColName = hit.collider.name; if (BlockUnTerrain && !isMining && ColName == "Terrain" && hit.point.y > Pos.y) { var buildingBlock = block.GetComponent <BuildingBlock>(); if (buildingBlock != null) { foreach (ItemAmount item in buildingBlock.blockDefinition.grades[(int)buildingBlock.grade].costToBuild) { player.inventory.GiveItem(ItemManager.CreateByItemID(item.itemid, (int)item.amount)); } } Reply(player, Lang("blockTerrain", player.UserIDString)); block.Kill(BaseNetworkable.DestroyMode.Gib); break; } } } } } }
///////////////////////////////////////////////////// /// DoErase(BuildPlayer buildplayer, BasePlayer player, Collider baseentity) /// Erase function ///////////////////////////////////////////////////// private static void DoErase(BuildPlayer buildplayer, BasePlayer player, Collider baseentity) { currentBaseNet = baseentity.GetComponentInParent<BaseNetworkable>(); if (currentBaseNet == null) return; currentBaseNet.Kill(BaseNetworkable.DestroyMode.Gib); }
private void AreaTimer() { // ==================================== [ ENTITY PORTION ] ========================================== new List <uint>(MAData.Entities.Keys).ForEach(u => { BaseNetworkable ent = BaseNetworkable.serverEntities.Find(u); if (ent != null && UnixTimeStampUTC() >= MAData.Entities[u].iExpire) { int area_id = MAData.Entities[u].iAreaID; if (area_id != -1 && MagicAreaExists(area_id)) { if (MAData.Areas[area_id].bRemoveEntities && MAData.Areas[area_id].iEntityExpire != 0) { MAData.Entities.Remove(u); ent.Kill(); if (Convert.ToBoolean(Config["Settings", "Debug"])) { Puts("Removing entity ID: " + u.ToString() + " [EXPIRED]"); } } } } }); // ================================== [ PLAYER ] ==================================================== foreach (BasePlayer connected_player in BasePlayer.activePlayerList) { bool found = false; if (connected_player != null && connected_player.IsConnected) { if (!PlayerExists(connected_player)) { InitPlayer(connected_player); } foreach (var area in MAData.Areas.Values) { if (PlayerToPoint(connected_player, area.fRadius, area.fMinX, area.fMinY, area.fMinZ)) { if (MAData.PlayerData[connected_player.userID].iInArea != area.iID) { MAData.PlayerData[connected_player.userID].iInArea = area.iID; Interface.Oxide.CallHook("OnPlayerEnterMagicArea", connected_player, MAData.PlayerData[connected_player.userID].iInArea); if (area.tKit.Length >= 1 && area.tKit != null) { object iskit = Kits?.Call("isKit", area.tKit); if (iskit is bool && (bool)iskit) { connected_player.inventory.Strip(); object successkit = Kits.Call("GiveKit", connected_player, area.tKit); if (successkit is bool && (bool)successkit) { string parsed_config = GetMessage("KitReceived", connected_player.UserIDString); parsed_config = parsed_config.Replace("{kit_name}", area.tKit); parsed_config = parsed_config.Replace("{area_title}", area.tTitle); PrintToChat(connected_player, parsed_config); } } } } found = true; } } if (!found && MAData.PlayerData[connected_player.userID].iInArea != -1) { if (MAData.Areas[MAData.PlayerData[connected_player.userID].iInArea].bResetInv) { PrintToChat(connected_player, GetMessage("InventoryReset", connected_player.UserIDString)); connected_player.inventory.Strip(); } Interface.Oxide.CallHook("OnPlayerExitMagicArea", connected_player, MAData.PlayerData[connected_player.userID].iInArea); MAData.PlayerData[connected_player.userID].iInArea = -1; } } } }
void CheckBlock(BaseNetworkable StartBlock, BasePlayer sender, bool CheckHeight, bool CheckWater) { if (StartBlock && sender.net.connection.authLevel < AuthLVL && !StartBlock.isDestroyed) { Vector3 Pos = StartBlock.transform.position; if (StartBlock.name == "foundation.steps(Clone)") { Pos.y += 1.3f; } if (CheckHeight || CheckWater) { float height = TerrainMeta.HeightMap.GetHeight(Pos); if (CheckHeight && Pos.y - height > MaxHeight) { sender.ChatMessage(MsgHeight); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); return; } else if (CheckWater && height < 0 && height < MaxWater && Pos.y < 2.8f) { sender.ChatMessage(MsgWater); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); return; } } Pos.y += 200; RaycastHit[] hits = Physics.RaycastAll(Pos, Vector3.down, 202.8f); Pos.y -= 200; bool isMining = StartBlock is MiningQuarry; for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider) { string ColName = hit.collider.name; if (UnTerrain && !isMining && ColName == "Terrain" && hit.point.y > Pos.y || InBase && ColName.StartsWith("base", StringComparison.CurrentCultureIgnoreCase) || InMetalBuilding && ColName == "Metal_building_COL" || UnBridge && ColName == "Bridge_top" || UnRadio && ColName.StartsWith("dish") || InWarehouse && ColName.StartsWith("Warehouse") || InHangar && ColName.StartsWith("Hangar") || OnRiver && ColName == "rivers" || InTunnel && ColName.Contains("unnel") || OnRoad && ColName.EndsWith("road", StringComparison.CurrentCultureIgnoreCase) || InStormDrain && ColName.StartsWith("Storm_drain", StringComparison.CurrentCultureIgnoreCase) || InTank && ColName == "howie_spheretank_blockin" || (ColName.StartsWith("rock", StringComparison.CurrentCultureIgnoreCase) || ColName.StartsWith("cliff", StringComparison.CurrentCultureIgnoreCase)) && (hit.point.y < Pos.y ? OnRock : hit.collider.bounds.Contains(Pos) ? InRock : InCave)) { sender.ChatMessage(Msg); StartBlock.Kill(BaseNetworkable.DestroyMode.Gib); break; } } } } }