mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-16 15:30:30 +01:00
Adapt the yeti code
(And fix the zombie view range and the mese_monster fleshy against players)
This commit is contained in:
parent
de5a7b6100
commit
5d155df1af
|
@ -1,10 +1,21 @@
|
||||||
|
|
||||||
-- Yeti by TenPlus1
|
-- Yeti by TenPlus1
|
||||||
|
|
||||||
mobs:register_mob("pmobs:yeti", {
|
mobs:register_mob("mobs:yeti", {
|
||||||
|
-- animal, monster, npc, barbarian
|
||||||
type = "monster",
|
type = "monster",
|
||||||
hp_min = 10,
|
-- agressive, deals 7 damage to player when hit
|
||||||
hp_max = 35,
|
passive = false,
|
||||||
|
damage = 7,
|
||||||
|
attack_type = "shoot",
|
||||||
|
shoot_interval = .75,
|
||||||
|
arrow = "mobs:snowball",
|
||||||
|
shoot_offset = 2,
|
||||||
|
-- health & armor
|
||||||
|
hp_min = 25,
|
||||||
|
hp_max = 30,
|
||||||
|
armor = 90,
|
||||||
|
-- textures and model
|
||||||
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
|
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "character.b3d",
|
mesh = "character.b3d",
|
||||||
|
@ -12,30 +23,32 @@ mobs:register_mob("pmobs:yeti", {
|
||||||
{"mobs_yeti.png"},
|
{"mobs_yeti.png"},
|
||||||
},
|
},
|
||||||
visual_size = {x=1, y=1},
|
visual_size = {x=1, y=1},
|
||||||
|
blood_texture = "mobs_blood.png",
|
||||||
|
-- sounds
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "mobs_stonemonster",
|
random = "mobs_dirtmonster",
|
||||||
|
attack = "mobs_stonemonster_attack",
|
||||||
|
death = "mobs_zombie_death",
|
||||||
},
|
},
|
||||||
view_range = 15,
|
-- speed and jump
|
||||||
|
view_range = 16,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
run_velocity = 3,
|
run_velocity = 3,
|
||||||
damage = 2,
|
jump = true,
|
||||||
|
floats = 1,
|
||||||
|
-- drops ice when dead
|
||||||
drops = {
|
drops = {
|
||||||
{name = "default:ice",
|
{name = "default:ice",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 3,},
|
max = 3,},
|
||||||
},
|
},
|
||||||
armor = 100,
|
-- damaged by
|
||||||
drawtype = "front",
|
|
||||||
water_damage = 1,
|
water_damage = 1,
|
||||||
lava_damage = 5,
|
lava_damage = 5,
|
||||||
light_damage = 1,
|
light_damage = 1,
|
||||||
on_rightclick = nil,
|
-- model animation
|
||||||
attack_type = "shoot",
|
|
||||||
shoot_interval = .7,
|
|
||||||
arrow = "pmobs:snowball",
|
|
||||||
shoot_offset = 2,
|
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 30, speed_run = 30,
|
speed_normal = 30, speed_run = 30,
|
||||||
stand_start = 0, stand_end = 79,
|
stand_start = 0, stand_end = 79,
|
||||||
|
@ -43,14 +56,14 @@ mobs:register_mob("pmobs:yeti", {
|
||||||
run_start = 168, run_end = 187,
|
run_start = 168, run_end = 187,
|
||||||
punch_start = 200, punch_end = 219,
|
punch_start = 200, punch_end = 219,
|
||||||
},
|
},
|
||||||
jump = true,
|
|
||||||
floats = 0,
|
|
||||||
})
|
})
|
||||||
mobs:register_spawn("pmobs:yeti", {"default:dirt_with_snow", "default:snowblock", "default:ice"}, 10, -1, 7000, 1, 31000)
|
-- spawn on stone between 20 and -1 light, 1 in 7000 chance, 1 in area below -25
|
||||||
|
mobs:register_spawn("mobs:yeti", {"default:dirt_with_snow", "default:snowblock", "default:ice"}, 10, -1, 7000, 1, 31000)
|
||||||
|
-- register spawn egg
|
||||||
|
mobs:register_egg("mobs:yeti", "Yeti", "default_snow.png", 1)
|
||||||
|
|
||||||
mobs:register_egg("pmobs:yeti", "Yeti", "default_snow.png", 1)
|
-- snowball (weapon)
|
||||||
|
mobs:register_arrow("mobs:snowball", {
|
||||||
mobs:register_arrow("pmobs:snowball", {
|
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x=.5, y=.5},
|
visual_size = {x=.5, y=.5},
|
||||||
textures = {"default_snowball.png"},
|
textures = {"default_snowball.png"},
|
||||||
|
@ -59,48 +72,17 @@ mobs:register_arrow("pmobs:snowball", {
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups = {fleshy=1},
|
damage_groups = {fleshy=7},
|
||||||
}, 0)
|
}, 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, player)
|
hit_mob = function(self, player)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups = {fleshy=1},
|
damage_groups = {fleshy=7},
|
||||||
}, 0)
|
}, 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- snowball throwing item
|
|
||||||
|
|
||||||
local snowball_GRAVITY=9
|
|
||||||
local snowball_VELOCITY=19
|
|
||||||
|
|
||||||
-- shoot snowball
|
|
||||||
local mobs_shoot_snowball=function (item, player, pointed_thing)
|
|
||||||
local playerpos=player:getpos()
|
|
||||||
local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "pmobs:snowball")
|
|
||||||
local dir=player:get_look_dir()
|
|
||||||
obj:get_luaentity().velocity = snowball_VELOCITY -- needed for api internal timing
|
|
||||||
obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
|
|
||||||
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
|
|
||||||
item:take_item()
|
|
||||||
return item
|
|
||||||
end
|
|
||||||
|
|
||||||
-- override default snow to shoot snowballs
|
|
||||||
minetest.override_item("default:snow", {
|
|
||||||
|
|
||||||
--Disable placement prediction for snow.
|
|
||||||
node_placement_prediction = "",
|
|
||||||
on_construct = function(pos)
|
|
||||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0 then
|
|
||||||
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_use = mobs_shoot_snowball
|
|
||||||
})
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ mobs:register_mob("mobs:zombie", {
|
||||||
death = "mobs_zombie_death",
|
death = "mobs_zombie_death",
|
||||||
},
|
},
|
||||||
-- speed and jump
|
-- speed and jump
|
||||||
|
view_range = 16,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
run_velocity = 3,
|
run_velocity = 3,
|
||||||
jump = true,
|
jump = true,
|
||||||
floats = 0,
|
floats = 0,
|
||||||
view_range = 10,
|
|
||||||
-- drops dirt and coins when dead
|
-- drops dirt and coins when dead
|
||||||
drops = {
|
drops = {
|
||||||
{name = "maptools:copper_coin",
|
{name = "maptools:copper_coin",
|
||||||
|
|
|
@ -76,7 +76,7 @@ mobs:register_arrow("mobs:mese_arrow", {
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups = {fleshy=1},
|
damage_groups = {fleshy=9},
|
||||||
}, 0)
|
}, 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user