void OnItemDeployedByPlayer(DeployableObject component, IDeployableItem item) { if (!antiSleepingBagHack) { return; } if (component.gameObject.name == "SleepingBagA(Clone)" || component.gameObject.name == "SingleBed(Clone)") { if (!item.character) { return; } if (!(MeshBatchPhysics.Linecast(item.character.eyesOrigin, component.transform.position, out cachedRaycast, out cachedBoolean, out cachedhitInstance))) { return; } if (cachedhitInstance == null && cachedRaycast.collider.gameObject.name != "MetalDoor(Clone)") { return; } if (Vector3.Distance(item.character.eyesOrigin, component.transform.position) > 9f) { return; } AntiCheatBroadcastAdmins(string.Format("{0} tried to spawn a {1} @ {2} from {3}", item.character.playerClient.userName, component.gameObject.name.Replace("(Clone)", ""), component.transform.position.ToString(), item.character.eyesOrigin.ToString())); AntiCheatBroadcastAdmins(string.Format("{0} was on the way", (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); Puts(string.Format("{0} tried to spawn a {1} @ {2} from {3} threw {4}", item.character.playerClient.userName, component.gameObject.name.Replace("(Clone)", ""), component.transform.position.ToString(), item.character.eyesOrigin.ToString(), (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); NetCull.Destroy(component.gameObject); if (sleepingbaghackPunish) { Punish(item.character.playerClient, string.Format("rSleepHack ({0})", (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); } } }
void OnItemDeployedByPlayer(DeployableObject component, IDeployableItem item) { if (!antiWoodDoorGlitch) { return; } if (component.gameObject.name == "WoodBoxLarge(Clone)") { foreach (Collider collider in Physics.OverlapSphere(component.transform.position + Vector3Up, 1.2f, doorLayer)) { if (collider.gameObject.name == "MetalDoor(Clone)") { if (doorstate.GetValue(collider.GetComponent <BasicDoor>()).ToString() == "Opened" || doorstate.GetValue(collider.GetComponent <BasicDoor>()).ToString() == "Opening") { ConsoleNetworker.SendClientCommand(item.character.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("{0} should be closed before trying to build here", collider.gameObject.name.ToString().Replace("(Clone)", "")))); item.character.GetComponent <Inventory>().AddItemAmount(item.datablock, 1); timer.Once(0.01f, () => NetCull.Destroy(component.gameObject)); return; } } } foreach (Collider collider in Physics.OverlapSphere(component.transform.position + Vector3Up, 0.65f, doorLayer)) { if (collider.gameObject.name == "MetalDoor(Clone)") { ConsoleNetworker.SendClientCommand(item.character.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("{0} is blocking the way", collider.gameObject.name.ToString().Replace("(Clone)", "")))); item.character.GetComponent <Inventory>().AddItemAmount(item.datablock, 1); timer.Once(0.01f, () => NetCull.Destroy(component.gameObject)); return; } } } else if (component.gameObject.name == "MetalDoor(Clone)") { foreach (Collider collider in Physics.OverlapSphere(component.transform.position + Vector3Up, 0.65f)) { if (collider.gameObject.name == "WoodBoxLarge(Clone)") { ConsoleNetworker.SendClientCommand(item.character.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("{0} is blocking the way", collider.gameObject.name.ToString().Replace("(Clone)", "")))); item.character.GetComponent <Inventory>().AddItemAmount(item.datablock, 1); timer.Once(0.01f, () => NetCull.Destroy(component.gameObject)); return; } } } }
///////////////////////////////////////// // OnItemDeployed(Deployer deployer, BaseEntity deployedEntity) // Called when an item was deployed ///////////////////////////////////////// void OnItemDeployedByPlayer(DeployableObject deployedEntity, IDeployableItem deployableItem) { if (deployableItem.controllable == null) { return; } if (hasTag(deployableItem.controllable.playerClient, "nodeploy")) { if (!hasPermission(deployableItem.controllable.playerClient, "candeploy")) { timer.Once(0.01f, () => DestroyObject(deployedEntity.gameObject)); SendMessage(deployableItem.controllable.playerClient, "You are not allowed to deploy here"); } } else if (deployedEntity.GetComponent <TimedExplosive>()) { timer.Once(4f, () => CheckPositionExplosive(deployedEntity, deployableItem)); } }
void CheckPositionExplosive(DeployableObject deployedEntity, IDeployableItem deployableItem) { var objects = GameObject.FindObjectsOfType(typeof(Zone)); if (objects != null) { foreach (Zone zone in objects) { if (zone.info.undestr == null) { continue; } if (Vector3.Distance(deployedEntity.transform.position, zone.info.Location.GetPosition()) < (zone.info.Location.GetRadius() + 5f)) { deployableItem.character.GetComponent <Inventory>().AddItemAmount(deployableItem.datablock, 1); NetCull.Destroy(deployedEntity.gameObject); } } } }
private object OnItemDeployedByPlayer(DeployableObject component, IDeployableItem item) { return Interface.CallHook("OnItemDeployed", component, item.controllable.netUser); }
///////////////////////////////////////// // OnItemDeployed(Deployer deployer, BaseEntity deployedEntity) // Called when an item was deployed ///////////////////////////////////////// void OnItemDeployedByPlayer(DeployableObject deployedEntity, IDeployableItem deployableItem) { if (deployableItem.controllable == null) return; if (hasTag(deployableItem.controllable.playerClient, "nodeploy")) { if (!hasPermission(deployableItem.controllable.playerClient, "candeploy")) { timer.Once(0.01f, () => DestroyObject(deployedEntity.gameObject)); SendMessage(deployableItem.controllable.playerClient, "You are not allowed to deploy here"); } } else if(deployedEntity.GetComponent<TimedExplosive>()) { timer.Once(4f, () => CheckPositionExplosive(deployedEntity, deployableItem)); } }
void CheckPositionExplosive(DeployableObject deployedEntity, IDeployableItem deployableItem) { var objects = GameObject.FindObjectsOfType(typeof(Zone)); if (objects != null) foreach (Zone zone in objects) { if (zone.info.undestr == null) continue; if(Vector3.Distance(deployedEntity.transform.position, zone.info.Location.GetPosition()) < (zone.info.Location.GetRadius() + 5f)) { deployableItem.character.GetComponent<Inventory>().AddItemAmount(deployableItem.datablock, 1); NetCull.Destroy(deployedEntity.gameObject); } } }