mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-08-25 03:17:24 +02:00
Simplify zombie/baby zombie code
This commit is contained in:
parent
37b9e71101
commit
d6a69cedec
@ -3,12 +3,7 @@
|
|||||||
--made for MC like Survival game
|
--made for MC like Survival game
|
||||||
--License for code WTFPL and otherwise stated in readmes
|
--License for code WTFPL and otherwise stated in readmes
|
||||||
|
|
||||||
|
local zombie = {
|
||||||
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:zombie", {
|
|
||||||
type = "monster",
|
type = "monster",
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
@ -29,7 +24,9 @@ mobs:register_mob("mobs_mc:zombie", {
|
|||||||
run_velocity = 1.6,
|
run_velocity = 1.6,
|
||||||
damage = 3,
|
damage = 3,
|
||||||
fear_height = 8,
|
fear_height = 8,
|
||||||
pathfinding = 1,
|
pathfinding = true,
|
||||||
|
jump = true,
|
||||||
|
jump_height = 1.25,
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_mobitems:rotten_flesh",
|
{name = "mcl_mobitems:rotten_flesh",
|
||||||
@ -87,97 +84,35 @@ mobs:register_mob("mobs_mc:zombie", {
|
|||||||
light_damage = 1,
|
light_damage = 1,
|
||||||
view_range = 40,
|
view_range = 40,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:baby_zombie", {
|
mobs:register_mob("mobs_mc:zombie", zombie)
|
||||||
type = "monster",
|
|
||||||
hp_min = 20,
|
-- Baby Zombie.
|
||||||
hp_max = 20,
|
-- A smaller and more dangerous variant of the zombie
|
||||||
-- They are a bit shorter than 1 block high to fit through gaps
|
|
||||||
collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25},
|
local baby = table.copy(zombie)
|
||||||
visual_size = {x=0.5, y=0.5},
|
baby.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25}
|
||||||
textures = {
|
baby.visual_size = {x=0.5, y=0.5}
|
||||||
{"mobs_zombie.png"}
|
baby.walk_velocity = 1.2
|
||||||
},
|
baby.run_velocity = 2.4
|
||||||
visual = "mesh",
|
baby.light_damage = 0
|
||||||
mesh = "mobs_zombie.x",
|
|
||||||
makes_footstep_sound = true,
|
mobs:register_mob("mobs_mc:baby_zombie", baby)
|
||||||
sounds = {
|
|
||||||
random = "zombie1",
|
|
||||||
death = "zombiedeath",
|
-- Spawning
|
||||||
damage = "zombiehurt1",
|
|
||||||
attack = "default_punch3",
|
|
||||||
},
|
|
||||||
walk_velocity = 1.2,
|
|
||||||
run_velocity = 2.4,
|
|
||||||
damage = 3,
|
|
||||||
-- Half attack range because they are small
|
|
||||||
reach = 1.5,
|
|
||||||
fear_height = 8,
|
|
||||||
pathfinding = 1,
|
|
||||||
group_attack = true,
|
|
||||||
drops = {
|
|
||||||
{name = "mcl_mobitems:rotten_flesh",
|
|
||||||
chance = 1,
|
|
||||||
min = 0,
|
|
||||||
max = 2,},
|
|
||||||
{name = "mcl_core:iron_ingot",
|
|
||||||
-- approximation to 8.5%
|
|
||||||
chance = 11,
|
|
||||||
min = 1,
|
|
||||||
max = 1,},
|
|
||||||
{name = "mcl_core:shovel_iron",
|
|
||||||
-- approximation to 8.5%
|
|
||||||
chance = 11,
|
|
||||||
min = 1,
|
|
||||||
max = 1,},
|
|
||||||
{name = "mcl_core:sword_iron",
|
|
||||||
-- approximation to 8.5%
|
|
||||||
chance = 11,
|
|
||||||
min = 1,
|
|
||||||
max = 1,},
|
|
||||||
{name = "mcl_farming:carrot_item",
|
|
||||||
-- approximation to 8.5%
|
|
||||||
chance = 11,
|
|
||||||
min = 1,
|
|
||||||
max = 1,},
|
|
||||||
{name = "mcl_farming:potato_item",
|
|
||||||
-- approximation to 8.5%
|
|
||||||
chance = 11,
|
|
||||||
min = 1,
|
|
||||||
max = 1,},
|
|
||||||
},
|
|
||||||
animation = {
|
|
||||||
speed_normal = 24,
|
|
||||||
speed_run = 48,
|
|
||||||
stand_start = 0,
|
|
||||||
stand_end = 23,
|
|
||||||
walk_start = 24,
|
|
||||||
walk_end = 47,
|
|
||||||
run_start = 48,
|
|
||||||
run_end = 62,
|
|
||||||
hurt_start = 64,
|
|
||||||
hurt_end = 86,
|
|
||||||
death_start = 88,
|
|
||||||
death_end = 118,
|
|
||||||
},
|
|
||||||
drawtype = "front",
|
|
||||||
lava_damage = minetest.registered_nodes["mcl_core:lava_source"].damage_per_second,
|
|
||||||
view_range = 40,
|
|
||||||
attack_type = "dogfight",
|
|
||||||
})
|
|
||||||
|
|
||||||
mobs:register_spawn("mobs_mc:zombie", {"group:solid"}, 7, -1, 5000, 4, 31000)
|
mobs:register_spawn("mobs_mc:zombie", {"group:solid"}, 7, -1, 5000, 4, 31000)
|
||||||
|
-- Baby zombie is 20 times less likely than regular zombies
|
||||||
-- 20 times less likely than regular zombies
|
|
||||||
mobs:register_spawn("mobs_mc:baby_zombie", {"group:solid"}, 7, -1, 100000, 4, 31000)
|
mobs:register_spawn("mobs_mc:baby_zombie", {"group:solid"}, 7, -1, 100000, 4, 31000)
|
||||||
|
|
||||||
|
|
||||||
-- compatibility
|
-- Compatibility
|
||||||
mobs:alias_mob("mobs:zombie", "mobs_mc:zombie")
|
mobs:alias_mob("mobs:zombie", "mobs_mc:zombie")
|
||||||
|
|
||||||
-- spawn eggs
|
-- Spawn eggs
|
||||||
mobs:register_egg("mobs_mc:zombie", "Spawn Zombie", "spawn_egg_zombie.png")
|
mobs:register_egg("mobs_mc:zombie", "Spawn Zombie", "spawn_egg_zombie.png")
|
||||||
mobs:register_egg("mobs_mc:baby_zombie", "Spawn Baby Zombie", "spawn_egg_baby_zombie.png")
|
mobs:register_egg("mobs_mc:baby_zombie", "Spawn Baby Zombie", "spawn_egg_baby_zombie.png")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user