This commit is contained in:
Elias Fleckenstein 2021-01-05 20:12:50 +01:00
parent c405242fa2
commit cd1b8e9d2f

View file

@ -274,10 +274,10 @@ mobs:register_mob("mobs_mc:enderman", {
end end
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE. -- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
if self.state == "attack" then if self.state == "attack" then
if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
self:teleport(nil) --self:teleport(nil)
self.state = "" --self.state = ""
else --else
if self.attack then if self.attack then
local target = self.attack local target = self.attack
local pos = target:get_pos() local pos = target:get_pos()
@ -287,7 +287,7 @@ mobs:register_mob("mobs_mc:enderman", {
end end
end end
end end
end --end
end end
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE. -- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
-- Check for arrows and people nearby. -- Check for arrows and people nearby.
@ -298,9 +298,9 @@ mobs:register_mob("mobs_mc:enderman", {
if obj then if obj then
if minetest.is_player(obj) then if minetest.is_player(obj) then
-- Warp from players during day. -- Warp from players during day.
if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
self:teleport(nil) -- self:teleport(nil)
end --end
else else
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
if lua then if lua then
@ -315,14 +315,14 @@ mobs:register_mob("mobs_mc:enderman", {
local enderpos = self.object:get_pos() local enderpos = self.object:get_pos()
if self.provoked == "broke_contact" then if self.provoked == "broke_contact" then
self.provoked = "false" self.provoked = "false"
if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
self:teleport(nil) -- self:teleport(nil)
self.state = "" -- self.state = ""
else --else
if self.attack ~= nil then if self.attack ~= nil then
self.state = 'attack' self.state = 'attack'
end end
end --end
end end
-- Check to see if people are near by enough to look at us. -- Check to see if people are near by enough to look at us.
local objs = minetest.get_objects_inside_radius(enderpos, 64) local objs = minetest.get_objects_inside_radius(enderpos, 64)
@ -528,13 +528,13 @@ mobs:register_mob("mobs_mc:enderman", {
do_punch = function(self, hitter, tflp, tool_caps, dir) do_punch = function(self, hitter, tflp, tool_caps, dir)
-- damage from rain caused by itself so we don't want it to attack itself. -- damage from rain caused by itself so we don't want it to attack itself.
if hitter ~= self.object and hitter ~= nil then if hitter ~= self.object and hitter ~= nil then
if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
self:teleport(nil) -- self:teleport(nil)
else --else
self:teleport(hitter) self:teleport(hitter)
self.attack=hitter self.attack=hitter
self.state="attack" self.state="attack"
end --end
end end
end, end,
armor = { fleshy = 100, water_vulnerable = 100 }, armor = { fleshy = 100, water_vulnerable = 100 },