diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua
index 8d43c54a..9e1c1edb 100644
--- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua
+++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua
@@ -304,6 +304,7 @@ mobs_mc.spawn_height = {
mobs_mc.misc = {
shears_wear = 276, -- Wear to add per shears usage (238 uses)
+ totem_fail_nodes = {} -- List of nodes in which the totem of undying fails
}
-- Item name overrides from mobs_mc_gameconfig (if present)
diff --git a/mods/ENTITIES/mobs_mc/1_items_default.lua b/mods/ENTITIES/mobs_mc/1_items_default.lua
index 07b3ba63..f7f7c2c0 100644
--- a/mods/ENTITIES/mobs_mc/1_items_default.lua
+++ b/mods/ENTITIES/mobs_mc/1_items_default.lua
@@ -519,22 +519,74 @@ end
-- Evoker
if c("totem") then
- -- TODO: Implement actual MC totem behaviour
+ local hud_totem = {}
+
+ -- Totem of Undying
minetest.register_craftitem("mobs_mc:totem", {
description = S("Totem of Undying"),
_doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."),
- _doc_items_usagehelp = S("Hold it in your hand and punch once to instantly get back to full health. The totem gets destroyed in the process."),
- wield_image = "mcl_mobitems_totem.png",
- inventory_image = "mcl_mobitems_totem.png",
+ _doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."),
+ inventory_image = "mcl_totems_totem.png",
+ wield_image = "mcl_totems_totem.png",
stack_max = 1,
- on_use = function(itemstack, user, pointed_thing)
- user:set_hp(20)
- if not minetest.settings:get_bool("creative_mode") then
- itemstack:take_item()
- end
- return itemstack
- end,
})
+
+ minetest.register_on_leaveplayer(function(player)
+ hud_totem[player:get_player_name()] = nil
+ end)
+
+ -- Save the player from death when holding totem of undying in hand
+ minetest.register_on_player_hpchange(function(player, hp_change)
+ local hp = player:get_hp()
+ -- Fatal damage?
+ if hp + hp_change <= 0 then
+ local wield = player:get_wielded_item()
+ if wield:get_name() == "mobs_mc:totem" then
+ local ppos = player:get_pos()
+ local pnname = minetest.get_node(ppos).name
+ -- Some exceptions when _not_ to save the player
+ for n=1, #mobs_mc.misc.totem_fail_nodes do
+ if pnname == mobs_mc.misc.totem_fail_nodes[n] then
+ return hp_change
+ end
+ end
+ -- Reset breath as well
+ if player:get_breath() < 11 then
+ player:set_breath(10)
+ end
+ if not minetest.settings:get_bool("creative_mode") then
+ wield:take_item()
+ player:set_wielded_item(wield)
+ end
+ -- Effects
+ minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16})
+
+ -- Big totem overlay
+ if not hud_totem[player:get_player_name()] then
+ hud_totem[player:get_player_name()] = player:hud_add({
+ hud_elem_type = "image",
+ text = "mcl_totems_totem.png",
+ position = { x=0.5, y=1 },
+ scale = { x=17, y=17 },
+ offset = { x=0, y=-178 },
+ })
+ minetest.after(3, function(player)
+ if player and player:is_player() then
+ local name = player:get_player_name()
+ if hud_totem[name] then
+ player:hud_remove(hud_totem[name])
+ hud_totem[name] = nil
+ end
+ end
+ end, player)
+ end
+
+ -- Set HP to exactly 1
+ return -hp + 1
+ end
+ end
+ return hp_change
+ end, true)
end
-- Rotten flesh
diff --git a/mods/ENTITIES/mobs_mc/LICENSE-media.md b/mods/ENTITIES/mobs_mc/LICENSE-media.md
index 1c98644d..17aecc18 100644
--- a/mods/ENTITIES/mobs_mc/LICENSE-media.md
+++ b/mods/ENTITIES/mobs_mc/LICENSE-media.md
@@ -120,3 +120,6 @@ Origin of those models:
* Source:
* `mobs_mc_zombie_hurt.ogg`
* Source:
+* [Spennnyyy](https://freesound.org/people/Spennnyyy/) (CC0)
+ * `mcl_totems_totem.ogg`
+ * Source:
diff --git a/mods/ENTITIES/mobs_mc/locale/de_DE.po b/mods/ENTITIES/mobs_mc/locale/de_DE.po
index 6d09c924..21ce7900 100644
--- a/mods/ENTITIES/mobs_mc/locale/de_DE.po
+++ b/mods/ENTITIES/mobs_mc/locale/de_DE.po
@@ -7,15 +7,15 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-07-05 16:40+0200\n"
-"PO-Revision-Date: 2017-07-20 15:05+0200\n"
+"POT-Creation-Date: 2018-01-25 18:45+0100\n"
+"PO-Revision-Date: 2018-01-25 18:48+0100\n"
"Last-Translator: Wuzzy \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 2.0.2\n"
+"X-Generator: Poedit 2.0.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: 1_items_default.lua
@@ -345,11 +345,13 @@ msgstr ""
#: 1_items_default.lua
msgid ""
-"Hold it in your hand and punch once to instantly get back to full health. "
-"The totem gets destroyed in the process."
+"The totem only works while you hold it in your hand. If you receive fatal "
+"damage, you are saved from death and you get a second chance with 1 HP. The "
+"totem is destroyed in the process, however."
msgstr ""
-"Halten Sie es in der Hand und schlagen Sie zu, um sofort auf die volle "
-"Gesundheit zu kommen. Das zerstört das Totem."
+"Der Totem funktioniert nur, während Sie ihn in der Hand halten. Wenn sie "
+"tödlichen Schaden erhalten, werden Sie vom Tod bewahrt und erhalten eine "
+"zweite Lebenschance mit 1 HP. Der Totem geht dabei jedoch zu Bruch."
#: 1_items_default.lua
msgid "Rotten Flesh"
@@ -500,6 +502,10 @@ msgstr ""
"Ein Witherskelettschädel ist ein kleiner dekorativer Block, der wie der "
"Schädel eines Witherskeletts aussieht."
+#: agent.lua
+msgid "Agent"
+msgstr "Agent"
+
#: bat.lua
msgid "Bat"
msgstr "Fledermaus"
@@ -716,6 +722,13 @@ msgstr "Zombie"
msgid "Zombie Pigman"
msgstr "Schweinezombie"
+#~ msgid ""
+#~ "Hold it in your hand and punch once to instantly get back to full health. "
+#~ "The totem gets destroyed in the process."
+#~ msgstr ""
+#~ "Halten Sie es in der Hand und schlagen Sie zu, um sofort auf die volle "
+#~ "Gesundheit zu kommen. Das zerstört das Totem."
+
#~ msgid "Enderman Head (WIP)"
#~ msgstr "Endermankopf (unfertig)"
diff --git a/mods/ENTITIES/mobs_mc/locale/template.pot b/mods/ENTITIES/mobs_mc/locale/template.pot
index 5758d0e6..f89dc24a 100644
--- a/mods/ENTITIES/mobs_mc/locale/template.pot
+++ b/mods/ENTITIES/mobs_mc/locale/template.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-07-20 14:43+0200\n"
+"POT-Creation-Date: 2018-01-25 18:45+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -298,8 +298,9 @@ msgstr ""
#: 1_items_default.lua
msgid ""
-"Hold it in your hand and punch once to instantly get back to full health. "
-"The totem gets destroyed in the process."
+"The totem only works while you hold it in your hand. If you receive fatal "
+"damage, you are saved from death and you get a second chance with 1 HP. The "
+"totem is destroyed in the process, however."
msgstr ""
#: 1_items_default.lua
@@ -425,6 +426,10 @@ msgid ""
"skull of a wither skeleton."
msgstr ""
+#: agent.lua
+msgid "Agent"
+msgstr ""
+
#: bat.lua
msgid "Bat"
msgstr ""
diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua
index 41d400e4..ef421557 100644
--- a/mods/ENTITIES/mobs_mc/parrot.lua
+++ b/mods/ENTITIES/mobs_mc/parrot.lua
@@ -87,9 +87,9 @@ mobs:register_mob("mobs_mc:parrot", {
})
---spawn
--- TODO: Increase spawn chance if polished
-mobs:spawn_specific("mobs_mc:parrot", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 30000, 1, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max)
+-- Spawn disabled because parrots are not very smart.
+-- TODO: Re-enable when parrots are finished
+--mobs:spawn_specific("mobs_mc:parrot", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 30000, 1, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max)
-- spawn eggs
mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)
diff --git a/mods/ENTITIES/mobs_mc/sounds/mcl_totems_totem.ogg b/mods/ENTITIES/mobs_mc/sounds/mcl_totems_totem.ogg
new file mode 100644
index 00000000..f7669b2a
Binary files /dev/null and b/mods/ENTITIES/mobs_mc/sounds/mcl_totems_totem.ogg differ
diff --git a/mods/ENTITIES/mobs_mc/textures/mcl_mobitems_totem.png b/mods/ENTITIES/mobs_mc/textures/mcl_totems_totem.png
similarity index 100%
rename from mods/ENTITIES/mobs_mc/textures/mcl_mobitems_totem.png
rename to mods/ENTITIES/mobs_mc/textures/mcl_totems_totem.png
diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua
index ec50b12f..9792fd79 100644
--- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua
+++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua
@@ -176,6 +176,9 @@ mobs_mc.override.enderman_takable = {
mobs_mc.override.enderman_replace_on_take = {
["mcl_core:dirt_with_dry_grass"] = "mcl_core:dirt_with_grass",
}
+mobs_mc.override.misc = {
+ totem_fail_nodes = { "mcl_core:void", "mcl_core:realm_barrier" },
+}
-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox
-- and the textures have tranparent pixels.
diff --git a/mods/MISC/mcl_wip/init.lua b/mods/MISC/mcl_wip/init.lua
index cd2c94f8..47cd272b 100644
--- a/mods/MISC/mcl_wip/init.lua
+++ b/mods/MISC/mcl_wip/init.lua
@@ -7,7 +7,6 @@ local wip_items = {
"mcl_observers:observer_off",
"mcl_observers:observer_on",
"mcl_chests:trapped_chest",
- "mobs_mc:totem",
"mcl_comparators:comparator_off_comp",
"mcl_minecarts:hopper_minecart",
"mcl_minecarts:command_block_minecart",
diff --git a/tools/Conversion_Table.csv b/tools/Conversion_Table.csv
index 74466aa4..b578da10 100644
--- a/tools/Conversion_Table.csv
+++ b/tools/Conversion_Table.csv
@@ -666,7 +666,7 @@ Source path,Source file,Target path,Target file,xs,ys,xl,yl,xt,yt,Blacklisted?
/assets/minecraft/textures/blocks,glass_pane_top_silver.png,/mods/ITEMS/xpanes/textures,xpanes_top_glass_silver.png,,,,,,,
/assets/minecraft/textures/blocks,glass_pane_top_white.png,/mods/ITEMS/xpanes/textures,xpanes_top_glass_white.png,,,,,,,
/assets/minecraft/textures/blocks,glass_pane_top_yellow.png,/mods/ITEMS/xpanes/textures,xpanes_top_glass_yellow.png,,,,,,,
-/assets/minecraft/textures/items,totem.png,/mods/ENTITIES/mobs_mc/textures,mcl_mobitems_totem.png,,,,,,,
+/assets/minecraft/textures/items,totem.png,/mods/ENTITIES/mobs_mc/textures,mcl_totems_totem.png,,,,,,,
/assets/minecraft/textures/entity,bat.png,/mods/ENTITIES/mobs_mc/textures,mobs_mc_bat.png,,,,,,,
/assets/minecraft/textures/entity,blaze.png,/mods/ENTITIES/mobs_mc/textures,mobs_mc_blaze.png,,,,,,,
/assets/minecraft/textures/entity/cat,black.png,/mods/ENTITIES/mobs_mc/textures,mobs_mc_cat_black.png,,,,,,,