Permalink
Browse files

Move all common mods back to minetest_game

  • Loading branch information...
PilzAdam committed May 18, 2013
1 parent 7f765f5 commit fcf0816fa81ca54b2cd866233b176f80285937b6
Showing with 12,186 additions and 6 deletions.
  1. +2 −5 README.txt
  2. +0 −1 game.conf
  3. +26 −0 mods/bucket/README.txt
  4. +2 −0 mods/bucket/depends.txt
  5. +135 −0 mods/bucket/init.lua
  6. BIN mods/bucket/textures/bucket.png
  7. BIN mods/bucket/textures/bucket_lava.png
  8. BIN mods/bucket/textures/bucket_water.png
  9. +22 −0 mods/creative/README.txt
  10. +1 −0 mods/creative/depends.txt
  11. +163 −0 mods/creative/init.lua
  12. +146 −0 mods/default/README.txt
  13. +2,679 −0 mods/default/init.lua
  14. +93 −0 mods/default/leafdecay.lua
  15. +537 −0 mods/default/mapgen.lua
  16. BIN mods/default/models/character.blend
  17. BIN mods/default/models/character.png
  18. +6,557 −0 mods/default/models/character.x
  19. +132 −0 mods/default/player.lua
  20. BIN mods/default/sounds/default_break_glass.1.ogg
  21. BIN mods/default/sounds/default_break_glass.2.ogg
  22. BIN mods/default/sounds/default_break_glass.3.ogg
  23. BIN mods/default/sounds/default_dig_choppy.ogg
  24. BIN mods/default/sounds/default_dig_cracky.ogg
  25. BIN mods/default/sounds/default_dig_crumbly.1.ogg
  26. BIN mods/default/sounds/default_dig_crumbly.2.ogg
  27. BIN mods/default/sounds/default_dig_dig_immediate.ogg
  28. BIN mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg
  29. BIN mods/default/sounds/default_dug_node.1.ogg
  30. BIN mods/default/sounds/default_grass_footstep.1.ogg
  31. BIN mods/default/sounds/default_grass_footstep.2.ogg
  32. BIN mods/default/sounds/default_grass_footstep.3.ogg
  33. BIN mods/default/sounds/default_gravel_footstep.1.ogg
  34. BIN mods/default/sounds/default_gravel_footstep.2.ogg
  35. BIN mods/default/sounds/default_gravel_footstep.3.ogg
  36. BIN mods/default/sounds/default_gravel_footstep.4.ogg
  37. BIN mods/default/sounds/default_hard_footstep.1.ogg
  38. BIN mods/default/sounds/default_hard_footstep.2.ogg
  39. BIN mods/default/sounds/default_place_node.1.ogg
  40. BIN mods/default/sounds/default_place_node.2.ogg
  41. BIN mods/default/sounds/default_place_node.3.ogg
  42. BIN mods/default/textures/crack_anylength.png
  43. BIN mods/default/textures/default_apple.png
  44. BIN mods/default/textures/default_book.png
  45. BIN mods/default/textures/default_bookshelf.png
  46. BIN mods/default/textures/default_brick.png
  47. BIN mods/default/textures/default_bronze_block.png
  48. BIN mods/default/textures/default_bronze_ingot.png
  49. BIN mods/default/textures/default_cactus_side.png
  50. BIN mods/default/textures/default_cactus_top.png
  51. BIN mods/default/textures/default_chest_front.png
  52. BIN mods/default/textures/default_chest_lock.png
  53. BIN mods/default/textures/default_chest_side.png
  54. BIN mods/default/textures/default_chest_top.png
  55. BIN mods/default/textures/default_clay.png
  56. BIN mods/default/textures/default_clay_brick.png
  57. BIN mods/default/textures/default_clay_lump.png
  58. BIN mods/default/textures/default_cloud.png
  59. BIN mods/default/textures/default_coal_block.png
  60. BIN mods/default/textures/default_coal_lump.png
  61. BIN mods/default/textures/default_cobble.png
  62. BIN mods/default/textures/default_copper_block.png
  63. BIN mods/default/textures/default_copper_ingot.png
  64. BIN mods/default/textures/default_copper_lump.png
  65. BIN mods/default/textures/default_desert_sand.png
  66. BIN mods/default/textures/default_desert_stone.png
  67. BIN mods/default/textures/default_desert_stone_brick.png
  68. BIN mods/default/textures/default_diamond.png
  69. BIN mods/default/textures/default_diamond_block.png
  70. BIN mods/default/textures/default_dirt.png
  71. BIN mods/default/textures/default_dry_shrub.png
  72. BIN mods/default/textures/default_fence.png
  73. BIN mods/default/textures/default_furnace_bottom.png
  74. BIN mods/default/textures/default_furnace_fire_bg.png
  75. BIN mods/default/textures/default_furnace_fire_fg.png
  76. BIN mods/default/textures/default_furnace_front.png
  77. BIN mods/default/textures/default_furnace_front_active.png
  78. BIN mods/default/textures/default_furnace_side.png
  79. BIN mods/default/textures/default_furnace_top.png
  80. BIN mods/default/textures/default_glass.png
  81. BIN mods/default/textures/default_gold_block.png
  82. BIN mods/default/textures/default_gold_ingot.png
  83. BIN mods/default/textures/default_gold_lump.png
  84. BIN mods/default/textures/default_grass.png
  85. BIN mods/default/textures/default_grass_1.png
  86. BIN mods/default/textures/default_grass_2.png
  87. BIN mods/default/textures/default_grass_3.png
  88. BIN mods/default/textures/default_grass_4.png
  89. BIN mods/default/textures/default_grass_5.png
  90. BIN mods/default/textures/default_grass_footsteps.png
  91. BIN mods/default/textures/default_grass_side.png
  92. BIN mods/default/textures/default_gravel.png
  93. BIN mods/default/textures/default_ice.png
  94. BIN mods/default/textures/default_iron_lump.png
  95. BIN mods/default/textures/default_junglegrass.png
  96. BIN mods/default/textures/default_jungleleaves.png
  97. BIN mods/default/textures/default_junglesapling.png
  98. BIN mods/default/textures/default_jungletree.png
  99. BIN mods/default/textures/default_jungletree_top.png
  100. BIN mods/default/textures/default_junglewood.png
  101. BIN mods/default/textures/default_ladder.png
  102. BIN mods/default/textures/default_lava.png
  103. BIN mods/default/textures/default_lava_flowing_animated.png
  104. BIN mods/default/textures/default_lava_source_animated.png
  105. BIN mods/default/textures/default_leaves.png
  106. BIN mods/default/textures/default_mese_block.png
  107. BIN mods/default/textures/default_mese_crystal.png
  108. BIN mods/default/textures/default_mese_crystal_fragment.png
  109. BIN mods/default/textures/default_mineral_coal.png
  110. BIN mods/default/textures/default_mineral_copper.png
  111. BIN mods/default/textures/default_mineral_diamond.png
  112. BIN mods/default/textures/default_mineral_gold.png
  113. BIN mods/default/textures/default_mineral_iron.png
  114. BIN mods/default/textures/default_mineral_mese.png
  115. BIN mods/default/textures/default_mossycobble.png
  116. BIN mods/default/textures/default_nc_back.png
  117. BIN mods/default/textures/default_nc_front.png
  118. BIN mods/default/textures/default_nc_rb.png
  119. BIN mods/default/textures/default_nc_side.png
  120. BIN mods/default/textures/default_obsidian.png
  121. BIN mods/default/textures/default_obsidian_glass.png
  122. BIN mods/default/textures/default_obsidian_shard.png
  123. BIN mods/default/textures/default_paper.png
  124. BIN mods/default/textures/default_papyrus.png
  125. BIN mods/default/textures/default_rail.png
  126. BIN mods/default/textures/default_rail_crossing.png
  127. BIN mods/default/textures/default_rail_curved.png
  128. BIN mods/default/textures/default_rail_t_junction.png
  129. BIN mods/default/textures/default_sand.png
  130. BIN mods/default/textures/default_sandstone.png
  131. BIN mods/default/textures/default_sandstone_brick.png
  132. BIN mods/default/textures/default_sapling.png
  133. BIN mods/default/textures/default_scorched_stuff.png
  134. BIN mods/default/textures/default_sign_wall.png
  135. BIN mods/default/textures/default_snow.png
  136. BIN mods/default/textures/default_snow_side.png
  137. BIN mods/default/textures/default_snowball.png
  138. BIN mods/default/textures/default_steel_block.png
  139. BIN mods/default/textures/default_steel_ingot.png
  140. BIN mods/default/textures/default_stick.png
  141. BIN mods/default/textures/default_stone.png
  142. BIN mods/default/textures/default_stone_brick.png
  143. BIN mods/default/textures/default_tnt_bottom.png
  144. BIN mods/default/textures/default_tnt_side.png
  145. BIN mods/default/textures/default_tnt_top.png
  146. BIN mods/default/textures/default_tool_bronzeaxe.png
  147. BIN mods/default/textures/default_tool_bronzepick.png
  148. BIN mods/default/textures/default_tool_bronzeshovel.png
  149. BIN mods/default/textures/default_tool_bronzesword.png
  150. BIN mods/default/textures/default_tool_diamondaxe.png
  151. BIN mods/default/textures/default_tool_diamondpick.png
  152. BIN mods/default/textures/default_tool_diamondshovel.png
  153. BIN mods/default/textures/default_tool_diamondsword.png
  154. BIN mods/default/textures/default_tool_meseaxe.png
  155. BIN mods/default/textures/default_tool_mesepick.png
  156. BIN mods/default/textures/default_tool_meseshovel.png
  157. BIN mods/default/textures/default_tool_mesesword.png
  158. BIN mods/default/textures/default_tool_steelaxe.png
  159. BIN mods/default/textures/default_tool_steelpick.png
  160. BIN mods/default/textures/default_tool_steelshovel.png
  161. BIN mods/default/textures/default_tool_steelsword.png
  162. BIN mods/default/textures/default_tool_stoneaxe.png
  163. BIN mods/default/textures/default_tool_stonepick.png
  164. BIN mods/default/textures/default_tool_stoneshovel.png
  165. BIN mods/default/textures/default_tool_stonesword.png
  166. BIN mods/default/textures/default_tool_woodaxe.png
  167. BIN mods/default/textures/default_tool_woodpick.png
  168. BIN mods/default/textures/default_tool_woodshovel.png
  169. BIN mods/default/textures/default_tool_woodsword.png
  170. BIN mods/default/textures/default_torch.png
  171. BIN mods/default/textures/default_torch_animated.png
  172. BIN mods/default/textures/default_torch_on_ceiling.png
  173. BIN mods/default/textures/default_torch_on_ceiling_animated.png
  174. BIN mods/default/textures/default_torch_on_floor.png
  175. BIN mods/default/textures/default_torch_on_floor_animated.png
  176. BIN mods/default/textures/default_tree.png
  177. BIN mods/default/textures/default_tree_top.png
  178. BIN mods/default/textures/default_water.png
  179. BIN mods/default/textures/default_water_flowing_animated.png
  180. BIN mods/default/textures/default_water_source_animated.png
  181. BIN mods/default/textures/default_wood.png
  182. BIN mods/default/textures/heart.png
  183. BIN mods/default/textures/player.png
  184. BIN mods/default/textures/player_back.png
  185. BIN mods/default/textures/treeprop.png
  186. BIN mods/default/textures/wieldhand.png
  187. +23 −0 mods/doors/README.txt
  188. +1 −0 mods/doors/depends.txt
  189. +295 −0 mods/doors/init.lua
  190. BIN mods/doors/textures/door_brown.png
  191. BIN mods/doors/textures/door_grey.png
  192. BIN mods/doors/textures/door_steel.png
  193. BIN mods/doors/textures/door_steel_a.png
  194. BIN mods/doors/textures/door_steel_b.png
  195. BIN mods/doors/textures/door_wood.png
  196. BIN mods/doors/textures/door_wood_a.png
  197. BIN mods/doors/textures/door_wood_b.png
  198. +15 −0 mods/dye/README.txt
  199. 0 mods/dye/depends.txt
  200. +139 −0 mods/dye/init.lua
  201. BIN mods/dye/textures/dye_black.png
  202. BIN mods/dye/textures/dye_blue.png
  203. BIN mods/dye/textures/dye_brown.png
  204. BIN mods/dye/textures/dye_cyan.png
  205. BIN mods/dye/textures/dye_dark_green.png
  206. BIN mods/dye/textures/dye_dark_grey.png
  207. BIN mods/dye/textures/dye_green.png
  208. BIN mods/dye/textures/dye_grey.png
  209. BIN mods/dye/textures/dye_magenta.png
  210. BIN mods/dye/textures/dye_orange.png
  211. BIN mods/dye/textures/dye_pink.png
  212. BIN mods/dye/textures/dye_red.png
  213. BIN mods/dye/textures/dye_violet.png
  214. BIN mods/dye/textures/dye_white.png
  215. BIN mods/dye/textures/dye_yellow.png
  216. +32 −0 mods/fire/README.txt
  217. +192 −0 mods/fire/init.lua
  218. BIN mods/fire/sounds/fire_large.ogg
  219. BIN mods/fire/sounds/fire_small.ogg
  220. BIN mods/fire/textures/fire_basic_flame.png
  221. BIN mods/fire/textures/fire_basic_flame_animated.png
  222. +16 −0 mods/flowers/README.txt
  223. +1 −0 mods/flowers/depends.txt
  224. +167 −0 mods/flowers/init.lua
  225. +62 −0 mods/flowers/mapgen.lua
  226. BIN mods/flowers/textures/flowers_dandelion_white.png
  227. BIN mods/flowers/textures/flowers_dandelion_yellow.png
  228. BIN mods/flowers/textures/flowers_geranium.png
  229. BIN mods/flowers/textures/flowers_rose.png
  230. BIN mods/flowers/textures/flowers_tulip.png
  231. BIN mods/flowers/textures/flowers_viola.png
  232. +1 −0 mods/screwdriver/depends.txt
  233. +210 −0 mods/screwdriver/init.lua
  234. +18 −0 mods/screwdriver/readme.txt
  235. BIN mods/screwdriver/textures/screwdriver.png
  236. BIN mods/screwdriver/textures/tool_mode1.png
  237. BIN mods/screwdriver/textures/tool_mode2.png
  238. BIN mods/screwdriver/textures/tool_mode3.png
  239. BIN mods/screwdriver/textures/tool_mode4.png
  240. +26 −0 mods/stairs/README.txt
  241. +1 −0 mods/stairs/depends.txt
  242. +252 −0 mods/stairs/init.lua
  243. +45 −0 mods/vessels/README.txt
  244. +1 −0 mods/vessels/depends.txt
  245. +116 −0 mods/vessels/init.lua
  246. BIN mods/vessels/textures/alternates/vessels_drinking_glass.png
  247. BIN mods/vessels/textures/alternates/vessels_glass_bottle.png
  248. BIN mods/vessels/textures/alternates/vessels_steel_bottle.png
  249. BIN mods/vessels/textures/vessels_drinking_glass.png
  250. BIN mods/vessels/textures/vessels_drinking_glass_inv.png
  251. BIN mods/vessels/textures/vessels_glass_bottle.png
  252. BIN mods/vessels/textures/vessels_glass_bottle_inv.png
  253. BIN mods/vessels/textures/vessels_glass_fragments.png
  254. BIN mods/vessels/textures/vessels_steel_bottle.png
  255. BIN mods/vessels/textures/vessels_steel_bottle_inv.png
  256. +28 −0 mods/wool/README.txt
  257. +1 −0 mods/wool/depends.txt
  258. +49 −0 mods/wool/init.lua
  259. BIN mods/wool/textures/wool_black.png
  260. BIN mods/wool/textures/wool_blue.png
  261. BIN mods/wool/textures/wool_brown.png
  262. BIN mods/wool/textures/wool_cyan.png
  263. BIN mods/wool/textures/wool_dark_green.png
  264. BIN mods/wool/textures/wool_dark_grey.png
  265. BIN mods/wool/textures/wool_green.png
  266. BIN mods/wool/textures/wool_grey.png
  267. BIN mods/wool/textures/wool_magenta.png
  268. BIN mods/wool/textures/wool_orange.png
  269. BIN mods/wool/textures/wool_pink.png
  270. BIN mods/wool/textures/wool_red.png
  271. BIN mods/wool/textures/wool_violet.png
  272. BIN mods/wool/textures/wool_white.png
  273. BIN mods/wool/textures/wool_yellow.png
