Player Specific Inventory Crafter.

DoyleChris
Member
 
Posts: 252
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Player Specific Inventory Crafter.

by DoyleChris » Mon Aug 05, 2019 19:44

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: 3951
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Player Specific Inventory Crafter.

by Sokomine » Wed Aug 07, 2019 19:35

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: 69
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

Re: Player Specific Inventory Crafter.

by neoh4x0r » Fri Aug 09, 2019 19:49

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: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

Re: Player Specific Inventory Crafter.

by pandaro » Sat Aug 10, 2019 05:43

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: 131
Joined: Fri Jul 05, 2019 03:18
Location: Japan

Re: Player Specific Inventory Crafter.

by Yvanhoe » Sat Aug 10, 2019 06:20

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: 161
Joined: Wed Nov 09, 2016 16:43
GitHub: akryukov92
In-game: Xudo

Re: Player Specific Inventory Crafter.

by Xudo » Sat Aug 10, 2019 06:24

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.
 


Return to Modding Discussion



Who is online

Users browsing this forum: Bastrabun and 1 guest