Add rats
parent
e9c9aea908
commit
6f4d2bad60
|
@ -21,9 +21,11 @@ There are 3 hostile mobs that want to kill the player:
|
|||
dirt monster
|
||||
- The desert monster spawns in deserts and is faster but less strong
|
||||
than the dirt monster
|
||||
There is also 1 friendly mob:
|
||||
There are also 2 friendly mobs:
|
||||
- The sheep spawns on grass. You can get wool from it when you rightclick
|
||||
it and meat if you kill it. Meat can bee cooked in the furnace to eat it.
|
||||
- The rat is the same as in 0.3. You can cook it or replace it in the
|
||||
world if you catched it with an rightclick.
|
||||
|
||||
For developers:
|
||||
This mod add some functions that you can use in other mods:
|
||||
|
|
48
init.lua
48
init.lua
|
@ -496,3 +496,51 @@ minetest.register_craft({
|
|||
recipe = "mobs:meat_raw",
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
mobs:register_animal("mobs:rat", {
|
||||
hp_max = 1,
|
||||
collisionbox = {-0.25, -0.175, -0.25, 0.25, 0.1, 0.25},
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x=0.7, y=0.35},
|
||||
textures = {"mobs_rat.png", "mobs_rat.png"},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 1,
|
||||
drop = "",
|
||||
drop_count = 0,
|
||||
drawtype = "side",
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
clicker:get_inventory():add_item("main", "mobs:rat")
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
})
|
||||
mobs:register_spawn("mobs:rat", {"default:dirt_with_grass", "default:stone"}, 20, -1)
|
||||
|
||||
minetest.register_craftitem("mobs:rat", {
|
||||
description = "Rat",
|
||||
inventory_image = "mobs_rat.png",
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.env:add_entity(pointed_thing.above, "mobs:rat")
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:rat_cooked", {
|
||||
description = "Cooked Rat",
|
||||
inventory_image = "mobs_cooked_rat.png",
|
||||
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mobs:rat_cooked",
|
||||
recipe = "mobs:rat",
|
||||
cooktime = 5,
|
||||
})
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 239 B |
Binary file not shown.
After Width: | Height: | Size: 920 B |
Loading…
Reference in New Issue