ids.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. minetest.register_craftitem('sss_items:id_1', {
  2. description = 'Cadet\'s ID',
  3. inventory_image = 'sss_items_id_cadet.png',
  4. on_use = function(itemstack, user)
  5. local name = user:get_player_name()
  6. local player_meta = user:get_meta()
  7. local level = player_meta:get_int('security_level')
  8. if level < 1 then
  9. player_meta:set_int('security_level', 1)
  10. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level one')
  11. else
  12. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  13. end
  14. itemstack:take_item(1); return itemstack
  15. end
  16. })
  17. minetest.register_craftitem('sss_items:id_2', {
  18. description = 'Mechanic\'s ID',
  19. inventory_image = 'sss_items_id_mechanic.png',
  20. on_use = function(itemstack, user)
  21. local name = user:get_player_name()
  22. local player_meta = user:get_meta()
  23. local level = player_meta:get_int('security_level')
  24. if level < 2 then
  25. player_meta:set_int('security_level', 2)
  26. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level two')
  27. else
  28. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  29. end
  30. itemstack:take_item(1); return itemstack
  31. end
  32. })
  33. minetest.register_craftitem('sss_items:id_3', {
  34. description = 'Engineers\'s ID',
  35. inventory_image = 'sss_items_id_engineer.png',
  36. on_use = function(itemstack, user)
  37. local name = user:get_player_name()
  38. local player_meta = user:get_meta()
  39. local level = player_meta:get_int('security_level')
  40. if level < 3 then
  41. player_meta:set_int('security_level', 3)
  42. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level three')
  43. else
  44. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  45. end
  46. itemstack:take_item(1); return itemstack
  47. end
  48. })
  49. minetest.register_craftitem('sss_items:id_4', {
  50. description = 'Third Officer\'s ID',
  51. inventory_image = 'sss_items_id_third_officer.png',
  52. on_use = function(itemstack, user)
  53. local name = user:get_player_name()
  54. local player_meta = user:get_meta()
  55. local level = player_meta:get_int('security_level')
  56. if level < 4 then
  57. player_meta:set_int('security_level', 4)
  58. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level four')
  59. else
  60. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  61. end
  62. itemstack:take_item(1); return itemstack
  63. end
  64. })
  65. minetest.register_craftitem('sss_items:id_5', {
  66. description = 'Second Officer\'s ID',
  67. inventory_image = 'sss_items_id_second_officer.png',
  68. on_use = function(itemstack, user)
  69. local name = user:get_player_name()
  70. local player_meta = user:get_meta()
  71. local level = player_meta:get_int('security_level')
  72. if level < 5 then
  73. player_meta:set_int('security_level', 5)
  74. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level five')
  75. else
  76. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  77. end
  78. itemstack:take_item(1); return itemstack
  79. end
  80. })
  81. minetest.register_craftitem('sss_items:id_6', {
  82. description = 'Captain\'s ID',
  83. inventory_image = 'sss_items_id_captain.png',
  84. on_use = function(itemstack, user)
  85. local name = user:get_player_name()
  86. local player_meta = user:get_meta()
  87. local level = player_meta:get_int('security_level')
  88. if level < 6 then
  89. player_meta:set_int('security_level', 6)
  90. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level six')
  91. else
  92. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  93. end
  94. itemstack:take_item(1); return itemstack
  95. end
  96. })
  97. minetest.register_craftitem('sss_items:id_7', {
  98. description = 'Captain\'s ID',
  99. inventory_image = 'sss_items_id_captain.png',
  100. on_use = function(itemstack, user)
  101. local name = user:get_player_name()
  102. local player_meta = user:get_meta()
  103. local level = player_meta:get_int('security_level')
  104. if level < 6 then
  105. player_meta:set_int('security_level', 6)
  106. minetest.chat_send_player(name, 'Congratulations, you just gained security clearance level six')
  107. else
  108. minetest.chat_send_player(name, 'This would be a downgrade, unable to proceed')
  109. end
  110. itemstack:take_item(1); return itemstack
  111. end
  112. })