mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Add files via upload
This commit is contained in:
parent
c49cc4726c
commit
b57fa926bd
3
TODO.txt
Normal file
3
TODO.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
this file was added by farooghkz.
|
||||||
|
TODO list:
|
||||||
|
- better images for eggs
|
20
api.lua
20
api.lua
@ -1,4 +1,17 @@
|
|||||||
mobs = {}
|
mobs = {}
|
||||||
|
|
||||||
|
function mobs:is_in_tbl(a_tbl, a_val)
|
||||||
|
if not a_tbl then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
for key, val in ipairs(a_tbl) do
|
||||||
|
if val == a_val then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function mobs:register_mob(name, def)
|
function mobs:register_mob(name, def)
|
||||||
minetest.register_entity(name, {
|
minetest.register_entity(name, {
|
||||||
hp_max = def.hp_max,
|
hp_max = def.hp_max,
|
||||||
@ -117,6 +130,10 @@ function mobs:register_mob(name, def)
|
|||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.hp_max == 5 and self.type == "animal" then
|
||||||
|
-- TODO: if its sheep, it will eat grass!
|
||||||
|
end
|
||||||
|
|
||||||
self.lifetimer = self.lifetimer - dtime
|
self.lifetimer = self.lifetimer - dtime
|
||||||
if self.lifetimer <= 0 and not self.tamed then
|
if self.lifetimer <= 0 and not self.tamed then
|
||||||
local player_count = 0
|
local player_count = 0
|
||||||
@ -248,7 +265,8 @@ function mobs:register_mob(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.following and self.following:is_player() then
|
if self.following and self.following:is_player() then
|
||||||
if self.following:get_wielded_item():get_name() ~= self.follow then
|
item_name = self.following:get_wielded_item():get_name()
|
||||||
|
if not mobs:is_in_tbl(self.follow, item_name) then
|
||||||
self.following = nil
|
self.following = nil
|
||||||
self.v_start = false
|
self.v_start = false
|
||||||
else
|
else
|
||||||
|
87
init.lua
87
init.lua
@ -199,12 +199,12 @@ mobs:register_mob("mobs:sheep", {
|
|||||||
walk_start = 81,
|
walk_start = 81,
|
||||||
walk_end = 100,
|
walk_end = 100,
|
||||||
},
|
},
|
||||||
follow = "farming:wheat",
|
follow = {"farming:wheat", "farming:bread"},
|
||||||
view_range = 5,
|
view_range = 5,
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == "farming:wheat" then
|
if mobs:is_in_tbl({"farming:wheat", "farming:bread"}, item:get_name()) then
|
||||||
if not self.tamed then
|
if not self.tamed then
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
@ -242,6 +242,7 @@ mobs:register_mob("mobs:sheep", {
|
|||||||
})
|
})
|
||||||
mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 8, 9000, 1, 31000)
|
mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 8, 9000, 1, 31000)
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mobs:meat_raw", {
|
minetest.register_craftitem("mobs:meat_raw", {
|
||||||
description = "Raw Meat",
|
description = "Raw Meat",
|
||||||
inventory_image = "mobs_meat_raw.png",
|
inventory_image = "mobs_meat_raw.png",
|
||||||
@ -275,6 +276,7 @@ mobs:register_mob("mobs:rat", {
|
|||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
lava_damage = 1,
|
lava_damage = 1,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
|
view_range = 3,
|
||||||
|
|
||||||
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() then
|
||||||
@ -298,6 +300,87 @@ minetest.register_craftitem("mobs:rat", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:sheep_egg", {
|
||||||
|
description = "Sheep Egg",
|
||||||
|
inventory_image = "mobs_sheep_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:sheep")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:dirt_monster_egg", {
|
||||||
|
description = "Dirt Monster Egg",
|
||||||
|
inventory_image = "mobs_dirt_monster_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:dirt_monster")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:sand_monster_egg", {
|
||||||
|
description = "Sand Monster Egg",
|
||||||
|
inventory_image = "mobs_sand_monster_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:sand_monster")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:stone_monster_egg", {
|
||||||
|
description = "Stone Monster Egg",
|
||||||
|
inventory_image = "mobs_stone_monster_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:stone_monster")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:dungeon_master_egg", {
|
||||||
|
description = "Dungeon Master Egg",
|
||||||
|
inventory_image = "mobs_dungeon_master_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:dungeon_master")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mobs:oerkki_egg", {
|
||||||
|
description = "Oerkki Egg",
|
||||||
|
inventory_image = "mobs_oerkki_egg.png",
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.above then
|
||||||
|
minetest.env:add_entity(pointed_thing.above, "mobs:oerkki")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mobs:rat_cooked", {
|
minetest.register_craftitem("mobs:rat_cooked", {
|
||||||
description = "Cooked Rat",
|
description = "Cooked Rat",
|
||||||
inventory_image = "mobs_cooked_rat.png",
|
inventory_image = "mobs_cooked_rat.png",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user