Honor mobs_griefing setting to some extent

master
Wuzzy 2018-01-27 06:52:26 +01:00
parent 415fc02294
commit df81e9e938
4 changed files with 31 additions and 14 deletions

View File

@ -96,6 +96,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
visual = "sprite",
@ -131,13 +132,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
end
end
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
if mobs_griefing then
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
end
end
end
})

View File

@ -161,6 +161,8 @@ local select_enderman_animation = function(animation_type)
end
end
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_mob("mobs_mc:enderman", {
-- TODO: Make endermen attack when looked at
type = "animal",
@ -194,6 +196,9 @@ mobs:register_mob("mobs_mc:enderman", {
animation = select_enderman_animation("normal"),
_taken_node = "",
do_custom = function(self, dtime)
if not mobs_griefing then
return
end
-- Take and put nodes
if not self._take_place_timer or not self._next_take_place_time then
self._take_place_timer = 0

View File

@ -8,6 +8,8 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_mob("mobs_mc:snowman", {
type = "npc",
passive = true,
@ -51,6 +53,9 @@ mobs:register_mob("mobs_mc:snowman", {
},
blood_amount = 0,
do_custom = function(self, dtime)
if not mobs_griefing then
return
end
-- Leave a trail of top snow behind.
-- This is done in do_custom instead of just using replace_what because with replace_what,
-- the top snop may end up floating in the air.

View File

@ -73,6 +73,8 @@ mobs:register_mob("mobs_mc:wither", {
blood_amount = 0,
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
visual = "sprite",
visual_size = {x = 1, y = 1},
@ -106,13 +108,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
end
end
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
if mobs_griefing then
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
end
end
end
})