Adding Generator For Single Prefab Structures
#2
Welcome to the forum Smile

Some thoughts I have about this:

There may be multiple prefabs for one "structure", so it makes sense for the single generator instance to load multiple prefabs at startup. Ideally, this would be from a file "Prefabs/SinglePiece/<StructureName>.cubeset". Note that "Prefabs" folder is already present and has other prefabs, and that a single .cubeset file may store multiple prefabs, which is ideal for this use-case.

Prefabs already have support for properties defined on them (metadata), the cubeset file includes those properties. The Gallery server stores them in a DB for each prefab, and has a web-based editor for them. There's also per-cubeset-file properties. The file-level ones can be used to define the grid size for each generator, the prefab-level ones can be used to limit the biomes, heights and possibly other factors regarding when that individual prefab is considered for generating and where it is placed.

cPrefabPiecePool already handles most of these, so it is actually the ideal class to use for this.

Please call it SinglePrefabXYZ, not PrefabSingleXYZ Smile

The Gallery server backups are available (see https://forum.cuberite.org/thread-1372-post-12382.html ), download the latest backup and run it in your own server, then you can see the full webadmin support that the plugins give. Unfortunately I can't give out webadmin access to the Gallery server to anyone, basically it transitively gives root access to the machine running the server, and I don't trust you that much just yet.

I don't think your flow is right. We don't want the cComposableGenerator to be modified for this at all, except for adding a new Finisher it recognizes. Instead, add a new Finisher called cSinglePrefabStructureGen, base it off of the cPieceStructuresGen (constructor does nothing, Initialize reads the cubeset etc.), which contains a single generator instance for each cubeset file specified in the Finishers world.ini line. So for example the line "Finishers=SinglePieceStructures: JungleTemple|WitchHut|DesertWell" will create one instance of cSinglePrefabStructureGen containing three instances of cSinglePrefabStructureGen::cGen (the actual generator), each handling the single cubeset.
Reply
Thanks given by:


Messages In This Thread
RE: Adding Generator For Single Prefab Structures - by xoft - 08-21-2020, 09:03 PM



Users browsing this thread: 10 Guest(s)