add hammer

master
HybridDog 2013-08-23 16:16:54 +02:00
parent 87a04c96fd
commit 2e995b7bf5
6 changed files with 102 additions and 6 deletions

View File

@ -1,2 +1 @@
default

View File

@ -2,7 +2,7 @@
local function orenode(name, desc)
minetest.register_node("extrablocks:"..name.."_ore", {
description = desc,
tile_images = {"default_stone.png^extrablocks_"..name.."_ore.png"},
tiles = {"default_stone.png^extrablocks_"..name.."_ore.png"},
groups = {cracky=3},
drop = "extrablocks:"..name.."_lump",
sounds = default.node_sound_stone_defaults(),
@ -12,7 +12,7 @@ end
local function monode(name, desc, ligh)
minetest.register_node("extrablocks:"..name, {
description = desc,
tile_images = {"extrablocks_"..name..".png"},
tiles = {"extrablocks_"..name..".png"},
light_source = ligh,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -53,7 +53,7 @@ monode("acid", "Acid", 15)
minetest.register_node("extrablocks:goldstone", {
description = "Gold in Stone",
tile_images = {"default_stone.png^extrablocks_goldstone.png"},
tiles = {"default_stone.png^extrablocks_goldstone.png"},
light_source = 15,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -138,7 +138,7 @@ local img = "extrablocks_"..name..".png"
minetest.register_node("extrablocks:"..name, {
description = desc,
drawtype = "raillike",
tile_images = {img},
tiles = {img},
inventory_image = img,
selection_box = {type = "fixed",fixed = {-0.5, -1/2, -0.5, 0.5, -0.45, 0.5},},
paramtype = "light",
@ -150,7 +150,7 @@ raillikenode("repellent", "Repellent Covering")
raillikenode("radi", "!!!")
minetest.register_node("extrablocks:tort", {
tile_images = {"extrablocks_to_t.png", "extrablocks_to_b.png", "extrablocks_to_s2.png"},
tiles = {"extrablocks_to_t.png", "extrablocks_to_b.png", "extrablocks_to_s2.png"},
groups = {crumbly=2},
drop = "extrablocks:torte 2",
sounds = default.node_sound_dirt_defaults
@ -377,4 +377,7 @@ end
if extrablocks_movement_stuff then
dofile(path.."/mvmt.lua")
end
if extrablocks_tools then
dofile(path.."/tools.lua")
end
print("[extrablocks] loaded")

View File

@ -0,0 +1,5 @@
P6
# CREATOR: GIMP PNM Filter Version 1.1
16 16
255
°¡—°¢˜°¢˜`q22Eš¦Cmw0 Pš¡KŸ605s<>2@IQS6{qi¯ gdc`j8diG}{xWj-h|5ljd@D*:Bt~D_j8…†rW^<FPLV¼¯¦CM!4:@LZWWL]&ifenih†ŠTUb)bbW~wsrNYS_$¤—<C2A4>QNM^YX(+ifeXd$YXKsontpoca`gdcgedupokgfURQ*=.A`x uqpCP?E$3;BJTUF<46>i™ltpotonWj,Qb)_i$`j%/@<^upotpo4<CNb`\sonnjiig_ƒ€ +"-†ƒTRPKKDCf@E*][W`dK28p<>%w…*BKpmktpouqpURQTQP_[Z`\[PZNZIWah:XUTVSR88)ST@QR2v„*),ZWVÅÃSgdcfcbVSRTbK["<>:L^°¢˜…†[T`$NX|Œ.<2E>©7q‡9Zl1DT'*<Šw[l1^˜KY+mk`ŽŠ‰ŒˆˆS\,^k#Oe ¬³=µ·]ifelih_]W2G bl'`t"w…2EH-a]\ifeifefd^€<>8‰•3Vl%hfdvƒ6uqpLV!wsqix&Sf)eu+[aA~vrq<72>Œ˜lVh.}zytŒ;hednjiuqp¢¥Ohdc§¯MT`+CE1bdS{yw“d% ­°[dhH]p2<70>€]vrqvrq°´JqrXnji<6A><69>0N^KO5jffjffVi+.A¡4bgCrnn¡ˆdv$†<E280A0>/Bdu(bfHv5=mtMrqhuqqea`Vi,uqpTVB\XW`q2UQPT_$"&.Auqpvrq„<71>€B@@NJIg^YNJILIHq‡%KX ²µl²µc¥519_p2sŠ;PMLb_^OKK

View File

@ -3,3 +3,4 @@
extrablocks_allow_crafting = true
extrablocks_enable_moss = true
extrablocks_movement_stuff = true
extrablocks_tools = true

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

88
tools.lua Normal file
View File

@ -0,0 +1,88 @@
extrablocks_hammer_list = {
{"default:stone", "default:cobble"},
{"default:cobble", "default:gravel"},
{"default:gravel", "default:dirt", 3},
{"default:gravel", "default:sand"},
{"default:desert_stone", "default:desert_sand"},
{"default:ice", "default:water_source"},
}
minetest.register_tool("extrablocks:hammer", {
description = "Steel Hammer",
inventory_image = "extrablocks_hammer.png",
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
},
damage_groups = {fleshy=4},
},
})
minetest.register_on_dignode(function(pos, oldnode, digger)
if digger:get_wielded_item():get_name() == "extrablocks:hammer"
and oldnode.name ~= "air" then
local nd = oldnode.name
for _,i in ipairs(extrablocks_hammer_list) do
local chance = i[3]
if chance == nil
or chance <= 0 then
chance = 1
end
if math.random(chance) == 1
and nd == i[1] then
local inv = digger:get_inventory()
local items = minetest.get_node_drops(nd)
if inv then
for _,item in ipairs(items) do
--if inv:contains_item("main", item) then
inv:remove_item("main", item)
--else
-- return
--end
end
minetest.set_node(pos, {name=i[2]})
nodeupdate(pos)
return
end
end
end
end
end)
if minetest.get_modpath("tnt") then
minetest.register_tool("extrablocks:pick_tnt", {
inventory_image = "default_tool_woodpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
minetest.register_on_dignode(function(pos, oldnode, digger)
if digger:get_wielded_item():get_name() == "extrablocks:pick_tnt"
and oldnode.name ~= "air"
and minetest.get_item_group(oldnode.name, "cracky") >= 1 then
local time = math.random(10)/10
minetest.after(time, function(pos)
minetest.set_node(pos, {name="tnt:tnt_burning"})
boom(pos, 0)
end, pos)
end
end)
minetest.register_craft({
output = "extrablocks:pick_tnt",
recipe = {
{'group:wood', 'group:tree', 'group:wood'},
{'group:wood', 'group:tree', 'group:wood'},
{'', 'default:stick', ''},
}
})
end