features.lua 848 B

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