New option under "Create" to "Generate Asteroid Belt"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định phương thức BuildEntities hiện có và các điểm vào UI Create và Generate Asteroid Field được mô tả trong issue. Đọc cách các trường tiểu hành tinh hiện tại thu thập tham số và xây dựng các thực thể, sau đó định nghĩa hộp thoại vành đai cùng việc tạo tọa độ để một world đã lưu chứa số lượng tiểu hành tinh được yêu cầu trong bán kính đã chỉ định; xác thực cảnh báo về số lượng cao đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have been looking for a while on how to generate an asteroid belt in space engineers. After some research there was no good way to do this other then really generate all those asteroids. Whereas with your program it can already generate asteroid fields. It ook me some time as a junior software engineer to find the specific code in your source code which was generating the astroids.
As I understood The method "BuildEntities" will build all the entities created in the pop-up windows. which triggers on create button event.
I kindly ask if you would like to implement this feature where the only thing still needed to be done is a new pop-up window. Which differs from "generate asteroid field" it would require the following parameters: Center (x, y, z coordinates), Radius (the distant from the center where the belt will be created), amount of asteroid (I would recommend using your already written random generate astroid in a loop function to generate the amount of asteroid. this in turn will result in how dense the astroid belt will be.
public void BuildEntitiesBelt(out string[] sourceVoxelFiles, out MyObjectBuilder_EntityBase[] sourceEntities)
{
var entities = new List<MyObjectBuilder_EntityBase>();
var sourceFiles = new List<string>();
var AsteroidCount = VoxelCollection.Count;
MainViewModel.ResetProgress(0, AsteroidCount);
foreach (var voxelDesign in VoxelCollection)
{
MainViewModel.Progress++;
if (string.IsNullOrEmpty(voxelDesign.VoxelFile.SourceFilename) || !MyVoxelMap.IsVoxelMapFile(voxelDesign.VoxelFile.SourceFilename))
continue;
var asteroid = new MyVoxelMap();
string tempSourcefilename = null;
switch (AsteroidFillType)
{
case Support.AsteroidFillType.None:
asteroid.Load(voxelDesign.VoxelFile.SourceFilename, voxelDesign.MainMaterial.Value, false);
tempSourcefilename = voxelDesign.VoxelFile.SourceFilename;
break;
case AsteroidFillType.ByteFiller:
asteroid.Load(voxelDesign.VoxelFile.SourceFilename, voxelDesign.MainMaterial.Value, false);
var filler = new AsteroidByteFiller();
filler.FillAsteroid(asteroid, voxelDesign);
tempSourcefilename = TempfileUtil.NewFilename(MyVoxelMap.V2FileExtension);
asteroid.Save(tempSourcefilename);
break;
}
// automatically number all files, and check for duplicate filenames.
var filename = MainViewModel.CreateUniqueVoxelStorageName(voxelDesign.VoxelFile.Name + MyVoxelMap.V2FileExtension, entities.ToArray());
Random random = new Random()
var x = CenterPositionX + radius * Math.cos(2 * Math.PI * i / AsteroidCount);
var y = CenterPositionY + radius * Math.sin(2 * Math.PI * i / AsteroidCount);
var z = CenterPositionZ + random.Next(-4000, 4000);
x+= random.Next(-2000, 2000);
y+= random.Next(-2000, 2000);
var center = new Vector3D(CenterPositionX, CenterPositionY, CenterPositionZ);
var position = center + new Vector3D(x, y, z) - asteroid.BoundingContent.Center;
var entity = new MyObjectBuilder_VoxelMap(position, filename)
{
EntityId = SpaceEngineersApi.GenerateEntityId(IDType.ASTEROID),
PersistentFlags = MyPersistentEntityFlags2.CastShadows | MyPersistentEntityFlags2.InScene,
StorageName = Path.GetFileNameWithoutExtension(filename),
PositionAndOrientation = new MyPositionAndOrientation
{
Position = position,
Forward = Vector3.Forward, // Asteroids currently don't have any orientation.
Up = Vector3.Up
}
};
entities.Add(entity);
sourceFiles.Add(tempSourcefilename);
}
sourceVoxelFiles = sourceFiles.ToArray();
sourceEntities = entities.ToArray();
}
This code is almost an exact copy of yours but with some slight changes in how the coordinates are calculated. It's up to you if you want two sperate methods or just a simple if statement checking if you are generating asteroid field or belt.
I haven't created a pop-up yet. If you don't have time I will try to make it myself. but as I said I'm still learning to code.
Hope this will help the community as some people are looking to generate an asteroid belt which this will be able to do.
If I missed anything thing or you would like some more information, I'm keen to hear from you!
Also let me know what you think of this feature!
Sidenote: put a warning that if you go a higher number then 10000 asteroid it will decrease load time of said save world.
- Ngôn ngữ chính
- C#
- Star
- 156
- Fork
- 61
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của midspace/SEToolbox
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
1.202.120.1 ErrorĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
-
Crash on ReplaceĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của midspace/SEToolbox
Issue tương tự
-
bug effort:S P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
nightscout/nocturne#3093 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add dependency list in documentsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Add 'upm' tag on githubĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100