123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- -- mods/default/craftitems.lua
- default = default or {}
- function default.strike_protection(itemstack, user, pt)
- if not user or not user:is_player() then
- return
- end
- if pt.type ~= "node" then
- return
- end
- local pname = user:get_player_name()
- if minetest.test_protection(pt.under, pname) then
- ambiance.sound_play("default_metal_footstep", pt.under, 1.0, 20)
- else
- ambiance.sound_play("default_wood_footstep", pt.under, 1.0, 20)
- end
- -- Update names in infotext.
- local node = minetest.get_node(pt.under)
- local ndef = minetest.registered_items[node.name]
- if ndef and ndef._on_rename_check then
- ndef._on_rename_check(pt.under)
- end
- end
- minetest.register_craftitem("default:stick", {
- description = "Stick\n\nCan be used to test protection.\nAlso updates infotext names.",
- inventory_image = "default_stick.png",
- groups = {stick = 1, flammable = 2},
- on_use = default.strike_protection,
- })
- minetest.register_craftitem("default:paper", {
- description = "Paper",
- inventory_image = "default_paper.png",
- groups = {flammable = 3},
- })
- minetest.register_craftitem("default:padlock", {
- description = "Lock",
- inventory_image = "lock_item.png",
- })
- minetest.register_craftitem("default:coal_lump", {
- description = "Coal Lump",
- inventory_image = "default_coal_lump.png",
- groups = {coal = 1, flammable = 1}
- })
- minetest.register_craftitem("default:iron_lump", {
- description = "Iron Lump",
- inventory_image = "default_iron_lump.png",
- })
- minetest.register_craftitem("default:copper_lump", {
- description = "Copper Lump",
- inventory_image = "default_copper_lump.png",
- })
- minetest.register_craftitem("default:mese_crystal", {
- description = "Mese Crystal",
- inventory_image = "default_mese_crystal.png",
- })
- minetest.register_craftitem("default:gold_lump", {
- description = "Gold Lump",
- inventory_image = "default_gold_lump.png",
- })
- minetest.register_craftitem("default:diamond", {
- description = "Diamond",
- inventory_image = "default_diamond.png",
- })
- minetest.register_craftitem("default:clay_lump", {
- description = "Clay Lump",
- inventory_image = "default_clay_lump.png",
- })
- minetest.register_craftitem("default:steel_ingot", {
- description = "Wrought Iron Ingot",
- inventory_image = "default_steel_ingot.png",
- groups = {ingot = 1},
- })
- minetest.register_craftitem("default:copper_ingot", {
- description = "Copper Ingot",
- inventory_image = "default_copper_ingot.png",
- groups = {ingot = 1},
- })
- minetest.register_craftitem("default:bronze_ingot", {
- description = "Bronze Ingot",
- inventory_image = "default_bronze_ingot.png",
- groups = {ingot = 1},
- })
- minetest.register_craftitem("default:gold_ingot", {
- description = "Gold Ingot",
- inventory_image = "default_gold_ingot.png",
- groups = {ingot = 1},
- })
- minetest.register_craftitem("default:mese_crystal_fragment", {
- description = "Mese Crystal Fragment",
- inventory_image = "default_mese_crystal_fragment.png",
- })
- minetest.register_craftitem("default:clay_brick", {
- description = "Clay Brick",
- inventory_image = "default_clay_brick.png",
- })
- minetest.register_craftitem("default:obsidian_shard", {
- description = "Obsidian Shard",
- inventory_image = "default_obsidian_shard.png",
- })
- minetest.register_craftitem("default:flint", {
- description = "Flint",
- inventory_image = "default_flint.png"
- })
|