1
0
Disbranĉigi 0
Ĉi tiu deponejo arĥiviĝis je 2024-01-28. Vi povas vidi kaj elŝuti dosierojn, sed ne povas puŝi nek raporti problemojn nek tirpeti.
minetest_ocd3/diff/default.diff/tools.lua.diff

425 lines
20 KiB
Diff
Raw Permalink Normal View History

2018-03-18 17:37:28 -05:00
2a3,11
> local place_tool = function(itemstack, direction, meta1, meta2, pt, tool)
> -- minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:" .. tool .. "_deco", param2=direction})
> -- meta1:set_int("wear", itemstack:get_wear())
> -- meta2:set_int("wear", itemstack:get_wear())
> -- itemstack:take_item()
> return itemstack
> end
>
>
35d43
< groups = {flammable = 2},
36a45,58
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_wood_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
50a73,86
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_stone_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
64a101,114
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_steel_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
78a129,142
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_bronze_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
92a157,170
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_mese_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
106a185,198
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_diamond_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
126a219,232
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_wood_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
141a248,261
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_stone_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
156a277,296
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_stone_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
> on_place = function(itemstack, placer, pointed_thing)
> place_tool(itemstack, minetest.dir_to_facedir(placer:get_look_dir()),
> minetest.env:get_meta({x=pointed_thing.under.x, y=pointed_thing.under.y , z=pointed_thing.under.z}),
> minetest.env:get_meta({x=pointed_thing.under.x, y=pointed_thing.under.y+1, z=pointed_thing.under.z}),
> pointed_thing, "shovel_steel");
> end,
171a312,325
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_bronze_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
186a341,354
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_mese_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
201a370,383
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_diamond_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
220a403,416
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_wood_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
234a431,444
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_stone_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
248a459,472
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_steel_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
262a487,500
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_bronze_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
276a515,528
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_mese_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
286c538
< choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2},
---
> choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=3},
290a543,556
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_diamond_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
309a576,589
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_wood_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
323a604,617
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_stone_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
337a632,645
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_steel_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
351a660,673
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_bronze_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
365a688,701
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_mese_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
379a716,729
> on_place = function(itemstack, placer, pointed_thing)
> local pt = pointed_thing
> if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
> local wear = itemstack:get_wear()
> local direction = minetest.dir_to_facedir(placer:get_look_dir())
> local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
> local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
> minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_diamond_deco", param2=direction})
> meta1:set_int("wear", wear)
> meta2:set_int("wear", wear)
> itemstack:take_item()
> return itemstack
> end
> end,
419a770,810
>
>
> local register_deco_block = function(tool_name, tool_tiles, tool_nodebox)
> minetest.register_node(tool_name.."_deco", {
> drawtype = "nodebox",
> paramtype = "light",
> paramtype2 = "facedir",
> tiles = tool_tiles,
> groups = {
> snappy=3,
> flammable=2,
> not_in_creative_inventory=1
> },
> node_box = {
> type = "fixed",
> fixed = tool_nodebox,
> },
> sounds = default.node_sound_wood_defaults(),
> on_dig = function(pos, node, digger)
> if digger:is_player() and digger:get_inventory() then
> local meta = minetest.env:get_meta(pos)
> local wear_out = meta:get_int("wear")
> digger:get_inventory():add_item("main", {name=tool_name, count=1, wear=wear_out, metadata=""})
> end
> minetest.remove_node(pos)
> end,
> })
> end
>
> local register_deco_block_materials = function(material, top)
> register_deco_block("default:pick_"..material, {top, "default_tool_"..material.."pick.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, -1.5/3, 0.5/3, 1.5/3, 1.5/3}})
> register_deco_block("default:shovel_"..material, {top, "default_tool_"..material.."shovel.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 1.5/3, 0.5/3}})
> register_deco_block("default:axe_"..material, {top, top, "default_tool_"..material.."axe.png^[transformFX", "default_tool_"..material.."axe.png", "default_tool_"..material.."axe.png^[combine:6x6:2,0=".."default_tool_"..material.."axe.png", "default_tool_"..material.."axe.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, -0.5/3, 0.5/3, 1.5/3, 1.5/3},{-0.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3}})
> register_deco_block("default:sword_"..material, {top, "default_tool_"..material.."sword.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 1.5/3, 0.5/3}})
> end
> register_deco_block_materials("stone", "default_cobble.png")
> register_deco_block_materials("wood", "default_wood.png")
> register_deco_block_materials("steel", "default_steel_block.png")
> register_deco_block_materials("bronze", "default_bronze_block.png")
> register_deco_block_materials("mese", "default_mese_block.png")
> register_deco_block_materials("diamond", "default_diamond_block.png")