Advertisement
Guest User

mimilus minetest local variable

a guest
May 7th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local walkinggrass = {}
  2.  
  3. walkinggrass.types = {
  4. -----Material Name      Material Desc           Standart tile                   Craft                       tileup                                      tiledown            tileleft            tileright           tilebehind          tilefront
  5.     {"endofroad",       "End of Road",          "",                             "castle:dirt",              "castle_endof_road_grass.png",              "",                 "",                 "",                 "",                 ""},
  6.     {"crossroad",       "Cross Road",           "",                             "castle:dirt",              "default_dirt.png^default_grass_side.png"},
  7. }
  8.  
  9. for _, row in ipairs(walkinggrass.types) do
  10.     local name =             row[1]
  11.     local desc =             row[2]
  12.     local inv =              row[3] -- if alone , tile for all visible faces
  13.     local craft_logical =    row[4]
  14.     local tileup =           row[5]
  15.     local tiledown =         row[6]
  16.     local tileleft =         row[7]
  17.     local tileright =        row[8]
  18.     local tilebehind =       row[9]
  19.     local tilefront =        row[10]
  20.     local alltiles      -- Definition for all faces
  21.  
  22.     if inv == nil
  23.         then    inv = "default_dirt.png^default_grass_side.png"
  24.     end
  25.     if tileup == nil
  26.         then    tileup = tostring(inv)
  27.     end
  28.     if tiledown == nil
  29.         then    tiledown = "default_dirt.png"
  30.     end
  31.     if tileleft == nil
  32.         then    tileleft = inv
  33.     end
  34.     if tileright == nil
  35.         then    tileright = inv
  36.     end
  37.     if tilebehind == nil
  38.         then    tilebehind = inv
  39.     end
  40.     if tilefront == nil
  41.         then    tilefront = inv
  42.     end
  43. --print(tostring(tileup))
  44. --print(tostring(tiledown))
  45. --print(tostring(tileleft))
  46.  
  47. minetest.register_node("castle:walking_grass_" ..name, {
  48.     drawtype = "normal",
  49.     paramtype = "light",
  50.     paramtype2 = "facedir",
  51.     description = "Walking Grass " ..desc,
  52.     tiles = { tileup, tiledown, tileleft, tileright, tilebehind, tilefront },
  53.     groups = {cracky=3},
  54.     sounds = default.node_sound_dirt_defaults({
  55.         footstep = {name="default_gravel_footstep", gain=0.5},
  56.         dug = {name="default_gravel_footstep", gain=1.0},
  57.     })
  58. })
  59.  
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement