You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature
A way to queue up prefab templates one by one, then Nautilus would apply the prefab changes from the first template, then add the changes from the second templates up to the previously-made prefab, and so on..
Purpose
Since most of the existing prefab templates are already capable of applying necessary changes if there's already a game object passed to the GetPrefabAsync method (example), this is already possible.. But it's dirty and intimidating to implement from scratch by a modder.
Currently the only way to queue up prefab templates is by creating a prefab factory method, then building up the prefab from scratch using prefab templates, and finally calling the CustomPrefab.SetGameObject(IEnumerator).
This approach "works", but your code will end up looking a mess due to the numerous GetPrefabAsync and new prefab template constructions you'd need to do.
Usage
The simplest approach would probably be adding a new PrefabTemplateBuilder class, then allow people to add new prefab templates using something like AddTemplate(PrefabTemplate), then at the end passing that builder to a SetGameObject overload.
Final interface would look like this:
CustomPrefabprefab=newCustomPrefab("FishEgg","Some egg for a fish","FishEgg that makes me go yes.");PrefabTemplateBuilderbuilder=newPrefabTemplateBuilder(prefab.Info);/* * Adds the asset bundle template as the first prefab to be constructed. * This will be the first and perhaps the only place where you allow the prefab template to construct a game object from scratch.*/builder.AddTemplate(newAssetBundleTemplate(assetbundle,"FishEgg"));/** Adds the egg template.* Since we already have a game object before from the asset bundle template, this would just apply the necessary settings* to make this game object function like an egg. So [this](https://github.com/SubnauticaModding/Nautilus/blob/master/Nautilus/Assets/PrefabTemplates/EggTemplate.cs#L213-L218) part of the template.*/builder.AddTemplate(newEggTemplate().WithHatchingCreature(TechType.Titanium));// Set the final game object and register this item to the game.prefab.SetGameObject(builder);prefab.Register();
The text was updated successfully, but these errors were encountered:
Describe the feature
A way to queue up prefab templates one by one, then Nautilus would apply the prefab changes from the first template, then add the changes from the second templates up to the previously-made prefab, and so on..
Purpose
Since most of the existing prefab templates are already capable of applying necessary changes if there's already a game object passed to the
GetPrefabAsync
method (example), this is already possible.. But it's dirty and intimidating to implement from scratch by a modder.Currently the only way to queue up prefab templates is by creating a prefab factory method, then building up the prefab from scratch using prefab templates, and finally calling the CustomPrefab.SetGameObject(IEnumerator).
This approach "works", but your code will end up looking a mess due to the numerous
GetPrefabAsync
and new prefab template constructions you'd need to do.Usage
The simplest approach would probably be adding a new
PrefabTemplateBuilder
class, then allow people to add new prefab templates using something likeAddTemplate(PrefabTemplate)
, then at the end passing that builder to aSetGameObject
overload.Final interface would look like this:
The text was updated successfully, but these errors were encountered: