Advertisement
Guest User

Untitled

a guest
Aug 17th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. Stress.formspec_arguments = {}
  2. Stress.formspec_id = 0
  3.  
  4. local create_formspec_id()
  5. Stress.formspec_id = Stress.formspec_id+1
  6. return "stress"..tostring(Stress.formspec_id)
  7. end
  8.  
  9. function Stress.show_formspec(formspec, player, args, handle, isnode)
  10. local formspec_id = create_formspec_id()
  11. minetest.show_formspec(player, formspec_id, formspec)
  12. Stress.formspec_arguments[formspec_id] = {isnode = isnode, args=args, handle=handle}
  13. end
  14.  
  15. minetest.register_on_player_receive_fields(function(player, formname, fields)
  16. local arg = Stress.formspec_arguments[formname]
  17. if arg then
  18. if arg.isnode then
  19. arg.handle(arg.args, "", fields, player)
  20. else
  21. arg.handle(player, fields, arg.args)
  22. end
  23. end
  24. end)
  25.  
  26. function Stress.Node.show_formspec(self, player)
  27. local formspec = self:meta("formspec")
  28. nodemeta = "list[nodemeta:"..self.pos.x..","..self.pos.y..","..self.pos.z..";"
  29. formspec = string.gsub(formspec, "list[context;", nodemeta)
  30. formspec = string.gsub(formspec, "list[currant_name;", nodemeta)
  31. Stress.show_formspec(formspec, player, self.pos, minetest.registered_nodes[self.name()], true)
  32. end
  33.  
  34. show_formspec = Stress.show_formspec
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement