Player Specific Inventory Crafter.

Post Reply
DoyleChris
Member
Posts: 265
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Player Specific Inventory Crafter.

by DoyleChris » Post

Is there a way to make a craftable item limited to a specific player.

For example in the recipe for coding a item add this

if player = playername or group
then item is registered and craftable by that player.
else
other players dont see the item.

but also if the "playername or group" can be pulled from a name file on the server that can be edited.

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Player Specific Inventory Crafter.

by Sokomine » Post

Not directly. The easiest way might be to add a "machine" that works like a crafting table and honors your restrictions.
A list of my mods can be found here.

neoh4x0r
Member
Posts: 82
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

Re: Player Specific Inventory Crafter.

by neoh4x0r » Post

DoyleChris wrote:Is there a way to make a craftable item limited to a specific player.

For example in the recipe for coding a item add this

if player = playername or group
then item is registered and craftable by that player.
else
other players dont see the item.

but also if the "playername or group" can be pulled from a name file on the server that can be edited.

Sounds to me like a candidate for a feature request,
such as adding a member named: "visible_to".


if visible_to == nil or visible_to == "" then
-- visible to all
else
-- visible only to named players or groups
end


https://dev.minetest.net/minetest.register_craft

eg:

Code: Select all

minetest.register_craft({
	type = "shapeless",
	output = "wool:green",
	recipe = {"group:wool", "dye:green"},
	replacements = {
		{"dye:green", "test:testnode"}
	}
	visible_to = { "name1", "group:group_name", "name2" }
})
When defining the craft recipe you could read from a file line by line, etc
and then use the read data to construct a list of names and/or groups to pass to "visible_to"


You can submit a new isssue/feature request here:
A suggest for the title would be:

Code: Select all

[Feature request] Add named players and groups to craft recipes
https://github.com/minetest/minetest/is ... re+request


===========================
Otherwise you can do what Sokomine suggested,
Sokomine wrote: Not directly. The easiest way might be to add a "machine" that works like a crafting table and honors your restrictions.
If you were to inject (ie define your craft recipe) to include visible_to then a custom craft table (machine, etc)
could use this new feature to limit available crafting recipes to only the defined players -- but it would not limit visibility in the vanilla crafting system (ie in-inventory, etc).

You could workaround that limitation by removing all crafting methods (including in-inventory) such that the players cannot craft unless they use your added crafting table.

User avatar
pandaro
Member
Posts: 327
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

Re: Player Specific Inventory Crafter.

by pandaro » Post

Using this you can do it i think

Code: Select all

minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv))

User avatar
Yvanhoe
Member
Posts: 140
Joined: Fri Jul 05, 2019 03:18
Location: Japan

Re: Player Specific Inventory Crafter.

by Yvanhoe » Post

It is possible with this mod https://github.com/rubenwardy/crafting but it may not be exactly what you are looking for as it is an overhaul of the crafting system where basically all recipes became shapeless.

I am currently using it in conjunction with something I called "skill books" to acquire new recipes.

Xudo
Member
Posts: 162
Joined: Wed Nov 09, 2016 16:43
GitHub: akryukov92
In-game: Xudo

Re: Player Specific Inventory Crafter.

by Xudo » Post

I think that craft recipe should be assigned to some kind of "grid". So modders could give access to grid in different kind of ui.
For example modders could add multiple different drafting tables with different recipes.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest