features.lua 660 B

123456789101112131415161718192021222324252627282930
  1. -- Minetest: builtin/features.lua
  2. core.features = {
  3. glasslike_framed = true,
  4. nodebox_as_selectionbox = true,
  5. chat_send_player_param3 = true,
  6. get_all_craft_recipes_works = true,
  7. use_texture_alpha = true,
  8. no_legacy_abms = true,
  9. texture_names_parens = true,
  10. }
  11. function core.has_feature(arg)
  12. if type(arg) == "table" then
  13. missing_features = {}
  14. result = true
  15. for ft, _ in pairs(arg) do
  16. if not core.features[ftr] then
  17. missing_features[ftr] = true
  18. result = false
  19. end
  20. end
  21. return result, missing_features
  22. elseif type(arg) == "string" then
  23. if not core.features[arg] then
  24. return false, {[arg]=true}
  25. end
  26. return true, {}
  27. end
  28. end