Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Stress.formspec_arguments = {}
- Stress.formspec_id = 0
- local create_formspec_id()
- Stress.formspec_id = Stress.formspec_id+1
- return "stress"..tostring(Stress.formspec_id)
- end
- function Stress.show_formspec(formspec, player, args, handle, isnode)
- local formspec_id = create_formspec_id()
- minetest.show_formspec(player, formspec_id, formspec)
- Stress.formspec_arguments[formspec_id] = {isnode = isnode, args=args, handle=handle}
- end
- minetest.register_on_player_receive_fields(function(player, formname, fields)
- local arg = Stress.formspec_arguments[formname]
- if arg then
- if arg.isnode then
- arg.handle(arg.args, "", fields, player)
- else
- arg.handle(player, fields, arg.args)
- end
- end
- end)
- function Stress.Node.show_formspec(self, player)
- local formspec = self:meta("formspec")
- nodemeta = "list[nodemeta:"..self.pos.x..","..self.pos.y..","..self.pos.z..";"
- formspec = string.gsub(formspec, "list[context;", nodemeta)
- formspec = string.gsub(formspec, "list[currant_name;", nodemeta)
- Stress.show_formspec(formspec, player, self.pos, minetest.registered_nodes[self.name()], true)
- end
- show_formspec = Stress.show_formspec
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement