Advertisement
Guest User

Untitled

a guest
Jul 13th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.62 KB | None | 0 0
  1. -- Generic colored-objects template by Vanessa Ezekowitz ~~ 2012-07-13
  2.  
  3. -- License: WTFPL
  4.  
  5. -- Before using this code, consult the README, particularly the "Semi-
  6. -- automatic generation of textures" section at the end, which descibes the
  7. -- use of the gentextures.sh BASH script included in this package. You"ll
  8. -- need to either follow those instructions or create your textures the usual,
  9. -- manual way. Without textures, this code won"t be very useful. :-)
  10.  
  11. -- When configured properly, this code creates node names that follow the
  12. -- naming convention established in Unified Dyes, such as "mymod:red" or
  13. -- "mymod:dark_yellow_s50".
  14.  
  15.  
  16. -- ===========================================================================
  17. -- Edit the next several variables to define what mod this template will
  18. -- generate and how it should behave in general.
  19. -- ===========================================================================
  20.  
  21. -- First, the standard machine-readable name of your mod
  22.  
  23. colored_block_modname = "template"
  24.  
  25. -- Human-readable description of the category of nodes you want to generate
  26.  
  27. colored_block_description = "My Colored Block"
  28.  
  29. -- The full node name of the neutral version of your main block as it
  30. -- exists right after crafting or mining it, before any dyes have been
  31. -- applied. Typically, this should refer to the white version of your
  32. -- mod's main block, but it can be anything as long as it makes sense.
  33.  
  34. neutral_block = colored_block_modname .. ":white"
  35.  
  36. -- This variable defines just how many of a given block a crafting operation
  37. -- should give. In most cases, the default (1) is correct.
  38.  
  39. colored_block_yield = "1"
  40.  
  41. -- If this object should let sunlight pass through it, set this to "true".
  42. -- Otherwise, set it to "false" (the default).
  43.  
  44. colored_block_sunlight = "false"
  45.  
  46. -- If the node should be something you can stand on, set this to "true"
  47. -- (the default). Otherwise, set it to false.
  48.  
  49. colored_block_walkable = "true"
  50.  
  51. -- What groups should the generated nodes belong to?
  52.  
  53. colored_block_groups = "{ snappy = 3, flammable = 2 }"
  54.  
  55. -- What sound should be played when the node is digged?
  56.  
  57. colored_block_groups = "default.node_sound_leaves_defaults()"
  58.  
  59.  
  60. -- ======================================================
  61. -- You shouldn"t need to edit anything below this point.
  62. -- ======================================================
  63.  
  64.  
  65. -- ------------------------------------------------------------------
  66. -- Generate all of the base color node definitions and all variations
  67. -- except for the greyscale stuff.
  68.  
  69. -- Hues are on a 30 degree spacing starting at red = 0 degrees.
  70. -- "s50" in a file/item name means "saturation: 50%".
  71. -- Texture brightness levels for the colors are 100%, 66% ("medium"),
  72. -- and 33% ("dark").
  73.  
  74. shades = {
  75. "dark",
  76. "medium",
  77. "" -- represents "no special shade name", e.g. bright.
  78. }
  79.  
  80. shades2 = {
  81. "Dark ",
  82. "Medium ",
  83. "" -- represents "no special shade name", e.g. bright.
  84. }
  85.  
  86. hues = {
  87. "red",
  88. "orange",
  89. "yellow",
  90. "lime",
  91. "green",
  92. "aqua",
  93. "cyan",
  94. "skyblue",
  95. "blue",
  96. "violet",
  97. "magenta",
  98. "redviolet"
  99. }
  100.  
  101. hues2 = {
  102. "Red ",
  103. "Orange ",
  104. "Yellow ",
  105. "Lime ",
  106. "Green ",
  107. "Aqua ",
  108. "Cyan ",
  109. "Sky Blue ",
  110. "Blue ",
  111. "Violet ",
  112. "Magenta ",
  113. "Red-violet "
  114. }
  115.  
  116. greys = {
  117. "black",
  118. "darkgrey",
  119. "mediumgrey",
  120. "lightgrey",
  121. "white"
  122. }
  123.  
  124. greys2 = {
  125. "Black ",
  126. "Dark Grey ",
  127. "Medium Grey ",
  128. "Light Grey ",
  129. "White "
  130. }
  131.  
  132. greys3 = {
  133. "black",
  134. "darkgrey_paint",
  135. "mediumgrey_paint",
  136. "lightgrey_paint",
  137. "white_paint"
  138. }
  139.  
  140. for shade = 1, 3 do
  141.  
  142. shadename = shades[shade]
  143. shadename2 = shades2[shade]
  144.  
  145. for hue = 1, 12 do
  146.  
  147. huename = hues[hue]
  148. huename2 = hues2[hue]
  149.  
  150. minetest.register_node(colored_block_modname .. ":" .. shadename .. "_" .. huename, {
  151. description = shadename2 .. huename2 .. colored_block_description,
  152. tiles = { colored_block_modname .. "_" .. shadename .. "_" .. huename .. ".png" },
  153. inventory_image = colored_block_modname .. "_" .. shadename .. "_" .. huename .. ".png",
  154. wield_image = colored_block_modname .. "_" .. shadename .. "_" .. huename .. ".png",
  155. sunlight_propagates = colored_block_sunlight,
  156. paramtype = "light",
  157. walkable = colored_block_walkable,
  158. groups = colored_block_groups,
  159. sounds = colored_block_groups
  160. })
  161.  
  162. minetest.register_node(colored_block_modname .. ":" .. shadename .. "_" .. huename .. "_s50", {
  163. description = shadename2 .. huename2 .. colored_block_description .. " (50% Saturation)",
  164. tiles = { colored_block_modname .. "_" .. shadename .. "_" .. huename .. "_s50.png" },
  165. inventory_image = colored_block_modname .. "_" .. shadename .. "_" .. huename .. "_s50.png",
  166. wield_image = colored_block_modname .. "_" .. shadename .. "_" .. huename .. "_s50.png",
  167. sunlight_propagates = colored_block_sunlight,
  168. paramtype = "light",
  169. walkable = colored_block_walkable,
  170. groups = colored_block_groups,
  171. sounds = colored_block_groups
  172. })
  173.  
  174. minetest.register_craft( {
  175. type = "shapeless",
  176. output = colored_block_modname .. ":" .. shadename .. "_" .. huename .. " " .. colored_block_yield,
  177. recipe = {
  178. neutral_block,
  179. "unifieddyes:" .. shadename .. "_" .. huename
  180. }
  181. })
  182.  
  183. minetest.register_craft( {
  184. type = "shapeless",
  185. output = colored_block_modname .. ":" .. shadename .. "_" .. huename "_s50 " .. colored_block_yield,
  186. recipe = {
  187. neutral_block,
  188. "unifieddyes:" .. shadename .. "_" .. huename .. "_s50"
  189. }
  190. })
  191.  
  192. end
  193. end
  194.  
  195.  
  196. -- ============================================================
  197. -- The 5 levels of greyscale.
  198. --
  199. -- Oficially these are 0, 25, 50, 75, and 100% relative to white,
  200. -- but in practice, they're actually 7.5%, 25%, 50%, 75%, and 95%.
  201. -- (otherwise black and white would wash out).
  202.  
  203. for grey = 1,5 do
  204.  
  205. greyname = greys[grey]
  206. greyname2 = greys2[grey]
  207. greyname3 = greys3[grey]
  208.  
  209. minetest.register_node(colored_block_modname .. ":" .. greyname, {
  210. description = greyname2 .. colored_block_description,
  211. tiles = { colored_block_modname .. "_" .. greyname .. ".png" },
  212. inventory_image = colored_block_modname .. "_" .. greyname .. ".png",
  213. wield_image = colored_block_modname .. "_" .. greyname .. ".png",
  214. sunlight_propagates = colored_block_sunlight,
  215. paramtype = "light",
  216. walkable = colored_block_walkable,
  217. groups = colored_block_groups,
  218. sounds = colored_block_groups
  219. })
  220.  
  221. minetest.register_craft( {
  222. type = "shapeless",
  223. output = colored_block_modname .. ":" .. greyname .. " " .. colored_block_yield,
  224. recipe = {
  225. neutral_block,
  226. "unifieddyes:" .. greyname3
  227. }
  228. })
  229.  
  230. end
  231.  
  232.  
  233. print("[" .. colored_block_modname .. "] Loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement