Skip to content

Commit

Permalink
Add rats
Browse files Browse the repository at this point in the history
  • Loading branch information
PilzAdam committed Sep 19, 2012
1 parent e9c9aea commit 6f4d2ba
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.txt
Expand Up @@ -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:
Expand Down
48 changes: 48 additions & 0 deletions init.lua
Expand Up @@ -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 added textures/mobs_cooked_rat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/mobs_rat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6f4d2ba

Please sign in to comment.