1
0
mirror of https://codeberg.org/tenplus1/mobs_monster.git synced 2025-07-08 03:10:22 +02:00

add different dirt and stone type monsters

This commit is contained in:
tenplus1
2021-03-01 12:27:12 +00:00
parent 05ccc87150
commit 22308b4c94
6 changed files with 77 additions and 8 deletions

View File

@ -1,6 +1,16 @@
local S = mobs.intllib
local dirt_types = {
{ nodes = {"ethereal:dry_dirt"},
skins = {"mobs_dirt_monster3.png"},
drops = {
{name = "ethereal:dry_dirt", chance = 1, min = 0, max = 2}
}
}
}
-- Dirt Monster by PilzAdam
@ -19,6 +29,7 @@ mobs:register_mob("mobs_monster:dirt_monster", {
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_dirt_monster.png"},
{"mobs_dirt_monster2.png"},
},
blood_texture = "default_dirt.png",
makes_footstep_sound = true,
@ -48,19 +59,39 @@ mobs:register_mob("mobs_monster:dirt_monster", {
punch_start = 40,
punch_end = 63,
},
-- check surrounding nodes and spawn a specific spider
on_spawn = function(self)
local pos = self.object:get_pos() ; pos.y = pos.y - 1
local tmp
for n = 1, #dirt_types do
tmp = dirt_types[n]
if minetest.find_node_near(pos, 1, tmp.nodes) then
self.base_texture = tmp.skins
self.object:set_properties({textures = tmp.skins})
if tmp.drops then
self.drops = tmp.drops
end
return true
end
end
return true -- run only once, false/nil runs every activation
end
})
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:gray_dirt"
end
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:dirt_monster",
nodes = {spawn_on},
nodes = {"default:dirt_with_grass", "ethereal:gray_dirt", "ethereal:dry_dirt"},
min_light = 0,
max_light = 7,
chance = 6000,