1
0
Fork 0

make register functions use the . notation

csm-enabled
cora 2022-11-09 04:09:58 +01:00
parent d62dbcb852
commit 70834d0f5d
50 changed files with 233 additions and 243 deletions

View File

@ -29,18 +29,9 @@ end
mcl_mobs.invis = {} mcl_mobs.invis = {}
-- localize math functions -- localize math functions
local pi = math.pi
local sin = math.sin
local cos = math.cos
local abs = math.abs
local min = math.min
local max = math.max
local atann = math.atan local atann = math.atan
local random = math.random
local floor = math.floor
local ceil = math.ceil
local atan = function(x) local function atan(x)
if not x or x ~= x then if not x or x ~= x then
return 0 return 0
else else
@ -143,7 +134,7 @@ local function entity_physics(pos,radius)
dist = vector.distance(pos, obj_pos) dist = vector.distance(pos, obj_pos)
if dist < 1 then dist = 1 end if dist < 1 then dist = 1 end
local damage = floor((4 / dist) * radius) local damage = math.floor((4 / dist) * radius)
local ent = objs[n]:get_luaentity() local ent = objs[n]:get_luaentity()
-- punches work on entities AND players -- punches work on entities AND players
@ -343,15 +334,15 @@ local can_jump_cliff = function(self)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local v = self.object:get_velocity() local v = self.object:get_velocity()
local v2 = abs(v.x)+abs(v.z)*.833 local v2 = math.abs(v.x)+math.abs(v.z)*.833
local jump_c_multiplier = 1 local jump_c_multiplier = 1
if v2/self.walk_velocity/2>1 then if v2/self.walk_velocity/2>1 then
jump_c_multiplier = v2/self.walk_velocity/2 jump_c_multiplier = v2/self.walk_velocity/2
end end
-- where is front -- where is front
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6
--is there nothing under the block in front? if so jump the gap. --is there nothing under the block in front? if so jump the gap.
local nodLow = node_ok({ local nodLow = node_ok({
@ -405,8 +396,8 @@ local is_at_cliff_or_danger = function(self)
end end
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local ypos = pos.y + self.collisionbox[2] -- just above floor local ypos = pos.y + self.collisionbox[2] -- just above floor
@ -440,8 +431,8 @@ local is_at_water_danger = function(self)
return false return false
end end
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local ypos = pos.y + self.collisionbox[2] -- just above floor local ypos = pos.y + self.collisionbox[2] -- just above floor
@ -501,15 +492,15 @@ local do_jump = function(self)
end end
local v = self.object:get_velocity() local v = self.object:get_velocity()
local v2 = abs(v.x)+abs(v.z)*.833 local v2 = math.abs(v.x)+math.abs(v.z)*.833
local jump_c_multiplier = 1 local jump_c_multiplier = 1
if v2/self.walk_velocity/2>1 then if v2/self.walk_velocity/2>1 then
jump_c_multiplier = v2/self.walk_velocity/2 jump_c_multiplier = v2/self.walk_velocity/2
end end
-- where is front -- where is front
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6
-- what is in front of mob? -- what is in front of mob?
nod = node_ok({ nod = node_ok({
@ -752,7 +743,7 @@ local breed = function(self)
return return
end end
mcl_experience.throw_xp(pos, random(1, 7)) mcl_experience.throw_xp(pos, math.random(1, 7))
-- custom breed function -- custom breed function
if parent1.on_breed then if parent1.on_breed then
@ -768,7 +759,7 @@ local breed = function(self)
-- Use texture of one of the parents -- Use texture of one of the parents
local p = random(1, 2) local p = math.random(1, 2)
if p == 1 then if p == 1 then
ent_c.base_texture = parent1.base_texture ent_c.base_texture = parent1.base_texture
else else
@ -799,7 +790,7 @@ local replace = function(self, pos)
or not self.replace_what or not self.replace_what
or self.child == true or self.child == true
or self.object:get_velocity().y ~= 0 or self.object:get_velocity().y ~= 0
or random(1, self.replace_rate) > 1 then or math.random(1, self.replace_rate) > 1 then
return return
end end
@ -807,7 +798,7 @@ local replace = function(self, pos)
if type(self.replace_what[1]) == "table" then if type(self.replace_what[1]) == "table" then
local num = random(#self.replace_what) local num = math.random(#self.replace_what)
what = self.replace_what[num][1] or "" what = self.replace_what[num][1] or ""
with = self.replace_what[num][2] or "" with = self.replace_what[num][2] or ""
@ -869,7 +860,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
local target_pos = self.attack:get_pos() local target_pos = self.attack:get_pos()
-- is it becoming stuck? -- is it becoming stuck?
if abs(s1.x - s.x) + abs(s1.z - s.z) < .5 then if math.abs(s1.x - s.x) + math.abs(s1.z - s.z) < .5 then
self.path.stuck_timer = self.path.stuck_timer + dtime self.path.stuck_timer = self.path.stuck_timer + dtime
else else
self.path.stuck_timer = 0 self.path.stuck_timer = 0
@ -930,7 +921,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
end, self) end, self)
end end
if abs(vector.subtract(s,target_pos).y) > self.stepheight then if math.abs(vector.subtract(s,target_pos).y) > self.stepheight then
if height_switcher then if height_switcher then
use_pathfind = true use_pathfind = true
@ -950,8 +941,8 @@ local smart_mobs = function(self, s, p, dist, dtime)
-- round position to center of node to avoid stuck in walls -- round position to center of node to avoid stuck in walls
-- also adjust height for player models! -- also adjust height for player models!
s.x = floor(s.x + 0.5) s.x = math.floor(s.x + 0.5)
s.z = floor(s.z + 0.5) s.z = math.floor(s.z + 0.5)
local ssight, sground = minetest.line_of_sight(s, { local ssight, sground = minetest.line_of_sight(s, {
x = s.x, y = s.y - 4, z = s.z}, 1) x = s.x, y = s.y - 4, z = s.z}, 1)
@ -963,15 +954,15 @@ local smart_mobs = function(self, s, p, dist, dtime)
local p1 = self.attack:get_pos() local p1 = self.attack:get_pos()
p1.x = floor(p1.x + 0.5) p1.x = math.floor(p1.x + 0.5)
p1.y = floor(p1.y + 0.5) p1.y = math.floor(p1.y + 0.5)
p1.z = floor(p1.z + 0.5) p1.z = math.floor(p1.z + 0.5)
local dropheight = 12 local dropheight = 12
if self.fear_height ~= 0 then dropheight = self.fear_height end if self.fear_height ~= 0 then dropheight = self.fear_height end
local jumpheight = 0 local jumpheight = 0
if self.jump and self.jump_height >= 4 then if self.jump and self.jump_height >= 4 then
jumpheight = min(ceil(self.jump_height / 4), 4) jumpheight = math.min(math.ceil(self.jump_height / 4), 4)
elseif self.stepheight > 0.5 then elseif self.stepheight > 0.5 then
jumpheight = 1 jumpheight = 1
end end
@ -1002,7 +993,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
end end
end end
local sheight = ceil(self.collisionbox[5]) + 1 local sheight = math.ceil(self.collisionbox[5]) + 1
-- assume mob is 2 blocks high so it digs above its head -- assume mob is 2 blocks high so it digs above its head
s.y = s.y + sheight s.y = s.y + sheight
@ -1031,11 +1022,11 @@ local smart_mobs = function(self, s, p, dist, dtime)
else -- dig 2 blocks to make door toward player direction else -- dig 2 blocks to make door toward player direction
local yaw1 = self.object:get_yaw() + pi / 2 local yaw1 = self.object:get_yaw() + math.pi / 2
local p1 = { local p1 = {
x = s.x + cos(yaw1), x = s.x + math.cos(yaw1),
y = s.y, y = s.y,
z = s.z + sin(yaw1) z = s.z + math.sin(yaw1)
} }
if not minetest.is_protected(p1, "") then if not minetest.is_protected(p1, "") then
@ -1334,7 +1325,7 @@ local runaway_from = function(self)
z = lp.z - s.z z = lp.z - s.z
} }
local yaw = (atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate local yaw = (atan(vec.z / vec.x) + 3 *math.pi/ 2) - self.rotate
if lp.x > s.x then if lp.x > s.x then
yaw = yaw + pi yaw = yaw + pi
@ -1426,9 +1417,9 @@ local follow_flop = function(self)
z = p.z - s.z z = p.z - s.z
} }
local yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate local yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
if p.x > s.x then yaw = yaw + pi end if p.x > s.x then yaw = yaw +math.pi end
self:set_yaw( yaw, 2.35) self:set_yaw( yaw, 2.35)
@ -1466,9 +1457,9 @@ local follow_flop = function(self)
if self.object:get_velocity().y < 0.1 then if self.object:get_velocity().y < 0.1 then
self:mob_sound("flop") self:mob_sound("flop")
self.object:set_velocity({ self.object:set_velocity({
x = random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), x = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED),
y = FLOP_HEIGHT, y = FLOP_HEIGHT,
z = random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), z = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED),
}) })
end end
end end
@ -1524,11 +1515,11 @@ local function go_to_pos(entity,b)
return true return true
end end
local v = { x = b.x - s.x, z = b.z - s.z } local v = { x = b.x - s.x, z = b.z - s.z }
local yaw = (atann(v.z / v.x) + pi / 2) - entity.rotate local yaw = (atann(v.z / v.x) +math.pi/ 2) - entity.rotate
if b.x > s.x then yaw = yaw + pi end if b.x > s.x then yaw = yaw +math.pi end
entity.object:set_yaw(yaw) entity.object:set_yaw(yaw)
entity:set_velocity(entity.follow_velocity) entity:set_velocity(entity.follow_velocity)
mcl_mobs:set_animation(entity, "walk") entity:set_animation("walk")
end end
local function interact_with_door(self, action, target) local function interact_with_door(self, action, target)
@ -1699,7 +1690,7 @@ local do_states = function(self, dtime)
local yaw = self.object:get_yaw() or 0 local yaw = self.object:get_yaw() or 0
if self.state == "stand" then if self.state == "stand" then
if random(1, 4) == 1 then if math.random(1, 4) == 1 then
local s = self.object:get_pos() local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, 3) local objs = minetest.get_objects_inside_radius(s, 3)
@ -1719,11 +1710,11 @@ local do_states = function(self, dtime)
z = lp.z - s.z z = lp.z - s.z
} }
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
if lp.x > s.x then yaw = yaw + pi end if lp.x > s.x then yaw = yaw +math.pi end
else else
yaw = yaw + random(-0.5, 0.5) yaw = yaw + math.random(-0.5, 0.5)
end end
yaw = self:set_yaw( yaw, 8) yaw = self:set_yaw( yaw, 8)
@ -1742,7 +1733,7 @@ local do_states = function(self, dtime)
else else
if self.walk_chance ~= 0 if self.walk_chance ~= 0
and self.facing_fence ~= true and self.facing_fence ~= true
and random(1, 100) <= self.walk_chance and math.random(1, 100) <= self.walk_chance
and is_at_cliff_or_danger(self) == false then and is_at_cliff_or_danger(self) == false then
self:set_velocity(self.walk_velocity) self:set_velocity(self.walk_velocity)
@ -1794,7 +1785,7 @@ local do_states = function(self, dtime)
{x = s.x + 5, y = s.y + 1, z = s.z + 5}, {x = s.x + 5, y = s.y + 1, z = s.z + 5},
{"group:solid"}) {"group:solid"})
lp = #lp > 0 and lp[random(#lp)] lp = #lp > 0 and lp[math.random(#lp)]
-- did we find land? -- did we find land?
if lp then if lp then
@ -1804,10 +1795,10 @@ local do_states = function(self, dtime)
z = lp.z - s.z z = lp.z - s.z
} }
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
if lp.x > s.x then yaw = yaw + pi end if lp.x > s.x then yaw = yaw +math.pi end
-- look towards land and move in that direction -- look towards land and move in that direction
yaw = self:set_yaw( yaw, 6) yaw = self:set_yaw( yaw, 6)
@ -1820,8 +1811,8 @@ local do_states = function(self, dtime)
else else
-- Randomly turn -- Randomly turn
if random(1, 100) <= 30 then if math.random(1, 100) <= 30 then
yaw = yaw + random(-0.5, 0.5) yaw = yaw + math.random(-0.5, 0.5)
yaw = self:set_yaw( yaw, 8) yaw = self:set_yaw( yaw, 8)
end end
end end
@ -1829,9 +1820,8 @@ local do_states = function(self, dtime)
yaw = self:set_yaw( yaw, 8) yaw = self:set_yaw( yaw, 8)
-- otherwise randomly turn -- otherwise randomly turn
elseif random(1, 100) <= 30 then elseif math.random(1, 100) <= 30 then
yaw = yaw + math.random(-0.5, 0.5)
yaw = yaw + random(-0.5, 0.5)
yaw = self:set_yaw( yaw, 8) yaw = self:set_yaw( yaw, 8)
end end
@ -1842,7 +1832,7 @@ local do_states = function(self, dtime)
end end
if self.facing_fence == true if self.facing_fence == true
or cliff_or_danger or cliff_or_danger
or random(1, 100) <= 30 then or math.random(1, 100) <= 30 then
self:set_velocity(0) self:set_velocity(0)
self.state = "stand" self.state = "stand"
@ -1917,9 +1907,9 @@ local do_states = function(self, dtime)
z = p.z - s.z z = p.z - s.z
} }
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
if p.x > s.x then yaw = yaw + pi end if p.x > s.x then yaw = yaw +math.pi end
yaw = self:set_yaw( yaw, 0, dtime) yaw = self:set_yaw( yaw, 0, dtime)
@ -2011,9 +2001,9 @@ local do_states = function(self, dtime)
and dist > self.reach then and dist > self.reach then
local p1 = s local p1 = s
local me_y = floor(p1.y) local me_y = math.floor(p1.y)
local p2 = p local p2 = p
local p_y = floor(p2.y + 1) local p_y = math.floor(p2.y + 1)
local v = self.object:get_velocity() local v = self.object:get_velocity()
if self:flight_check( s) then if self:flight_check( s) then
@ -2074,7 +2064,7 @@ local do_states = function(self, dtime)
return return
end end
if abs(p1.x-s.x) + abs(p1.z - s.z) < 0.6 then if math.abs(p1.x-s.x) + math.abs(p1.z - s.z) < 0.6 then
-- reached waypoint, remove it from queue -- reached waypoint, remove it from queue
table.remove(self.path.way, 1) table.remove(self.path.way, 1)
end end
@ -2088,9 +2078,9 @@ local do_states = function(self, dtime)
z = p.z - s.z z = p.z - s.z
} }
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate yaw = (atan(vec.z / vec.x) + math.pi / 2) - self.rotate
if p.x > s.x then yaw = yaw + pi end if p.x > s.x then yaw = yaw + math.pi end
yaw = self:set_yaw( yaw, 0, dtime) yaw = self:set_yaw( yaw, 0, dtime)
@ -2140,7 +2130,7 @@ local do_states = function(self, dtime)
self.timer = 0 self.timer = 0
if self.double_melee_attack if self.double_melee_attack
and random(1, 2) == 1 then and math.random(1, 2) == 1 then
self:set_animation( "punch2") self:set_animation( "punch2")
else else
self:set_animation( "punch") self:set_animation( "punch")
@ -2193,9 +2183,9 @@ local do_states = function(self, dtime)
z = p.z - s.z z = p.z - s.z
} }
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
if p.x > s.x then yaw = yaw + pi end if p.x > s.x then yaw = yaw +math.pi end
yaw = self:set_yaw( yaw, 0, dtime) yaw = self:set_yaw( yaw, 0, dtime)
@ -2227,7 +2217,7 @@ local do_states = function(self, dtime)
if self.shoot_interval if self.shoot_interval
and self.timer > self.shoot_interval and self.timer > self.shoot_interval
and not minetest.raycast(vector.add(p, vector.new(0,self.shoot_offset,0)), vector.add(self.attack:get_pos(), vector.new(0,1.5,0)), false, false):next() and not minetest.raycast(vector.add(p, vector.new(0,self.shoot_offset,0)), vector.add(self.attack:get_pos(), vector.new(0,1.5,0)), false, false):next()
and random(1, 100) <= 60 then and math.random(1, 100) <= 60 then
self.timer = 0 self.timer = 0
self:set_animation( "shoot") self:set_animation( "shoot")
@ -2708,7 +2698,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
-- healing -- healing
if damage <= -1 then if damage <= -1 then
self.health = self.health - floor(damage) self.health = self.health - math.floor(damage)
return return
end end
@ -2728,7 +2718,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
local weapon = hitter:get_wielded_item(player) local weapon = hitter:get_wielded_item(player)
local def = weapon:get_definition() local def = weapon:get_definition()
if def.tool_capabilities and def.tool_capabilities.punch_attack_uses then if def.tool_capabilities and def.tool_capabilities.punch_attack_uses then
local wear = floor(65535/tool_capabilities.punch_attack_uses) local wear = math.floor(65535/tool_capabilities.punch_attack_uses)
weapon:add_wear(wear) weapon:add_wear(wear)
hitter:set_wielded_item(weapon) hitter:set_wielded_item(weapon)
end end
@ -2745,7 +2735,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
-- weapon sounds -- weapon sounds
if weapon:get_definition().sounds ~= nil then if weapon:get_definition().sounds ~= nil then
local s = random(0, #weapon:get_definition().sounds) local s = math.random(0, #weapon:get_definition().sounds)
minetest.sound_play(weapon:get_definition().sounds[s], { minetest.sound_play(weapon:get_definition().sounds[s], {
object = self.object, --hitter, object = self.object, --hitter,
@ -2776,8 +2766,8 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
local v = self.object:get_velocity() local v = self.object:get_velocity()
if not v then return end if not v then return end
local r = 1.4 - min(punch_interval, 1.4) local r = 1.4 - math.min(punch_interval, 1.4)
local kb = r * (abs(v.x)+abs(v.z)) local kb = r * (math.abs(v.x)+math.abs(v.z))
local up = 2 local up = 2
if die==true then if die==true then
@ -2785,7 +2775,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
end end
-- if already in air then dont go up anymore when hit -- if already in air then dont go up anymore when hit
if abs(v.y) > 0.1 if math.abs(v.y) > 0.1
or self.fly then or self.fly then
up = 0 up = 0
end end
@ -2988,7 +2978,7 @@ local mob_activate = function(self, staticdata, def, dtime)
local c = 1 local c = 1
if #def.textures > c then c = #def.textures end if #def.textures > c then c = #def.textures end
self.base_texture = def.textures[random(c)] self.base_texture = def.textures[math.random(c)]
self.base_mesh = def.mesh self.base_mesh = def.mesh
self.base_size = self.visual_size self.base_size = self.visual_size
self.base_colbox = self.collisionbox self.base_colbox = self.collisionbox
@ -3050,7 +3040,7 @@ local mob_activate = function(self, staticdata, def, dtime)
end end
if self.health == 0 then if self.health == 0 then
self.health = random (self.hp_min, self.hp_max) self.health = math.random (self.hp_min, self.hp_max)
end end
if self.breath == nil then if self.breath == nil then
self.breath = self.breath_max self.breath = self.breath_max
@ -3114,7 +3104,7 @@ local mob_activate = function(self, staticdata, def, dtime)
-- set anything changed above -- set anything changed above
self.object:set_properties(self) self.object:set_properties(self)
self:set_yaw( (random(0, 360) - 180) / 180 * pi, 6) self:set_yaw( (math.random(0, 360) - 180) / 180 * math.pi, 6)
self:update_tag() self:update_tag()
self._current_animation = nil self._current_animation = nil
self:set_animation( "stand") self:set_animation( "stand")
@ -3176,7 +3166,7 @@ local mob_step = function(self, dtime)
self.object:remove() self.object:remove()
return return
elseif self.lifetimer <= 10 then elseif self.lifetimer <= 10 then
if random(10) < 4 then if math.random(10) < 4 then
self.despawn_immediately = true self.despawn_immediately = true
else else
self.lifetimer = 20 self.lifetimer = 20
@ -3190,7 +3180,7 @@ local mob_step = function(self, dtime)
if (self.state and self.state=="die" or self:check_for_death()) and not self.animation.die_end then if (self.state and self.state=="die" or self:check_for_death()) and not self.animation.die_end then
d = 0.92 d = 0.92
local rot = self.object:get_rotation() local rot = self.object:get_rotation()
rot.z = ((pi/2-rot.z)*.2)+rot.z rot.z = ((math.pi/2-rot.z)*.2)+rot.z
self.object:set_rotation(rot) self.object:set_rotation(rot)
end end
@ -3250,11 +3240,11 @@ local mob_step = function(self, dtime)
local v = self.object:get_velocity() local v = self.object:get_velocity()
if v then if v then
if self.frame_speed_multiplier then if self.frame_speed_multiplier then
local v2 = abs(v.x)+abs(v.z)*.833 local v2 = math.abs(v.x)+math.abs(v.z)*.833
if not self.animation.walk_speed then if not self.animation.walk_speed then
self.animation.walk_speed = 25 self.animation.walk_speed = 25
end end
if abs(v.x)+abs(v.z) > 0.5 then if math.abs(v.x)+math.abs(v.z) > 0.5 then
self.object:set_animation_frame_speed((v2/math.max(1,self.run_velocity))*self.animation.walk_speed*self.frame_speed_multiplier) self.object:set_animation_frame_speed((v2/math.max(1,self.run_velocity))*self.animation.walk_speed*self.frame_speed_multiplier)
else else
self.object:set_animation_frame_speed(25) self.object:set_animation_frame_speed(25)
@ -3280,12 +3270,12 @@ local mob_step = function(self, dtime)
if self.delay == 1 then if self.delay == 1 then
yaw = self.target_yaw yaw = self.target_yaw
else else
local dif = abs(yaw - self.target_yaw) local dif = math.abs(yaw - self.target_yaw)
if yaw > self.target_yaw then if yaw > self.target_yaw then
if dif > pi then if dif > math.pi then
dif = 2 * pi - dif -- need to add dif = 2 * math.pi - dif -- need to add
yaw = yaw + dif / self.delay yaw = yaw + dif / self.delay
else else
yaw = yaw - dif / self.delay -- need to subtract yaw = yaw - dif / self.delay -- need to subtract
@ -3293,21 +3283,21 @@ local mob_step = function(self, dtime)
elseif yaw < self.target_yaw then elseif yaw < self.target_yaw then
if dif > pi then if dif >math.pi then
dif = 2 * pi - dif dif = 2 * math.pi - dif
yaw = yaw - dif / self.delay -- need to subtract yaw = yaw - dif / self.delay -- need to subtract
else else
yaw = yaw + dif / self.delay -- need to add yaw = yaw + dif / self.delay -- need to add
end end
end end
if yaw > (pi * 2) then yaw = yaw - (pi * 2) end if yaw > (math.pi * 2) then yaw = yaw - (math.pi * 2) end
if yaw < 0 then yaw = yaw + (pi * 2) end if yaw < 0 then yaw = yaw + (math.pi * 2) end
end end
self.delay = self.delay - 1 self.delay = self.delay - 1
if self.shaking then if self.shaking then
yaw = yaw + (random() * 2 - 1) * 5 * dtime yaw = yaw + (math.random() * 2 - 1) * 5 * dtime
end end
self.object:set_yaw(yaw) self.object:set_yaw(yaw)
self:update_roll() self:update_roll()
@ -3420,7 +3410,7 @@ local mob_step = function(self, dtime)
end end
-- mob plays random sound at times -- mob plays random sound at times
if random(1, 70) == 1 then if math.random(1, 70) == 1 then
self:mob_sound("random", true) self:mob_sound("random", true)
end end
@ -3462,11 +3452,11 @@ local mob_step = function(self, dtime)
runaway_from(self) runaway_from(self)
if is_at_water_danger(self) and self.state ~= "attack" then if is_at_water_danger(self) and self.state ~= "attack" then
if random(1, 10) <= 6 then if math.random(1, 10) <= 6 then
self:set_velocity(0) self:set_velocity(0)
self.state = "stand" self.state = "stand"
self:set_animation( "stand") self:set_animation( "stand")
yaw = yaw + random(-0.5, 0.5) yaw = yaw + math.random(-0.5, 0.5)
yaw = self:set_yaw( yaw, 8) yaw = self:set_yaw( yaw, 8)
end end
else else
@ -3574,7 +3564,7 @@ local create_mob_on_rightclick = function(on_rightclick)
end end
-- register mob entity -- register mob entity
function mcl_mobs:register_mob(name, def) function mcl_mobs.register_mob(name, def)
mcl_mobs.spawning_mobs[name] = true mcl_mobs.spawning_mobs[name] = true
@ -3591,7 +3581,7 @@ local function scale_difficulty(value, default, min, special)
if (not value) or (value == default) or (value == special) then if (not value) or (value == default) or (value == special) then
return default return default
else else
return max(min, value * difficulty) return math.max(min, value * difficulty)
end end
end end
@ -3798,11 +3788,11 @@ if minetest.get_modpath("doc_identifier") ~= nil then
doc.sub.identifier.register_object(name, "basics", "mobs") doc.sub.identifier.register_object(name, "basics", "mobs")
end end
end -- END mcl_mobs:register_mob function end -- END mcl_mobs.register_mob function
-- register arrow for shoot attack -- register arrow for shoot attack
function mcl_mobs:register_arrow(name, def) function mcl_mobs.register_arrow(name, def)
if not name or not def then return end -- errorcheck if not name or not def then return end -- errorcheck
@ -3829,7 +3819,7 @@ function mcl_mobs:register_arrow(name, def)
end, end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
automatic_face_movement_dir = def.rotate automatic_face_movement_dir = def.rotate
and (def.rotate - (pi / 180)) or false, and (def.rotate - (math.pi / 180)) or false,
on_activate = def.on_activate, on_activate = def.on_activate,
@ -3961,7 +3951,7 @@ end
-- Note: This also introduces the “spawn_egg” group: -- Note: This also introduces the “spawn_egg” group:
-- * spawn_egg=1: Spawn egg (generic mob, no metadata) -- * spawn_egg=1: Spawn egg (generic mob, no metadata)
-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata) -- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata)
function mcl_mobs:register_egg(mob, desc, background_color, overlay_color, addegg, no_creative) function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addegg, no_creative)
local grp = {spawn_egg = 1} local grp = {spawn_egg = 1}
@ -4109,7 +4099,7 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
if self.health < self.hp_max and not consume_food then if self.health < self.hp_max and not consume_food then
consume_food = true consume_food = true
self.health = min(self.health + 4, self.hp_max) self.health = math.min(self.health + 4, self.hp_max)
if self.htimer < 1 then if self.htimer < 1 then
self.htimer = 5 self.htimer = 5
@ -4216,7 +4206,7 @@ minetest.register_globalstep(function(dtime)
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
if lua and lua.is_mob then if lua and lua.is_mob then
lua.lifetimer = max(20, lua.lifetimer) lua.lifetimer = math.max(20, lua.lifetimer)
lua.despawn_immediately = false lua.despawn_immediately = false
end end
end end

View File

@ -87,7 +87,7 @@ local axolotl = {
runaway = true, runaway = true,
} }
mcl_mobs:register_mob("mobs_mc:axolotl", axolotl) mcl_mobs.register_mob("mobs_mc:axolotl", axolotl)
local water = 0 local water = 0
@ -178,4 +178,4 @@ water-16,
water+1) water+1)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:axolotl", S("Axolotl"), "#e890bf", "#b83D7e", 0) mcl_mobs.register_egg("mobs_mc:axolotl", S("Axolotl"), "#e890bf", "#b83D7e", 0)

