diff --git a/minetestforfun_game/mods/bucket/init.lua b/minetestforfun_game/mods/bucket/init.lua index df8ea7ec..3aeea923 100755 --- a/minetestforfun_game/mods/bucket/init.lua +++ b/minetestforfun_game/mods/bucket/init.lua @@ -3,7 +3,6 @@ minetest.register_alias("bucket", "bucket:bucket_empty") minetest.register_alias("bucket_water", "bucket:bucket_water") -minetest.register_alias("bucket_acid", "bucket:bucket_acid") minetest.register_alias("bucket_lava", "bucket:bucket_lava") minetest.register_craft({ @@ -53,6 +52,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name stack_max = 1, liquids_pointable = true, groups = groups, + on_place = function(itemstack, user, pointed_thing) -- Must be pointing to node if pointed_thing.type ~= "node" then @@ -60,10 +60,8 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name end local node = minetest.get_node_or_nil(pointed_thing.under) - local ndef - if node then - ndef = minetest.registered_nodes[node.name] - end + local ndef = node and minetest.registered_nodes[node.name] + -- Call on_rightclick if the pointed node defines it if ndef and ndef.on_rightclick and user and not user:get_player_control().sneak then @@ -106,8 +104,6 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name end end --- Empty Bucket code by Casimir. - minetest.register_craftitem("bucket:bucket_empty", { description = "Empty Bucket", inventory_image = "bucket.png", @@ -145,7 +141,7 @@ minetest.register_craftitem("bucket:bucket_empty", { else local pos = user:getpos() pos.y = math.floor(pos.y + 0.5) - core.add_item(pos, liquiddef.itemname) + minetest.add_item(pos, liquiddef.itemname) end -- set to return empty buckets minus 1 @@ -186,24 +182,6 @@ bucket.register_liquid( "Lava Bucket" ) -bucket.register_liquid( - "default:acid_source", - "default:acid_flowing", - "bucket:bucket_acid", - "bucket_acid.png", - "Acid Bucket", - {not_in_creative_inventory = 1} -) - -bucket.register_liquid( - "default:sand_source", - "default:sand_flowing", - "bucket:bucket_sand", - "bucket_sand.png", - "Sand Bucket", - {not_in_creative_inventory = 1} -) - minetest.register_craft({ type = "fuel", recipe = "bucket:bucket_lava", @@ -211,11 +189,3 @@ minetest.register_craft({ replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}}, }) -minetest.register_craft({ - output = "bucket:bucket_sand", - recipe = { - {"group:sand"}, - {"group:sand"}, - {"bucket:bucket_water"}, - }, -}) diff --git a/mods/death_messages/init.lua b/mods/death_messages/init.lua index ac7d404f..a5765841 100755 --- a/mods/death_messages/init.lua +++ b/mods/death_messages/init.lua @@ -124,12 +124,12 @@ local monsters = { ["mobs:cow"] = "cow", ["mobs:creeper"] = "creeper", ["mobs:dog"] = "dog", - ["mobs:greenbig"] = "big green slim", - ["mobs:greenmedium"] = "medium green slim", - ["mobs:greensmall"] = "small green slim", - ["mobs:lavabig"] = "big lava slim", - ["mobs:lavamedium"] = "medium lava slim", - ["mobs:lavasmall"] = "small lava slim", + ["mobs:greenbig"] = "big green slime", + ["mobs:greenmedium"] = "medium green slime", + ["mobs:greensmall"] = "small green slime", + ["mobs:lavabig"] = "big lava slime", + ["mobs:lavamedium"] = "medium lava slime", + ["mobs:lavasmall"] = "small lava slime", ["mobs:yeti"] = "yeti", ["mobs:snowball"] = "yeti", ["mobs:npc"] = "npc", @@ -197,6 +197,11 @@ minetest.register_on_respawnplayer(function(player) whacked[player:get_player_name()] = nil end) +local function equiv(what, to) + what = (type(what) ~= 'string') and what.name or what + return what == to or minetest.registered_aliases[what] == to +end + if RANDOM_MESSAGES == true then minetest.register_on_dieplayer(function(player) local player_name = player:get_player_name() @@ -219,10 +224,10 @@ if RANDOM_MESSAGES == true then elseif player:get_breath() == 0 and node.groups.water then death_message = messages.water[math.random(1,#messages.water)] -- Death by fire - elseif node.name == "fire:basic_flame" then + elseif equiv(node, "fire:basic_flame") then death_message = messages.fire[math.random(1,#messages.fire)] -- Death in quicksand - elseif player:get_breath() == 0 and node.name == "default:sand_source" or node.name == "default:sand_flowing" then + elseif player:get_breath() == 0 and equiv(node, "default:sand_source") or equiv(node, "default:sand_flowing") then death_message = messages.sand[math.random(1,#messages.sand)] -- Death by something else else @@ -254,7 +259,7 @@ else elseif player:get_breath() == 0 then minetest.chat_send_all(player_name .. " ran out of air.") -- Death by fire - elseif node.name == "fire:basic_flame" then + elseif equiv(node, "fire:basic_flame") then minetest.chat_send_all(player_name .. " burned to a crisp.") -- Death by something else else diff --git a/mods/mff/mff_classic/aliases.lua b/mods/mff/mff_classic/aliases.lua index d3bd33c9..5958bc64 100644 --- a/mods/mff/mff_classic/aliases.lua +++ b/mods/mff/mff_classic/aliases.lua @@ -33,3 +33,8 @@ do -- moreores minetest.register_alias('silver_block', modname .. ':silverblock') minetest.register_alias('tin_block', modname .. ':tinblock') end + +minetest.register_alias('bucket_acid', modname .. ':bucket_acid') +minetest.register_alias('bucket:bucket_acid', modname .. ':bucket_acid') +minetest.register_alias('bucket_sand', modname .. ':bucket_sand') +minetest.register_alias('bucket:bucket_sand', modname .. ':bucket_sand') diff --git a/mods/mff/mff_classic/depends.txt b/mods/mff/mff_classic/depends.txt index 4ad96d51..6cf00e8d 100644 --- a/mods/mff/mff_classic/depends.txt +++ b/mods/mff/mff_classic/depends.txt @@ -1 +1,2 @@ default +bucket diff --git a/mods/mff/mff_classic/init.lua b/mods/mff/mff_classic/init.lua index 21dcd823..73d3f90b 100644 --- a/mods/mff/mff_classic/init.lua +++ b/mods/mff/mff_classic/init.lua @@ -11,3 +11,4 @@ dofile(modpath .. '/biomes.lua') dofile(modpath .. '/mapgen.lua') dofile(modpath .. '/nodes.lua') dofile(modpath .. '/trees.lua') +dofile(modpath .. '/registers.lua') diff --git a/mods/mff/mff_classic/registers.lua b/mods/mff/mff_classic/registers.lua new file mode 100644 index 00000000..1e14dfed --- /dev/null +++ b/mods/mff/mff_classic/registers.lua @@ -0,0 +1,28 @@ +local modname = minetest.get_current_modname() + +bucket.register_liquid( + modname .. ':acid_source', + modname .. ':acid_flowing', + modname .. ':bucket_acid', + 'bucket_acid.png', + "Acid Bucket", + {not_in_creative_inventory = 1} +) + +bucket.register_liquid( + modname .. ':sand_source', + modname .. ':sand_flowing', + modname .. ':bucket_sand', + 'bucket_sand.png', + "Sand Bucket", + {not_in_creative_inventory = 1} +) + +minetest.register_craft({ + output = modname .. ':bucket_sand', + recipe = { + {'group:sand'}, + {'group:sand'}, + {'bucket:bucket_water'} + }, +}) diff --git a/minetestforfun_game/mods/bucket/textures/bucket_acid.png b/mods/mff/mff_classic/textures/bucket_acid.png similarity index 100% rename from minetestforfun_game/mods/bucket/textures/bucket_acid.png rename to mods/mff/mff_classic/textures/bucket_acid.png diff --git a/minetestforfun_game/mods/bucket/textures/bucket_sand.png b/mods/mff/mff_classic/textures/bucket_sand.png similarity index 100% rename from minetestforfun_game/mods/bucket/textures/bucket_sand.png rename to mods/mff/mff_classic/textures/bucket_sand.png