[0.8.9][NK] Porting from 0.8.6

NKGetInstance and .object
NKGetInstance is deprecated and scheduled for removal.It used to retrieve the lua script instance associated with this GameObject, now this is done automatically.
Using this function will print console warnings (with stacktrace) to aid the removal.
Getting the native object is also deprecated, this used to be done using .object called on an instance of an object and was required when calling engine functions that required a game object (world queries, NKAddChildObject, ...)
Both NKGetInstance and .object and now automated by the engine and the lua versions return self to avoid crashes while porting.
Crafting recipes
Each recipe needs to define a craftingActionName and craftingDisplayName.craftingActionName combined with craftingDisplayName is used the display the message on the progress bar.
craftingDisplayName is used as a name for the Crafting Journal.
Example:
RecipeRegistering new crafting recipe file now requires a 2nd parameter (category name):
{
...
LuaData
{
craftingActionName = "Crafting... "
craftingDisplayName = "Recipe"
...
}
}
Eternus.CraftingSystem:ParseRecipeFile( "path/to/file.txt", "CategoryName" )Crafting Recipes tutorial
Archetypes
The archetype system has changed in 0.8.7.The new system is using txt files stored in Data/Archetypes/* to define groups of archetypes.
Example:
ArchetypesThe deprecated system used to work by assigning craftingArchetype to an object in it's txt file.
{
Cobblestone Clump
{
Cobblestone
Cobblestone Gray Clump
Cobblestone Blue Clump
Cobblestone Green Clump
}
}
This system is no longer in use.
Archetypes tutorial
World queries
World queries can now use a bitmask instead of just a layer ID.Physics Tutorial
Other notes
Invalid texture files parsed from txt files will now show an error during loading.Texture atlas is no longer limited to 1024 icons.
VoxelsModifiedCallback will now get the userdata1, even when no player is specified.
0
Comments
CraftingSystem:ParseRecipeFile( filePath, category )
now requires a category in its arguments
If you have multiple files within the mod, does each recipe in each file require unique, sequential Index values?
Example: And so on..
Heh, I thought I have updated this tutorial... (fixed now)
I see @UFIOES mentions a "category" attribute is now necessary in the ParseRecipeFile, which I don't have. Can you help me out with that?
Eternus.CraftingSystem:ParseRecipeFile("Data/Crafting/WhetstoneRecipe.txt")
I have added the "category" to the Crafting Recipes section and links to the Crafting Recipes tutorial and Archetypes tutorial.
Now if I could just get my crafting recipe to work. I cannot figure out what I'm doing wrong. I was able to add a new object which I can spawn, but the recipe just won't work.
Here is the lua for my mod, Terrella. Did I miss something here?
Also do you have console enabled? If you do, did you get any warnings?
This is Data/Crafting/TerrellaMod_recipes.txt
All Recipes { Glow Corn Meal Recipe { Script = "Scripts/Recipes/DefaultRecipe.lua" LuaData { craftingActionName = "Grinding... " craftingDisplayName = "Glow Corn Meal" #Craft times are below unconsumedDamage = 3 priority = 1.0 Components { Fruit { "Glow Corn" = 1 } } Crafting Tool { category = "Hammer" tier = 1 } Results { "Glow Corn Meal" = 1 } Crafting Stations { Flat Rock { offsetOverride = <0.0, 1.0, 0.0> craftTime = 5.0 } } #Requirements to unlock this recipe in the crafting journal Requirements { #Player has collected one of these 1 { Collected { 1 { name = "Glow Corn" count = 1 } } } } } } }
It might be that you are missing the Script definition in your Manifest.json
One way to check that would be to add an NKPrint or NKWarn in the Terrella:Initialize function. If it will not output to the console when you start the game you will need to add something like this to your Manifest.json:
Manifest { # Name of the mods. Name = "Terrella" # Description of the mod. Description = "A test of the mod scripting system" # The major version number. MajorVersion = 0.8 # The minor version number. MinorVersion = 0.9 #The file path to the script that is the entry point. //ScriptFile = "Scripts/Terrella.lua" #The script entry point class name //ScriptClass = "Terrella" }