]> git.lizzy.rs Git - Crafter.git/blob - mods/hand/init.lua
remove server debug
[Crafter.git] / mods / hand / init.lua
1 -- The hand
2
3 --Create an initial hand tool
4 minetest.register_item(":", {
5         type = "none",
6         wield_image = "nothing.png",
7         wield_scale = {x=1,y=1,z=2.5},
8 })
9
10 -- This is a fake node that should never be placed in the world
11 local def = minetest.registered_items[""]
12 minetest.register_node("hand:player", {
13         description = "",
14         tiles = {"player.png"},
15         visual_scale = 1,
16         tool_capabilities = {
17                 full_punch_interval = 0.9,
18                 max_drop_level = 0,
19                 groupcaps = {           
20                         stone = {times={[1]=7.5,[2]=16,[3]=32,[4]=64,[5]=128},  uses=0, maxlevel=1}, --
21                         dirt =  {times={[1]=0.75,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
22                         snow =  {times={[1]=0.75,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
23                         grass = {times={[1]=0.9,[2]=1.5,[3]=3,[4]=6,[5]=12},    uses=0, maxlevel=1}, --
24                         sand =  {times={[1]=0.75,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
25                         wood =  {times={[1]=3,[2]=6,[3]=9,[4]=12,[5]=15},       uses=0, maxlevel=1}, --
26                         leaves ={times={[1]=0.75,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
27                         wool =  {times={[1]=0.75,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
28                         glass = {times={[1]=0.5,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
29                         netherrack = {times={[1]=0.4,[2]=1.5,[3]=3,[4]=6,[5]=12},   uses=0, maxlevel=1}, --
30                         
31                         unbreakable = {times={[1]=63072000000000},   uses=0, maxlevel=1}, -- 2 million years
32                         
33                         --instant = {times={[1]=0.1,},uses=0,maxlevel=1},
34                         dig_immediate = {times={[2]=0,[3]=0,[1]=0,},uses=0,maxlevel=1},
35                 },
36                 damage_groups = {damage=1},
37         },
38         wield_scale = {x=1,y=1,z=1},
39         paramtype = "light",
40         drawtype = "mesh",
41         mesh = "hand.b3d",
42         -- Prevent construction
43         node_placement_prediction = "",
44         on_construct = function(pos)
45                 minetest.log("error", "Tried to place hand at "..minetest.pos_to_string(pos))
46                 minetest.remove_node(pos)
47         end,
48         drop = "",
49         on_drop = function()
50                 return ""
51         end,
52         groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
53         range = def.range,
54 })
55
56 minetest.register_node("hand:creative", {
57         description = "",
58         tiles = {"player.png"},
59         visual_scale = 1,
60         tool_capabilities = {
61                 full_punch_interval = 0.9,
62                 max_drop_level = 0,
63                 groupcaps = {           
64                         stone = {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
65                         dirt =  {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
66                         snow =  {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
67                         grass = {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
68                         sand =  {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
69                         wood =  {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
70                         leaves ={times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
71                         wool =  {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
72                         glass = {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}, uses=0, maxlevel=1},
73                         netherrack = {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0},uses=0, maxlevel=1},
74                         unbreakable = {times={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0},uses=0, maxlevel=1},
75                         dig_immediate = {times={[2]=0,[3]=0,[1]=0,},uses=0, maxlevel=1},
76                 },
77                 damage_groups = {damage=1},
78         },
79         wield_scale = {x=1,y=1,z=1},
80         paramtype = "light",
81         drawtype = "mesh",
82         mesh = "hand.b3d",
83         -- Prevent construction
84         node_placement_prediction = "",
85         on_construct = function(pos)
86                 minetest.log("error", "Tried to place hand at "..minetest.pos_to_string(pos))
87                 minetest.remove_node(pos)
88         end,
89         drop = "",
90         on_drop = function()
91                 return ""
92         end,
93         groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
94         range = def.range,
95 })
96
97
98 --Create a hand list and then enable the hand node
99 minetest.register_on_joinplayer(function(player)
100         player:get_inventory():set_size("hand", 1)
101         player:get_inventory():set_stack("hand", 1, "hand:player")
102 end)
103