Page 1 of 1

crafting category for the player

Posted: Tue Oct 13, 2015 10:22 pm
by judos
Hello there,

I want to add a crafting category also for the player. Right now I have a modded a small machine (packager) which should not show all other recipes, therefore I started using a crafting_category. Now I also want the player to be able to craft the same recipes.

The following I found online, but it seems not to be working:

Code: Select all

table.insert(data.raw["player"]["crafting_categories"],"packager-pack")
"packager-pack" would be the new crafting category.

Thanks for your help!
cheers,
judos

Re: crafting category for the player

Posted: Tue Oct 13, 2015 10:32 pm
by cartmen180
try this:

Code: Select all

table.insert(data.raw["player"]["player"].crafting_categories,"packager-pack")

Re: crafting category for the player

Posted: Tue Oct 13, 2015 10:37 pm
by Adil
Did you package machine work as expected?
Are recipes researched/enabled?
There seems nothing wrong with the code listed.
You may try temporarily putting that right into player definition on base. If they don't appear after that, then something is wrong with recipes or category.

Re: crafting category for the player

Posted: Tue Oct 13, 2015 10:40 pm
by judos
Nice this works. At least when I'm not in ghost mode (I used this to check my mod items etc.) Is it possible to connect the character again to the player perspective?

Code: Select all

table.insert(data.raw["player"]["player"].crafting_categories,"packager-pack")
Does this also work for multiplayer?
I right now have this one line at the beginning of my entity.lua file before the data:extend(..).

Re: crafting category for the player

Posted: Wed Oct 14, 2015 7:23 am
by cartmen180
Adil wrote: There seems nothing wrong with the code listed.
In the first brackets you specify a 'type' and in the second brackets you specify the 'name' of that type. Otherwise the game doesn't know what to adjust.

@Judos I don't know if it works in multiplayer, you will have to try it out. Report your results back here please :)

Re: crafting category for the player

Posted: Fri Oct 23, 2015 6:32 am
by judos
I played the mod several days on a server and it works nicely.
Probably this is because the command changes the prototype of the player even before any instances are created and therefore it will be used for any player.

Problem is solved :)