mirror of
https://codeberg.org/tenplus1/mobs_monster.git
synced 2024-12-23 01:10:26 +01:00
harden lava flan code
This commit is contained in:
parent
1ba32b39eb
commit
a097ee9388
@ -18,13 +18,13 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||||||
textures = {
|
textures = {
|
||||||
{"zmobs_lava_flan.png"},
|
{"zmobs_lava_flan.png"},
|
||||||
{"zmobs_lava_flan2.png"},
|
{"zmobs_lava_flan2.png"},
|
||||||
{"zmobs_lava_flan3.png"},
|
{"zmobs_lava_flan3.png"}
|
||||||
},
|
},
|
||||||
blood_texture = "fire_basic_flame.png",
|
blood_texture = "fire_basic_flame.png",
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "mobs_lavaflan",
|
random = "mobs_lavaflan",
|
||||||
war_cry = "mobs_lavaflan",
|
war_cry = "mobs_lavaflan"
|
||||||
},
|
},
|
||||||
walk_velocity = 0.5,
|
walk_velocity = 0.5,
|
||||||
run_velocity = 2,
|
run_velocity = 2,
|
||||||
@ -32,14 +32,14 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||||||
view_range = 10,
|
view_range = 10,
|
||||||
floats = 1,
|
floats = 1,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1},
|
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1}
|
||||||
},
|
},
|
||||||
water_damage = 8,
|
water_damage = 8,
|
||||||
lava_damage = -1,
|
lava_damage = -1,
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
immune_to = {
|
immune_to = {
|
||||||
{"mobs:pick_lava", -2}, -- lava pick heals 2 health
|
{"mobs:pick_lava", -2} -- lava pick heals 2 health
|
||||||
},
|
},
|
||||||
fly_in = {"default:lava_source", "default:lava_flowing"},
|
fly_in = {"default:lava_source", "default:lava_flowing"},
|
||||||
animation = {
|
animation = {
|
||||||
@ -54,6 +54,8 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||||||
punch_start = 20,
|
punch_start = 20,
|
||||||
punch_end = 28
|
punch_end = 28
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- custom death function
|
||||||
on_die = function(self, pos)
|
on_die = function(self, pos)
|
||||||
|
|
||||||
local cod = self.cause_of_death or {}
|
local cod = self.cause_of_death or {}
|
||||||
@ -71,12 +73,14 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
if math.random(4) == 1 then
|
if math.random(4) == 1 then
|
||||||
mobs:add_mob(pos, {
|
mobs:add_mob(pos, {name = "mobs_monster:obsidian_flan"})
|
||||||
name = "mobs_monster:obsidian_flan",
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
else
|
else -- place flame if position empty and flame exists
|
||||||
if minetest.get_node(pos).name == "air" then
|
local nod = minetest.get_node(pos)
|
||||||
|
local def = nod.name and minetest.registered_nodes[nod.name]
|
||||||
|
|
||||||
|
if def and def.buildable_to == true
|
||||||
|
and minetest.registered_nodes["fire:basic_flame"] then
|
||||||
minetest.set_node(pos, {name = "fire:basic_flame"})
|
minetest.set_node(pos, {name = "fire:basic_flame"})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,7 +89,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
glow = 10,
|
glow = 10
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -95,21 +99,24 @@ mobs:spawn({
|
|||||||
nodes = {"default:lava_source"},
|
nodes = {"default:lava_source"},
|
||||||
chance = 1500,
|
chance = 1500,
|
||||||
active_object_count = 1,
|
active_object_count = 1,
|
||||||
max_height = 0,
|
max_height = 0
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- add spawn egg
|
||||||
mobs:register_egg("mobs_monster:lava_flan", S("Lava Flan"), "default_lava.png", 1)
|
mobs:register_egg("mobs_monster:lava_flan", S("Lava Flan"), "default_lava.png", 1)
|
||||||
|
|
||||||
mobs:alias_mob("mobs:lava_flan", "mobs_monster:lava_flan") -- compatibility
|
|
||||||
|
-- compatibility alias, only needed for servers who used the old mobs mod
|
||||||
|
mobs:alias_mob("mobs:lava_flan", "mobs_monster:lava_flan")
|
||||||
|
|
||||||
|
|
||||||
-- lava orb
|
-- lava orb
|
||||||
minetest.register_craftitem(":mobs:lava_orb", {
|
minetest.register_craftitem(":mobs:lava_orb", {
|
||||||
description = S("Lava orb"),
|
description = S("Lava orb"),
|
||||||
inventory_image = "zmobs_lava_orb.png",
|
inventory_image = "zmobs_lava_orb.png",
|
||||||
light_source = 14,
|
light_source = 14
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
|
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
|
||||||
@ -117,7 +124,7 @@ minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mobs:lava_orb",
|
recipe = "mobs:lava_orb",
|
||||||
burntime = 80,
|
burntime = 80
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -225,13 +232,12 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
|
|||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "zmobs_lava_flan.x",
|
mesh = "zmobs_lava_flan.x",
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_obsidian_flan.png"},
|
{"mobs_obsidian_flan.png"}
|
||||||
},
|
},
|
||||||
blood_texture = "default_obsidian.png",
|
blood_texture = "default_obsidian.png",
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "mobs_lavaflan",
|
random = "mobs_lavaflan"
|
||||||
-- war_cry = "mobs_lavaflan",
|
|
||||||
},
|
},
|
||||||
walk_velocity = 0.1,
|
walk_velocity = 0.1,
|
||||||
run_velocity = 0.5,
|
run_velocity = 0.5,
|
||||||
@ -240,7 +246,7 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
|
|||||||
floats = 0,
|
floats = 0,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "default:obsidian_shard", chance = 1, min = 1, max = 5},
|
{name = "default:obsidian_shard", chance = 1, min = 1, max = 5},
|
||||||
{name = "default:obsidian", chance = 3, min = 0, max = 2},
|
{name = "default:obsidian", chance = 3, min = 0, max = 2}
|
||||||
},
|
},
|
||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
lava_damage = 8,
|
lava_damage = 8,
|
||||||
@ -260,6 +266,8 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- add spawn egg
|
||||||
mobs:register_egg("mobs_monster:obsidian_flan", S("Obsidian Flan"),
|
mobs:register_egg("mobs_monster:obsidian_flan", S("Obsidian Flan"),
|
||||||
"default_obsidian.png", 1)
|
"default_obsidian.png", 1)
|
||||||
|
|
||||||
@ -269,11 +277,9 @@ local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
|||||||
-- mese arrow (weapon)
|
-- mese arrow (weapon)
|
||||||
mobs:register_arrow("mobs_monster:obsidian_arrow", {
|
mobs:register_arrow("mobs_monster:obsidian_arrow", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
-- visual = "wielditem",
|
|
||||||
visual_size = {x = 0.5, y = 0.5},
|
visual_size = {x = 0.5, y = 0.5},
|
||||||
textures = {"default_obsidian_shard.png"},
|
textures = {"default_obsidian_shard.png"},
|
||||||
velocity = 6,
|
velocity = 6,
|
||||||
-- rotate = 180,
|
|
||||||
|
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
|
Loading…
Reference in New Issue
Block a user