Message when try 2 spawn hostile mob if forbidden

This commit is contained in:
Wuzzy 2019-09-03 21:39:29 +02:00
parent 57b9a7d1cb
commit 5bb5829e86
3 changed files with 13 additions and 0 deletions

View File

@ -1537,6 +1537,11 @@ end
-- Spawn Egg -- Spawn Egg
function mobs:register_egg(mob, desc, background) function mobs:register_egg(mob, desc, background)
local invimg = background local invimg = background
local place
if minetest.registered_entities[mob].type == "monster" and peaceful_only then
desc = S("@1 (disabled)", desc)
invimg = invimg .. "^[multiply:#FF0000"
end
minetest.register_craftitem( minetest.register_craftitem(
mob, mob,
{ {
@ -1544,6 +1549,10 @@ function mobs:register_egg(mob, desc, background)
inventory_image = invimg, inventory_image = invimg,
groups = { spawn_egg = 1 }, groups = { spawn_egg = 1 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if peaceful_only then
minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FFFF00", S("Hostile mobs are disabled!")))
return itemstack
end
local pos = pointed_thing.above local pos = pointed_thing.above
if pointed_thing.above if pointed_thing.above
and not minetest.is_protected(pos, placer:get_player_name()) then and not minetest.is_protected(pos, placer:get_player_name()) then

View File

@ -60,3 +60,5 @@ Have a nice day!=Guten Tag!
I feel weak.=Ich fühle mich schwach. I feel weak.=Ich fühle mich schwach.
My head hurts.=Mein Kopf tut weh. My head hurts.=Mein Kopf tut weh.
I have a bad day today.=Ich hab heute einen schlechten Tag. I have a bad day today.=Ich hab heute einen schlechten Tag.
@1 (disabled)=@1 (deaktiviert)
Hostile mobs are disabled!=Feindliche Mobs sind deaktiviert!

View File

@ -62,3 +62,5 @@ I ... I am hurt.=
I feel weak.= I feel weak.=
My head hurts.= My head hurts.=
I have a bad day today.= I have a bad day today.=
@1 (disabled)=
Hostile mobs are disabled!=