[Help Wanted] Keg formspec

Post Reply
_TarkFrench
New member
Posts: 5
Joined: Wed Oct 31, 2018 20:46
GitHub: Tarku
IRC: _TarkFrench
In-game: _TarkFrench

[Help Wanted] Keg formspec

by _TarkFrench » Post

Hello, I'm making a mod and i'm creating a keg.
I really suck at making formspecs and I ask if someone is interested to make for
me the keg's formspec.
I would like the formspec as the schema in attachments
Attachments
MinetestForum.Image.Formspec.Keg.png
Formspec.png
(7.91 KiB) Not downloaded yet

User avatar
AiTechEye
Member
Posts: 859
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Help Wanted] Keg formspec

by AiTechEye » Post

this is example, but better then nothing

Code: Select all

minetest.register_node("keg:barrel", {
	description = "Kag",
	tiles = {"default_steel_block.png"},
	groups = {cracky = 3},
	allow_metadata_inventory_put = function(pos, listname, index, stack, player)

		print(stack:get_count(),stack:get_name(),minetest.get_item_group(stack:get_name(),"flora"))
		if listname=="flowers" and minetest.get_item_group(stack:get_name(),"flora")~=0 then
			return stack:get_count()
		elseif listname=="base" and stack:get_name()=="default:apple" then
			return stack:get_count()
		end
		return 0

	end,
--	allow_metadata_inventory_take = function(pos, listname, index, stack, player)
--	end,
	on_timer = function (pos, elapsed)
		local meta=minetest.get_meta(pos)
		local inv=meta:get_inventory()
		local yeast=inv:get_stack("yeast",1)
	end,
	can_dig = function(pos, player)
		local meta=minetest.get_meta(pos)
		local inv=meta:get_inventory()
		return (inv:is_empty("flowers") and inv:is_empty("base") and inv:is_empty("yeast") and inv:is_empty("result"))
	end,
	after_place_node = function(pos, placer)
		local meta = minetest.get_meta(pos)
		local inv = meta:get_inventory()
		inv:set_size("flowers", 9)
		inv:set_size("base", 9)
		inv:set_size("yeast", 1)
		inv:set_size("result", 16)

		meta:set_string("formspec",
		"size[8,11]"
		.."list[context;yeast;0,2;1,1;]"
		.."list[context;base;1,0;3,3;]"
		.."list[context;flowers;5,0;3,3;]"
		.."list[context;result;0,4;8,2;]"

		.."list[current_player;main;0,7;8,4;]"

		.. "label[5,-0.4;Flowers]"
		)
		minetest.get_node_timer(pos):start(1)
	end,
})
https://dev.minetest.net/formspec
https://dev.minetest.net/InvRef


here are lots of formspec, inventory and meta stuff you can copy from

https://github.com/AiTechEye/smartshop
https://github.com/AiTechEye/smartrenting

_TarkFrench
New member
Posts: 5
Joined: Wed Oct 31, 2018 20:46
GitHub: Tarku
IRC: _TarkFrench
In-game: _TarkFrench

Re: [Help Wanted] Keg formspec

by _TarkFrench » Post

Thank you very much ! This will probably help me to create formspecs !

_TarkFrench
New member
Posts: 5
Joined: Wed Oct 31, 2018 20:46
GitHub: Tarku
IRC: _TarkFrench
In-game: _TarkFrench

Re: [Help Wanted] Keg formspec

by _TarkFrench » Post

But now I am needing real formspecs and not examples.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest