void OnStructurePlaced(StructureComponent component, IStructureComponentItem structureComponentItem) { var structurecheck = component.gameObject.AddComponent <StructureCheck>(); structurecheck.owner = structureComponentItem.character; structurecheck.radius = 0f; if ((antiPillarStash || antiPillarBarricade) && component.IsPillar()) { structurecheck.radius = 0.2f; } else if (antiFoundationGlitch && (component.type == StructureComponent.StructureComponentType.Foundation)) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } else if (component.type == StructureComponent.StructureComponentType.Ramp) { if (antiRampStack) { if (MeshBatchPhysics.Raycast(structurecheck.position + Vector3ABitUp, Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { if (cachedhitInstance != null) { cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>(); if (cachedComponent.type == StructureComponent.StructureComponentType.Foundation || cachedComponent.type == StructureComponent.StructureComponentType.Ceiling) { var weight = getweight.GetValue(cachedComponent._master) as Dictionary <StructureComponent, HashSet <StructureComponent> >; int ramps = 0; if (weight.ContainsKey(cachedComponent)) { foreach (StructureComponent structure in weight[cachedComponent]) { if (structure.type == StructureComponent.StructureComponentType.Ramp) { ramps++; } } } if (ramps > rampstackMax) { TakeDamage.KillSelf(component.GetComponent <IDMain>()); if (structurecheck.owner != null && structurecheck.owner.playerClient != null) { ConsoleNetworker.SendClientCommand(structurecheck.owner.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("You are not allowed to stack more than {0} ramps", rampstackMax.ToString()))); } timer.Once(0.01f, () => GameObject.Destroy(structurecheck)); return; } } } } } if (antiRampGlitch) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } } timer.Once(0.05f, () => structurecheck.CheckCollision()); }
///////////////////////////////////////// // OnEntityBuilt(Planner planner, GameObject gameobject) // Called when a buildingblock was created ///////////////////////////////////////// void OnStructurePlaced(StructureComponent component, IStructureComponentItem item) { if (item.controllable == null) { return; } if (hasTag(item.controllable.playerClient, "nobuild")) { if (!hasPermission(item.controllable.playerClient, "canbuild")) { timer.Once(0.01f, () => DestroyObject(component.gameObject)); SendMessage(item.controllable.playerClient, "You are not allowed to build here"); } } }
void OnStructurePlaced(StructureComponent component, IStructureComponentItem structureComponentItem) { var currettime = Time.realtimeSinceStartup; if (MeshBatchPhysics.Raycast(component.transform.position + Vector3ABitUp, Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { if (cachedhitInstance != null) { cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>(); if (cachedComponent != null) { cachedMaster = cachedComponent._master; CheckIfCanPlace(structureComponentItem.character.playerClient, cachedMaster.ownerID.ToString(), component); } } } else { CheckIfCanPlace(structureComponentItem.character.playerClient, structureComponentItem.character.playerClient.userID.ToString(), component); } SendReply(structureComponentItem.character.playerClient.netUser, "Took: " + (currettime - Time.realtimeSinceStartup).ToString()); }
private object OnStructurePlaced(StructureComponent component, IStructureComponentItem item) { return Interface.CallHook("OnStructureBuilt", component, item.controllable.netUser); }
///////////////////////////////////////// // OnEntityBuilt(Planner planner, GameObject gameobject) // Called when a buildingblock was created ///////////////////////////////////////// void OnStructurePlaced(StructureComponent component, IStructureComponentItem item) { if (item.controllable == null) return; if (hasTag(item.controllable.playerClient, "nobuild")) { if (!hasPermission(item.controllable.playerClient, "canbuild")) { timer.Once(0.01f, () => DestroyObject(component.gameObject)); SendMessage(item.controllable.playerClient, "You are not allowed to build here"); } } }