-
Notifications
You must be signed in to change notification settings - Fork 16
Adding Build Items
Ansible2 edited this page Sep 16, 2021
·
7 revisions
This will be a walkthrough of adding a single wall item to the shop. A tall concrete wall of the class Land_CncWall4_F
.
Headers\descriptionEXT\Build Items\Main Build Items.hpp
Headers\descriptionEXT\GUI\shopGUICommonDefines.hpp
-
Create a
.hpp
file in the same directory as theMain Build Items.hpp
. You can see examples of this for the mods OPTRE & RHS in the same folder. My file will be calledMy Wall Header.hpp
. (SEE NOTE 1) -
Prepare an empty class for the build item by placing the following inside your
.hpp
file.
class
{
};
- Now find the object's classname that you want to add to the shop. The easiest method for this is to go into the Eden Editor and find the item in entities list. Select it, set the item down, then
right-click
on it ->Log
->Log Classes To Clipboard
. Go back to your header file and paste it inside right in front of the class.
class Land_CncWall4_F
{
};
- Now we're at the point where we need to give the item some properties. If you go back to the
Main Build Items.hpp
, you'll notice at the top of the file that there are a few "generic" base classes such asBLWK_genericLampBase
orBLWK_genericTurretBase
that you can inherit from. It's best to inherit from one of the bases, for the wall, I will use theBLWK_genericBuildItemBase
. Tweak your config properties according to this wiki page.
class Land_CncWall4_F : BLWK_genericBuildItemBase
{
};
- After step 4 the item will be capable of being pulled out of the shop. Go back to the
Main Build Items.hpp
and add a#include
for your header file towards the bottom of the mainBLWK_buildItems
class. You'll see a number of other included files to reference.
Main Build Items.hpp
:
...
...
class Land_GarbageContainer_open_F : BLWK_genericBuildItemBase
{
displayName = "Item Reclaimer";
price = 900;
category = UNIQUE_CATEGORY;
attachmentY = 2;
attachmentZ = 0.8;
invincible = 1;
detectCollision = 0;
tooltip = "Place items inside, reclaim, and get points put into the community pool";
onPurchasedPostfix = "_this call BLWK_fnc_itemReclaimer_init";
onSold = "_this call BLWK_fnc_itemReclaimer_onSold";
};
#include "OPTRE Build Items.hpp"
#include "RHS Build Items.hpp"
#include "SOG PF Build Items.hpp"
#include "My Wall Header.hpp" // my header file is added here
};
- You should now be able to pull your item out of the shop.
- While not necessary, the act of placing items in separate
.hpp
files helps declutter the main file. That being said, if you are adding items from the vanilla game, you can add them to theMain Build Items.hpp
.