features.lua 773 B

123456789101112131415161718192021222324252627282930313233
  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. area_store_custom_ids = true,
  11. add_entity_with_staticdata = true,
  12. no_chat_message_prediction = true,
  13. }
  14. function core.has_feature(arg)
  15. if type(arg) == "table" then
  16. local missing_features = {}
  17. local result = true
  18. for ftr in pairs(arg) do
  19. if not core.features[ftr] then
  20. missing_features[ftr] = true
  21. result = false
  22. end
  23. end
  24. return result, missing_features
  25. elseif type(arg) == "string" then
  26. if not core.features[arg] then
  27. return false, {[arg]=true}
  28. end
  29. return true, {}
  30. end
  31. end