1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

Adapt the yeti code

(And fix the zombie view range and the mese_monster fleshy against players)
This commit is contained in:
Quentin BUISSON-DEBON 2015-04-28 17:31:22 +02:00
parent de5a7b6100
commit 5d155df1af
3 changed files with 36 additions and 54 deletions

View File

@ -1,10 +1,21 @@
-- Yeti by TenPlus1
mobs:register_mob("pmobs:yeti", {
mobs:register_mob("mobs:yeti", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 10,
hp_max = 35,
-- agressive, deals 7 damage to player when hit
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},
visual = "mesh",
mesh = "character.b3d",
@ -12,30 +23,32 @@ mobs:register_mob("pmobs:yeti", {
{"mobs_yeti.png"},
},
visual_size = {x=1, y=1},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
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,
run_velocity = 3,
damage = 2,
jump = true,
floats = 1,
-- drops ice when dead
drops = {
{name = "default:ice",
chance = 1,
min = 1,
max = 3,},
},
armor = 100,
drawtype = "front",
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 1,
on_rightclick = nil,
attack_type = "shoot",
shoot_interval = .7,
arrow = "pmobs:snowball",
shoot_offset = 2,
-- model animation
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
@ -43,14 +56,14 @@ mobs:register_mob("pmobs:yeti", {
run_start = 168, run_end = 187,
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)
mobs:register_arrow("pmobs:snowball", {
-- snowball (weapon)
mobs:register_arrow("mobs:snowball", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"default_snowball.png"},
@ -59,48 +72,17 @@ mobs:register_arrow("pmobs:snowball", {
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
damage_groups = {fleshy=7},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
damage_groups = {fleshy=7},
}, 0)
end,
hit_node = function(self, pos, node)
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
})

View File

@ -30,11 +30,11 @@ mobs:register_mob("mobs:zombie", {
death = "mobs_zombie_death",
},
-- speed and jump
view_range = 16,
walk_velocity = 1,
run_velocity = 3,
jump = true,
floats = 0,
view_range = 10,
-- drops dirt and coins when dead
drops = {
{name = "maptools:copper_coin",

View File

@ -76,7 +76,7 @@ mobs:register_arrow("mobs:mese_arrow", {
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
damage_groups = {fleshy=9},
}, 0)
end,