public void Prefabs() { ItemDataBlock[] all = DatablockDictionary.All; for (int i = 0; i < all.Length; i++) { ItemDataBlock itemDataBlock = all[i]; if (itemDataBlock is DeployableItemDataBlock) { DeployableItemDataBlock deployableItemDataBlock = itemDataBlock as DeployableItemDataBlock; File.AppendAllText(Util.GetAbsoluteFilePath("Prefabs.txt"), string.Concat(new string[] { "[\"", deployableItemDataBlock.ObjectToPlace.name, "\", \"", deployableItemDataBlock.DeployableObjectPrefabName, "\"],\n" })); } else if (itemDataBlock is StructureComponentDataBlock) { StructureComponentDataBlock structureComponentDataBlock = itemDataBlock as StructureComponentDataBlock; File.AppendAllText(Util.GetAbsoluteFilePath("Prefabs.txt"), string.Concat(new string[] { "[\"", structureComponentDataBlock.structureToPlacePrefab.name, "\", \"", structureComponentDataBlock.structureToPlaceName, "\"],\n" })); } } }
public static void StructureComponentDataBlock_DoAction1(StructureComponentDataBlock block, uLink.BitStream stream, ItemRepresentation rep, ref uLink.NetworkMessageInfo info) { object[] array = new object[] { block, stream, rep, info }; Method.Invoke("RustExtended.RustHook.StructureComponentDataBlock_DoAction1", array); info = (uLink.NetworkMessageInfo)array[3]; }
public void Prefabs() { foreach (ItemDataBlock block in DatablockDictionary.All) { if (block is DeployableItemDataBlock) { DeployableItemDataBlock block2 = block as DeployableItemDataBlock; File.AppendAllText(Util.GetAbsoluteFilePath("Prefabs.txt"), "[\"" + block2.ObjectToPlace.name + "\", \"" + block2.DeployableObjectPrefabName + "\"],\n"); } else if (block is StructureComponentDataBlock) { StructureComponentDataBlock block3 = block as StructureComponentDataBlock; File.AppendAllText(Util.GetAbsoluteFilePath("Prefabs.txt"), "[\"" + block3.structureToPlacePrefab.name + "\", \"" + block3.structureToPlaceName + "\"],\n"); } } }
public static void Prefabs() { if (File.Exists(FilePath)) { File.Delete(FilePath); } foreach (ItemDataBlock block in DatablockDictionary.All) { if (block is DeployableItemDataBlock) { DeployableItemDataBlock block2 = block as DeployableItemDataBlock; File.AppendAllText(FilePath, block2.ObjectToPlace.name + "=" + block2.DeployableObjectPrefabName + "\n"); } if (block is StructureComponentDataBlock) { StructureComponentDataBlock block3 = block as StructureComponentDataBlock; File.AppendAllText(FilePath, block3.structureToPlacePrefab.name + "=" + block3.structureToPlaceName + "\n"); } } }
public static void Prefabs() { if (File.Exists(World.FilePath)) { File.Delete(World.FilePath); } ItemDataBlock[] all = DatablockDictionary.All; for (int i = 0; i < all.Length; i++) { ItemDataBlock itemDataBlock = all[i]; if (itemDataBlock is DeployableItemDataBlock) { DeployableItemDataBlock deployableItemDataBlock = itemDataBlock as DeployableItemDataBlock; File.AppendAllText(World.FilePath, deployableItemDataBlock.ObjectToPlace.name + "=" + deployableItemDataBlock.DeployableObjectPrefabName + "\n"); } if (itemDataBlock is StructureComponentDataBlock) { StructureComponentDataBlock structureComponentDataBlock = itemDataBlock as StructureComponentDataBlock; File.AppendAllText(World.FilePath, structureComponentDataBlock.structureToPlacePrefab.name + "=" + structureComponentDataBlock.structureToPlaceName + "\n"); } } }
public static void StructureComponentAction(uLink.BitStream stream, ItemRepresentation rep, ref uLink.NetworkMessageInfo info, StructureComponentDataBlock SCDB) { uLink.NetworkPlayer netPlayer = info.sender; PlayerClient playerClient = Array.Find(AllPlayerClients.ToArray(), (PlayerClient pc) => pc.netPlayer == netPlayer); IStructureComponentItem item; NetCull.VerifyRPC(ref info); if (rep.Item<IStructureComponentItem>(out item) && (item.uses > 0)) { StructureComponent structureToPlacePrefab = SCDB.structureToPlacePrefab; Vector3 origin = stream.ReadVector3(); Vector3 direction = stream.ReadVector3(); Vector3 position = stream.ReadVector3(); Quaternion rotation = stream.ReadQuaternion(); uLink.NetworkViewID viewID = stream.ReadNetworkViewID(); StructureMaster component = null; if (nearZone(position) && !buildList.Contains(playerClient.userID.ToString())) { Rust.Notice.Popup(info.sender, "", "You can't place that near safe zones or war zones.", 4f); } else { if (viewID == uLink.NetworkViewID.unassigned) { if (SCDB.MasterFromRay(new Ray(origin, direction))) { return; } if (structureToPlacePrefab.type != StructureComponent.StructureComponentType.Foundation) { Debug.Log("ERROR, tried to place non foundation structure on terrain!"); } else { component = NetCull.InstantiateClassic<StructureMaster>(Bundling.Load<StructureMaster>("content/structures/StructureMasterPrefab"), position, rotation, 0); component.SetupCreator(item.controllable); } } else { component = uLink.NetworkView.Find(viewID).gameObject.GetComponent<StructureMaster>(); } if (component == null) { Debug.Log("NO master, something seriously wrong"); } else if (SCDB._structureToPlace.CheckLocation(component, position, rotation) && SCDB.CheckBlockers(position)) { StructureComponent comp = NetCull.InstantiateStatic(SCDB.structureToPlaceName, position, rotation).GetComponent<StructureComponent>(); if (comp != null) { component.AddStructureComponent(comp); int count = 1; if (item.Consume(ref count)) { item.inventory.RemoveItem(item.slot); } } } } } }