@@ -1,9 +1,6 @@
The main game for the Minetest game engine [minetest_game]
==========================================================

This game requires Minetest common mods:
https://github.com/minetest/common/

To build the wholeness of the Minetest project, insert this repository as
/games/minetest_game
in the Minetest Engine.
@@ -48,6 +45,6 @@ License of media (textures and sounds)
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.

Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/

@@ -1,2 +1 @@
name = Minetest
common_mods = default, bucket, creative, doors, dye, fire, stairs, vessels, wool
@@ -0,0 +1,26 @@
Minetest 0.4 mod: bucket
=========================

License of source code:
-----------------------
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

http://www.gnu.org/licenses/lgpl-2.1.html

License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/

Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>


@@ -0,0 +1,2 @@
default

@@ -0,0 +1,135 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.

local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled

minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")

minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
}
})

bucket = {}
bucket.liquids = {}

-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]

if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end

local place_liquid = function(pos, node, source, flowing, fullness)
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then
minetest.env:add_node(pos, {name=source, param2=fullness})
return
elseif node.name == flowing then
fullness = fullness + node.param2
elseif node.name == source then
fullness = LIQUID_MAX
end

if fullness >= LIQUID_MAX then
minetest.env:add_node(pos, {name=source, param2=LIQUID_MAX})
else
minetest.env:add_node(pos, {name=flowing, param2=fullness})
end
end

