mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 01:30:38 +01:00
Begin the mobs update
This commit is contained in:
parent
e2a49d6552
commit
8d45d416be
@ -446,7 +446,7 @@ function mobs:register_mob(name, def)
|
||||
--print ("spawned baby:",self.name)
|
||||
local mob = minetest.add_entity(pos, self.name)
|
||||
local ent2 = mob:get_luaentity()
|
||||
local texture = self.base_texture
|
||||
local textures = self.base_texture
|
||||
if def.child_texture then
|
||||
print ("child texture detected")
|
||||
textures = def.child_texture[1]
|
||||
|
@ -46,7 +46,7 @@ mobs:register_mob("mobs:bee", {
|
||||
},
|
||||
-- right click to pick up bee
|
||||
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")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ mobs:register_mob("mobs:bunny", {
|
||||
end
|
||||
return
|
||||
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")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ mobs:register_mob("mobs:chicken", {
|
||||
-- textures and model
|
||||
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
|
||||
visual = "mesh",
|
||||
mesh = "chicken.x",
|
||||
mesh = "mobs_chicken.x",
|
||||
drawtype = "front",
|
||||
available_textures = {
|
||||
total = 2,
|
||||
@ -78,7 +78,7 @@ mobs:register_mob("mobs:chicken", {
|
||||
end
|
||||
return tool
|
||||
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")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -35,6 +35,8 @@ mobs:register_mob("mobs:cow", {
|
||||
drops = {
|
||||
{name = "mobs:meat_raw",
|
||||
chance = 1, min = 5, max = 10},
|
||||
{name = "mobs:leather",
|
||||
chance = 1, min = 0, max = 3},
|
||||
},
|
||||
-- damaged by
|
||||
water_damage = 1,
|
||||
@ -86,6 +88,11 @@ mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 10000, 1, 31
|
||||
-- register spawn egg
|
||||
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
|
||||
minetest.register_craftitem("mobs:bucket_milk", {
|
||||
description = "Bucket of Milk",
|
||||
|
@ -2,35 +2,29 @@
|
||||
|
||||
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").."/cow.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/rat.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/sheep.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/warthog.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/bee.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/bunny.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/kitten.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/chicken.lua") -- JKmurray
|
||||
dofile(minetest.get_modpath("mobs").."/cow.lua") -- KrupnoPavel
|
||||
dofile(minetest.get_modpath("mobs").."/rat.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/sheep.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/warthog.lua") -- KrupnoPavel
|
||||
dofile(minetest.get_modpath("mobs").."/bee.lua") -- KrupnoPavel
|
||||
dofile(minetest.get_modpath("mobs").."/bunny.lua") -- ExeterDad
|
||||
dofile(minetest.get_modpath("mobs").."/kitten.lua") -- Jordach/BFD
|
||||
|
||||
-- Monsters
|
||||
|
||||
dofile(minetest.get_modpath("mobs").."/dirtmonster.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/oerkki.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/sandmonster.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/stonemonster.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/treemonster.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/wolf.lua")
|
||||
|
||||
-- Zmobs by Zeg9
|
||||
|
||||
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")
|
||||
dofile(minetest.get_modpath("mobs").."/dirtmonster.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/oerkki.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/sandmonster.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/stonemonster.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam
|
||||
dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- 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
|
||||
|
||||
-- NPC
|
||||
dofile(minetest.get_modpath("mobs").."/npc.lua")
|
||||
|
@ -64,7 +64,7 @@ mobs:register_mob("mobs:kitten", {
|
||||
end
|
||||
return
|
||||
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")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ mobs:register_mob("mobs:rat", {
|
||||
light_damage = 0,
|
||||
-- right click to pick up rat
|
||||
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")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -33,7 +33,9 @@ mobs:register_mob("mobs:sheep", {
|
||||
-- drops raw meat when dead
|
||||
drops = {
|
||||
{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
|
||||
water_damage = 1,
|
||||
@ -61,6 +63,9 @@ mobs:register_mob("mobs:sheep", {
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
self.food = (self.food or 0) + 1
|
||||
if self.child == true then
|
||||
self.hornytimer = self.hornytimer + 10
|
||||
end
|
||||
if self.food >= 8 then
|
||||
self.food = 0
|
||||
if self.child == false then self.horny = true end
|
||||
@ -75,10 +80,16 @@ mobs:register_mob("mobs:sheep", {
|
||||
return
|
||||
end
|
||||
-- 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
|
||||
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)
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
|
BIN
mods/mobs/textures/mobs_leather.png
Normal file
BIN
mods/mobs/textures/mobs_leather.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 B |
Loading…
Reference in New Issue
Block a user