-
Notifications
You must be signed in to change notification settings - Fork 2
Adding an object
Last time, we created a model in Blender and exported it to a form that Equilimod can load. Today, we'll use that model to add a new object into the game. As entities can become quite complex, the entity we'll be creating today will be the bare-minimum, having no special components.
To begin with, we need to ensure that the model we created is in the correct place. If you have not done so already, you should set up the assets folder within your mod's folder. It should look something like this:
The OBJ and MTL files for the model then go in the model
folder of the assets. Once this is done, we can begin to program the mod itself. Once again, I'll start off with the basic mod template shown below:
ModRegistry.registerMod(new Mod({
name : "Christmas Presents",
version : "1.0.0",
author : "pcr3w",
description : "A festive mod that adds a decorative Christmas present to the world.",
init : function() {
// we'll add the present here!
}
}));
We can then use the BlueprintRegistry
in our init
function to create a blueprint for the present entity, using the present model we made earlier.
BlueprintRegistry.registerBlueprint({
// as with tasks, the ID has to be completely unique so that it won't conflict with any other mods
id : 2512,
// this is the name that will be displayed in the shop
name : "Christmas Present",
// this will be the description of the item in its information panel
description : "A beautifully wrapped Christmas present",
// this classification is used to determine which shop the entity goes in, and can also affect the components that you can have
// I have chosen to classify the present as a "large rock"
classification : "erl",
// the present will only cost 10DP to purchase
cost : 10,
// this is very important as it tells Equilinox which model to use, and how to display it
model : {
// we only need to give the OBJ file; Equilimod will automatically load any required MTL files
// as the present cannot grow, there is only one model
files : ["present.obj"],
// the model should have a 1:1 scale in game (the same sizes as in the model file)
size : 1
},
// for this basic entity we don't want to add any special components (which add new behaviours, etc)
components : []
});
As the present entity is very basic, only the bare-minimum has been added to the blueprint. We'll be working on adding far more complex entities in future tutorials.
Loading the game up shows that the modding has been successful:
Today was the first time that we added an actual entity into the game, albeit a very basic one. Next time, we'll be looking at adding a growing plant to the game. This will require a little bit more modelling and some components in the entity blueprint.
Thanks for visiting this wiki. Don't forget to check out Equilinox!
The wiki and the modding framework are still heavily under development, so not all content is available yet.