-- Check if pointing to a buildable node
local node = minetest.env:get_node(pointed_thing.under)
local fullness = tonumber(itemstack:get_metadata())
if not fullness then fullness = LIQUID_MAX end

if minetest.registered_nodes[node.name].buildable_to then
-- buildable; replace the node
place_liquid(pointed_thing.under, node, source, flowing, fullness)
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
local node = minetest.env:get_node(pointed_thing.above)
if minetest.registered_nodes[node.name].buildable_to then
place_liquid(pointed_thing.above, node, source, flowing, fullness)
else
-- do not remove the bucket with the liquid
return
end
end
return {name="bucket:bucket_empty"}
end
})
end
end

minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Bucket",
inventory_image = "bucket.png",
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source
node = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[node.name]
if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == liquiddef.source or
(node.name == liquiddef.flowing and minetest.setting_getbool("liquid_finite"))) then

minetest.env:add_node(pointed_thing.under, {name="air"})

if node.name == liquiddef.source then node.param2 = LIQUID_MAX end
return ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
end
end,
})

bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
"Water Bucket"
)

bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)

minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
Minetest 0.4 mod: creative
==========================

Implements creative mode.

Switch on by using the "creative_mode" setting.

Registered items that
- have a description, and
- do not have the group not_in_creative_inventory
are added to the creative inventory.

License of source code and media files:
---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>

This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

@@ -0,0 +1 @@
default
@@ -0,0 +1,163 @@
-- minetest/creative/init.lua

creative_inventory = {}
creative_inventory.creative_inventory_size = 0

-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)

-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)


creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec("size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
"list[current_player;main;5,3.5;8,4;]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]")
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0

if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end

if start_i < 0 then
start_i = start_i + 4*6
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end

if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end

creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)

if minetest.setting_getbool("creative_mode") then

minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
},
damage_groups = {fleshy = 10},
}
})

minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)

function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end

end
Oops, something went wrong.

0 comments on commit fcf0816

Please sign in to comment.