mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Finish the mobs update
This commit is contained in:
parent
5f9d3c54bd
commit
a291222ea6
Binary file not shown.
@ -29,6 +29,7 @@ This mod contains the following additions:
|
|||||||
Changelog:
|
Changelog:
|
||||||
|
|
||||||
beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop
|
beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop
|
||||||
|
1.06- Changed recovery times after breeding, and time taken to grow up (can be sped up by feeding baby animal)
|
||||||
1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten
|
1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten
|
||||||
1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :)
|
1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :)
|
||||||
1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc.
|
1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- Mobs Api (15th March 2015)
|
-- Mobs Api (24th March 2015)
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
|
|
||||||
@ -341,76 +341,23 @@ function mobs:register_mob(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.following and self.following:is_player() and self.following:get_wielded_item():get_name() ~= self.follow then
|
|
||||||
self.following = nil
|
|
||||||
self.v_start = false
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.following then
|
-- horny animal can mate for 40 seconds, afterwards horny animal cannot mate again for 200 seconds
|
||||||
|
if self.horny == true and self.hornytimer < 240 and self.child == false then
|
||||||
local s = self.object:getpos()
|
|
||||||
local p
|
|
||||||
if self.following.is_player and self.following:is_player() then
|
|
||||||
p = self.following:getpos()
|
|
||||||
elseif self.following.object then
|
|
||||||
p = self.following.object:getpos()
|
|
||||||
end
|
|
||||||
|
|
||||||
if p then
|
|
||||||
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) <= 1.5 and self.object:getvelocity().y == 0 then
|
|
||||||
local v = self.object:getvelocity()
|
|
||||||
v.y = 6
|
|
||||||
self.object:setvelocity(v)
|
|
||||||
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
|
|
||||||
|
|
||||||
-- horny animal can mate for 40 seconds, afterwards horny animal cannot mate again for 60 seconds
|
|
||||||
if self.horny == true and self.hornytimer < 100 and self.child == false then
|
|
||||||
self.hornytimer = self.hornytimer + 1
|
self.hornytimer = self.hornytimer + 1
|
||||||
if self.hornytimer <= 40 then
|
if self.hornytimer <= 40 then
|
||||||
effect(self.object:getpos(), 4, "heart.png")
|
effect(self.object:getpos(), 4, "heart.png")
|
||||||
end
|
end
|
||||||
if self.hornytimer >= 100 then
|
if self.hornytimer >= 240 then
|
||||||
self.hornytimer = 0
|
self.hornytimer = 0
|
||||||
self.horny = false
|
self.horny = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if animal is child take 120 seconds before growing into adult
|
-- if animal is child take 240 seconds before growing into adult
|
||||||
if self.child == true then
|
if self.child == true then
|
||||||
self.hornytimer = self.hornytimer + 1
|
self.hornytimer = self.hornytimer + 1
|
||||||
if self.hornytimer > 120 then
|
if self.hornytimer > 240 then
|
||||||
self.child = false
|
self.child = false
|
||||||
self.hornytimer = 0
|
self.hornytimer = 0
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
@ -464,6 +411,59 @@ function mobs:register_mob(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.following and self.following:is_player() and self.following:get_wielded_item():get_name() ~= self.follow then
|
||||||
|
self.following = nil
|
||||||
|
self.v_start = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.following then
|
||||||
|
|
||||||
|
local s = self.object:getpos()
|
||||||
|
local p
|
||||||
|
if self.following.is_player and self.following:is_player() then
|
||||||
|
p = self.following:getpos()
|
||||||
|
elseif self.following.object then
|
||||||
|
p = self.following.object:getpos()
|
||||||
|
end
|
||||||
|
|
||||||
|
if p then
|
||||||
|
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 -- 0.5 was 1.5
|
||||||
|
local v = self.object:getvelocity()
|
||||||
|
v.y = 6
|
||||||
|
self.object:setvelocity(v)
|
||||||
|
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 self.state == "stand" then
|
||||||
-- randomly turn
|
-- randomly turn
|
||||||
if math.random(1, 4) == 1 then
|
if math.random(1, 4) == 1 then
|
||||||
@ -825,14 +825,13 @@ function mobs:register_mob(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- quick fix for dog so it doesn't revert back to wolf
|
||||||
|
if self.type == "monster" and self.tamed == true then
|
||||||
|
self.type = "npc"
|
||||||
|
end
|
||||||
if self.lifetimer <= 0 and not self.tamed and self.type ~= "npc" then
|
if self.lifetimer <= 0 and not self.tamed and self.type ~= "npc" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Internal check to see if player damage is still enabled
|
|
||||||
damage_enabled = minetest.setting_getbool("enable_damage")
|
|
||||||
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
-- Chicken by JK Murray
|
-- Chicken by JK Murray
|
||||||
|
|
||||||
mobs:register_mob("mobs:chicken", {
|
mobs:register_mob("mobs:chicken", {
|
||||||
@ -138,7 +139,7 @@ description = "Raw Chicken",
|
|||||||
minetest.register_craftitem("mobs:chicken_cooked", {
|
minetest.register_craftitem("mobs:chicken_cooked", {
|
||||||
description = "Cooked Chicken",
|
description = "Cooked Chicken",
|
||||||
inventory_image = "mobs_chicken_cooked.png",
|
inventory_image = "mobs_chicken_cooked.png",
|
||||||
on_use = minetest.item_eat(4),
|
on_use = minetest.item_eat(4), -- Modif MFF
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -61,8 +61,16 @@ mobs:register_mob("mobs:cow", {
|
|||||||
local tool = clicker:get_wielded_item()
|
local tool = clicker:get_wielded_item()
|
||||||
if tool:get_name() == "bucket:bucket_empty" and self.child == false then
|
if tool:get_name() == "bucket:bucket_empty" and self.child == false then
|
||||||
if self.gotten then return end
|
if self.gotten then return end
|
||||||
clicker:get_inventory():remove_item("main", "bucket:bucket_empty")
|
local inv = clicker:get_inventory()
|
||||||
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
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
|
||||||
self.gotten = true -- milked
|
self.gotten = true -- milked
|
||||||
end
|
end
|
||||||
if tool:get_name() == "farming:wheat" then -- and self.gotten then
|
if tool:get_name() == "farming:wheat" then -- and self.gotten then
|
||||||
@ -71,6 +79,9 @@ mobs:register_mob("mobs:cow", {
|
|||||||
clicker:set_wielded_item(tool)
|
clicker:set_wielded_item(tool)
|
||||||
end
|
end
|
||||||
self.food = (self.food or 0) + 1
|
self.food = (self.food or 0) + 1
|
||||||
|
if self.child == true then
|
||||||
|
self.hornytimer = self.hornytimer + 10
|
||||||
|
end
|
||||||
if self.food >= 8 then
|
if self.food >= 8 then
|
||||||
self.food = 0
|
self.food = 0
|
||||||
if self.child == false then self.horny = true end
|
if self.child == false then self.horny = true end
|
||||||
@ -93,6 +104,7 @@ minetest.register_craftitem("mobs:leather", {
|
|||||||
description = "Leather",
|
description = "Leather",
|
||||||
inventory_image = "mobs_leather.png",
|
inventory_image = "mobs_leather.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Bucket of Milk
|
-- Bucket of Milk
|
||||||
minetest.register_craftitem("mobs:bucket_milk", {
|
minetest.register_craftitem("mobs:bucket_milk", {
|
||||||
description = "Bucket of Milk",
|
description = "Bucket of Milk",
|
||||||
|
@ -7,7 +7,7 @@ local excluded = {"nether:netherrack","default:obsidian_glass","default:obsidian
|
|||||||
mobs:register_mob("mobs:dungeon_master", {
|
mobs:register_mob("mobs:dungeon_master", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, shoots fireballs at player
|
-- aggressive, shoots fireballs at player, deal 13 damages
|
||||||
passive = false,
|
passive = false,
|
||||||
damage = 13,
|
damage = 13,
|
||||||
attack_type = "shoot",
|
attack_type = "shoot",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:lava_flan", {
|
mobs:register_mob("mobs:lava_flan", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, deals 3 damage to player when hit
|
-- aggressive, deals 5 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 5,
|
damage = 5,
|
||||||
@ -32,7 +32,7 @@ mobs:register_mob("mobs:lava_flan", {
|
|||||||
walk_velocity = 0.5,
|
walk_velocity = 0.5,
|
||||||
run_velocity = 2,
|
run_velocity = 2,
|
||||||
jump = true,
|
jump = true,
|
||||||
-- step = 2, (ça aurait été pas mal, voir comment faire pour le remettre comme ça ?)
|
-- step = 2, (c'était pas mal, voir comment faire pour le remettre comme ça ?)
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
floats = 0,
|
floats = 0,
|
||||||
-- chance of dropping lava orb when dead
|
-- chance of dropping lava orb when dead
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:mese_monster", {
|
mobs:register_mob("mobs:mese_monster", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- agressive, deals 3 damage to player when hit
|
-- agressive, deals 9 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
damage = 9,
|
damage = 9,
|
||||||
attack_type = "shoot",
|
attack_type = "shoot",
|
||||||
@ -78,7 +78,7 @@ mobs:register_arrow("mobs:mese_arrow", {
|
|||||||
|
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=9},
|
||||||
}, 0)
|
}, 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:a
|
|||||||
mobs:register_mob("mobs:npc", {
|
mobs:register_mob("mobs:npc", {
|
||||||
-- animal, monster, npc
|
-- animal, monster, npc
|
||||||
type = "npc",
|
type = "npc",
|
||||||
-- aggressive, deals 4 damage to player/monster when hit
|
-- aggressive, deals 6 damage to player/monster when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
damage = 6,
|
damage = 6,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:oerkki", {
|
mobs:register_mob("mobs:oerkki", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, deals 5 damage when player hit
|
-- aggressive, deals 7 damage when player hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 7,
|
damage = 7,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:sand_monster", {
|
mobs:register_mob("mobs:sand_monster", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, deals 3 damage to player when hit
|
-- aggressive, deals 5 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 5,
|
damage = 5,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:spider", {
|
mobs:register_mob("mobs:spider", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- agressive, does 4 damage to player when hit
|
-- agressive, does 6 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 6,
|
damage = 6,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:stone_monster", {
|
mobs:register_mob("mobs:stone_monster", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, deals 5 damage to player when hit
|
-- aggressive, deals 8 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 8,
|
damage = 8,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:tree_monster", {
|
mobs:register_mob("mobs:tree_monster", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
-- aggressive, deals 8 damage to player when hit
|
-- aggressive, deals 9 damage to player when hit
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 9,
|
damage = 9,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mobs:register_mob("mobs:pumba", {
|
mobs:register_mob("mobs:pumba", {
|
||||||
-- animal, monster, npc, barbarian
|
-- animal, monster, npc, barbarian
|
||||||
type = "animal",
|
type = "animal",
|
||||||
-- aggressive, deals 4 damage to player when threatened
|
-- aggressive, deals 5 damage to player when threatened
|
||||||
passive = false,
|
passive = false,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 5,
|
damage = 5,
|
||||||
|
Loading…
Reference in New Issue
Block a user