Add new furniture
You do not edit FurnitureData.json by hand. PlusEMU builds it from the furniture table and the catalogue. To add a new furniture item you only need to:
- Put the asset files on the web server.
- Add one row to the
furnituretable. - Add a catalogue offer, if players should be able to buy it.
- Reload the furniture and the catalogue.
The examples use a floor item with the classname my_throne. Replace it with your own name.
How furniture data works
Section titled “How furniture data works”PlusEMU serves FurnitureData.json at /api/gamedata/furnidata. It builds the file from two sources:
- Every
furniturerow withhas_furnidata = 1. This gives the name, description, size, colours and the other client fields. - The catalogue offers that sell the furniture. This gives
offerid,buyout,bcandbcofferid, so the buy button in the info stand and the catalogue search open the right offer.
PlusEMU rebuilds the file every time the catalogue reloads. The AIR client’s XML furniture data and product data come from the same file. See Configuration for the endpoints.
1. Add the asset files
Section titled “1. Add the asset files”The client needs the graphics of the furniture and an icon. The paths below are the installer defaults from renderer-config.json. The installer serves hotel-files/ at https://your-domain/hotel-files/.
| File | Path | Setting |
|---|---|---|
| Volt asset bundle | hotel-files/assets/furniture/my_throne.hab |
furni.asset.url |
| Icon | hotel-files/c_images/hof_furni/icons/my_throne_icon.png |
furni.asset.icon.url |
The file name of the bundle must be the classname. Volt reads .hab bundles by default. If you have a .nitro bundle, convert it with hab-converter:
./hab-converter -o hotel-files/assets/ nitro-assets/This turns nitro-assets/furniture/my_throne.nitro into hotel-files/assets/furniture/my_throne.hab.
The update tool keeps files you add to hotel-files. It only replaces the stock files.
AIR client
Section titled “AIR client”The AIR client loads furniture from Flash .swf libraries. Two external variables set the location:
flash.dynamic.download.url, for examplehttps://your-domain/dcr/hof_furni/flash.dynamic.download.name.template, for example%revision%/%typeid%.swf
With this template, the client loads <revision>/my_throne.swf, where the revision is the revision column of the furniture row. Put the file in the folder with that number, or use a template without %revision%.
2. Add the furniture row
Section titled “2. Add the furniture row”One row in furniture holds two kinds of data:
- Server columns. PlusEMU uses them in rooms:
width,length,stack_height,can_stack,can_sit,is_walkable,interaction_type, and theallow_*columns. - Furniture data columns. These go into
FurnitureData.jsonfor the client:name,description,xdim,ydim,can_sit_on,can_stand_on,can_lay_on,part_colors,revisionand others.
Keep the two sets the same. For example, set xdim to the same value as width, and ydim to the same value as length. If they differ, the client draws the furniture with a different size than the server uses.
INSERT INTO furniture (item_name, public_name, type, width, length, stack_height, can_stack, can_sit, is_walkable, sprite_id, interaction_type, interaction_modes_count, has_furnidata, name, description, xdim, ydim, can_sit_on, revision)VALUES ('my_throne', 'My Throne', 's', 1, 1, 1.0, 0, 1, 0, 90001, 'default', 1, 1, 'My Throne', 'A throne for my hotel.', 1, 1, 1, 1);What the important columns mean:
| Column | Meaning |
|---|---|
item_name |
The classname. It must match the asset file name. |
type |
s for a floor item, i for a wall item. Only these two types can have furniture data. |
sprite_id |
The furniture data id. It must be unique for its type. Pick a free number. |
has_furnidata |
1 puts the row into FurnitureData.json. |
name, description |
The texts that players see in the catalogue, the info stand and the inventory. |
interaction_type |
What the furniture does in a room. default switches between states. interaction_modes_count is the number of states. |
can_sit_on, can_stand_on, can_lay_on |
What the client shows. Set them to match can_sit, is_walkable and the interaction. |
revision |
The asset revision. The AIR client uses it in the file path. Raise it when you change the asset, so clients load the new file. |
default_dir |
The direction the item faces when a player places it. |
part_colors |
Comma-separated colours for furniture with colour versions. NULL leaves the field out. |
To find a free sprite_id:
SELECT MAX(sprite_id) + 1 FROM furniture WHERE type = 's';The database checks these rules:
- A
sprite_idis unique among furniture data rows of the same type. - An
item_nameis unique among furniture data rows.
Copies with another interaction
Section titled “Copies with another interaction”Sometimes you want a second row for the same furniture with another interaction. Give the copy the same item_name and keep has_furnidata = 0. The copy then uses the furniture data entry of the first row.
3. Add a catalogue offer
Section titled “3. Add a catalogue offer”An offer has three parts: the offer, what it sells, and the page that shows it. First find the page:
SELECT id, caption FROM catalog_pages WHERE caption LIKE '%Thrones%';Then add the offer. Replace 42 with your page id.
INSERT INTO catalog_offers (localization_key, cost_credits, cost_points, points_type)VALUES ('my_throne', 25, 0, 0);SET @offer = LAST_INSERT_ID();
INSERT INTO catalog_offer_products (offer_id, position, product_type, furniture_id, amount)VALUES (@offer, 0, 'furni', (SELECT id FROM furniture WHERE item_name = 'my_throne' AND has_furnidata = 1), 1);
INSERT INTO catalog_page_offers (page_id, offer_id, position)VALUES (42, @offer, 0);cost_creditsis the price in credits.cost_pointsandpoints_typeset a price in activity points.points_type0is duckets and5is diamonds.club_levelmakes the offer need a club membership.
If the furniture is sold in more than one offer, furniture data names one of them. PlusEMU prefers an offer that sells only this item once, on a page that every player can see. See Catalogue and economy for more about offers.
You can skip this step for furniture that players should not buy. The furniture then gets offerid -1 and has no buy button.
4. Reload
Section titled “4. Reload”Run these two commands in the hotel, in this order:
:update furni:update catalog:update furniloads the new row into the server. It needs thecommand_update_furnipermission.:update catalogloads the new offer, builds a newFurnitureData.jsonand tells online clients that the catalogue changed. It needs thecommand_update_catalogpermission.
The order matters, because the catalogue looks up the furniture rows when it loads. A restart of PlusEMU also works.
Players who are online must reload the client to get the new furniture data.
Check that it works
Section titled “Check that it works”-
Check that the furniture is in the generated file:
Terminal window curl -s http://127.0.0.1:8080/api/gamedata/furnidata | grep -o '"classname":"my_throne"[^}]*' -
Check that the web server serves the asset and the icon:
Terminal window curl -I https://your-domain/hotel-files/assets/furniture/my_throne.habcurl -I https://your-domain/hotel-files/c_images/hof_furni/icons/my_throne_icon.pngBoth must answer
200. -
Reload the client, open the catalogue page, buy the furniture and place it in a room.
Troubleshooting
Section titled “Troubleshooting”- The furniture is missing from
FurnitureData.json. Checkhas_furnidata = 1andtypesori. Then run:update catalogagain. - The insert fails with a duplicate key. Another furniture data row already uses this
sprite_idfor the type, or thisitem_name. Pick another value. - The catalogue shows the offer, but the furniture has no image. The asset file is missing or has another name than
item_name. Check thecurl -Icommand above. - The furniture is not in the catalogue. Run
:update furnibefore:update catalog. Check that the offer and the page haveenabled = 1. - The size or the sitting in the room is wrong. The server columns and the furniture data columns differ. Make
width,lengthandcan_sitmatchxdim,ydimandcan_sit_on.
Clothing
Section titled “Clothing”New clothing, catalogue clothing and the wardrobe have their own guide: Add new clothing.