features.lua 807 B

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