View File

@ -2,7 +2,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:bat", { mcl_mobs.register_mob("mobs_mc:bat", {
description = S("Bat"), description = S("Bat"),
type = "animal", type = "animal",
spawn_class = "ambient", spawn_class = "ambient",
@ -144,4 +144,4 @@ mobs_mc.water_level-1)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:bat", S("Bat"), "#4c3e30", "#0f0f0f", 0) mcl_mobs.register_egg("mobs_mc:bat", S("Bat"), "#4c3e30", "#0f0f0f", 0)

View File

@ -12,7 +12,7 @@ local mod_target = minetest.get_modpath("mcl_target")
--################### --###################
mcl_mobs:register_mob("mobs_mc:blaze", { mcl_mobs.register_mob("mobs_mc:blaze", {
description = S("Blaze"), description = S("Blaze"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -153,7 +153,7 @@ mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
-- Blaze fireball -- Blaze fireball
mcl_mobs:register_arrow("mobs_mc:blaze_fireball", { mcl_mobs.register_arrow("mobs_mc:blaze_fireball", {
visual = "sprite", visual = "sprite",
visual_size = {x = 0.3, y = 0.3}, visual_size = {x = 0.3, y = 0.3},
textures = {"mcl_fire_fire_charge.png"}, textures = {"mcl_fire_fire_charge.png"},
@ -208,4 +208,4 @@ mcl_mobs:register_arrow("mobs_mc:blaze_fireball", {
}) })
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:blaze", S("Blaze"), "#f6b201", "#fff87e", 0) mcl_mobs.register_egg("mobs_mc:blaze", S("Blaze"), "#f6b201", "#fff87e", 0)

View File

@ -8,7 +8,7 @@ local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:chicken", { mcl_mobs.register_mob("mobs_mc:chicken", {
description = S("Chicken"), description = S("Chicken"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -163,4 +163,4 @@ mobs_mc.water_level,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:chicken", S("Chicken"), "#a1a1a1", "#ff0000", 0) mcl_mobs.register_egg("mobs_mc:chicken", S("Chicken"), "#a1a1a1", "#ff0000", 0)

View File

@ -111,7 +111,7 @@ local cod = {
end end
} }
mcl_mobs:register_mob("mobs_mc:cod", cod) mcl_mobs.register_mob("mobs_mc:cod", cod)
--spawning TODO: in schools --spawning TODO: in schools
@ -272,4 +272,4 @@ water-16,
water+1) water+1)
--spawn egg --spawn egg
mcl_mobs:register_egg("mobs_mc:cod", S("Cod"), "#c1a76a", "#e5c48b", 0) mcl_mobs.register_egg("mobs_mc:cod", S("Cod"), "#c1a76a", "#e5c48b", 0)

View File

@ -88,7 +88,7 @@ local cow_def = {
fear_height = 4, fear_height = 4,
} }
mcl_mobs:register_mob("mobs_mc:cow", cow_def) mcl_mobs.register_mob("mobs_mc:cow", cow_def)
-- Mooshroom -- Mooshroom
local mooshroom_def = table.copy(cow_def) local mooshroom_def = table.copy(cow_def)
@ -163,7 +163,7 @@ mooshroom_def.on_lightning_strike = function(self, pos, pos2, objects)
self.object:set_properties({ textures = self.base_texture }) self.object:set_properties({ textures = self.base_texture })
return true return true
end end
mcl_mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) mcl_mobs.register_mob("mobs_mc:mooshroom", mooshroom_def)
-- Spawning -- Spawning
@ -231,5 +231,5 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn egg -- spawn egg
mcl_mobs:register_egg("mobs_mc:cow", S("Cow"), "#443626", "#a1a1a1", 0) mcl_mobs.register_egg("mobs_mc:cow", S("Cow"), "#443626", "#a1a1a1", 0)
mcl_mobs:register_egg("mobs_mc:mooshroom", S("Mooshroom"), "#a00f10", "#b7b7b7", 0) mcl_mobs.register_egg("mobs_mc:mooshroom", S("Mooshroom"), "#a00f10", "#b7b7b7", 0)

View File

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:creeper", { mcl_mobs.register_mob("mobs_mc:creeper", {
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
spawn_in_group = 1, spawn_in_group = 1,
@ -133,7 +133,7 @@ mcl_mobs:register_mob("mobs_mc:creeper", {
view_range = 16, view_range = 16,
}) })
mcl_mobs:register_mob("mobs_mc:creeper_charged", { mcl_mobs.register_mob("mobs_mc:creeper_charged", {
description = S("Creeper"), description = S("Creeper"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -411,4 +411,4 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:creeper", S("Creeper"), "#0da70a", "#000000", 0) mcl_mobs.register_egg("mobs_mc:creeper", S("Creeper"), "#0da70a", "#000000", 0)

View File

@ -92,7 +92,7 @@ local dolphin = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:dolphin", dolphin) mcl_mobs.register_mob("mobs_mc:dolphin", dolphin)
--spawning TO DO: in schools --spawning TO DO: in schools
@ -250,4 +250,4 @@ water-16,
water+1) water+1)
--spawn egg --spawn egg
mcl_mobs:register_egg("mobs_mc:dolphin", S("Dolphin"), "#223b4d", "#f9f9f9", 0) mcl_mobs.register_egg("mobs_mc:dolphin", S("Dolphin"), "#223b4d", "#f9f9f9", 0)

View File

@ -48,7 +48,7 @@ local function check_pos(self)
end end
end end
mcl_mobs:register_mob("mobs_mc:enderdragon", { mcl_mobs.register_mob("mobs_mc:enderdragon", {
description = S("Ender Dragon"), description = S("Ender Dragon"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -142,7 +142,7 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
-- dragon fireball (projectile) -- dragon fireball (projectile)
mcl_mobs:register_arrow("mobs_mc:dragon_fireball", { mcl_mobs.register_arrow("mobs_mc:dragon_fireball", {
visual = "sprite", visual = "sprite",
visual_size = {x = 1.25, y = 1.25}, visual_size = {x = 1.25, y = 1.25},
textures = {"mobs_mc_dragon_fireball.png"}, textures = {"mobs_mc_dragon_fireball.png"},
@ -170,7 +170,7 @@ mcl_mobs:register_arrow("mobs_mc:dragon_fireball", {
end end
}) })
mcl_mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "#252525", "#b313c9", 0, true) mcl_mobs.register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "#252525", "#b313c9", 0, true)
mcl_wip.register_wip_item("mobs_mc:enderdragon") mcl_wip.register_wip_item("mobs_mc:enderdragon")

View File

@ -255,7 +255,7 @@ local psdefs = {{
texture = "mcl_portals_particle"..math.random(1, 5)..".png", texture = "mcl_portals_particle"..math.random(1, 5)..".png",
}} }}
mcl_mobs:register_mob("mobs_mc:enderman", { mcl_mobs.register_mob("mobs_mc:enderman", {
description = S("Enderman"), description = S("Enderman"),
type = "monster", type = "monster",
spawn_class = "passive", spawn_class = "passive",
@ -832,4 +832,4 @@ mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:enderman", S("Enderman"), "#252525", "#151515", 0) mcl_mobs.register_egg("mobs_mc:enderman", S("Enderman"), "#252525", "#151515", 0)

View File

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:endermite", { mcl_mobs.register_mob("mobs_mc:endermite", {
description = S("Endermite"), description = S("Endermite"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -38,4 +38,4 @@ mcl_mobs:register_mob("mobs_mc:endermite", {
reach = 1, reach = 1,
}) })
mcl_mobs:register_egg("mobs_mc:endermite", S("Endermite"), "#161616", "#6d6d6d", 0) mcl_mobs.register_egg("mobs_mc:endermite", S("Endermite"), "#161616", "#6d6d6d", 0)

View File

@ -10,7 +10,7 @@ local S = minetest.get_translator("mobs_mc")
--################### --###################
mcl_mobs:register_mob("mobs_mc:ghast", { mcl_mobs.register_mob("mobs_mc:ghast", {
description = S("Ghast"), description = S("Ghast"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -103,7 +103,7 @@ mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
-- fireball (projectile) -- fireball (projectile)
mcl_mobs:register_arrow("mobs_mc:fireball", { mcl_mobs.register_arrow("mobs_mc:fireball", {
visual = "sprite", visual = "sprite",
visual_size = {x = 1, y = 1}, visual_size = {x = 1, y = 1},
textures = {"mcl_fire_fire_charge.png"}, textures = {"mcl_fire_fire_charge.png"},
@ -141,4 +141,4 @@ mcl_mobs:register_arrow("mobs_mc:fireball", {
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:ghast", S("Ghast"), "#f9f9f9", "#bcbcbc", 0) mcl_mobs.register_egg("mobs_mc:ghast", S("Ghast"), "#f9f9f9", "#bcbcbc", 0)

View File

@ -29,7 +29,7 @@ for i=1,4 do
table.insert(psdefs,p) table.insert(psdefs,p)
end end
mcl_mobs:register_mob("mobs_mc:glow_squid", { mcl_mobs.register_mob("mobs_mc:glow_squid", {
type = "animal", type = "animal",
spawn_class = "water", spawn_class = "water",
can_despawn = true, can_despawn = true,
@ -243,4 +243,4 @@ mcl_mobs:spawn_specific(
water) water)
-- spawn egg -- spawn egg
mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#095757", "#87f6c0", 0) mcl_mobs.register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#095757", "#87f6c0", 0)

View File

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:guardian", { mcl_mobs.register_mob("mobs_mc:guardian", {
description = S("Guardian"), description = S("Guardian"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -104,4 +104,4 @@ mcl_mobs:register_mob("mobs_mc:guardian", {
--mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10) --mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:guardian", S("Guardian"), "#5a8272", "#f17d31", 0) mcl_mobs.register_egg("mobs_mc:guardian", S("Guardian"), "#5a8272", "#f17d31", 0)

View File

@ -6,7 +6,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:guardian_elder", { mcl_mobs.register_mob("mobs_mc:guardian_elder", {
description = S("Elder Guardian"), description = S("Elder Guardian"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -112,6 +112,6 @@ mcl_mobs:register_mob("mobs_mc:guardian_elder", {
-- mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18) -- mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "#ceccba", "#747693", 0) mcl_mobs.register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "#ceccba", "#747693", 0)

View File

@ -84,7 +84,7 @@ local hoglin = {
attack_animals = true, attack_animals = true,
} }
mcl_mobs:register_mob("mobs_mc:hoglin", hoglin) mcl_mobs.register_mob("mobs_mc:hoglin", hoglin)
local zoglin = table.copy(hoglin) local zoglin = table.copy(hoglin)
zoglin.fire_resistant = 1 zoglin.fire_resistant = 1
@ -95,7 +95,7 @@ end
zoglin.attacks_monsters = true zoglin.attacks_monsters = true
zoglin.lava_damage = 0 zoglin.lava_damage = 0
zoglin.fire_damage = 0 zoglin.fire_damage = 0
mcl_mobs:register_mob("mobs_mc:zoglin", zoglin) mcl_mobs.register_mob("mobs_mc:zoglin", zoglin)
-- Baby hoglin. -- Baby hoglin.
@ -112,7 +112,7 @@ baby_hoglin.walk_velocity = 1.2
baby_hoglin.run_velocity = 2.4 baby_hoglin.run_velocity = 2.4
baby_hoglin.child = 1 baby_hoglin.child = 1
mcl_mobs:register_mob("mobs_mc:baby_hoglin", baby_hoglin) mcl_mobs.register_mob("mobs_mc:baby_hoglin", baby_hoglin)
-- Regular spawning in the Nether -- Regular spawning in the Nether
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
@ -132,4 +132,4 @@ mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:hoglin", S("Hoglin"), "#85682e", "#2b2140", 0) mcl_mobs.register_egg("mobs_mc:hoglin", S("Hoglin"), "#85682e", "#2b2140", 0)

View File

@ -490,7 +490,7 @@ local horse = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:horse", horse) mcl_mobs.register_mob("mobs_mc:horse", horse)
-- Skeleton horse -- Skeleton horse
local skeleton_horse = table.copy(horse) local skeleton_horse = table.copy(horse)
@ -513,7 +513,7 @@ skeleton_horse.sounds = {
distance = 16, distance = 16,
} }
skeleton_horse.harmed_by_heal = true skeleton_horse.harmed_by_heal = true
mcl_mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse) mcl_mobs.register_mob("mobs_mc:skeleton_horse", skeleton_horse)
-- Zombie horse -- Zombie horse
local zombie_horse = table.copy(horse) local zombie_horse = table.copy(horse)
@ -537,7 +537,7 @@ zombie_horse.sounds = {
distance = 16, distance = 16,
} }
zombie_horse.harmed_by_heal = true zombie_horse.harmed_by_heal = true
mcl_mobs:register_mob("mobs_mc:zombie_horse", zombie_horse) mcl_mobs.register_mob("mobs_mc:zombie_horse", zombie_horse)
-- Donkey -- Donkey
local d = 0.86 -- donkey scale local d = 0.86 -- donkey scale
@ -571,7 +571,7 @@ donkey.jump = true
donkey.jump_height = 3.75 -- can clear 1 block height donkey.jump_height = 3.75 -- can clear 1 block height
mcl_mobs:register_mob("mobs_mc:donkey", donkey) mcl_mobs.register_mob("mobs_mc:donkey", donkey)
mcl_entity_invs.register_inv("mobs_mc:donkey","Donkey",15,true) mcl_entity_invs.register_inv("mobs_mc:donkey","Donkey",15,true)
-- Mule -- Mule
local m = 0.94 local m = 0.94
@ -589,7 +589,7 @@ mule.collisionbox = {
horse.collisionbox[5] * m, horse.collisionbox[5] * m,
horse.collisionbox[6] * m, horse.collisionbox[6] * m,
} }
mcl_mobs:register_mob("mobs_mc:mule", mule) mcl_mobs.register_mob("mobs_mc:mule", mule)
mcl_entity_invs.register_inv("mobs_mc:mule","Mule",15,true) mcl_entity_invs.register_inv("mobs_mc:mule","Mule",15,true)
--=========================== --===========================
@ -641,8 +641,8 @@ mobs_mc.water_level+3,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:horse", S("Horse"), "#c09e7d", "#eee500", 0) mcl_mobs.register_egg("mobs_mc:horse", S("Horse"), "#c09e7d", "#eee500", 0)
mcl_mobs:register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "#68684f", "#e5e5d8", 0) mcl_mobs.register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "#68684f", "#e5e5d8", 0)
--mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "#2a5a37", "#84d080", 0) --mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "#2a5a37", "#84d080", 0)
mcl_mobs:register_egg("mobs_mc:donkey", S("Donkey"), "#534539", "#867566", 0) mcl_mobs.register_egg("mobs_mc:donkey", S("Donkey"), "#534539", "#867566", 0)
mcl_mobs:register_egg("mobs_mc:mule", S("Mule"), "#1b0200", "#51331d", 0) mcl_mobs.register_egg("mobs_mc:mule", S("Mule"), "#1b0200", "#51331d", 0)

View File

@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
local etime = 0 local etime = 0
mcl_mobs:register_mob("mobs_mc:iron_golem", { mcl_mobs.register_mob("mobs_mc:iron_golem", {
description = S("Iron Golem"), description = S("Iron Golem"),
type = "npc", type = "npc",
spawn_class = "passive", spawn_class = "passive",
@ -97,7 +97,7 @@ mcl_mobs:register_mob("mobs_mc:iron_golem", {
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:iron_golem", S("Iron Golem"), "#3b3b3b", "#f57223", 0) mcl_mobs.register_egg("mobs_mc:iron_golem", S("Iron Golem"), "#3b3b3b", "#f57223", 0)
--[[ This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function of the node. --[[ This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function of the node.
This summons an iron golen if placing the pumpkin created an iron golem summon pattern: This summons an iron golen if placing the pumpkin created an iron golem summon pattern:

View File

@ -47,7 +47,7 @@ local function get_drops(self)
end end
end end
mcl_mobs:register_mob("mobs_mc:llama", { mcl_mobs.register_mob("mobs_mc:llama", {
description = S("Llama"), description = S("Llama"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -254,7 +254,7 @@ mcl_mobs:register_mob("mobs_mc:llama", {
mcl_entity_invs.register_inv("mobs_mc:llama","Llama",nil,true) mcl_entity_invs.register_inv("mobs_mc:llama","Llama",nil,true)
-- spit arrow (weapon) -- spit arrow (weapon)
mcl_mobs:register_arrow("mobs_mc:llamaspit", { mcl_mobs.register_arrow("mobs_mc:llamaspit", {
visual = "sprite", visual = "sprite",
visual_size = {x = 0.10, y = 0.10}, visual_size = {x = 0.10, y = 0.10},
textures = {"mobs_mc_llama_spit.png"}, textures = {"mobs_mc_llama_spit.png"},
@ -297,4 +297,4 @@ mobs_mc.water_level+15,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:llama", S("Llama"), "#c09e7d", "#995f40", 0) mcl_mobs.register_egg("mobs_mc:llama", S("Llama"), "#c09e7d", "#995f40", 0)

View File

@ -107,7 +107,7 @@ local ocelot = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:ocelot", ocelot) mcl_mobs.register_mob("mobs_mc:ocelot", ocelot)
-- Cat -- Cat
local cat = table.copy(ocelot) local cat = table.copy(ocelot)
@ -167,7 +167,7 @@ cat.on_spawn = function(self)
self.object:set_properties({textures = {self._texture}}) self.object:set_properties({textures = {self._texture}})
end end
mcl_mobs:register_mob("mobs_mc:cat", cat) mcl_mobs.register_mob("mobs_mc:cat", cat)
local base_spawn_chance = 5000 local base_spawn_chance = 5000
@ -249,4 +249,4 @@ mobs:spawn({
]]-- ]]--
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:ocelot", S("Ocelot"), "#efde7d", "#564434", 0) mcl_mobs.register_egg("mobs_mc:ocelot", S("Ocelot"), "#efde7d", "#564434", 0)

View File

@ -125,7 +125,7 @@ local function check_perch(self,dtime)
end end
end end
mcl_mobs:register_mob("mobs_mc:parrot", { mcl_mobs.register_mob("mobs_mc:parrot", {
description = S("Parrot"), description = S("Parrot"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -241,4 +241,4 @@ mobs_mc.water_level+7,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:parrot", S("Parrot"), "#0da70a", "#ff0000", 0) mcl_mobs.register_egg("mobs_mc:parrot", S("Parrot"), "#0da70a", "#ff0000", 0)

View File

@ -2,7 +2,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:pig", { mcl_mobs.register_mob("mobs_mc:pig", {
description = S("Pig"), description = S("Pig"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -242,4 +242,4 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:pig", S("Pig"), "#f0a5a2", "#db635f", 0) mcl_mobs.register_egg("mobs_mc:pig", S("Pig"), "#f0a5a2", "#db635f", 0)

View File

@ -174,7 +174,7 @@ local piglin = {
specific_attack = { "player", "mobs_mc:hoglin" }, specific_attack = { "player", "mobs_mc:hoglin" },
} }
mcl_mobs:register_mob("mobs_mc:piglin", piglin) mcl_mobs.register_mob("mobs_mc:piglin", piglin)
local sword_piglin = table.copy(piglin) local sword_piglin = table.copy(piglin)
@ -206,7 +206,7 @@ sword_piglin.animation = {
punch_start = 189, punch_start = 189,
punch_end = 198, punch_end = 198,
} }
mcl_mobs:register_mob("mobs_mc:sword_piglin", sword_piglin) mcl_mobs.register_mob("mobs_mc:sword_piglin", sword_piglin)
local zombified_piglin = table.copy(piglin) local zombified_piglin = table.copy(piglin)
zombified_piglin.fire_resistant = 1 zombified_piglin.fire_resistant = 1
@ -239,7 +239,7 @@ zombified_piglin.animation = {
punch_start = 189, punch_start = 189,
punch_end = 198, punch_end = 198,
} }
mcl_mobs:register_mob("mobs_mc:zombified_piglin", zombified_piglin) mcl_mobs.register_mob("mobs_mc:zombified_piglin", zombified_piglin)
local piglin_brute = table.copy(piglin) local piglin_brute = table.copy(piglin)
@ -280,7 +280,7 @@ piglin_brute.animation = {
} }
piglin_brute.can_despawn = false piglin_brute.can_despawn = false
piglin_brute.group_attack = { "mobs_mc:piglin", "mobs_mc:piglin_brute" } piglin_brute.group_attack = { "mobs_mc:piglin", "mobs_mc:piglin_brute" }
mcl_mobs:register_mob("mobs_mc:piglin_brute", piglin_brute) mcl_mobs.register_mob("mobs_mc:piglin_brute", piglin_brute)
-- Regular spawning in the Nether -- Regular spawning in the Nether
@ -316,5 +316,5 @@ minetest.LIGHT_MAX+1,
mcl_vars.mg_lava_nether_max, mcl_vars.mg_lava_nether_max,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:piglin", S("Piglin"), "#7b4a17","#d5c381", 0) mcl_mobs.register_egg("mobs_mc:piglin", S("Piglin"), "#7b4a17","#d5c381", 0)
mcl_mobs:register_egg("mobs_mc:piglin_brute", S("Piglin Brute"), "#562b0c","#ddc89d", 0) mcl_mobs.register_egg("mobs_mc:piglin_brute", S("Piglin Brute"), "#562b0c","#ddc89d", 0)

View File

@ -120,5 +120,5 @@ pillager = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:pillager", pillager) mcl_mobs.register_mob("mobs_mc:pillager", pillager)
mcl_mobs:register_egg("mobs_mc:pillager", S("Pillager"), "#532f36", "#959b9b", 0) mcl_mobs.register_egg("mobs_mc:pillager", S("Pillager"), "#532f36", "#959b9b", 0)

View File

@ -7,7 +7,7 @@ local S = minetest.get_translator("mobs_mc")
--################### --###################
mcl_mobs:register_mob("mobs_mc:polar_bear", { mcl_mobs.register_mob("mobs_mc:polar_bear", {
description = S("Polar Bear"), description = S("Polar Bear"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -92,4 +92,4 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn egg -- spawn egg
mcl_mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "#f2f2f2", "#959590", 0) mcl_mobs.register_egg("mobs_mc:polar_bear", S("Polar Bear"), "#f2f2f2", "#959590", 0)

View File

@ -102,7 +102,7 @@ local rabbit = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:rabbit", rabbit) mcl_mobs.register_mob("mobs_mc:rabbit", rabbit)
-- The killer bunny (Only with spawn egg) -- The killer bunny (Only with spawn egg)
local killer_bunny = table.copy(rabbit) local killer_bunny = table.copy(rabbit)
@ -128,7 +128,7 @@ killer_bunny.do_custom = function(self)
end end
end end
mcl_mobs:register_mob("mobs_mc:killer_bunny", killer_bunny) mcl_mobs.register_mob("mobs_mc:killer_bunny", killer_bunny)
-- Mob spawning rules. -- Mob spawning rules.
-- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out -- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out
@ -213,7 +213,7 @@ mcl_mobs:spawn(spawn_grass)
]]-- ]]--
-- Spawn egg -- Spawn egg
mcl_mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "#995f40", "#734831", 0) mcl_mobs.register_egg("mobs_mc:rabbit", S("Rabbit"), "#995f40", "#734831", 0)
-- Note: This spawn egg does not exist in Minecraft -- Note: This spawn egg does not exist in Minecraft
mcl_mobs:register_egg("mobs_mc:killer_bunny", S("Killer Bunny"), "#f2f2f2", "#ff0000", 0) mcl_mobs.register_egg("mobs_mc:killer_bunny", S("Killer Bunny"), "#f2f2f2", "#ff0000", 0)

View File

@ -67,7 +67,7 @@ local salmon = {
end end
} }
mcl_mobs:register_mob("mobs_mc:salmon", salmon) mcl_mobs.register_mob("mobs_mc:salmon", salmon)
--spawning TODO: in schools --spawning TODO: in schools
@ -226,4 +226,4 @@ water-16,
water+1) water+1)
--spawn egg --spawn egg
mcl_mobs:register_egg("mobs_mc:salmon", S("Salmon"), "#a00f10", "#0e8474", 0) mcl_mobs.register_egg("mobs_mc:salmon", S("Salmon"), "#a00f10", "#0e8474", 0)

View File

@ -52,7 +52,7 @@ end
local gotten_texture = { "blank.png", "mobs_mc_sheep.png" } local gotten_texture = { "blank.png", "mobs_mc_sheep.png" }
--mcsheep --mcsheep
mcl_mobs:register_mob("mobs_mc:sheep", { mcl_mobs.register_mob("mobs_mc:sheep", {
description = S("Sheep"), description = S("Sheep"),
type = "animal", type = "animal",
spawn_class = "passive", spawn_class = "passive",
@ -365,4 +365,4 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:sheep", S("Sheep"), "#e7e7e7", "#ffb5b5", 0) mcl_mobs.register_egg("mobs_mc:sheep", S("Sheep"), "#e7e7e7", "#ffb5b5", 0)

View File

@ -30,7 +30,7 @@ local function check_spot(pos)
end end
local pr = PseudoRandom(os.time()*(-334)) local pr = PseudoRandom(os.time()*(-334))
-- animation 45-80 is transition between passive and attack stance -- animation 45-80 is transition between passive and attack stance
mcl_mobs:register_mob("mobs_mc:shulker", { mcl_mobs.register_mob("mobs_mc:shulker", {
description = S("Shulker"), description = S("Shulker"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -152,7 +152,7 @@ mcl_mobs:register_mob("mobs_mc:shulker", {
}) })
-- bullet arrow (weapon) -- bullet arrow (weapon)
mcl_mobs:register_arrow("mobs_mc:shulkerbullet", { mcl_mobs.register_arrow("mobs_mc:shulkerbullet", {
visual = "sprite", visual = "sprite",
visual_size = {x = 0.25, y = 0.25}, visual_size = {x = 0.25, y = 0.25},
textures = {"mobs_mc_shulkerbullet.png"}, textures = {"mobs_mc_shulkerbullet.png"},
@ -177,7 +177,7 @@ mcl_mobs:register_arrow("mobs_mc:shulkerbullet", {
}) })
mcl_mobs:register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0) mcl_mobs.register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0)
--[[ --[[
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(

View File

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:silverfish", { mcl_mobs.register_mob("mobs_mc:silverfish", {
description = S("Silverfish"), description = S("Silverfish"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -56,7 +56,7 @@ mcl_mobs:register_mob("mobs_mc:silverfish", {
reach = 1, reach = 1,
}) })
mcl_mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "#6d6d6d", "#313131", 0) mcl_mobs.register_egg("mobs_mc:silverfish", S("Silverfish"), "#6d6d6d", "#313131", 0)
-- Monster egg blocks (Minetest Game) -- Monster egg blocks (Minetest Game)
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then

View File

@ -129,7 +129,7 @@ local skeleton = {
harmed_by_heal = true, harmed_by_heal = true,
} }
mcl_mobs:register_mob("mobs_mc:skeleton", skeleton) mcl_mobs.register_mob("mobs_mc:skeleton", skeleton)
--################### --###################
@ -166,7 +166,7 @@ table.insert(stray.drops, {
end, end,
}) })
mcl_mobs:register_mob("mobs_mc:stray", stray) mcl_mobs.register_mob("mobs_mc:stray", stray)
-- Overworld spawn -- Overworld spawn
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
@ -356,6 +356,6 @@ mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:skeleton", S("Skeleton"), "#c1c1c1", "#494949", 0) mcl_mobs.register_egg("mobs_mc:skeleton", S("Skeleton"), "#c1c1c1", "#494949", 0)
mcl_mobs:register_egg("mobs_mc:stray", S("Stray"), "#5f7476", "#dae8e7", 0) mcl_mobs.register_egg("mobs_mc:stray", S("Stray"), "#5f7476", "#dae8e7", 0)

View File

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### WITHER SKELETON --################### WITHER SKELETON
--################### --###################
mcl_mobs:register_mob("mobs_mc:witherskeleton", { mcl_mobs.register_mob("mobs_mc:witherskeleton", {
description = S("Wither Skeleton"), description = S("Wither Skeleton"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -117,4 +117,4 @@ mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
--]] --]]
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "#141414", "#474d4d", 0) mcl_mobs.register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "#141414", "#474d4d", 0)

View File

@ -109,7 +109,7 @@ local slime_big = {
on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5), on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5),
use_texture_alpha = true, use_texture_alpha = true,
} }
mcl_mobs:register_mob("mobs_mc:slime_big", slime_big) mcl_mobs.register_mob("mobs_mc:slime_big", slime_big)
local slime_small = table.copy(slime_big) local slime_small = table.copy(slime_big)
slime_small.sounds.base_pitch = 1.15 slime_small.sounds.base_pitch = 1.15
@ -126,7 +126,7 @@ slime_small.run_velocity = 1.3
slime_small.jump_height = 4.3 slime_small.jump_height = 4.3
slime_small.spawn_small_alternative = "mobs_mc:slime_tiny" slime_small.spawn_small_alternative = "mobs_mc:slime_tiny"
slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0) slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0)
mcl_mobs:register_mob("mobs_mc:slime_small", slime_small) mcl_mobs.register_mob("mobs_mc:slime_small", slime_small)
local slime_tiny = table.copy(slime_big) local slime_tiny = table.copy(slime_big)
slime_tiny.sounds.base_pitch = 1.3 slime_tiny.sounds.base_pitch = 1.3
@ -151,7 +151,7 @@ slime_tiny.jump_height = 3
slime_tiny.spawn_small_alternative = nil slime_tiny.spawn_small_alternative = nil
slime_tiny.on_die = nil slime_tiny.on_die = nil
mcl_mobs:register_mob("mobs_mc:slime_tiny", slime_tiny) mcl_mobs.register_mob("mobs_mc:slime_tiny", slime_tiny)
local smin = mcl_vars.mg_overworld_min local smin = mcl_vars.mg_overworld_min
local smax = mobs_mc.water_level - 23 local smax = mobs_mc.water_level - 23
@ -348,7 +348,7 @@ local magma_cube_big = {
on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 3, 0.8, 1.5), on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 3, 0.8, 1.5),
fire_resistant = true, fire_resistant = true,
} }
mcl_mobs:register_mob("mobs_mc:magma_cube_big", magma_cube_big) mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big)
local magma_cube_small = table.copy(magma_cube_big) local magma_cube_small = table.copy(magma_cube_big)
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
@ -369,7 +369,7 @@ magma_cube_small.reach = 2.75
magma_cube_small.armor = 66 magma_cube_small.armor = 66
magma_cube_small.spawn_small_alternative = "mobs_mc:magma_cube_tiny" magma_cube_small.spawn_small_alternative = "mobs_mc:magma_cube_tiny"
magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 4, 0.6, 1.0) magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 4, 0.6, 1.0)
mcl_mobs:register_mob("mobs_mc:magma_cube_small", magma_cube_small) mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small)
local magma_cube_tiny = table.copy(magma_cube_big) local magma_cube_tiny = table.copy(magma_cube_big)
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
@ -391,7 +391,7 @@ magma_cube_tiny.drops = {}
magma_cube_tiny.spawn_small_alternative = nil magma_cube_tiny.spawn_small_alternative = nil
magma_cube_tiny.on_die = nil magma_cube_tiny.on_die = nil
mcl_mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny) mcl_mobs.register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny)
local mmin = mcl_vars.mg_nether_min local mmin = mcl_vars.mg_nether_min
@ -447,6 +447,6 @@ mmin,
mmax) mmax)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "#350000", "#fcfc00") mcl_mobs.register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "#350000", "#fcfc00")
mcl_mobs:register_egg("mobs_mc:slime_big", S("Slime"), "#52a03e", "#7ebf6d") mcl_mobs.register_egg("mobs_mc:slime_big", S("Slime"), "#52a03e", "#7ebf6d")

View File

@ -20,7 +20,7 @@ local gotten_texture = {
"blank.png", "blank.png",
} }
mcl_mobs:register_mob("mobs_mc:snowman", { mcl_mobs.register_mob("mobs_mc:snowman", {
description = S("Snow Golem"), description = S("Snow Golem"),
type = "npc", type = "npc",
spawn_class = "passive", spawn_class = "passive",
@ -196,4 +196,4 @@ function mobs_mc.check_snow_golem_summon(pos)
end end
-- Spawn egg -- Spawn egg
mcl_mobs:register_egg("mobs_mc:snowman", S("Snow Golem"), "#f2f2f2", "#fd8f47", 0) mcl_mobs.register_egg("mobs_mc:snowman", S("Snow Golem"), "#f2f2f2", "#fd8f47", 0)

View File

@ -111,7 +111,7 @@ local spider = {
run_end = 20, run_end = 20,
}, },
} }
mcl_mobs:register_mob("mobs_mc:spider", spider) mcl_mobs.register_mob("mobs_mc:spider", spider)
-- Cave spider -- Cave spider
local cave_spider = table.copy(spider) local cave_spider = table.copy(spider)
@ -141,7 +141,7 @@ cave_spider.walk_velocity = 1.3
cave_spider.run_velocity = 3.2 cave_spider.run_velocity = 3.2
cave_spider.sounds = table.copy(spider.sounds) cave_spider.sounds = table.copy(spider.sounds)
cave_spider.sounds.base_pitch = 1.25 cave_spider.sounds.base_pitch = 1.25
mcl_mobs:register_mob("mobs_mc:cave_spider", cave_spider) mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
@ -293,5 +293,5 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:spider", S("Spider"), "#342d26", "#a80e0e", 0) mcl_mobs.register_egg("mobs_mc:spider", S("Spider"), "#342d26", "#a80e0e", 0)
mcl_mobs:register_egg("mobs_mc:cave_spider", S("Cave Spider"), "#0c424e", "#a80e0e", 0) mcl_mobs.register_egg("mobs_mc:cave_spider", S("Cave Spider"), "#0c424e", "#a80e0e", 0)

View File

@ -6,7 +6,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:squid", { mcl_mobs.register_mob("mobs_mc:squid", {
description = S("Squid"), description = S("Squid"),
type = "animal", type = "animal",
spawn_class = "water", spawn_class = "water",
@ -217,4 +217,4 @@ water-16,
water+1) water+1)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:squid", S("Squid"), "#223b4d", "#708999", 0) mcl_mobs.register_egg("mobs_mc:squid", S("Squid"), "#223b4d", "#708999", 0)

View File

@ -192,7 +192,7 @@ local strider = {
end, end,
} }
mcl_mobs:register_mob("mobs_mc:strider", strider) mcl_mobs.register_mob("mobs_mc:strider", strider)
-- Baby strider. -- Baby strider.
@ -208,7 +208,7 @@ baby_strider.walk_velocity = 1.2
baby_strider.run_velocity = 2.4 baby_strider.run_velocity = 2.4
baby_strider.child = 1 baby_strider.child = 1
mcl_mobs:register_mob("mobs_mc:baby_strider", baby_strider) mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider)
-- Regular spawning in the Nether -- Regular spawning in the Nether
@ -245,4 +245,4 @@ mcl_mobs:spawn_setup({
}) })
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:strider", S("Strider"), "#000000", "#FF0000", 0) mcl_mobs.register_egg("mobs_mc:strider", S("Strider"), "#000000", "#FF0000", 0)

View File

@ -118,7 +118,7 @@ local tropical_fish = {
on_spawn = set_textures, on_spawn = set_textures,
} }
mcl_mobs:register_mob("mobs_mc:tropical_fish", tropical_fish) mcl_mobs.register_mob("mobs_mc:tropical_fish", tropical_fish)
local water = 0 local water = 0
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
@ -189,4 +189,4 @@ water-16,
water+1) water+1)
--spawn egg --spawn egg
mcl_mobs:register_egg("mobs_mc:tropical_fish", S("Tropical fish"), "#ef6915", "#fff9ef", 0) mcl_mobs.register_egg("mobs_mc:tropical_fish", S("Tropical fish"), "#ef6915", "#fff9ef", 0)

View File

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### VEX --################### VEX
--################### --###################
mcl_mobs:register_mob("mobs_mc:vex", { mcl_mobs.register_mob("mobs_mc:vex", {
description = S("Vex"), description = S("Vex"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -94,4 +94,4 @@ mcl_mobs:register_mob("mobs_mc:vex", {
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:vex", S("Vex"), "#7a90a4", "#e8edf1", 0) mcl_mobs.register_egg("mobs_mc:vex", S("Vex"), "#7a90a4", "#e8edf1", 0)

View File

@ -1898,7 +1898,7 @@ end)
local pick_up = { "mcl_farming:bread", "mcl_farming:carrot_item", "mcl_farming:beetroot_item" , "mcl_farming:potato_item" } local pick_up = { "mcl_farming:bread", "mcl_farming:carrot_item", "mcl_farming:beetroot_item" , "mcl_farming:potato_item" }
mcl_mobs:register_mob("mobs_mc:villager", { mcl_mobs.register_mob("mobs_mc:villager", {
description = S("Villager"), description = S("Villager"),
type = "npc", type = "npc",
spawn_class = "passive", spawn_class = "passive",
@ -2157,4 +2157,4 @@ mobs_mc.water_level+1,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
--]] --]]
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:villager", S("Villager"), "#563d33", "#bc8b72", 0) mcl_mobs.register_egg("mobs_mc:villager", S("Villager"), "#563d33", "#bc8b72", 0)

View File

@ -13,7 +13,7 @@ local pr = PseudoRandom(os.time()*666)
local spawned_vexes = {} --this is stored locally so the mobs engine doesn't try to store it in staticdata local spawned_vexes = {} --this is stored locally so the mobs engine doesn't try to store it in staticdata
mcl_mobs:register_mob("mobs_mc:evoker", { mcl_mobs.register_mob("mobs_mc:evoker", {
description = S("Evoker"), description = S("Evoker"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -89,4 +89,4 @@ mcl_mobs:register_mob("mobs_mc:evoker", {
}) })
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:evoker", S("Evoker"), "#959b9b", "#1e1c1a", 0) mcl_mobs.register_egg("mobs_mc:evoker", S("Evoker"), "#959b9b", "#1e1c1a", 0)

View File

@ -6,7 +6,7 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
mcl_mobs:register_mob("mobs_mc:illusioner", { mcl_mobs.register_mob("mobs_mc:illusioner", {
description = S("Illusioner"), description = S("Illusioner"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -65,4 +65,4 @@ mcl_mobs:register_mob("mobs_mc:illusioner", {
fear_height = 4, fear_height = 4,
}) })
mcl_mobs:register_egg("mobs_mc:illusioner", S("Illusioner"), "#3f5cbb", "#8a8686", 0) mcl_mobs.register_egg("mobs_mc:illusioner", S("Illusioner"), "#3f5cbb", "#8a8686", 0)

View File

@ -10,7 +10,7 @@ local S = minetest.get_translator("mobs_mc")
--################### --###################
mcl_mobs:register_mob("mobs_mc:vindicator", { mcl_mobs.register_mob("mobs_mc:vindicator", {
description = S("Vindicator"), description = S("Vindicator"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -77,4 +77,4 @@ mcl_mobs:register_mob("mobs_mc:vindicator", {
}) })
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:vindicator", S("Vindicator"), "#959b9b", "#275e61", 0) mcl_mobs.register_egg("mobs_mc:vindicator", S("Vindicator"), "#959b9b", "#275e61", 0)

View File

@ -25,7 +25,7 @@ local professions = {
nitwit = "mobs_mc_villager.png", nitwit = "mobs_mc_villager.png",
} }
mcl_mobs:register_mob("mobs_mc:villager_zombie", { mcl_mobs.register_mob("mobs_mc:villager_zombie", {
description = S("Zombie Villager"), description = S("Zombie Villager"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -231,4 +231,4 @@ mcl_vars.mg_overworld_max)
--mcl_mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_max) --mcl_mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "#563d33", "#799c66", 0) mcl_mobs.register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "#563d33", "#799c66", 0)

View File

@ -12,7 +12,7 @@ local S = minetest.get_translator("mobs_mc")
mcl_mobs:register_mob("mobs_mc:witch", { mcl_mobs.register_mob("mobs_mc:witch", {
description = S("Witch"), description = S("Witch"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -73,7 +73,7 @@ mcl_mobs:register_mob("mobs_mc:witch", {
}) })
-- potion projectile (EXPERIMENTAL) -- potion projectile (EXPERIMENTAL)
mcl_mobs:register_arrow("mobs_mc:potion_arrow", { mcl_mobs.register_arrow("mobs_mc:potion_arrow", {
visual = "sprite", visual = "sprite",
visual_size = {x = 0.5, y = 0.5}, visual_size = {x = 0.5, y = 0.5},
--textures = {"vessels_glass_bottle.png"}, --TODO fix to else if default --textures = {"vessels_glass_bottle.png"}, --TODO fix to else if default
@ -105,6 +105,6 @@ mcl_mobs:register_arrow("mobs_mc:potion_arrow", {
--mcl_mobs:spawn_specific("mobs_mc:witch", { "mcl_core:jungletree", "mcl_core:jungleleaves", "mcl_flowers:fern", "mcl_core:vine" }, {"air"}, 0, minetest.LIGHT_MAX-6, 12, 20000, 2, mobs_mc.water_level-6, mcl_vars.mg_overworld_max) --mcl_mobs:spawn_specific("mobs_mc:witch", { "mcl_core:jungletree", "mcl_core:jungleleaves", "mcl_flowers:fern", "mcl_core:vine" }, {"air"}, 0, minetest.LIGHT_MAX-6, 12, 20000, 2, mobs_mc.water_level-6, mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:witch", S("Witch"), "#340000", "#51a03e", 0, true) mcl_mobs.register_egg("mobs_mc:witch", S("Witch"), "#340000", "#51a03e", 0, true)
mcl_wip.register_wip_item("mobs_mc:witch") mcl_wip.register_wip_item("mobs_mc:witch")

View File

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### WITHER --################### WITHER
--################### --###################
mcl_mobs:register_mob("mobs_mc:wither", { mcl_mobs.register_mob("mobs_mc:wither", {
description = S("Wither"), description = S("Wither"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
@ -85,7 +85,7 @@ mcl_mobs:register_mob("mobs_mc:wither", {
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" } local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
mcl_mobs:register_arrow("mobs_mc:wither_skull", { mcl_mobs.register_arrow("mobs_mc:wither_skull", {
visual = "sprite", visual = "sprite",
visual_size = {x = 0.75, y = 0.75}, visual_size = {x = 0.75, y = 0.75},
-- TODO: 3D projectile, replace tetxture -- TODO: 3D projectile, replace tetxture
@ -129,6 +129,6 @@ mcl_mobs:register_arrow("mobs_mc:wither_skull", {
-- TODO: Add blue wither skull -- TODO: Add blue wither skull
--Spawn egg --Spawn egg
mcl_mobs:register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true) mcl_mobs.register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true)
mcl_wip.register_wip_item("mobs_mc:wither") mcl_wip.register_wip_item("mobs_mc:wither")

View File

@ -100,7 +100,7 @@ local wolf = {
specific_attack = { "player", "mobs_mc:sheep" }, specific_attack = { "player", "mobs_mc:sheep" },
} }
mcl_mobs:register_mob("mobs_mc:wolf", wolf) mcl_mobs.register_mob("mobs_mc:wolf", wolf)
-- Tamed wolf -- Tamed wolf
@ -232,7 +232,7 @@ dog.on_rightclick = function(self, clicker)
end end
end end
mcl_mobs:register_mob("mobs_mc:dog", dog) mcl_mobs.register_mob("mobs_mc:dog", dog)
-- Spawn -- Spawn
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
"mobs_mc:wolf", "mobs_mc:wolf",
@ -258,4 +258,4 @@ minetest.LIGHT_MAX+1,
mobs_mc.water_level+3, mobs_mc.water_level+3,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
mcl_mobs:register_egg("mobs_mc:wolf", S("Wolf"), "#d7d3d3", "#ceaf96", 0) mcl_mobs.register_egg("mobs_mc:wolf", S("Wolf"), "#d7d3d3", "#ceaf96", 0)

View File

@ -102,7 +102,7 @@ local zombie = {
attack_npcs = true, attack_npcs = true,
} }
mcl_mobs:register_mob("mobs_mc:zombie", zombie) mcl_mobs.register_mob("mobs_mc:zombie", zombie)
-- Baby zombie. -- Baby zombie.
-- A smaller and more dangerous variant of the zombie -- A smaller and more dangerous variant of the zombie
@ -123,7 +123,7 @@ baby_zombie.animation = {
punch_start = 109, punch_end = 119 punch_start = 109, punch_end = 119
} }
mcl_mobs:register_mob("mobs_mc:baby_zombie", baby_zombie) mcl_mobs.register_mob("mobs_mc:baby_zombie", baby_zombie)
-- Husk. -- Husk.
-- Desert variant of the zombie -- Desert variant of the zombie
@ -140,7 +140,7 @@ husk.sunlight_damage = 0
husk.drops = drops_common husk.drops = drops_common
-- TODO: Husks avoid water -- TODO: Husks avoid water
mcl_mobs:register_mob("mobs_mc:husk", husk) mcl_mobs.register_mob("mobs_mc:husk", husk)
-- Baby husk. -- Baby husk.
-- A smaller and more dangerous variant of the husk -- A smaller and more dangerous variant of the husk
@ -154,7 +154,7 @@ baby_husk.ignited_by_sunlight = false
baby_husk.sunlight_damage = 0 baby_husk.sunlight_damage = 0
baby_husk.drops = drops_common baby_husk.drops = drops_common
mcl_mobs:register_mob("mobs_mc:baby_husk", baby_husk) mcl_mobs.register_mob("mobs_mc:baby_husk", baby_husk)
-- Spawning -- Spawning
@ -368,5 +368,5 @@ mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max) mcl_vars.mg_overworld_max)
-- Spawn eggs -- Spawn eggs
mcl_mobs:register_egg("mobs_mc:husk", S("Husk"), "#777361", "#ded88f", 0) mcl_mobs.register_egg("mobs_mc:husk", S("Husk"), "#777361", "#ded88f", 0)
mcl_mobs:register_egg("mobs_mc:zombie", S("Zombie"), "#00afaf", "#799c66", 0) mcl_mobs.register_egg("mobs_mc:zombie", S("Zombie"), "#00afaf", "#799c66", 0)

View File

@ -93,7 +93,7 @@ local pigman = {
fire_damage_resistant = true, fire_damage_resistant = true,
} }
mcl_mobs:register_mob("mobs_mc:pigman", pigman) mcl_mobs.register_mob("mobs_mc:pigman", pigman)
-- Baby pigman. -- Baby pigman.
-- A smaller and more dangerous variant of the pigman -- A smaller and more dangerous variant of the pigman
@ -113,7 +113,7 @@ baby_pigman.run_velocity = 2.4
baby_pigman.light_damage = 0 baby_pigman.light_damage = 0
baby_pigman.child = 1 baby_pigman.child = 1
mcl_mobs:register_mob("mobs_mc:baby_pigman", baby_pigman) mcl_mobs.register_mob("mobs_mc:baby_pigman", baby_pigman)
-- Regular spawning in the Nether -- Regular spawning in the Nether
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
@ -152,4 +152,4 @@ mcl_vars.mg_nether_max)
--mobs:spawn_specific("mobs_mc:pigman", {"mcl_portals:portal"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_max) --mobs:spawn_specific("mobs_mc:pigman", {"mcl_portals:portal"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:pigman", S("Zombie Pigman"), "#ea9393", "#4c7129", 0) mcl_mobs.register_egg("mobs_mc:pigman", S("Zombie Pigman"), "#ea9393", "#4c7129", 0)