Update Mobs redo and add mobs_mc, modified
872
mods/mobs_mc/api-mcorg.lua
Normal file
|
@ -0,0 +1,872 @@
|
|||
mobs = {}
|
||||
|
||||
mobs.default_definition = {
|
||||
physical = true,
|
||||
jump = function (self)
|
||||
local v = self.object:getvelocity()
|
||||
v.y = 5
|
||||
self.object:setvelocity(v)
|
||||
end,
|
||||
|
||||
|
||||
timer = 0,
|
||||
env_damage_timer = 0, -- only if state = "attack"
|
||||
bombtimer = -999,
|
||||
attack = {player=nil, dist=nil},
|
||||
state = "stand",
|
||||
v_start = false,
|
||||
old_y = nil,
|
||||
lifetimer = 600,
|
||||
tamed = false,
|
||||
|
||||
boom = function(self, tnt_range)
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
tnt:boom(pos)
|
||||
end,
|
||||
|
||||
set_velocity = function(self, v)
|
||||
local get_flowing_dir = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
local p4 = {
|
||||
{x=1,y=0,z=0},
|
||||
{x=-1,y=0,z=0},
|
||||
{x=0,y=0,z=1},
|
||||
{x=0,y=0,z=-1},
|
||||
}
|
||||
local out = {x=0,y=0,z=0}
|
||||
local num = 0
|
||||
for i=1,4 do
|
||||
local p2 = vector.add(pos, p4[i])
|
||||
local name = minetest.get_node(p2).name
|
||||
local par2 = minetest.get_node(p2).param2
|
||||
-- param2 == 13 means water is falling down a block
|
||||
if (name == "default:water_flowing" and par2 < param2 and param2 < 13) or (name == "default:water_flowing" and par2 == 13) or name == "air" then
|
||||
out = vector.add(out, p4[i])
|
||||
num = num + 1
|
||||
end
|
||||
end
|
||||
if num then
|
||||
return out
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local yaw = self.object:getyaw()
|
||||
if self.drawtype == "side" then
|
||||
yaw = yaw+(math.pi/2)
|
||||
end
|
||||
local x = math.sin(yaw) * -v
|
||||
local z = math.cos(yaw) * v
|
||||
local v1 = {x=x, y=self.object:getvelocity().y, z=z}
|
||||
local pos = self.object:getpos()
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "default:water_flowing" then
|
||||
local v = get_flowing_dir(self)
|
||||
if v then
|
||||
v1 = vector.add(v1, vector.multiply(v, 1.3))
|
||||
end
|
||||
end
|
||||
self.object:setvelocity(v1)
|
||||
end,
|
||||
|
||||
get_velocity = function(self)
|
||||
local v = self.object:getvelocity()
|
||||
return (v.x^2 + v.z^2)^(0.5)
|
||||
end,
|
||||
|
||||
set_animation = function(self, type)
|
||||
if not self.animation then
|
||||
return
|
||||
end
|
||||
if not self.animation.current then
|
||||
self.animation.current = ""
|
||||
end
|
||||
if type == "stand" and self.animation.current ~= "stand" then
|
||||
if
|
||||
self.animation.stand_start
|
||||
and self.animation.stand_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.stand_start,y=self.animation.stand_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "stand"
|
||||
end
|
||||
elseif type == "look" and self.animation.current ~= "look" then
|
||||
if
|
||||
self.animation.look_start
|
||||
and self.animation.look_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.look_start,y=self.animation.look_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "look"
|
||||
end
|
||||
elseif type == "eat" and self.animation.current ~= "eat" then
|
||||
if
|
||||
self.animation.eat_start
|
||||
and self.animation.eat_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.eat_start,y=self.animation.eat_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "eat"
|
||||
if self.name == "mobs:sheep" and self.naked then
|
||||
local pos = self.object:getpos()
|
||||
pos.y = pos.y - 1
|
||||
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
self.naked = false
|
||||
if not self.color then
|
||||
self.object:set_properties({
|
||||
textures = {"sheep.png"},
|
||||
})
|
||||
else
|
||||
self.object:set_properties({
|
||||
textures = {"sheep_"..self.color..".png"},
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif type == "shoot" and self.animation.current ~= "shoot" then
|
||||
if
|
||||
self.animation.shoot_start
|
||||
and self.animation.shoot_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.shoot_start,y=self.animation.shoot_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.shootdur = (self.animation.shoot_end - self.animation.shoot_start)/self.animation.speed_normal - .5
|
||||
self.animation.current = "shoot"
|
||||
end
|
||||
elseif type == "fly" and self.animation.current ~= "fly" then
|
||||
if
|
||||
self.animation.fly_start
|
||||
and self.animation.fly_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.fly_start,y=self.animation.fly_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "fly"
|
||||
end
|
||||
elseif type == "walk" and self.animation.current ~= "walk" then
|
||||
if
|
||||
self.animation.walk_start
|
||||
and self.animation.walk_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.walk_start,y=self.animation.walk_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "walk"
|
||||
end
|
||||
elseif type == "run" and self.animation.current ~= "run" then
|
||||
if
|
||||
self.animation.run_start
|
||||
and self.animation.run_end
|
||||
and self.animation.speed_run
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.run_start,y=self.animation.run_end},
|
||||
self.animation.speed_run, 0
|
||||
)
|
||||
self.animation.current = "run"
|
||||
end
|
||||
elseif type == "punch" and self.animation.current ~= "punch" then
|
||||
if
|
||||
self.animation.punch_start
|
||||
and self.animation.punch_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.punch_start,y=self.animation.punch_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "punch"
|
||||
end
|
||||
elseif type == "hurt" and self.animation.current ~= "hurt" then
|
||||
self.animation.hurtdur = .5
|
||||
if
|
||||
self.animation.hurt_start
|
||||
and self.animation.hurt_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.hurt_start,y=self.animation.hurt_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "hurt"
|
||||
self.animation.hurtdur = (self.animation.hurt_end - self.animation.hurt_start)/self.animation.speed_normal - 1
|
||||
end
|
||||
elseif type == "death" and self.animation.current ~= "death" then
|
||||
self.animation.deathdur = 1
|
||||
if
|
||||
self.animation.death_start
|
||||
and self.animation.death_end
|
||||
and self.animation.speed_normal
|
||||
then
|
||||
self.object:set_animation(
|
||||
{x=self.animation.death_start,y=self.animation.death_end},
|
||||
self.animation.speed_normal, 0
|
||||
)
|
||||
self.animation.current = "death"
|
||||
self.animation.deathdur = (self.animation.death_end - self.animation.death_start)/self.animation.speed_normal - .5
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
if self.type == "monster" and minetest.setting_getbool("only_peaceful_mobs") then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
self.lifetimer = self.lifetimer - dtime
|
||||
if self.lifetimer <= 0 and not self.tamed then
|
||||
local player_count = 0
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(self.object:getpos(), 30)) do
|
||||
if obj:is_player() then
|
||||
player_count = player_count+1
|
||||
end
|
||||
end
|
||||
if player_count == 0 and self.state ~= "attack" then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
if self.object:getvelocity().y > 0.1 then
|
||||
local yaw = self.object:getyaw()
|
||||
if self.drawtype == "side" then
|
||||
yaw = yaw+(math.pi/2)
|
||||
end
|
||||
local x = math.sin(yaw) * -2
|
||||
local z = math.cos(yaw) * 2
|
||||
self.object:setacceleration({x=x, y=-10, z=z})
|
||||
else
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
end
|
||||
|
||||
if self.disable_fall_damage and self.object:getvelocity().y == 0 then
|
||||
if not self.old_y then
|
||||
self.old_y = self.object:getpos().y
|
||||
else
|
||||
local d = self.old_y - self.object:getpos().y
|
||||
if d > 5 then
|
||||
local damage = d-5
|
||||
self.object:set_hp(self.object:get_hp()-damage)
|
||||
if self.object:get_hp() == 0 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.old_y = self.object:getpos().y
|
||||
end
|
||||
end
|
||||
|
||||
self.timer = self.timer+dtime
|
||||
self.bombtimer = self.bombtimer+dtime
|
||||
if self.state ~= "attack" then
|
||||
if self.timer < 1 then
|
||||
return
|
||||
end
|
||||
self.timer = 0
|
||||
end
|
||||
|
||||
if self.sounds and self.sounds.random and math.random(1, 100) <= 1 then
|
||||
minetest.sound_play(self.sounds.random, {object = self.object})
|
||||
end
|
||||
|
||||
local do_env_damage = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local n = minetest.get_node(pos)
|
||||
|
||||
if self.light_damage and self.light_damage ~= 0
|
||||
and pos.y>0
|
||||
and minetest.get_node_light(pos)
|
||||
and minetest.get_node_light(pos) > 4
|
||||
and minetest.get_timeofday() > 0.2
|
||||
and minetest.get_timeofday() < 0.8
|
||||
then
|
||||
self.object:set_hp(self.object:get_hp()-self.light_damage)
|
||||
if self.object:get_hp() == 0 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
||||
if self.water_damage and self.water_damage ~= 0 and
|
||||
minetest.get_item_group(n.name, "water") ~= 0
|
||||
then
|
||||
self.object:set_hp(self.object:get_hp()-self.water_damage)
|
||||
if self.object:get_hp() == 0 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
||||
if self.lava_damage and self.lava_damage ~= 0 and
|
||||
minetest.get_item_group(n.name, "lava") ~= 0
|
||||
then
|
||||
self.object:set_hp(self.object:get_hp()-self.lava_damage)
|
||||
if self.object:get_hp() == 0 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ridable pigs
|
||||
if self.name == "mobs:pig" and self.saddle == "yes" and self.driver then
|
||||
local item = self.driver:get_wielded_item()
|
||||
if item:get_name() == "mobs:carrotstick" then
|
||||
local yaw = self.driver:get_look_yaw() - math.pi / 2
|
||||
local velo = self.object:getvelocity()
|
||||
local v = 1.5
|
||||
if math.abs(velo.x) + math.abs(velo.z) < .6 then velo.y = 5 end
|
||||
self.state = "walk"
|
||||
self:set_animation("walk")
|
||||
self.object:setyaw(yaw)
|
||||
self.object:setvelocity({x = -math.sin(yaw) * v, y = velo.y, z = math.cos(yaw) * v})
|
||||
|
||||
local inv = self.driver:get_inventory()
|
||||
local stack = inv:get_stack("main", self.driver:get_wield_index())
|
||||
stack:add_wear(100)
|
||||
if stack:get_wear() > 65400 then
|
||||
stack = {name = "fishing:pole", count = 1}
|
||||
end
|
||||
inv:set_stack("main", self.driver:get_wield_index(), stack)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
self.env_damage_timer = self.env_damage_timer + dtime
|
||||
if self.state == "attack" and self.env_damage_timer > 1 then
|
||||
self.env_damage_timer = 0
|
||||
do_env_damage(self)
|
||||
elseif self.state ~= "attack" then
|
||||
do_env_damage(self)
|
||||
end
|
||||
|
||||
if self.type == "monster" and minetest.setting_getbool("enable_damage") then
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist < 2 and self.attack_type == "bomb" and self.bombmode ~= "armed" then
|
||||
if self.sounds and self.sounds.approach then
|
||||
minetest.sound_play(self.sounds.approach, {object = self.object})
|
||||
end
|
||||
self.bombmode = "armed"
|
||||
self.bombtimer = 0
|
||||
end
|
||||
if dist < self.view_range then
|
||||
if self.attack.dist then
|
||||
if dist < self.attack.dist then
|
||||
self.attack.player = player
|
||||
self.attack.dist = dist
|
||||
end
|
||||
else
|
||||
self.state = "attack"
|
||||
self.attack.player = player
|
||||
self.attack.dist = dist
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.follow and self.follow ~= "" and not self.following then
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if self.view_range and dist < self.view_range then
|
||||
self.following = player
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.following and self.following:is_player() then
|
||||
if self.following:get_wielded_item():get_name() ~= self.follow then
|
||||
self.following = nil
|
||||
self.v_start = false
|
||||
else
|
||||
local s = self.object:getpos()
|
||||
local p = self.following:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist > self.view_range then
|
||||
self.following = nil
|
||||
self.v_start = false
|
||||
else
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
||||
local yaw = math.atan(vec.z/vec.x)+math.pi/2
|
||||
if self.drawtype == "side" then
|
||||
yaw = yaw+(math.pi/2)
|
||||
end
|
||||
if p.x > s.x then
|
||||
yaw = yaw+math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
if dist > 2 then
|
||||
if not self.v_start then
|
||||
self.v_start = true
|
||||
self.set_velocity(self, self.walk_velocity)
|
||||
else
|
||||
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
self:jump()
|
||||
end
|
||||
self.set_velocity(self, self.walk_velocity)
|
||||
end
|
||||
self:set_animation("walk")
|
||||
else
|
||||
self.v_start = false
|
||||
self.set_velocity(self, 0)
|
||||
self:set_animation("stand")
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.state == "stand" then
|
||||
if math.random(1, 4) == 1 then
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
||||
end
|
||||
self.set_velocity(self, 0)
|
||||
self.set_animation(self, "stand")
|
||||
local standanim = math.random(1,4)
|
||||
if standanim == 2 then
|
||||
self.set_animation(self, "look")
|
||||
elseif standanim == 3 then
|
||||
self.set_animation(self, "eat")
|
||||
elseif standanim == 4 then
|
||||
self.set_animation(self, "fly")
|
||||
end
|
||||
if math.random(1, 100) <= 50 then
|
||||
self.set_velocity(self, self.walk_velocity)
|
||||
self.state = "walk"
|
||||
self.set_animation(self, "walk")
|
||||
end
|
||||
elseif self.state == "walk" then
|
||||
if math.random(1, 100) <= 30 then
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
||||
end
|
||||
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
self:jump()
|
||||
end
|
||||
self:set_animation("walk")
|
||||
self.set_velocity(self, self.walk_velocity)
|
||||
if math.random(1, 100) <= 10 then
|
||||
self.set_velocity(self, 0)
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
end
|
||||
elseif self.state == "attack" and (self.attack_type == "dogfight" or self.attack_type == "bomb") then
|
||||
if not self.attack.player or not self.attack.player:is_player() then
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
self.attack = {player=nil, dist=nil}
|
||||
return
|
||||
end
|
||||
local s = self.object:getpos()
|
||||
local p = self.attack.player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist > self.view_range or self.attack.player:get_hp() <= 0 then
|
||||
self.state = "stand"
|
||||
self.v_start = false
|
||||
self.set_velocity(self, 0)
|
||||
self.attack = {player=nil, dist=nil}
|
||||
self:set_animation("stand")
|
||||
return
|
||||
else
|
||||
self.attack.dist = dist
|
||||
end
|
||||
if self.attack_type == "bomb" and self.bombmode == "armed" and self.bombtimer > 2 then
|
||||
-- print("***BOOM",self.bombtimer)
|
||||
self.bombmode = "exploded"
|
||||
self.boom(self, math.random(2, 4))
|
||||
end
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
||||
local yaw = math.atan(vec.z/vec.x)+math.pi/2
|
||||
if self.drawtype == "side" then
|
||||
yaw = yaw+(math.pi/2)
|
||||
end
|
||||
if p.x > s.x then
|
||||
yaw = yaw+math.pi
|
||||
end
|
||||
-- creepers use a spiraling approach:
|
||||
if self.attack_type == "bomb" then
|
||||
yaw = yaw - 14*math.pi/180
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
if self.attack.dist > 2 then
|
||||
if not self.v_start then
|
||||
self.v_start = true
|
||||
self.set_velocity(self, self.run_velocity)
|
||||
else
|
||||
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
self:jump()
|
||||
end
|
||||
self.set_velocity(self, self.run_velocity)
|
||||
end
|
||||
self:set_animation("run")
|
||||
else
|
||||
self.set_velocity(self, 0)
|
||||
self:set_animation("punch")
|
||||
self.v_start = false
|
||||
if self.timer > 1 then
|
||||
self.timer = 0
|
||||
if self.sounds and self.sounds.attack then
|
||||
minetest.sound_play(self.sounds.attack, {object = self.object})
|
||||
end
|
||||
self.attack.player:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups = {fleshy=self.damage}
|
||||
}, vec)
|
||||
end
|
||||
end
|
||||
elseif self.state == "attack" and self.attack_type == "shoot" then
|
||||
if not self.attack.player or not self.attack.player:is_player() then
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
self.attack = {player=nil, dist=nil}
|
||||
return
|
||||
end
|
||||
local s = self.object:getpos()
|
||||
local p = self.attack.player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist > self.view_range or self.attack.player:get_hp() <= 0 then
|
||||
self.state = "stand"
|
||||
self.v_start = false
|
||||
self.set_velocity(self, 0)
|
||||
self.attack = {player=nil, dist=nil}
|
||||
self:set_animation("stand")
|
||||
return
|
||||
else
|
||||
self.attack.dist = dist
|
||||
self.shoot_interval = (dist + self.view_range) / self.view_range
|
||||
end
|
||||
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
||||
local yaw = math.atan(vec.z/vec.x)+math.pi/2
|
||||
if self.drawtype == "side" then
|
||||
yaw = yaw+(math.pi/2)
|
||||
end
|
||||
if p.x > s.x then
|
||||
yaw = yaw+math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
if self.attack.dist < 4 then
|
||||
self.set_velocity(self, -self.run_velocity)
|
||||
elseif self.attack.dist > 8 then
|
||||
self.set_velocity(self, self.run_velocity)
|
||||
else
|
||||
self.set_velocity(self, 0)
|
||||
end
|
||||
if self.timer > self.shoot_interval and math.random(1, 100) <= 60 then
|
||||
self.timer = 0
|
||||
|
||||
self:set_animation("shoot")
|
||||
minetest.after(self.animation.shootdur, function()
|
||||
self:set_animation("walk")
|
||||
end)
|
||||
if self.sounds and self.sounds.attack then
|
||||
minetest.sound_play(self.sounds.attack, {object = self.object})
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y + (self.collisionbox[2]+self.collisionbox[5])/2
|
||||
local obj = minetest.add_entity(p, self.arrow)
|
||||
local amount = (vec.x^2+vec.y^2+vec.z^2)^0.5
|
||||
local v = 15
|
||||
vec.y = vec.y+1
|
||||
vec.x = vec.x*v/amount
|
||||
vec.y = vec.y*v/amount
|
||||
vec.z = vec.z*v/amount
|
||||
obj:setvelocity(vec)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
self.object:set_armor_groups({fleshy=self.armor})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.state = "stand"
|
||||
self.attack = {player = nil, dist = nil}
|
||||
self.object:setvelocity({x=0, y=self.object:getvelocity().y, z=0})
|
||||
self.object:setyaw(math.random(1, 360)/180*math.pi)
|
||||
if self.type == "monster" and minetest.setting_getbool("only_peaceful_mobs") then
|
||||
self.object:remove()
|
||||
end
|
||||
self.lifetimer = 600 - dtime_s
|
||||
if staticdata then
|
||||
local tmp = minetest.deserialize(staticdata)
|
||||
if tmp and tmp.lifetimer then
|
||||
self.lifetimer = tmp.lifetimer - dtime_s
|
||||
end
|
||||
if tmp and tmp.tamed then
|
||||
self.tamed = tmp.tamed
|
||||
end
|
||||
if tmp and tmp.color then
|
||||
self.color = tmp.color
|
||||
end
|
||||
if tmp and tmp.naked then
|
||||
self.naked = tmp.naked
|
||||
end
|
||||
if tmp and tmp.saddle then
|
||||
self.saddle = tmp.saddle
|
||||
end
|
||||
end
|
||||
if self.name == "mobs:sheep" and self.color and not self.naked then
|
||||
self.object:set_properties({
|
||||
textures = {"sheep_"..self.color..".png"},
|
||||
})
|
||||
self.drops = {
|
||||
{name = "mobs:mutton_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 2,},
|
||||
{name = "wool:"..self.color,
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
}
|
||||
end
|
||||
if self.name == "mobs:sheep" and not self.color then
|
||||
local col = "white"
|
||||
local cols = {"dark_grey", "grey", "black", "brown", "pink"}
|
||||
if math.random(100) > 80 then
|
||||
col = cols[math.random(1,5)]
|
||||
end
|
||||
self.color = col
|
||||
self.object:set_properties({
|
||||
textures = {"sheep_"..self.color..".png"},
|
||||
})
|
||||
self.drops = {
|
||||
{name = "mobs:mutton_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 2,},
|
||||
{name = "wool:"..self.color,
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
}
|
||||
end
|
||||
if self.name == "mobs:sheep" and self.naked then
|
||||
self.object:set_properties({
|
||||
textures = {"sheep_sheared.png"},
|
||||
})
|
||||
end
|
||||
if self.name == "mobs:pig" and self.saddle == "yes" then
|
||||
self.object:set_properties({
|
||||
textures = {"pig_with_saddle.png"},
|
||||
})
|
||||
end
|
||||
|
||||
if self.lifetimer <= 0 and not self.tamed then
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
local tmp = {
|
||||
lifetimer = self.lifetimer,
|
||||
tamed = self.tamed,
|
||||
color = self.color,
|
||||
naked = self.naked,
|
||||
saddle = self.saddle,
|
||||
}
|
||||
return minetest.serialize(tmp)
|
||||
end,
|
||||
|
||||
on_punch = function(self, hitter)
|
||||
-- death happens at 20 hp so we can play the death animation:
|
||||
if self.object:get_hp() <= 20 then
|
||||
local pos = self.object:getpos()
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = .2,
|
||||
minpos = {x=pos.x-1, y=pos.y-.5, z=pos.z-1},
|
||||
maxpos = {x=pos.x+1, y=pos.y+.5, z=pos.z+1},
|
||||
minvel = {x=0, y=.3, z=0},
|
||||
maxvel = {x=0, y=2, z=0},
|
||||
minacc = {x=-.2, y=-.2, z=-.2},
|
||||
maxacc = {x=.2, y=.2, z=.2},
|
||||
minexptime = 1,
|
||||
maxexptime = 5,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "bettertnt_smoke.png",
|
||||
})
|
||||
self:set_animation("death")
|
||||
self.object:set_hp(1000)
|
||||
if self.name == "mobs:pig" and self.driver then
|
||||
local name = self.driver:get_player_name()
|
||||
self.driver:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(self.driver, "stand" , 30)
|
||||
self.driver = nil
|
||||
end
|
||||
minetest.after(self.animation.deathdur, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
if self.sounds and self.sounds.death then
|
||||
minetest.sound_play(self.sounds.death, {object = self.object})
|
||||
end
|
||||
pos.y = pos.y + 0.5
|
||||
local obj = nil
|
||||
local ndrops = 0
|
||||
for _,drop in ipairs(self.drops) do
|
||||
if math.random(1, drop.chance) == 1 and ndrops < (self.maxdrops or 100) then
|
||||
obj = minetest.add_item(pos, ItemStack(drop.name.." "..math.random(drop.min, drop.max)))
|
||||
ndrops = ndrops + 1
|
||||
if obj then
|
||||
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.sounds and self.sounds.hurt then
|
||||
minetest.sound_play(self.sounds.hurt, {object = self.object})
|
||||
end
|
||||
self:set_animation("hurt")
|
||||
minetest.after(self.animation.hurtdur, function()
|
||||
self:set_animation("walk")
|
||||
end)
|
||||
end
|
||||
end,
|
||||
|
||||
__index = function(table,key)
|
||||
return mobs.default_definition[key]
|
||||
end,}
|
||||
|
||||
function mobs:register_mob(name, def)
|
||||
setmetatable (def,mobs.default_definition)
|
||||
minetest.register_entity(name, def)
|
||||
end
|
||||
|
||||
function mobs:check_player_dist(pos, node)
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
||||
if dist < 24 then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
mobs.spawning_mobs = {}
|
||||
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_func)
|
||||
if minetest.setting_getbool(string.gsub(name,":","_").."_spawn") ~= false then
|
||||
mobs.spawning_mobs[name] = true
|
||||
minetest.register_abm({
|
||||
nodenames = nodes,
|
||||
neighbors = {"air"},
|
||||
interval = 10,
|
||||
chance = chance,
|
||||
action = function(pos, node, _, active_object_count_wider)
|
||||
if node.name == "default:ice" or node.name == "default:glass" then
|
||||
return
|
||||
end
|
||||
if active_object_count_wider > active_object_count then
|
||||
return
|
||||
end
|
||||
if not mobs.spawning_mobs[name] then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) > max_light then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < min_light then
|
||||
return
|
||||
end
|
||||
if pos.y > max_height then
|
||||
return
|
||||
end
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
if spawn_func and not spawn_func(pos, node) then
|
||||
return
|
||||
end
|
||||
if mobs:check_player_dist(pos, node) then
|
||||
return
|
||||
end
|
||||
if minetest.setting_getbool("display_mob_spawn") then
|
||||
minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))
|
||||
end
|
||||
minetest.add_entity(pos, name)
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function mobs:register_arrow(name, def)
|
||||
minetest.register_entity(name, {
|
||||
physical = false,
|
||||
visual = def.visual,
|
||||
visual_size = def.visual_size,
|
||||
textures = def.textures,
|
||||
velocity = def.velocity,
|
||||
hit_player = def.hit_player,
|
||||
hit_node = def.hit_node,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
if minetest.get_node(self.object:getpos()).name ~= "air" then
|
||||
minetest.sound_play("bowhit1", {pos = pos})
|
||||
self.hit_node(self, pos, node)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-1
|
||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if player:is_player() then
|
||||
self.hit_player(self, player)
|
||||
minetest.sound_play("damage", {pos = pos})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function mobs:register_egg(mob, desc, img)
|
||||
minetest.register_craftitem(mob, {
|
||||
description = "Spawn "..desc,
|
||||
inventory_image = img,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
if pointed_thing.above and not minetest.is_protected(pos, placer:get_player_name()) then
|
||||
pos.y = pos.y + 0.5
|
||||
minetest.add_entity(pos, mob)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
3010
mods/mobs_mc/api-mm-mcmods.lua
Normal file
159
mods/mobs_mc/chicken.lua
Normal file
|
@ -0,0 +1,159 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:chicken", {
|
||||
type = "animal",
|
||||
hp_max = 24,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
|
||||
visual = "mesh",
|
||||
mesh = "mobs_mc_chicken.x",
|
||||
textures = {
|
||||
{"mobs_mc_chicken.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:chicken_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "mcl_mobitems:feather",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
sounds = {
|
||||
random = "Chicken1",
|
||||
death = "Chickenhurt1",
|
||||
hurt = "Chickenhurt1",
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
hurt_start = 118,
|
||||
hurt_end = 154,
|
||||
death_start = 154,
|
||||
death_end = 179,
|
||||
eat_start = 49,
|
||||
eat_end = 78,
|
||||
look_start = 78,
|
||||
look_end = 108,
|
||||
fly_start = 181,
|
||||
fly_end = 187,
|
||||
},
|
||||
--[[
|
||||
follow = "farming:seed_wheat",
|
||||
view_range = 5,
|
||||
on_rightclick = function(self, clicker)
|
||||
if clicker:get_inventory() then
|
||||
if minetest.registered_items[":mobs:egg"] then
|
||||
clicker:get_inventory():add_item("main", ItemStack(":mobs:egg 1"))
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
do_custom = function(self)
|
||||
|
||||
if self.child
|
||||
or math.random(1, 5000) > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
|
||||
minetest.add_item(pos, ":mobs:egg")
|
||||
|
||||
minetest.sound_play("default_place_node_hard", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 5,
|
||||
})
|
||||
end,
|
||||
]]
|
||||
--from mobs_animals
|
||||
follow = {"farming:seed_wheat", "farming:seed_cotton"},
|
||||
view_range = 5,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
|
||||
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||
return
|
||||
end
|
||||
|
||||
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
|
||||
end,
|
||||
|
||||
do_custom = function(self)
|
||||
|
||||
if self.child
|
||||
or math.random(1, 5000) > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
|
||||
minetest.add_item(pos, "mcl_mobitems:egg")
|
||||
|
||||
minetest.sound_play("default_place_node_hard", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 5,
|
||||
})
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
--mobs:register_spawn("mobs_mc:chicken", {"default:dirt_with_grass"}, 20, 8, 7000, 1, 31000)
|
||||
|
||||
|
||||
-- from mobs_redo
|
||||
-- egg
|
||||
minetest.register_node(":mobs:egg", {
|
||||
description = "Chicken Egg",
|
||||
tiles = {"mobs_chicken_egg.png"},
|
||||
inventory_image = "mobs_chicken_egg.png",
|
||||
visual_scale = 0.7,
|
||||
drawtype = "plantlike",
|
||||
wield_image = "mobs_chicken_egg.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
if placer:is_player() then
|
||||
minetest.set_node(pos, {name = "mobs:egg", param2 = 1})
|
||||
end
|
||||
end,
|
||||
on_use = mobs_shoot_egg
|
||||
})
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:chicken", "mobs_mc:chicken")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:chicken", "Chicken", "spawn_egg_chicken.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC chicken loaded")
|
||||
end
|
139
mods/mobs_mc/cow.lua
Normal file
|
@ -0,0 +1,139 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
mobs:register_mob("mobs_mc:cow", {
|
||||
type = "animal",
|
||||
hp_max = 28,
|
||||
collisionbox = {-0.6, -0.01, -0.6, 0.6, 1.8, 0.6},
|
||||
|
||||
visual = "mesh",
|
||||
mesh = "mobs_mc_cow.x",
|
||||
textures = {
|
||||
{"mobs_mc_cow.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mobs:beef_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 3,},
|
||||
{name = "mobs:leather",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 3,
|
||||
sounds = {
|
||||
random = "Cow1",
|
||||
death = "Cowhurt1",
|
||||
damage = "Cowhurt1",
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
hurt_start = 118,
|
||||
hurt_end = 154,
|
||||
death_start = 154,
|
||||
death_end = 179,
|
||||
eat_start = 49,
|
||||
eat_end = 78,
|
||||
look_start = 78,
|
||||
look_end = 108,
|
||||
},
|
||||
--[[
|
||||
follow = "farming:wheat",
|
||||
view_range = 5,
|
||||
on_rightclick = function(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
if item:get_name() == "bucket:bucket_empty" and clicker:get_inventory() then
|
||||
local inv = clicker:get_inventory()
|
||||
inv:remove_item("main", "bucket:bucket_empty")
|
||||
-- if room add bucket of milk to inventory, otherwise drop as item
|
||||
if inv:room_for_item("main", {name="mobs:bucket_milk"}) then
|
||||
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
||||
else
|
||||
local pos = self.object:getpos()
|
||||
pos.y = pos.y + 0.5
|
||||
minetest.add_item(pos, {name = "mobs:bucket_milk"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
]]
|
||||
--from mobs_animals
|
||||
follow = "farming:wheat",
|
||||
view_range = 7,
|
||||
replace_rate = 10,
|
||||
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
|
||||
replace_with = "air",
|
||||
fear_height = 2,
|
||||
on_rightclick = function(self, clicker)
|
||||
|
||||
-- feed or tame
|
||||
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||
return
|
||||
end
|
||||
|
||||
local tool = clicker:get_wielded_item()
|
||||
|
||||
-- milk cow with empty bucket
|
||||
if tool:get_name() == "bucket:bucket_empty" then
|
||||
|
||||
--if self.gotten == true
|
||||
if self.child == true then
|
||||
return
|
||||
end
|
||||
|
||||
if self.gotten == true then
|
||||
minetest.chat_send_player(clicker:get_player_name(),
|
||||
"Cow already milked!")
|
||||
return
|
||||
end
|
||||
|
||||
local inv = clicker:get_inventory()
|
||||
|
||||
inv:remove_item("main", "bucket:bucket_empty")
|
||||
|
||||
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
|
||||
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
||||
else
|
||||
local pos = self.object:getpos()
|
||||
pos.y = pos.y + 0.5
|
||||
minetest.add_item(pos, {name = "mobs:bucket_milk"})
|
||||
end
|
||||
|
||||
self.gotten = true -- milked
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||
end,
|
||||
})
|
||||
|
||||
--mobs:register_spawn("mobs_mc:cow", {"default:dirt_with_grass"}, 20, 8, 7000, 1, 31000)
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:cow", "mobs_mc:cow")
|
||||
|
||||
-- spawn egg
|
||||
mobs:register_egg("mobs_mc:cow", "Cow", "spawn_egg_cow.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Cow loaded")
|
||||
end
|
111
mods/mobs_mc/creeper.lua
Normal file
|
@ -0,0 +1,111 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:creeper", {
|
||||
type = "monster",
|
||||
hp_max = 30,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.6, 0.4},
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
visual = "mesh",
|
||||
visual_size = {x=.75, y=.75, z=.75},
|
||||
mesh = "mobs_creeper.x",
|
||||
textures = {
|
||||
{"mobs_creeper.png"}
|
||||
},
|
||||
makes_footstep_sound = false,
|
||||
sounds = {
|
||||
attack = "Fuse",
|
||||
death = "Creeperdeath",
|
||||
damage = "Creeper4",
|
||||
war_cry = "Fuse",
|
||||
explode = "explo",
|
||||
},
|
||||
walk_velocity = 1.5,
|
||||
run_velocity = 3,
|
||||
damage = 1,
|
||||
explosion_radius = 3,
|
||||
armor = 200,
|
||||
maxdrops = 3,
|
||||
drops = {
|
||||
{name = "tnt:gunpowder",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
{name = "default:flint_and_steel",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "farorb:farorb",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_1",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_2",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_3",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_4",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_5",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
{name = "jdukebox:disc_6",
|
||||
chance = 10,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
run_start = 24,
|
||||
run_end = 49,
|
||||
hurt_start = 110,
|
||||
hurt_end = 139,
|
||||
death_start = 140,
|
||||
death_end = 189,
|
||||
look_start = 50,
|
||||
look_end = 108,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "explode",
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:creeper", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
|
||||
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:creeper", "mobs_mc:creeper")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:creeper", "Creeper", "spawn_egg_creeper.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Creeper loaded")
|
||||
end
|
5
mods/mobs_mc/depends.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
default
|
||||
fire
|
||||
mobs
|
||||
tnt
|
||||
mcl_mobitems
|
1
mods/mobs_mc/description.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Adds Minecraft-like monsters and animals.
|
80
mods/mobs_mc/enderman.lua
Normal file
|
@ -0,0 +1,80 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:enderman", {
|
||||
type = "monster",
|
||||
hp_max = 39,
|
||||
collisionbox = {-0.4, -2.4, -0.4, 0.4, 1.8, 0.4},
|
||||
|
||||
visual = "mesh",
|
||||
mesh = "mobs_sand_monster.b3d",
|
||||
textures = {
|
||||
{"mobs_endermen.png"}
|
||||
},
|
||||
visual_size = {x=1.2, y=2.5},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "mobs_sandmonster",
|
||||
death = "green_slime_death",
|
||||
damage = "Creeperdeath",
|
||||
},
|
||||
walk_velocity = 3.2,
|
||||
run_velocity = 5.4,
|
||||
damage = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "default:obsidian",
|
||||
chance = 4,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
{name = "default:diamond",
|
||||
chance = 11,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "farorb:farorb",
|
||||
chance = 3,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 45,
|
||||
speed_run = 15,
|
||||
stand_start = 0,
|
||||
stand_end = 39,
|
||||
walk_start = 41,
|
||||
walk_end = 72,
|
||||
run_start = 74,
|
||||
run_end = 105,
|
||||
punch_start = 74,
|
||||
punch_end = 105,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
replace_rate = 1,
|
||||
replace_what = {"default:torch","default:sand","default:desert_sand","default:cobble","default:dirt","default:dirt_with_glass","default:dirt_with_dry_grass","default:wood","default:stone","default:sandstone"},
|
||||
replace_with = "air",
|
||||
replace_offset = -1,
|
||||
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:enderman", { "default:sand", "default:desert_sand"}, 5, -1, 5000, 4, 31000)
|
||||
|
||||
|
||||
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:enderman", "Enderman", "spawn_egg_overlay.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Enderman loaded")
|
||||
end
|
125
mods/mobs_mc/ghast.lua
Normal file
|
@ -0,0 +1,125 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
mobs:register_mob("mobs_mc:ghast", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 50,
|
||||
collisionbox = {-1.45, -1.45, -1.45 ,1.45, 1.45, 1.45},
|
||||
visual_size = {x=3.0, y=3.0},
|
||||
-- textures = {
|
||||
-- {"ghast_top.png", "ghast_bottom.png", "ghast_front.png", "ghast_sides.png", "ghast_sides.png", "ghast_sides.png"}
|
||||
-- },
|
||||
textures = {
|
||||
{"ghast_white.png", "ghast_white.png", "ghast_front.png", "ghast_white.png", "ghast_white.png", "ghast_white.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="mobs_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
shoot = "mobs_fireball",
|
||||
death = "zombiedeath",
|
||||
damage = "ghast_damage",
|
||||
attack = "mobs_fireball",
|
||||
random = "mobs_eerie",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 2.6,
|
||||
damage = 1,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "default:lava_source 1",
|
||||
chance = 3,
|
||||
min = 1,
|
||||
max = 4,},
|
||||
{name = "default:diamond",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
--attack_type = "dogshoot",
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs_monster:fireball",
|
||||
shoot_interval = 3.5,
|
||||
shoot_offset = 1,
|
||||
--'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
|
||||
--'dogshoot_count_max' number of seconds before switching above modes.
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max =1,
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 4,
|
||||
floats=1,
|
||||
fly = true,
|
||||
jump_chance = 98,
|
||||
fear_height = 120,
|
||||
})
|
||||
|
||||
|
||||
mobs:register_spawn("mobs_mc:ghast", {"default:flowing_lava", "nether:rack","air"}, 17, -1, 5000, 1, -2000)
|
||||
|
||||
-- fireball (weapon)
|
||||
mobs:register_arrow(":mobs_monster:fireball", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"mobs_fireball.png"},
|
||||
velocity = 6,
|
||||
|
||||
-- direct hit, no fire... just plenty of pain
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
-- node hit, bursts into flame
|
||||
hit_node = function(self, pos, node)
|
||||
mobs:explosion(pos, 1, 1, 0)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:ghast", "Ghast", "ghast_front.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Ghast loaded")
|
||||
end
|
359
mods/mobs_mc/horse.lua
Normal file
|
@ -0,0 +1,359 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
-------------------------
|
||||
--KPGMOBS HORSE
|
||||
-------------------------
|
||||
--By: KrupnovPavel
|
||||
--Tweaked by: maikerumine
|
||||
local function is_ground(pos)
|
||||
local nn = minetest.get_node(pos).name
|
||||
return minetest.get_item_group(nn, "crumbly") ~= 0 or
|
||||
minetest.get_item_group(nn, "choppy") ~= 0 or
|
||||
minetest.get_item_group(nn, "cracky") ~= 0 or
|
||||
minetest.get_item_group(nn, "snappy") ~= 0 or
|
||||
minetest.get_item_group(nn, "unbreakable") ~= 0 or
|
||||
minetest.get_item_group(nn, "immortal") ~= 0
|
||||
end
|
||||
|
||||
local function get_sign(i)
|
||||
if i == 0 then
|
||||
return 0
|
||||
else
|
||||
return i/math.abs(i)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_velocity(v, yaw, y)
|
||||
local x = math.cos(yaw)*v
|
||||
local z = math.sin(yaw)*v
|
||||
return {x=x, y=y, z=z}
|
||||
end
|
||||
|
||||
local function get_v(v)
|
||||
return math.sqrt(v.x^2+v.z^2)
|
||||
end
|
||||
|
||||
function merge(a, b)
|
||||
if type(a) == 'table' and type(b) == 'table' then
|
||||
for k,v in pairs(b) do if type(v)=='table' and type(a[k] or false)=='table' then merge(a[k],v) else a[k]=v end end
|
||||
end
|
||||
return a
|
||||
end
|
||||
|
||||
-- HORSE go go goooo :)
|
||||
local horse = {
|
||||
physical = true,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
visual = "mesh",
|
||||
stepheight = 1.1,
|
||||
visual_size = {x=1,y=1},
|
||||
mesh = "mobs_horseh1.x",
|
||||
driver = nil,
|
||||
v = 0,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
clicker:set_detach()
|
||||
elseif not self.driver then
|
||||
self.driver = clicker
|
||||
clicker:set_attach(self.object, "", {x=0,y=11,z=0}, {x=0,y=0,z=0})
|
||||
self.object:setyaw(clicker:get_look_yaw())
|
||||
end
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
print (self.texture, self.jmp)
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
if puncher and puncher:is_player() then
|
||||
puncher:get_inventory():add_item("main", self.name)
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
|
||||
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
|
||||
|
||||
if self.driver then
|
||||
local ctrl = self.driver:get_player_control()
|
||||
if ctrl.up then
|
||||
self.v = self.v + self.jmp
|
||||
end
|
||||
if ctrl.down then
|
||||
self.v = self.v-0.1
|
||||
end
|
||||
if ctrl.left then
|
||||
self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120)
|
||||
end
|
||||
if ctrl.right then
|
||||
self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120)
|
||||
end
|
||||
if ctrl.jump then
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y-0.5
|
||||
if is_ground(p) then
|
||||
local pos = self.object:getpos()
|
||||
pos.y = math.floor(pos.y)+4
|
||||
self.object:setpos(pos)
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local s = get_sign(self.v)
|
||||
self.v = self.v - 0.02*s
|
||||
if s ~= get_sign(self.v) then
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
self.v = 0
|
||||
return
|
||||
end
|
||||
|
||||
if math.abs(self.v) > 4.5 then
|
||||
self.v = 4.5*get_sign(self.v)
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y-0.5
|
||||
|
||||
if not is_ground(p) then
|
||||
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
|
||||
self.v = 0
|
||||
end
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
|
||||
else
|
||||
p.y = p.y+1
|
||||
if is_ground(p) then
|
||||
self.object:setacceleration({x=0, y=3, z=0})
|
||||
local y = self.object:getvelocity().y
|
||||
if y > 2 then
|
||||
y = 2
|
||||
end
|
||||
if y < 0 then
|
||||
self.object:setacceleration({x=0, y=10, z=0})
|
||||
end
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), y))
|
||||
else
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
if math.abs(self.object:getvelocity().y) < 1 then
|
||||
local pos = self.object:getpos()
|
||||
pos.y = math.floor(pos.y)+0.5
|
||||
self.object:setpos(pos)
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
|
||||
else
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
--END HORSE
|
||||
|
||||
-- backup table
|
||||
local hbak = horse
|
||||
|
||||
-- Brown Horse
|
||||
local hrs = {
|
||||
textures = {"mobs_horseh1.png"},
|
||||
jmp = 2,
|
||||
}
|
||||
minetest.register_entity("mobs_mc:horseh1", merge(hrs, horse))
|
||||
|
||||
-- White Horse
|
||||
horse = hbak
|
||||
local peg = {
|
||||
textures = {"mobs_horsepegh1.png"},
|
||||
jmp = 2,
|
||||
}
|
||||
minetest.register_entity("mobs_mc:horsepegh1", merge(peg, horse))
|
||||
|
||||
-- Black Horse
|
||||
horse = hbak
|
||||
local ara = {
|
||||
textures = {"mobs_horsearah1.png"},
|
||||
jmp = 3,
|
||||
}
|
||||
minetest.register_entity("mobs_mc:horsearah1", merge(ara, horse))
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:horse", {
|
||||
type = "animal",
|
||||
hp_min = 5,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
textures = {
|
||||
{"mobs_horseh.png"},
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_horse.x",
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:meat_raw",
|
||||
chance = 1,
|
||||
min = 2,
|
||||
max = 3,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 6,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
stand_start = 25, stand_end = 75,
|
||||
walk_start = 75, walk_end = 100,
|
||||
},
|
||||
follow = "farming:wheat",
|
||||
view_range = 5,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local tool = clicker:get_wielded_item()
|
||||
if tool:get_name() == "mobs:saddle" then
|
||||
clicker:get_inventory():remove_item("main", "mobs:saddle")
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
minetest.add_entity(pos, "mobs_mc:horseh1")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_mc:horse2", {
|
||||
type = "animal",
|
||||
hp_min = 5,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
textures = {
|
||||
{"mobs_horsepegh.png"},
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_horse.x",
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:meat_raw",
|
||||
chance = 1,
|
||||
min = 2,
|
||||
max = 3,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 6,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
stand_start = 25, stand_end = 75,
|
||||
walk_start = 75, walk_end = 100,
|
||||
},
|
||||
follow = "farming:wheat",
|
||||
view_range = 5,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local tool = clicker:get_wielded_item()
|
||||
if tool:get_name() == "mobs:saddle" then
|
||||
clicker:get_inventory():remove_item("main", "mobs:saddle")
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
minetest.add_entity(pos, "mobs_mc:horsepegh1")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_mc:horse3", {
|
||||
type = "animal",
|
||||
hp_min = 5,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
textures = {
|
||||
{"mobs_horsearah.png"},
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_horse.x",
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:meat_raw",
|
||||
chance = 1,
|
||||
min = 2,
|
||||
max = 3,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 6,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
stand_start = 25, stand_end = 75,
|
||||
walk_start = 75, walk_end = 100,
|
||||
},
|
||||
follow = "farming:wheat",
|
||||
view_range = 5,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local tool = clicker:get_wielded_item()
|
||||
if tool:get_name() == "mobs:saddle" then
|
||||
clicker:get_inventory():remove_item("main", "mobs:saddle")
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
minetest.add_entity(pos, "mobs_mc:horsearah1")
|
||||
end
|
||||
end,
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:horse", {"default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 20, 12, 21000, 1, 12)
|
||||
mobs:register_spawn("mobs_mc:horse2", {"default:dirt_with_dry_grass"}, 20, 12, 23000, 1, 31000)
|
||||
mobs:register_spawn("mobs_mc:horse3", {"default:desert_sand"}, 20, 8, 17000, 1, 5)
|
||||
|
||||
|
||||
-- saddle
|
||||
minetest.register_craftitem(":mobs:saddle", {
|
||||
description = "Saddle",
|
||||
inventory_image = "saddle.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:saddle",
|
||||
recipe = {
|
||||
{"mobs:leather", "mobs:leather", "mobs:leather"},
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"}
|
||||
},
|
||||
})
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:horse", "mobs_mc:horse")
|
||||
mobs:alias_mob("mobs:horse2", "mobs_mc:horse2")
|
||||
mobs:alias_mob("mobs:horse3", "mobs_mc:horse3")
|
||||
|
||||
-- spawn eggs
|
||||
-- KPV wild horse spawn eggs
|
||||
mobs:register_egg("mobs_mc:horse", "Brown Horse", "mobs_horse_inv.png", 0)
|
||||
mobs:register_egg("mobs_mc:horse2", "White Horse", "mobs_horse_peg_inv.png", 0)
|
||||
mobs:register_egg("mobs_mc:horse3", "Arabic Horse", "mobs_horse_ara_inv.png", 0)
|
||||
-- KPV tamed horse spawn eggs
|
||||
mobs:register_egg("mobs_mc:horseh1", "Tamed Brown Horse", "mobs_horse_inv.png", 0)
|
||||
mobs:register_egg("mobs_mc:horsepegh1", "Tamed White Horse", "mobs_horse_peg_inv.png", 0)
|
||||
mobs:register_egg("mobs_mc:horsearah1", "Tamed Arabic Horse", "mobs_horse_ara_inv.png", 0)
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Horse loaded")
|
||||
end
|
31
mods/mobs_mc/init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
local path = minetest.get_modpath("mobs_mc")
|
||||
|
||||
-- Animals
|
||||
dofile(path .. "/chicken.lua") -- Mesh and animation by Pavel_S
|
||||
dofile(path .. "/cow.lua") -- Mesh by Morn76 Animation by Pavel_S
|
||||
dofile(path .. "/sheep.lua") -- Mesh and animation by Pavel_S
|
||||
dofile(path .. "/pig.lua") -- Mesh and animation by Pavel_S
|
||||
dofile(path .. "/horse.lua") -- KrupnoPavel
|
||||
dofile(path .. "/wolf.lua") -- KrupnoPavel
|
||||
dofile(path .. "/horse.lua") -- KrupnoPavel
|
||||
|
||||
|
||||
-- NPC
|
||||
dofile(path .. "/villager.lua") -- KrupnoPavel
|
||||
|
||||
--Monsters
|
||||
dofile(path .. "/creeper.lua") -- Mesh by Morn76 Animation by Pavel_S
|
||||
dofile(path .. "/skeleton.lua") -- Mesh by Morn76 Animation by Pavel_S
|
||||
dofile(path .. "/zombie.lua") -- Mesh by Morn76 Animation by Pavel_S
|
||||
dofile(path .. "/zombiepig.lua") -- Mesh by Morn76 Animation by Pavel_S
|
||||
dofile(path .. "/slimes.lua") -- Tomas J. Luis
|
||||
dofile(path .. "/spider.lua") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
|
||||
dofile(path .. "/enderman.lua") -- maikerumine
|
||||
dofile(path .. "/ghast.lua") -- maikerumine
|
||||
|
||||
print ("[MOD] Mobs Redo 'MC' loaded")
|
269
mods/mobs_mc/license.txt
Normal file
|
@ -0,0 +1,269 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes such as this one.
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
cows: right-click with empty bucket gets milk
|
||||
sheep: right-click gets wool
|
||||
chicken: right-click to get an egg
|
||||
|
||||
Milk and eggs need a food mod to be installed.
|
||||
|
||||
Textures are from Faithful 32x32 pack (http://www.minecraftforum.net/topic/72747-faithful-32x32-pack-updateocelot-two-cats-new-saplings-ctm-17/)
|
||||
|
||||
Sounds are from the Minecraft Wiki (Freesound license)
|
||||
|
||||
=====Pig=====(at layer 1)
|
||||
=====Cow=====(at layer 2)
|
||||
=====Sheep=====(at layer 3)
|
||||
|
||||
Ver.0.3
|
||||
Mesh by Morn76
|
||||
Animation by Pavel_S
|
||||
|
||||
===Chicken===
|
||||
Mesh and animation by Pavel_S
|
||||
|
||||
Meshes : Pig, Cow, Sheep
|
||||
Armatures : Pig_Rig, Cow_Rig, Sheep_Rig
|
||||
|
||||
==Animation==
|
||||
Optimized for 24fps.
|
||||
(the last frame equal to first in each animation)
|
||||
The first frame of each animation is default pose.
|
||||
=List of animations :
|
||||
standing (head bobbing slightly up and down) : 1-24
|
||||
walking : 24-50
|
||||
eating (head goes to the ground) : 50-79
|
||||
eating cycle : 58-73
|
||||
look around
|
||||
right : 79-99
|
||||
looking left pose : 89
|
||||
left : 99-119
|
||||
looking right pose : 109
|
||||
hurt (quick half jump with legs slightly crossed) : 119-155
|
||||
death (falls on left side) : 155-180
|
||||
|
||||
There is no delays for looking around and repeats for eating!
|
||||
|
||||
==Rig==
|
||||
See Pig_Rig.png
|
||||
|
||||
==ChangeLog==
|
||||
0.3
|
||||
Added Cow, Sheep
|
||||
Added Cow and Sheep animations
|
||||
Fixed UVunwraps
|
||||
Extended hurt and death animation
|
||||
|
||||
0.2
|
||||
Added Pig animation
|
||||
Fixed UVunwrap
|
||||
|
||||
=====Creeper=====
|
||||
Ver.0.3
|
||||
Mesh by Morn76
|
||||
Animation by Pavel_S
|
||||
|
||||
Meshes : Creeper
|
||||
Armatures : Creeper_Rig
|
||||
|
||||
==Animation==
|
||||
Optimized for 24fps.
|
||||
(the last frame equal to first in each animation)
|
||||
The first frame of each animation is default pose.
|
||||
=List of animations :
|
||||
standing : 1-25
|
||||
walking : 25-50
|
||||
look around
|
||||
right : 50-80
|
||||
looking left pose : 65
|
||||
left : 80-110
|
||||
looking right pose : 95
|
||||
hurt : 110-140
|
||||
death : 140-190
|
||||
|
||||
=====Skeleton=====
|
||||
Ver.0.3
|
||||
Mesh by Morn76
|
||||
Animation by Pavel_S
|
||||
|
||||
Meshes : Skeleton
|
||||
Armatures : Skeleton_Rig
|
||||
|
||||
==Animation==
|
||||
Optimized for 30fps.
|
||||
(the last frame equal to first in each animation)
|
||||
The first frame of each animation is default pose.
|
||||
=List of animations :
|
||||
standing (head bobbing slightly up and down) : 1-25
|
||||
walking : 25-50
|
||||
hurt (quick half jump with legs slightly crossed) : 85-117
|
||||
death (falls on left side) : 117-146
|
||||
|
||||
=====Zombie=====
|
||||
Mesh by Morn76
|
||||
Animation by Pavel_S
|
||||
|
||||
1 - 24 - standing
|
||||
24 - 48 - walking
|
||||
48 - 64 - running
|
||||
64 - 88 - hurm
|
||||
88 - 120 - death
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Original "Slimes Redone" README follows
|
||||
|
||||
"Slimes Redone" - Mod for Minetest (http://www.minetest.net/)
|
||||
|
||||
Introduction
|
||||
==========================================================================================================================
|
||||
This mod adds two type of mobs in the world of Minetest: green slimes and lava slimes. They are hostile and will attack the
|
||||
players as soon as they see them. If they are defeated, the slimes maybe will reward the player with useful resources.
|
||||
|
||||
Green slimes live in the tall grass of the jungles and in the ancient ruins of lost temples. And lava slimes live deep
|
||||
underground near the lava pools.
|
||||
|
||||
I've made this mod inspired by this other: https://forum.minetest.net/viewtopic.php?f=11&t=2979&hilit=slimes which adds friendly
|
||||
slimes. Thank you Jeija!
|
||||
|
||||
Details
|
||||
==========================================================================================================================
|
||||
- Adds two new hostile mobs: green slimes and lava slimes.
|
||||
- They attack players and hurt them on touch. (i'm not sure if the amount of damage is enough or too much...:/)
|
||||
- The biger ones split in a random amout of smaller versions when defeated: big > medium > small.
|
||||
- They can get different enviromental damage: water, lava, sunlight and falling.
|
||||
- They use custom textures and sounds. (more work needs to be done here ;P)
|
||||
- Cartoonish animation (they deform a bit when landing and stretch out when jumping).
|
||||
- Effects (blood, smoke, bubbles, footprints,..).
|
||||
- API to add new slimes.
|
||||
|
||||
Green slimes:
|
||||
> spawn in jungle grass or in temples mossy cobble (default:mossycobble).
|
||||
> on die, they drop a randomish amount of glue (from mesecon mod)
|
||||
> Lava hurts them.
|
||||
|
||||
Lava slimes:
|
||||
> spawn in lava pools deep under ground.
|
||||
> on die, they drop a randomish amount of gunpowder (from default tnt mod).
|
||||
> water hurts them.
|
||||
> when they jump they leave behind a footprint of fire. ^^
|
||||
|
||||
Install
|
||||
==========================================================================================================================
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
If you have a windows client or a linux run-in-place client.
|
||||
If you have a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
If you want to install this mod only in one world create the folder worldmods/ in your world directory.
|
||||
For further information or help see: http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
==========================================================================================================================
|
||||
Just install it an everything should work.
|
||||
|
||||
Mod Information
|
||||
==========================================================================================================================
|
||||
Version: 0.1
|
||||
Required Minetest Version: >=0.4.12
|
||||
Dependencies: default, default:tnt, mesecon (https://forum.minetest.net/viewtopic.php?f=11&t=628&hilit=mesecon)
|
||||
Soft Dependencies: (none)
|
||||
Highly Recommended: (none)
|
||||
Craft Recipies: (none)
|
||||
Git Repo: https://github.com/TomasJLuis/mt-slimes-redone
|
||||
|
||||
Modders/Developers
|
||||
=========================================================================================================================
|
||||
If you are a modder, you should know that I've never used LUA before. this is my first mod for Mintetest, and I've used
|
||||
this mod to learn how to mod on Minetest. So may be you will find a code full of mistakes and bad practices... ;P
|
||||
If you spot someting that can/must be improved/changed/removed and want to help me to improve this mode and my knowledge,
|
||||
please tell me here: https://forum.minetest.net/viewtopic.php?f=9&t=11743&p=175186#p175186
|
||||
Thank you!
|
||||
|
||||
Version history
|
||||
==========================================================================================================================
|
||||
0.1 - Initial release
|
||||
|
||||
Copyright and Licensing
|
||||
==========================================================================================================================
|
||||
|
||||
- Author: Tomas J. Luis
|
||||
|
||||
- Original sound for slime damage by RandomationPictures under licence CC0 1.0.
|
||||
http://www.freesound.org/people/RandomationPictures/sounds/138481/
|
||||
|
||||
- Original sounds for slime jump, land and death by Dr. Minky under licence CC BY 3.0.
|
||||
http://www.freesound.org/people/DrMinky/sounds/
|
||||
|
||||
- Source code and images by Tomas J. Luis under WTFPL.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Original "simple mobs" README follows
|
||||
|
||||
=== MOBS-MOD for MINETEST-C55 ===
|
||||
by PilzAdam
|
||||
|
||||
Inroduction:
|
||||
This mod adds some basic hostile and friendly mobs to the game.
|
||||
|
||||
How to install:
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
if you have a windows client or a linux run-in-place client. If you have
|
||||
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
If you want to install this mod only in one world create the folder
|
||||
worldmods/ in your worlddirectory.
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
See https://github.com/PilzAdam/mobs/wiki
|
||||
|
||||
For developers:
|
||||
The API documentation is moved to https://github.com/PilzAdam/mobs/wiki/API
|
||||
|
||||
License:
|
||||
Sourcecode: WTFPL (see below)
|
||||
Grahpics: WTFPL (see below)
|
||||
Models: WTFPL (by Pavel_S, see below)
|
||||
|
||||
See also:
|
||||
http://minetest.net/
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
|
||||
|
1
mods/mobs_mc/mod.conf
Normal file
|
@ -0,0 +1 @@
|
|||
name = mobs_mc
|
BIN
mods/mobs_mc/models/3d_armor_character.b3d
Normal file
6032
mods/mobs_mc/models/mobs_chicken.x
Normal file
6138
mods/mobs_mc/models/mobs_cow.x
Normal file
6168
mods/mobs_mc/models/mobs_creeper.x
Normal file
5739
mods/mobs_mc/models/mobs_horse.x
Normal file
5821
mods/mobs_mc/models/mobs_horseh1.x
Normal file
6032
mods/mobs_mc/models/mobs_mc_chicken.x
Normal file
6138
mods/mobs_mc/models/mobs_mc_cow.x
Normal file
5998
mods/mobs_mc/models/mobs_pig.x
Normal file
BIN
mods/mobs_mc/models/mobs_sand_monster.b3d
Normal file
7051
mods/mobs_mc/models/mobs_sheep.x
Normal file
5449
mods/mobs_mc/models/mobs_skeleton.x
Normal file
6110
mods/mobs_mc/models/mobs_spider.x
Normal file
5471
mods/mobs_mc/models/mobs_villager.x
Normal file
7420
mods/mobs_mc/models/mobs_wolf.x
Normal file
4293
mods/mobs_mc/models/mobs_zombie.x
Normal file
248
mods/mobs_mc/pig.lua
Normal file
|
@ -0,0 +1,248 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
mobs:register_mob("mobs_mc:pig", {
|
||||
type = "animal",
|
||||
hp_max = 25,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||
|
||||
visual = "mesh",
|
||||
mesh = "mobs_pig.x",
|
||||
textures = {
|
||||
{"mobs_pig.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:pork_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 3,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 3,
|
||||
sounds = {
|
||||
random = "Pig2",
|
||||
death = "Pigdeath",
|
||||
damage = "Pig2",
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
hurt_start = 118,
|
||||
hurt_end = 154,
|
||||
death_start = 154,
|
||||
death_end = 179,
|
||||
eat_start = 49,
|
||||
eat_end = 78,
|
||||
look_start = 78,
|
||||
look_end = 108,
|
||||
},
|
||||
follow = {"default:apple", "farming:potato", "farming:carrot"},
|
||||
view_range = 5,
|
||||
on_rightclick = function(self, clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
local item = clicker:get_wielded_item()
|
||||
if item:get_name() == "mobs:saddle" and self.saddle ~= "yes" then
|
||||
self.object:set_properties({
|
||||
textures = {"mobs_pig_with_saddle.png"},
|
||||
})
|
||||
self.saddle = "yes"
|
||||
self.tamed = true
|
||||
self.drops = {
|
||||
{name = "mcl_mobitems:pork_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 3,},
|
||||
{name = "mobs:saddle",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
}
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
local inv = clicker:get_inventory()
|
||||
local stack = inv:get_stack("main", clicker:get_wield_index())
|
||||
stack:take_item()
|
||||
inv:set_stack("main", clicker:get_wield_index(), stack)
|
||||
end
|
||||
return
|
||||
end
|
||||
-- from boats mod
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
clicker:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand" , 30)
|
||||
elseif not self.driver and self.saddle == "yes" then
|
||||
self.driver = clicker
|
||||
clicker:set_attach(self.object, "", {x = 0, y = 19, z = 0}, {x = 0, y = 0, z = 0})
|
||||
default.player_attached[name] = true
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(clicker, "sit" , 30)
|
||||
end)
|
||||
----[[
|
||||
-- ridable pigs
|
||||
if self.name == "mobs:pig" and self.saddle == "yes" and self.driver then
|
||||
local item = self.driver:get_wielded_item()
|
||||
if item:get_name() == "mobs:carrotstick" then
|
||||
local yaw = self.driver:get_look_yaw() - math.pi / 2
|
||||
local velo = self.object:getvelocity()
|
||||
local v = 1.5
|
||||
if math.abs(velo.x) + math.abs(velo.z) < .6 then velo.y = 5 end
|
||||
self.state = "walk"
|
||||
self:set_animation("walk")
|
||||
self.object:setyaw(yaw)
|
||||
self.object:setvelocity({x = -math.sin(yaw) * v, y = velo.y, z = math.cos(yaw) * v})
|
||||
|
||||
local inv = self.driver:get_inventory()
|
||||
local stack = inv:get_stack("main", self.driver:get_wield_index())
|
||||
stack:add_wear(100)
|
||||
if stack:get_wear() > 65400 then
|
||||
stack = {name = "fishing:pole", count = 1}
|
||||
end
|
||||
inv:set_stack("main", self.driver:get_wield_index(), stack)
|
||||
return
|
||||
end
|
||||
end
|
||||
--]]
|
||||
--self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
--from mobs_animals
|
||||
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||
return
|
||||
end
|
||||
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_spawn("mobs_mc:pig", {"default:dirt_with_grass"}, 20, 12, 5000, 1, 31000)
|
||||
|
||||
|
||||
-- pork
|
||||
minetest.register_craftitem(":mobs:pork_raw", {
|
||||
description = "Raw Porkchop",
|
||||
inventory_image = "pork_raw.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":mobs:pork_cooked", {
|
||||
description = "Cooked Porkchop",
|
||||
inventory_image = "pork_cooked.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mobs:pork_cooked",
|
||||
recipe = "mobs:pork_raw",
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem(":mobs:saddle", {
|
||||
description = "Saddle",
|
||||
inventory_image = "saddle.png",
|
||||
})
|
||||
|
||||
minetest.register_tool(":mobs:carrotstick", {
|
||||
description = "Carrot on a Stick",
|
||||
inventory_image = "carrot_on_a_stick.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:carrotstick",
|
||||
recipe = {
|
||||
{"", "", "farming:string" },
|
||||
{"", "group:stick", "farming:string" },
|
||||
{"group:stick", "", "farming:bread" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:carrotstick",
|
||||
recipe = {
|
||||
{"", "", "farming:string" },
|
||||
{"", "group:stick", "farming:string" },
|
||||
{"group:stick", "", "farming:carrot" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mobs:carrotstick",
|
||||
recipe = {"fishing:pole_wood", "farming:carrot"},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:saddle",
|
||||
recipe = {
|
||||
{"mobs:leather", "mobs:leather", "mobs:leather"},
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"}
|
||||
},
|
||||
})
|
||||
|
||||
--api code to fix
|
||||
--[[
|
||||
|
||||
on_step = function(self, dtime)
|
||||
-- ridable pigs
|
||||
if self.name == "mobs:pig" and self.saddle == "yes" and self.driver then
|
||||
local item = self.driver:get_wielded_item()
|
||||
if item:get_name() == "mobs:carrotstick" then
|
||||
local yaw = self.driver:get_look_yaw() - math.pi / 2
|
||||
local velo = self.object:getvelocity()
|
||||
local v = 1.5
|
||||
if math.abs(velo.x) + math.abs(velo.z) < .6 then velo.y = 5 end
|
||||
self.state = "walk"
|
||||
self:set_animation("walk")
|
||||
self.object:setyaw(yaw)
|
||||
self.object:setvelocity({x = -math.sin(yaw) * v, y = velo.y, z = math.cos(yaw) * v})
|
||||
|
||||
local inv = self.driver:get_inventory()
|
||||
local stack = inv:get_stack("main", self.driver:get_wield_index())
|
||||
stack:add_wear(100)
|
||||
if stack:get_wear() > 65400 then
|
||||
stack = {name = "fishing:pole", count = 1}
|
||||
end
|
||||
inv:set_stack("main", self.driver:get_wield_index(), stack)
|
||||
return
|
||||
end
|
||||
end
|
||||
end,
|
||||
]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:pig", "mobs_mc:pig")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:pig", "Pig", "spawn_egg_pig.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Pig loaded")
|
||||
end
|
21
mods/mobs_mc/readme.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
MC MOBS
|
||||
WIP
|
||||
assembled by maikerumine
|
||||
compatable with mobs redo api
|
||||
|
||||
|
||||
Chicken
|
||||
|
||||
- Found in green areas (bamboo biome in ethereal) and lays eggs on flat ground, Can be picked up and placed in inventory and gives 1-2 raw chicken when killed. Feed 8x wheat seed to breed.
|
||||
|
||||
Cow
|
||||
|
||||
- Wanders around eating grass/wheat and can be right-clicked with empty bucket to get milk. Cows will defend themselves when hit and can be right-clicked with 8x wheat to tame and breed.
|
||||
|
||||
Sheep
|
||||
|
||||
- Green grass and wheat munchers that can be clipped using shears to give 1-3 wool. Feed sheep 8x wheat to regrow wool, tame and breed. Will drop 1-3 meat when killed.
|
||||
|
||||
|
||||
Note: After breeding animals need to rest for 4 minutes, baby animals take 4 minutes to grow up and feeding them helps them grow quicker...
|
159
mods/mobs_mc/sheep.lua
Normal file
|
@ -0,0 +1,159 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
--mcsheep
|
||||
mobs:register_mob("mobs_mc:sheep", {
|
||||
type = "animal",
|
||||
hp_max = 25,
|
||||
collisionbox = {-0.5, -0.01, -0.5, 0.5, 1.5, 0.5},
|
||||
|
||||
visual = "mesh",
|
||||
mesh = "mobs_sheep.x",
|
||||
textures = {
|
||||
{"mobs_sheep.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mcl_mobs:mutton_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 2,},
|
||||
{name = "wool:white",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 3,
|
||||
sounds = {
|
||||
random = "Sheep3",
|
||||
death = "Sheep3",
|
||||
damage = "Sheep3",
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
hurt_start = 118,
|
||||
hurt_end = 154,
|
||||
death_start = 154,
|
||||
death_end = 179,
|
||||
eat_start = 49,
|
||||
eat_end = 78,
|
||||
look_start = 78,
|
||||
look_end = 108,
|
||||
},
|
||||
follow = "farming:wheat",
|
||||
view_range = 5,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
if item:get_name() == "farming:wheat" then
|
||||
if not self.tamed then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
self.tamed = true
|
||||
elseif self.naked then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
self.food = (self.food or 0) + 1
|
||||
if self.food >= 4 then
|
||||
self.food = 0
|
||||
self.naked = false
|
||||
self.object:set_properties({
|
||||
textures = {"sheep.png"},
|
||||
})
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
if item:get_name() == "mobs:shears" and not self.naked then
|
||||
self.naked = true
|
||||
local pos = self.object:getpos()
|
||||
minetest.sound_play("shears", {pos = pos})
|
||||
pos.y = pos.y + 0.5
|
||||
if not self.color then
|
||||
minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3)))
|
||||
else
|
||||
minetest.add_item(pos, ItemStack("wool:"..self.color.." "..math.random(1,3)))
|
||||
end
|
||||
self.object:set_properties({
|
||||
textures = {"sheep_sheared.png"},
|
||||
})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:add_wear(300)
|
||||
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
||||
end
|
||||
end
|
||||
if minetest.get_item_group(item:get_name(), "dye") == 1 and not self.naked then
|
||||
print(item:get_name(), minetest.get_item_group(item:get_name(), "dye"))
|
||||
local name = item:get_name()
|
||||
local pname = name:split(":")[2]
|
||||
|
||||
self.object:set_properties({
|
||||
textures = {"mobs_sheep_"..pname..".png"},
|
||||
})
|
||||
self.color = pname
|
||||
self.drops = {
|
||||
{name = "mcl_mobs:mutton_raw",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 2,},
|
||||
{name = "wool:"..self.color,
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
}
|
||||
end
|
||||
end,
|
||||
})
|
||||
--mobs:register_spawn("mobs_mc:sheep", {"default:dirt_with_grass"}, 20, 12, 5000, 2, 31000)
|
||||
|
||||
|
||||
--mutton
|
||||
minetest.register_craftitem(":mobs:mutton_raw", {
|
||||
description = "Raw Mutton",
|
||||
inventory_image = "mutton_raw.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":mobs:mutton_cooked", {
|
||||
description = "Cooked Mutton",
|
||||
inventory_image = "mutton_cooked.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mobs:mutton_cooked",
|
||||
recipe = "mobs:mutton_raw",
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:sheep", "mobs_mc:sheep")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:sheep", "Sheep", "spawn_egg_sheep.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Sheep loaded")
|
||||
end
|
332
mods/mobs_mc/skeleton.lua
Normal file
|
@ -0,0 +1,332 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
mobs:register_mob("mobs_mc:skeleton", {
|
||||
type = "monster",
|
||||
hp_max = 30,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
visual = "mesh",
|
||||
mesh = "mobs_skeleton.x",
|
||||
textures = {
|
||||
{"mobs_skeleton.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "skeleton1",
|
||||
death = "skeletondeath",
|
||||
damage = "skeletonhurt1",
|
||||
},
|
||||
walk_velocity = 1.2,
|
||||
run_velocity = 2.4,
|
||||
damage = 1,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "throwing:arrow",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
{name = "throwing:bow",
|
||||
chance = 11,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "bonemeal:bone",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 60,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
run_start = 24,
|
||||
run_end = 49,
|
||||
hurt_start = 85,
|
||||
hurt_end = 115,
|
||||
death_start = 117,
|
||||
death_end = 145,
|
||||
shoot_start = 50,
|
||||
shoot_end = 82,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 1,
|
||||
view_range = 16,
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs:arrow_entity",
|
||||
shoot_interval = 2.5,
|
||||
shoot_offset = 1,
|
||||
--'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
|
||||
--'dogshoot_count_max' number of seconds before switching above modes.
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max =3,
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:skeleton", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:skeleton2", {
|
||||
type = "monster",
|
||||
hp_max = 60,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
visual = "mesh",
|
||||
mesh = "mobs_skeleton.x",
|
||||
textures = {
|
||||
{"mobs_skeleton2.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "skeleton1",
|
||||
death = "skeletondeath",
|
||||
damage = "skeletonhurt1",
|
||||
},
|
||||
walk_velocity = 1.2,
|
||||
run_velocity = 2.4,
|
||||
damage = 3,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "throwing:arrow",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
{name = "throwing:bow",
|
||||
chance = 11,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "bonemeal:bone",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 2,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 60,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
run_start = 24,
|
||||
run_end = 49,
|
||||
hurt_start = 85,
|
||||
hurt_end = 115,
|
||||
death_start = 117,
|
||||
death_end = 145,
|
||||
shoot_start = 50,
|
||||
shoot_end = 82,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs:arrow_entity",
|
||||
shoot_interval = 0.5,
|
||||
shoot_offset = 1,
|
||||
--'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
|
||||
--'dogshoot_count_max' number of seconds before switching above modes.
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max =6,
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:skeleton2", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, -3000)
|
||||
|
||||
|
||||
|
||||
-- leather, feathers, etc.
|
||||
minetest.register_craftitem(":mobs:feather", {
|
||||
description = "Feather",
|
||||
inventory_image = "mobs_feather.png",
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
--maikerumines throwing code
|
||||
--arrow (weapon)
|
||||
minetest.register_craftitem(":mobs:arrow", {
|
||||
description = "ESM Arrow",
|
||||
inventory_image = "arrow.png",
|
||||
})
|
||||
|
||||
minetest.register_node(":mobs:arrow_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
|
||||
|
||||
local THROWING_ARROW_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"mobs:arrow_box"},
|
||||
--textures = {"esmobs:arrow.png"},
|
||||
velocity = 10,
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
|
||||
--ARROW CODE
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
vel = {x=0, y=0, z=0},
|
||||
acc = {x=0, y=0, z=0},
|
||||
expirationtime = .3,
|
||||
size = 1,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "arrow_particle.png",
|
||||
})
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1.5)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "mobs:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
local damage = 3
|
||||
minetest.sound_play("damage", {pos = pos})
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
local damage = 3
|
||||
minetest.sound_play("damage", {pos = pos})
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
minetest.sound_play("bowhit1", {pos = pos})
|
||||
--minetest.punch_node(pos) --this crash game when bones for mobs used
|
||||
minetest.add_item(self.lastpos, 'mobs:arrow')
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
|
||||
minetest.register_entity(":mobs:arrow_entity", THROWING_ARROW_ENTITY)
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mobs:arrow 48',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
{'mobs:feather'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
arrows = {
|
||||
{"mobs:arrow", "mobs:arrow_entity" },
|
||||
}
|
||||
|
||||
local throwing_shoot_arrow = function(itemstack, player)
|
||||
for _,arrow in ipairs(arrows) do
|
||||
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:get_inventory():remove_item("main", arrow[1])
|
||||
end
|
||||
local playerpos = player:getpos()
|
||||
--local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) --current
|
||||
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) --mc
|
||||
local dir = player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*22, y=dir.y*22, z=dir.z*22})
|
||||
obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
|
||||
obj:setyaw(player:get_look_yaw()+math.pi)
|
||||
minetest.sound_play("throwing_sound", {pos=playerpos})
|
||||
if obj:get_luaentity().player == "" then
|
||||
obj:get_luaentity().player = player
|
||||
end
|
||||
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_tool(":mobs:bow_wood", {
|
||||
description = "ESM Wood Bow",
|
||||
inventory_image = "bow_standby.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/50)
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mobs:bow_wood',
|
||||
recipe = {
|
||||
{'farming:cotton', 'default:stick', ''},
|
||||
{'farming:cotton', '', 'default:stick'},
|
||||
{'farming:cotton', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
--end maikerumine code
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:skeleton", "mobs_mc:skeleton")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:skeleton", "Skeleton", "spawn_egg_skeleton.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Skeleton loaded")
|
||||
end
|
368
mods/mobs_mc/slimes.lua
Normal file
|
@ -0,0 +1,368 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
mobs:register_mob("mobs_mc:greensmall", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 5,
|
||||
collisionbox = {-0.2, -0.4, -0.2, 0.2, 0.2, 0.2},
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
textures = {
|
||||
{"green_slime_top.png", "green_slime_bottom.png", "green_slime_front.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="green_slime_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
jump = "green_slime_jump",
|
||||
death = "green_slime_death",
|
||||
damage = "green_slime_damage",
|
||||
attack = "green_slime_attack",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 2.6,
|
||||
damage = 1,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "mesecons_materials:glue 1",
|
||||
chance = 3,
|
||||
min = 1,
|
||||
max = 4,},
|
||||
{name = "default:grass",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 4,
|
||||
jump_chance = 98,
|
||||
fear_height = 12,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_mc:greenmedium", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
|
||||
visual_size = {x=1.0, y=1.0},
|
||||
textures = {
|
||||
{"green_slime_top.png", "green_slime_bottom.png", "green_slime_front.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="green_slime_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
jump = "green_slime_jump",
|
||||
death = "green_slime_death",
|
||||
damage = "green_slime_damage",
|
||||
attack = "green_slime_attack",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 2.0,
|
||||
damage = 2,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "default:mossycobble",
|
||||
chance = 2,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "default:leaves",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 8,
|
||||
jump_chance = 100,
|
||||
fear_height = 60,
|
||||
on_die =function(self, pos)
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greensmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greensmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greensmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greensmall")
|
||||
ent = lavasmall:get_luaentity()
|
||||
end
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_mc:greenbig", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 25,
|
||||
collisionbox = {-0.75, -0.75, -0.75, 0.75, 0.75, 0.75},
|
||||
visual_size = {x=1.5, y=1.5},
|
||||
textures = {
|
||||
{"green_slime_top.png", "green_slime_bottom.png", "green_slime_front.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="green_slime_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
jump = "green_slime_jump",
|
||||
death = "green_slime_death",
|
||||
damage = "green_slime_damage",
|
||||
attack = "green_slime_attack",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 1.6,
|
||||
damage = 2,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "default:leaves",
|
||||
chance = 2,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "default:papyrus",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 8,
|
||||
jump_chance = 100,
|
||||
fear_height = 60,
|
||||
on_die =function(self, pos)
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greenmedium")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:greenmedium")
|
||||
ent = lavasmall:get_luaentity()
|
||||
end
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:greensmall", {"default:flowing_water", "default:mossycobble"}, 7, -1, 5000, 4, 31000)
|
||||
mobs:register_spawn("mobs_mc:greenmedium", {"default:flowing_water", "default:mossycobble"}, 7, -1, 5000, 4, 31000)
|
||||
mobs:register_spawn("mobs_mc:greenbig", {"default:flowing_water", "default:mossycobble"}, 7, -1, 5000, 4, 31000)
|
||||
|
||||
|
||||
|
||||
|
||||
mobs:register_mob("mobs_mc:lavasmall", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 15,
|
||||
collisionbox = {-0.2, -0.4, -0.2, 0.2, 0.2, 0.2},
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
textures = {
|
||||
{"lava_slime_top.png", "lava_slime_bottom.png", "lava_slime_front.png", "lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_sides.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="lava_slime_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
jump = "green_slime_jump",
|
||||
death = "green_slime_death",
|
||||
damage = "green_slime_damage",
|
||||
attack = "green_slime_attack",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 2.6,
|
||||
damage = 1,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "tnt:gunpowder",
|
||||
chance = 3,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "default:coal",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 4,
|
||||
jump_chance = 98,
|
||||
fear_height = 12,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_mc:lavabig", {
|
||||
type = "monster",
|
||||
pathfinding = true,
|
||||
group_attack = true,
|
||||
hp_max = 15,
|
||||
collisionbox = {-0.75, -0.75, -0.75, 0.75, 0.75, 0.75},
|
||||
visual_size = {x=1.5, y=1.5},
|
||||
textures = {
|
||||
{"lava_slime_top.png", "lava_slime_bottom.png", "lava_slime_front.png", "lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_sides.png"}
|
||||
},
|
||||
visual = "cube",
|
||||
blood_texture ="lava_slime_blood.png",
|
||||
rotate = 270,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
jump = "green_slime_jump",
|
||||
death = "green_slime_death",
|
||||
damage = "green_slime_damage",
|
||||
attack = "green_slime_attack",
|
||||
},
|
||||
walk_velocity = .8,
|
||||
run_velocity = 1.6,
|
||||
damage = 2,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "tnt:gunpowder",
|
||||
chance = 2,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
{name = "mobs_mc:lavasmall",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
hurt_start = 64,
|
||||
hurt_end = 86,
|
||||
death_start = 88,
|
||||
death_end = 118,
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
passive = false,
|
||||
jump = true,
|
||||
jump_height = 8,
|
||||
jump_chance = 100,
|
||||
fear_height = 60,
|
||||
on_die =function(self, pos)
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:lavasmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:lavasmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:lavasmall")
|
||||
lavasmall = minetest.add_entity(self.object:getpos(), "mobs_mc:lavasmall")
|
||||
ent = lavasmall:get_luaentity()
|
||||
end
|
||||
})
|
||||
|
||||
mobs:register_spawn("mobs_mc:lavasmall", {"nether:rack", "default:lava"}, 7, -1, 5000, 4, 31000)
|
||||
mobs:register_spawn("mobs_mc:lavabig", {"nether:rack", "default:lava"}, 7, -1, 5000, 4, 31000)
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:lavasmall", "mobs_mc:lavasmall")
|
||||
mobs:alias_mob("mobs:lavabig", "mobs_mc:lavabig")
|
||||
mobs:alias_mob("mobs:greensmall", "mobs_mc:greensmall")
|
||||
mobs:alias_mob("mobs:greenmediuml", "mobs_mc:greenmedium")
|
||||
mobs:alias_mob("mobs:greenbig", "mobs_mc:greenbig")
|
||||
|
||||
mobs:alias_mob("slimes:lavasmall", "mobs_mc:lavasmall")
|
||||
mobs:alias_mob("slimes:lavabig", "mobs_mc:lavabig")
|
||||
mobs:alias_mob("slimes:greensmall", "mobs_mc:greensmall")
|
||||
mobs:alias_mob("slimes:greenmediuml", "mobs_mc:greenmedium")
|
||||
mobs:alias_mob("slimes:greenbig", "mobs_mc:greenbig")
|
||||
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:lavabig", "Magma Cube", "spawn_egg_magma_cube.png")
|
||||
mobs:register_egg("mobs_mc:greenbig", "Green Slime", "spawn_egg_slime.png")
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Slimes loaded")
|
||||
end
|
BIN
mods/mobs_mc/sounds/Chicken1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Chickenhurt1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Chickenplop.ogg
Normal file
BIN
mods/mobs_mc/sounds/Cow1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Cowhurt1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Creeper4.ogg
Normal file
BIN
mods/mobs_mc/sounds/Creeperdeath.ogg
Normal file
BIN
mods/mobs_mc/sounds/Fuse.ogg
Normal file
BIN
mods/mobs_mc/sounds/Pig2.ogg
Normal file
BIN
mods/mobs_mc/sounds/Pigdeath.ogg
Normal file
BIN
mods/mobs_mc/sounds/Sheep3.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villager1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villageraccept.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villagerdead.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villagerdeny.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villagerhurt1.ogg
Normal file
BIN
mods/mobs_mc/sounds/Villagertrade.ogg
Normal file
BIN
mods/mobs_mc/sounds/bowhit1.ogg
Normal file
BIN
mods/mobs_mc/sounds/default_punch3.ogg
Normal file
BIN
mods/mobs_mc/sounds/explo.ogg
Normal file
BIN
mods/mobs_mc/sounds/green_slime_attack.ogg
Normal file
BIN
mods/mobs_mc/sounds/green_slime_damage.ogg
Normal file
BIN
mods/mobs_mc/sounds/green_slime_death.ogg
Normal file
BIN
mods/mobs_mc/sounds/green_slime_jump.ogg
Normal file
BIN
mods/mobs_mc/sounds/green_slime_land.ogg
Normal file
BIN
mods/mobs_mc/sounds/mobs_eerie.ogg
Normal file
BIN
mods/mobs_mc/sounds/mobs_fireball.ogg
Normal file
BIN
mods/mobs_mc/sounds/mobs_sandmonster.ogg
Normal file
BIN
mods/mobs_mc/sounds/mobs_sheep.ogg
Normal file
BIN
mods/mobs_mc/sounds/mobs_spider.ogg
Normal file
BIN
mods/mobs_mc/sounds/skeleton1.ogg
Normal file
BIN
mods/mobs_mc/sounds/skeletondeath.ogg
Normal file
BIN
mods/mobs_mc/sounds/skeletonhurt1.ogg
Normal file
BIN
mods/mobs_mc/sounds/zombie1.ogg
Normal file
BIN
mods/mobs_mc/sounds/zombiedeath.ogg
Normal file
BIN
mods/mobs_mc/sounds/zombiehurt1.ogg
Normal file
104
mods/mobs_mc/spider.lua
Normal file
|
@ -0,0 +1,104 @@
|
|||
--MCmobs v0.2
|
||||
--maikerumine
|
||||
--made for MC like Survival game
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
|
||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
-- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
|
||||
mobs:register_mob("mobs_mc:spider", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
attack_type = "dogfight",
|
||||
pathfinding = true,
|
||||
damage = 2,
|
||||
hp_min = 12,
|
||||
hp_max = 20,
|
||||
armor = 100,
|
||||
collisionbox = {-0.9, -0.01, -0.7, 0.7, 0.6, 0.7},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_spider.x",
|
||||
textures = {
|
||||
{"mobs_spider.png"}
|
||||
},
|
||||
visual_size = {x=5,y=5},
|
||||
makes_footstep_sound = false,
|
||||
sounds = {
|
||||
random = "mobs_spider",
|
||||
attack = "mobs_spider",
|
||||
},
|
||||
walk_velocity = 1.7,
|
||||
run_velocity = 3.3,
|
||||
jump = true,
|
||||
view_range = 15,
|
||||
floats = 0,
|
||||
group_attack = true,
|
||||
replace_rate = 5,
|
||||
replace_what = {"default:torch"},
|
||||
replace_with = "air",
|
||||
replace_offset = -1,
|
||||
peaceful = false,
|
||||
drops = {
|
||||
{name = "default:string",
|
||||
chance = 1, min = 1, max = 5,},
|
||||
{name = "mcl_mobitems:meat_raw",
|
||||
chance = 1, min = 0, max = 1,},
|
||||
},
|
||||
water_damage = 5,
|
||||
lava_damage = 50,
|
||||
light_damage = 0,
|
||||
fear_height = 14,
|
||||
animation = {
|
||||
speed_normal = 15, speed_run = 15,
|
||||
stand_start = 1, stand_end = 1,
|
||||
walk_start = 20, walk_end = 40,
|
||||
run_start = 20, run_end = 40,
|
||||
punch_start = 50, punch_end = 90,
|
||||
},
|
||||
})
|
||||
mobs:register_spawn("mobs_mc:spider", {"default:stone" ,"default:gravel","default:cobble","group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 4, -1, 17000, 2, 3000)
|
||||
|
||||
|
||||
-- Cobweb
|
||||
minetest.register_node(":mobs:cobweb", {
|
||||
description = "Cobweb",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.1,
|
||||
tiles = {"mobs_cobweb.png"},
|
||||
inventory_image = "mobs_cobweb.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
liquid_viscosity = 11,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mobs:cobweb",
|
||||
liquid_alternative_source = "mobs:cobweb",
|
||||
liquid_renewable = false,
|
||||
liquid_range = 0,
|
||||
walkable = false,
|
||||
groups = {snappy=1,liquid=3},
|
||||
drop = "farming:cotton",
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:cobweb",
|
||||
recipe = {
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"", "farming:string", ""},
|
||||
{"farming:string", "", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-- compatibility
|
||||
mobs:alias_mob("mobs:spider", "mobs_mc:spider")
|
||||
mobs:alias_mob("esmobs:spider", "mobs_mc:spider")
|
||||
|
||||
-- spawn eggs
|
||||
mobs:register_egg("mobs_mc:spider", "Spider", "mobs_cobweb.png", 1)
|
||||
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "MC Spiders loaded")
|
||||
end
|
BIN
mods/mobs_mc/textures/Original_Zombiepig_Man_by_Fedora_P.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
mods/mobs_mc/textures/bones_bottom.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
mods/mobs_mc/textures/bones_front.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
mods/mobs_mc/textures/bones_rear.png
Normal file
After Width: | Height: | Size: 306 B |
BIN
mods/mobs_mc/textures/bones_side.png
Normal file
After Width: | Height: | Size: 289 B |
BIN
mods/mobs_mc/textures/bones_top.png
Normal file
After Width: | Height: | Size: 279 B |
BIN
mods/mobs_mc/textures/carrot_on_a_stick.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
mods/mobs_mc/textures/ghast_front.png
Normal file
After Width: | Height: | Size: 610 B |
BIN
mods/mobs_mc/textures/ghast_white.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
mods/mobs_mc/textures/green_slime_blood.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
mods/mobs_mc/textures/green_slime_bottom.png
Normal file
After Width: | Height: | Size: 422 B |
BIN
mods/mobs_mc/textures/green_slime_front.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
mods/mobs_mc/textures/green_slime_sides.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
mods/mobs_mc/textures/green_slime_top.png
Normal file
After Width: | Height: | Size: 386 B |
BIN
mods/mobs_mc/textures/lava_slime_blood.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
mods/mobs_mc/textures/lava_slime_bottom.png
Normal file
After Width: | Height: | Size: 461 B |
BIN
mods/mobs_mc/textures/lava_slime_front.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
mods/mobs_mc/textures/lava_slime_sides.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
mods/mobs_mc/textures/lava_slime_top.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
mods/mobs_mc/textures/mobs_blood.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
mods/mobs_mc/textures/mobs_bucket_milk.png
Normal file
After Width: | Height: | Size: 312 B |
BIN
mods/mobs_mc/textures/mobs_chicken.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
mods/mobs_mc/textures/mobs_chicken_egg.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
mods/mobs_mc/textures/mobs_chicken_egg_fried.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
mods/mobs_mc/textures/mobs_chicken_egg_overlay.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
mods/mobs_mc/textures/mobs_cobweb.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
mods/mobs_mc/textures/mobs_cow.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/mobs_mc/textures/mobs_creeper.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
mods/mobs_mc/textures/mobs_creeper_front.png
Normal file
After Width: | Height: | Size: 3.6 KiB |