Jump to content

Recommended Posts

This info must be on the forums already so perhaps someone could point me in the right direction?

I’ve been able to update all my recipes, but my structures are still broken..  They’re placed immediately upon being built, rather than letting the player decide where they should be put.  Anyone know how to fix this?

@IronHunter

I believe I added the placer.  I added it in a few different places, but this was the only spot I found that didn't result in an error, yet it doesn't seem to work.  I've been looking for an example in the vanilla code and other mods, but I'm a bit tied up with my family, so I haven't made too much progress.  I went looking for information about this in the beta release notes but haven't found anything.

AddRecipe2("ice_den", { Ingredient("twigs", 6), Ingredient("cutgrass", 6), Ingredient("ice", 8) }, TECH.SCIENCE_ONE, {builder_tag = nil, atlas = "images/inventoryimages/ice_den.xml", image = nil}, {"CHARACTER", "STRUCTURES", "WINTER", "RESTORATION"}, {placer="ice_den_placer"})

 

13 minutes ago, FurryEskimo said:

AddRecipe2("ice_den", { Ingredient("twigs", 6), Ingredient("cutgrass", 6), Ingredient("ice", 8) }, TECH.SCIENCE_ONE, {builder_tag = nil, atlas = "images/inventoryimages/ice_den.xml", image = nil}, {"CHARACTER", "STRUCTURES", "WINTER", "RESTORATION"}, {placer="ice_den_placer"})

config is the 4th parameter for AddRecipe2 it supports the following data

  • min_spacing
  • nounlock
  • numtogive
  • builder_tag
  • atlas
  • image
  • testfn
  • product
  • build_mode
  • build_distance
  • placer

Your placer table is in the wrong spot and should be with the other configs, as adding parameters beyond 5 does nothing for this function atm.
Also there is no point assigning nil to the configs

AddRecipe2(
  	"ice_den", --prefab name, also the default product
	{ Ingredient("twigs", 6), Ingredient("cutgrass", 6), Ingredient("ice", 8) },--recipe for the crafting
	TECH.SCIENCE_ONE,--tech requirements to craft
	{builder_tag = nil, atlas = "images/inventoryimages/ice_den.xml", image = nil, placer="ice_den_placer"},--special config settings most important one will be placer for structures.
  	{"CHARACTER", "STRUCTURES", "WINTER", "RESTORATION"}--filters
)

You can see examples of the placer being used in the recipes.lua

Edited by IronHunter
  • Like 1
  • Health 1

Wait, did this change

return Prefab("ice_den", ice_den, ice_den_assets),  --Unsure what this does.  Used by game to find assets?
	MakePlacer("ice_den_placer", "ice_den", "ice_den", "idle")  --Seems to control what assets are used when placing a new tent.

This was in another mod:

return Prefab("common/eteleporter", fn, assets, prefabs),
	Prefab("eshockfx", eshockfxfn, assets),
	Prefab("eteleringenter", enterfn, assets)--,
--	MakePlacer("common/eteleporter_placer", "esentry_item", "esentry_item", "idle")

Edit: You responded at the exact moment I did haha.  Reading your response now.

Edited by FurryEskimo
3 minutes ago, FurryEskimo said:

Wait, did this change


return Prefab("ice_den", ice_den, ice_den_assets),  --Unsure what this does.  Used by game to find assets?
	MakePlacer("ice_den_placer", "ice_den", "ice_den", "idle")  --Seems to control what assets are used when placing a new tent.

This was in another mod:


return Prefab("common/eteleporter", fn, assets, prefabs),
	Prefab("eshockfx", eshockfxfn, assets),
	Prefab("eteleringenter", enterfn, assets)--,
--	MakePlacer("common/eteleporter_placer", "esentry_item", "esentry_item", "idle")

Edit: You responded at the exact moment I did haha.  Reading your response now.

Placer's are a client side animstate prefab similar to a fx, they are created using the MakePlacer function similar to the Prefab function it returns the entity data.

function MakePlacer(name, bank, build, anim, onground, snap, metersnap, scale, fixedcameraoffset, facing, postinit_fn, offset, onfailedplacement)

can be found in prefabutil.lua

  • Like 1

@IronHunter

Huh, well what do you know, that worked!  Where did you find this information?  I was trying to solve this without asking but couldn't find a source anywhere.

Also thanks for explaining how the placer works.  I got that working months and months ago and moved on, but I never really figured out what it was doing..  I had more important stuff to focus on, like the swimming code, which drove me up the wall..

Just now, FurryEskimo said:

@IronHunter

Huh, well what do you know, that worked!  Where did you find this information?  I was trying to solve this without asking but couldn't find a source anywhere.

Also thanks for explaining how the placer works.  I got that working months and months ago and moved on, but I never really figured out what it was doing..  I had more important stuff to focus on, like the swimming code, which drove me up the wall..

I just dig through game files and forum posts, the new modding information was included in the patch notes by the devs but only touched on lightly. The rest I figured out by looking at the changes to the recipe, recipes, and other related files to the new crafting update.

  • Like 1
2 minutes ago, FurryEskimo said:

Well I really appreciate your insight!  I did what I could to learn everything in the last two evenings, but I'm a writer by trade, working 10 hours days.  I try,,

XD, I am only a humble healthcare professional who just is passionate about modding don't starve. Keep up the good work I say.

  • Like 1

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...