tilesheet.lua 864 B

1234567891011121314151617181920212223242526272829303132
  1. image = {}
  2. local find = string.find
  3. local replacements = {
  4. ["default_stone.png"] = "tsa.png^[sheet:16x16:0,0",
  5. ["default_snow.png"] = "tsa.png^[sheet:16x16:1,0",
  6. ["default_ice.png"] = "tsa.png^[sheet:16x16:1,1",
  7. ["default_cobble.png"] = "tsa.png^[sheet:16x16:2,0",
  8. ["default_gravel.png"] = "tsa.png^[sheet:16x16:3,0",
  9. ["default_dirt.png"] = "tsa.png^[sheet:16x16:4,0",
  10. }
  11. function image.get(fn)
  12. -- Minetest does not actually support tilesheets at this time.
  13. -- Therefore this function actually does nothing.
  14. -- Names with modifiers already in place are not supported.
  15. -- We cannot safely replace them with images from a tilesheet.
  16. --if find(fn, "%^") then
  17. -- return fn
  18. --end
  19. -- Use named replacement if available.
  20. --if replacements[fn] then
  21. -- return replacements[fn]
  22. --end
  23. -- If we found no replacement, just use name as-is.
  24. return fn
  25. end