Jump to content

Custom Craftable/Placeable Item? (Like a chest or campfire)

Recommended Posts


EXAMPLE PROJECT HERE: http://steamcommunity.com/sharedfiles/filedetails/?id=445182091


Is there a sample mod anywhere which shows the structure of a placeable item like a chest?

-Has crafting recipe

-Placeable in the world (like a campire)


I've tried to work my way through but can't get my item to be placeable after clicking on the crafting recipe.


my recipe is as follows: 

local myprefab = AddRecipe("myprefab", {Ingredient("boards", 1)}, GLOBAL.RECIPETABS.FARM,  GLOBAL.TECH.NONE)

myprefab.atlas = "images/inventoryimages/myprefab.xml"

But when I click on it it just completes and doesn't let me place it. Any help would be greatly appreciated!


my file structure: http://i.imgur.com/60IpMo2.png

Edited by JakeBR72
Link to comment
Share on other sites

local myrecipe = AddRecipe("myprefab", -- name

{Ingredient("boards", 1)}, -- ingredients



"myprefab", -- placer

nil, -- min_spacing

nil, -- nounlock

nil, -- numtogive

nil, -- builder_tag

"images/inventoryimages/myprefab.xml", -- atlas

"myprefab.tex") -- image

Link to comment
Share on other sites

local myrecipe = AddRecipe("myprefab", -- name{Ingredient("boards", 1)}, -- ingredientsGLOBAL.RECIPETABS.FARM, -- tabGLOBAL.TECH.NONE, -- level"myprefab", -- placernil, -- min_spacingnil, -- nounlocknil, -- numtogivenil, -- builder_tag"images/inventoryimages/myprefab.xml", -- atlas"myprefab.tex") -- image

thanks for the explanations, I knew i was missing some fields. that fixed that issue but it seems to be invisible and nonexistant...

Link to comment
Share on other sites

MakePlacer returns a prefab.

You have two prefabs with the same name.


Try using:

MakePlacer("common/myprefab_placer", "myprefab", "myprefab", "idle")

and puttin myprefab_placer in AddRecipe.

I don't think im following, putting that line in modmain causes a crash. To be honest I'm not even sure my file structure is correct. I only have 1 prefab which is the myprefab.lua

Link to comment
Share on other sites

In your prefab.lua, you have:

return Prefab("common/myprefab", fn, assets, prefabs),       MakePlacer("common/myprefab", "myprefab", "myprefab", "idle")

Edit that MakePlacer line.

Ok, the collision box is in place when built but there is still no art being shown. 

Link to comment
Share on other sites

If you c_spawn("myprefab") via the console, does something show up?

no but the hitbox is there so the prefab is being created in the world.


while writing this i reworked the animation and spriter files. Got it showing up in game. thanks for your help man, I really appreciate it! I'm going to upload a sample structure template for future people to use for their mods since there isnt much documentation.

Edited by JakeBR72
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...