From 760416b81fbcf3343d4276c20cf7d6028b5ad461 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 3 Dec 2011 11:41:52 +0200 Subject: Change naming convention to be modname:* instead of modname_* (sorry modders!) --- data/mods/bucket/init.lua | 20 ++++++++++---------- data/mods/default/init.lua | 12 ++++++++---- data/mods/experimental/init.lua | 22 +++++++++++----------- 3 files changed, 29 insertions(+), 25 deletions(-) (limited to 'data/mods') diff --git a/data/mods/bucket/init.lua b/data/mods/bucket/init.lua index 33beb699d..3b1eefb37 100644 --- a/data/mods/bucket/init.lua +++ b/data/mods/bucket/init.lua @@ -1,12 +1,12 @@ minetest.register_craft({ - output = 'craft "bucket_empty" 1', + output = 'craft "bucket:bucket_empty" 1', recipe = { {'craft "steel_ingot"', '', 'craft "steel_ingot"'}, {'', 'craft "steel_ingot"', ''}, } }) -minetest.register_craftitem("bucket_empty", { +minetest.register_craftitem("bucket:bucket_empty", { image = "bucket.png", stack_max = 1, liquids_pointable = true, @@ -16,11 +16,11 @@ minetest.register_craftitem("bucket_empty", { n = minetest.env:get_node(pointed_thing.under) if n.name == "water_source" then minetest.env:add_node(pointed_thing.under, {name="air"}) - player:add_to_inventory_later('craft "bucket_water" 1') + player:add_to_inventory_later('craft "bucket:bucket_water" 1') return true elseif n.name == "lava_source" then minetest.env:add_node(pointed_thing.under, {name="air"}) - player:add_to_inventory_later('craft "bucket_lava" 1') + player:add_to_inventory_later('craft "bucket:bucket_lava" 1') return true end end @@ -28,8 +28,8 @@ minetest.register_craftitem("bucket_empty", { end, }) -minetest.register_craftitem("bucket_water", { - image = "bucket_water.png", +minetest.register_craftitem("bucket:bucket_water", { + image = "bucket:bucket_water.png", stack_max = 1, liquids_pointable = true, on_place_on_ground = minetest.craftitem_place_item, @@ -43,15 +43,15 @@ minetest.register_craftitem("bucket_water", { else minetest.env:add_node(pointed_thing.above, {name="water_source"}) end - player:add_to_inventory_later('craft "bucket_empty" 1') + player:add_to_inventory_later('craft "bucket:bucket_empty" 1') return true end return false end, }) -minetest.register_craftitem("bucket_lava", { - image = "bucket_lava.png", +minetest.register_craftitem("bucket:bucket_lava", { + image = "bucket:bucket_lava.png", stack_max = 1, liquids_pointable = true, on_place_on_ground = minetest.craftitem_place_item, @@ -65,7 +65,7 @@ minetest.register_craftitem("bucket_lava", { else minetest.env:add_node(pointed_thing.above, {name="lava_source"}) end - player:add_to_inventory_later('craft "bucket_empty" 1') + player:add_to_inventory_later('craft "bucket:bucket_empty" 1') return true end return false diff --git a/data/mods/default/init.lua b/data/mods/default/init.lua index e0cc3598b..3baafff63 100644 --- a/data/mods/default/init.lua +++ b/data/mods/default/init.lua @@ -21,17 +21,21 @@ -- -- Naming convention for registered textual names -- ---------------------------------------------- --- "modname_" +-- "modname:" ( can have characters a-zA-Z0-9_) -- -- This is to prevent conflicting names from corrupting maps and is -- enforced by the mod loader. -- -- Example: mod "experimental", ideal item/node/entity name "tnt": --- -> the name should be "experimental_tnt". +-- -> the name should be "experimental:tnt". -- -- Enforcement can be overridden by prefixing the name with ":". This can -- be used for overriding the registrations of some other mod. -- +-- Example: Any mod can redefine experimental:tnt by using the name +-- ":experimental:tnt" when registering it. +-- (also that mods is required to have "experimental" as a dependency) +-- -- Default mod uses ":" for maintaining backwards compatibility. -- -- Textures @@ -1426,7 +1430,7 @@ function nodeupdate_single(p) n_bottom = minetest.env:get_node(p_bottom) if n_bottom.name == "air" then minetest.env:remove_node(p) - minetest.env:add_luaentity(p, "default_falling_"..n.name) + minetest.env:add_luaentity(p, "default:falling_"..n.name) nodeupdate(p) end end @@ -1448,7 +1452,7 @@ end -- function register_falling_node(nodename, texture) - minetest.register_entity("default_falling_"..nodename, { + minetest.register_entity("default:falling_"..nodename, { -- Static definition physical = true, collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, diff --git a/data/mods/experimental/init.lua b/data/mods/experimental/init.lua index 207b38cbf..326fe1b75 100644 --- a/data/mods/experimental/init.lua +++ b/data/mods/experimental/init.lua @@ -4,7 +4,7 @@ -- An example furnace-thing implemented in Lua -minetest.register_node("experimental_luafurnace", { +minetest.register_node("experimental:luafurnace", { tile_images = {"lava.png", "furnace_side.png", "furnace_side.png", "furnace_side.png", "furnace_side.png", "furnace_front.png"}, --inventory_image = "furnace_front.png", @@ -15,7 +15,7 @@ minetest.register_node("experimental_luafurnace", { }) minetest.register_on_placenode(function(pos, newnode, placer) - if newnode.name == "experimental_luafurnace" then + if newnode.name == "experimental:luafurnace" then print("get_meta"); local meta = minetest.env:get_meta(pos) print("inventory_set_list"); @@ -42,7 +42,7 @@ minetest.register_on_placenode(function(pos, newnode, placer) end) minetest.register_abm({ - nodenames = {"experimental_luafurnace"}, + nodenames = {"experimental:luafurnace"}, interval = 1.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) @@ -97,7 +97,7 @@ minetest.register_abm({ }) minetest.register_craft({ - output = 'node "experimental_luafurnace" 1', + output = 'node "experimental:luafurnace" 1', recipe = { {'node "cobble"', 'node "cobble"', 'node "cobble"'}, {'node "cobble"', 'node "cobble"', 'node "cobble"'}, @@ -132,7 +132,7 @@ minetest.register_craft({ } }) -minetest.register_node("experimental_somenode", { +minetest.register_node("experimental:somenode", { tile_images = {"lava.png", "mese.png", "stone.png", "grass.png", "cobble.png", "tree_top.png"}, inventory_image = "treeprop.png", material = { @@ -151,7 +151,7 @@ minetest.register_node("experimental_somenode", { -- minetest.register_craft({ - output = 'node "experimental_tnt" 4', + output = 'node "experimental:tnt" 4', recipe = { {'node "wood" 1'}, {'craft "lump_of_coal" 1'}, @@ -159,7 +159,7 @@ minetest.register_craft({ } }) -minetest.register_node("experimental_tnt", { +minetest.register_node("experimental:tnt", { tile_images = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png", "tnt_side.png", "tnt_side.png", "tnt_side.png"}, inventory_image = "tnt_side.png", dug_item = '', -- Get nothing @@ -169,9 +169,9 @@ minetest.register_node("experimental_tnt", { }) minetest.register_on_punchnode(function(p, node) - if node.name == "experimental_tnt" then + if node.name == "experimental:tnt" then minetest.env:remove_node(p) - minetest.env:add_luaentity(p, "experimental_tnt") + minetest.env:add_luaentity(p, "experimental:tnt") nodeupdate(p) end end) @@ -235,13 +235,13 @@ end --print("TNT dump: "..dump(TNT)) --print("Registering TNT"); -minetest.register_entity("experimental_tnt", TNT) +minetest.register_entity("experimental:tnt", TNT) -- -- A test entity for testing animated and yaw-modulated sprites -- -minetest.register_entity("experimental_testentity", { +minetest.register_entity("experimental:testentity", { -- Static definition physical = true, -- Collides with things -- weight = 5, -- cgit v1.2.3