1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-09-30 00:10:33 +02:00

Begin the mobs update

This commit is contained in:
Ombridride 2015-03-25 17:25:54 +01:00
parent e2a49d6552
commit 8d45d416be
11 changed files with 47 additions and 35 deletions

View File

@ -446,7 +446,7 @@ function mobs:register_mob(name, def)
--print ("spawned baby:",self.name) --print ("spawned baby:",self.name)
local mob = minetest.add_entity(pos, self.name) local mob = minetest.add_entity(pos, self.name)
local ent2 = mob:get_luaentity() local ent2 = mob:get_luaentity()
local texture = self.base_texture local textures = self.base_texture
if def.child_texture then if def.child_texture then
print ("child texture detected") print ("child texture detected")
textures = def.child_texture[1] textures = def.child_texture[1]

View File

@ -46,7 +46,7 @@ mobs:register_mob("mobs:bee", {
}, },
-- right click to pick up bee -- right click to pick up bee
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bee") then
clicker:get_inventory():add_item("main", "mobs:bee") clicker:get_inventory():add_item("main", "mobs:bee")
self.object:remove() self.object:remove()
end end

View File

@ -63,7 +63,7 @@ mobs:register_mob("mobs:bunny", {
end end
return return
end end
if clicker:is_player() and clicker:get_inventory() then if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bunny") then
clicker:get_inventory():add_item("main", "mobs:bunny") clicker:get_inventory():add_item("main", "mobs:bunny")
self.object:remove() self.object:remove()
end end

View File

@ -10,7 +10,7 @@ mobs:register_mob("mobs:chicken", {
-- textures and model -- textures and model
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3}, collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
visual = "mesh", visual = "mesh",
mesh = "chicken.x", mesh = "mobs_chicken.x",
drawtype = "front", drawtype = "front",
available_textures = { available_textures = {
total = 2, total = 2,
@ -78,7 +78,7 @@ mobs:register_mob("mobs:chicken", {
end end
return tool return tool
else else
if clicker:is_player() and clicker:get_inventory() then if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:chicken") then
clicker:get_inventory():add_item("main", "mobs:chicken") clicker:get_inventory():add_item("main", "mobs:chicken")
self.object:remove() self.object:remove()
end end

View File

@ -35,6 +35,8 @@ mobs:register_mob("mobs:cow", {
drops = { drops = {
{name = "mobs:meat_raw", {name = "mobs:meat_raw",
chance = 1, min = 5, max = 10}, chance = 1, min = 5, max = 10},
{name = "mobs:leather",
chance = 1, min = 0, max = 3},
}, },
-- damaged by -- damaged by
water_damage = 1, water_damage = 1,
@ -86,6 +88,11 @@ mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 10000, 1, 31
-- register spawn egg -- register spawn egg
mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1) mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1)
-- Leather
minetest.register_craftitem("mobs:leather", {
description = "Leather",
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",

View File

@ -2,35 +2,29 @@
dofile(minetest.get_modpath("mobs").."/api.lua") dofile(minetest.get_modpath("mobs").."/api.lua")
-- Animals inc. Krupnovpavel's warthog/bee, JKmurray's chicken, ExeterDad's bunny, Jordach/BFD's kitten -- Animals
dofile(minetest.get_modpath("mobs").."/chicken.lua") dofile(minetest.get_modpath("mobs").."/chicken.lua") -- JKmurray
dofile(minetest.get_modpath("mobs").."/cow.lua") dofile(minetest.get_modpath("mobs").."/cow.lua") -- KrupnoPavel
dofile(minetest.get_modpath("mobs").."/rat.lua") dofile(minetest.get_modpath("mobs").."/rat.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/sheep.lua") dofile(minetest.get_modpath("mobs").."/sheep.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/warthog.lua") dofile(minetest.get_modpath("mobs").."/warthog.lua") -- KrupnoPavel
dofile(minetest.get_modpath("mobs").."/bee.lua") dofile(minetest.get_modpath("mobs").."/bee.lua") -- KrupnoPavel
dofile(minetest.get_modpath("mobs").."/bunny.lua") dofile(minetest.get_modpath("mobs").."/bunny.lua") -- ExeterDad
dofile(minetest.get_modpath("mobs").."/kitten.lua") dofile(minetest.get_modpath("mobs").."/kitten.lua") -- Jordach/BFD
-- Monsters -- Monsters
dofile(minetest.get_modpath("mobs").."/dirtmonster.lua") dofile(minetest.get_modpath("mobs").."/dirtmonster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua") dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/oerkki.lua") dofile(minetest.get_modpath("mobs").."/oerkki.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/sandmonster.lua") dofile(minetest.get_modpath("mobs").."/sandmonster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/stonemonster.lua") dofile(minetest.get_modpath("mobs").."/stonemonster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/treemonster.lua") dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/wolf.lua") dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- Zeg9
-- Zmobs by Zeg9 dofile(minetest.get_modpath("mobs").."/mese_monster.lua") -- Zeg9
dofile(minetest.get_modpath("mobs").."/spider.lua") -- https://forum.minetest.net/viewtopic.php?pid=127538
dofile(minetest.get_modpath("mobs").."/lava_flan.lua")
dofile(minetest.get_modpath("mobs").."/mese_monster.lua")
-- Spider from Lord of the Test - https://forum.minetest.net/viewtopic.php?pid=127538
dofile(minetest.get_modpath("mobs").."/spider.lua")
-- NPC -- NPC
dofile(minetest.get_modpath("mobs").."/npc.lua") dofile(minetest.get_modpath("mobs").."/npc.lua")

View File

@ -64,7 +64,7 @@ mobs:register_mob("mobs:kitten", {
end end
return return
end end
if clicker:is_player() and clicker:get_inventory() then if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:kitten") then
clicker:get_inventory():add_item("main", "mobs:kitten") clicker:get_inventory():add_item("main", "mobs:kitten")
self.object:remove() self.object:remove()
end end

View File

@ -35,7 +35,7 @@ mobs:register_mob("mobs:rat", {
light_damage = 0, light_damage = 0,
-- right click to pick up rat -- right click to pick up rat
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:rat") then
clicker:get_inventory():add_item("main", "mobs:rat") clicker:get_inventory():add_item("main", "mobs:rat")
self.object:remove() self.object:remove()
end end

View File

@ -33,7 +33,9 @@ mobs:register_mob("mobs:sheep", {
-- drops raw meat when dead -- drops raw meat when dead
drops = { drops = {
{name = "mobs:meat_raw", {name = "mobs:meat_raw",
chance = 1, min = 2, max = 3,}, chance = 1, min = 2, max = 3},
{name = "wool:white",
chance = 1, min = 1, max = 1},
}, },
-- damaged by -- damaged by
water_damage = 1, water_damage = 1,
@ -61,6 +63,9 @@ mobs:register_mob("mobs:sheep", {
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
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
@ -75,10 +80,16 @@ mobs:register_mob("mobs:sheep", {
return return
end end
-- need shears to get wool from sheep -- need shears to get wool from sheep
if clicker:get_inventory() and item:get_name() == "mobs:shears" and not self.gotten and self.child == false then local inv = clicker:get_inventory()
if inv and item:get_name() == "mobs:shears" and not self.gotten and self.child == false then
self.gotten = true -- shaved self.gotten = true -- shaved
if minetest.registered_items["wool:white"] then if minetest.registered_items["wool:white"] then
clicker:get_inventory():add_item("main", ItemStack("wool:white "..math.random(1,3))) local pos = self.object:getpos()
pos.y = pos.y + 0.5
local obj = minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3)))
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end
item:add_wear(65535/100) item:add_wear(65535/100)
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B