change-privs.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --Change old race privs to new GAME privs
  2. minetest.register_on_joinplayer(function(player)
  3. local name = player:get_player_name()
  4. local privs = minetest.get_player_privs(name)
  5. if minetest.check_player_privs(name, {male = true, dwarf = true}) then
  6. privs.male, privs.dwarf = nil
  7. privs.GAMEdwarf, privs.GAMEmale = true, true
  8. minetest.set_player_privs(name, privs)
  9. elseif minetest.check_player_privs(name, {male = true, elf = true}) then
  10. privs.male, privs.elf = nil
  11. privs.GAMEelf, privs.GAMEmale = true, true
  12. minetest.set_player_privs(name, privs)
  13. elseif minetest.check_player_privs(name, {male = true, man = true}) then
  14. privs.male, privs.man = nil
  15. privs.GAMEman, privs.GAMEmale = true, true
  16. minetest.set_player_privs(name, privs)
  17. elseif minetest.check_player_privs(name, {male = true, orc = true}) then
  18. privs.male, privs.orc = nil
  19. privs.GAMEorc, privs.GAMEmale = true, true
  20. minetest.set_player_privs(name, privs)
  21. elseif minetest.check_player_privs(name, {male = true, hobbit = true}) then
  22. privs.male, privs.hobbit = nil
  23. privs.GAMEhobbit, privs.GAMEmale = true, true
  24. minetest.set_player_privs(name, privs)
  25. elseif minetest.check_player_privs(name, {female = true, dwarf = true}) then
  26. privs.female, privs.dwarf = nil
  27. privs.GAMEdwarf, privs.GAMEfemale = true, true
  28. minetest.set_player_privs(name, privs)
  29. elseif minetest.check_player_privs(name, {female = true, elf = true}) then
  30. privs.female, privs.elf = nil
  31. privs.GAMEelf, privs.GAMEfemale = true, true
  32. minetest.set_player_privs(name, privs)
  33. elseif minetest.check_player_privs(name, {female = true, man = true}) then
  34. privs.female, privs.man = nil
  35. privs.GAMEman, privs.GAMEfemale = true, true
  36. minetest.set_player_privs(name, privs)
  37. elseif minetest.check_player_privs(name, {female = true, orc = true}) then
  38. privs.female, privs.orc = nil
  39. privs.GAMEorc, privs.GAMEfemale = true, true
  40. minetest.set_player_privs(name, privs)
  41. elseif minetest.check_player_privs(name, {female = true, hobbit = true}) then
  42. privs.female, privs.hobbit = nil
  43. privs.GAMEhobbit, privs.GAMEfemale = true, true
  44. minetest.set_player_privs(name, privs)
  45. end
  46. end)