1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 22:26:08 +02:00

Change mobs api and add new mobs from (water_mobs, pmobs, kpgmobs, mob_horse)

This commit is contained in:
sys4
2017-11-11 17:37:21 +01:00
parent d3a7d82233
commit 6241f4ecaf
491 changed files with 74864 additions and 12913 deletions

7
mods/pmobs/README.txt Normal file
View File

@ -0,0 +1,7 @@
PMobs by CProgrammerRU
This mod uses the Mobs Redo Api to add new mobs to minetest.
0.1 - Added Npc, Guard, Ninja, Wolf, Dog and Yeti
Special thanks to TenPlus1.

2
mods/pmobs/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
mobs

79
mods/pmobs/dog.lua Normal file
View File

@ -0,0 +1,79 @@
-- Dog
mobs:register_mob("pmobs:dog", {
type = "npc",
passive = true,
hp_max = 5,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "mobs_wolf.x",
textures = {
{"mobs_dog.png"},
},
makes_footstep_sound = true,
sounds = {
random = "mobs_wolf",
war_cry = "mobs_wolf_attack",
},
view_range = 15,
stepheight = 1.1,
owner = "",
order = "follow",
walk_velocity = 4,
run_velocity = 4,
damage = 2,
armor = 200,
attacks_monsters = true,
attack_type = "dogfight",
drops = {
{name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 0,
lava_damage = 5,
light_damage = 0,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:meat_raw" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
else
if self.owner == "" then
self.owner = clicker:get_player_name()
else
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end,
animation = {
speed_normal = 20,
speed_run = 30,
stand_start = 10,
stand_end = 20,
walk_start = 75,
walk_end = 100,
run_start = 100,
run_end = 130,
punch_start = 135,
punch_end = 155,
},
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
})
mobs:register_egg("pmobs:dog", "Dog", "wool_brown.png", 1)
mobs:alias_mob("mobs:dog", "pmobs:dog")

92
mods/pmobs/guard.lua Normal file
View File

@ -0,0 +1,92 @@
-- Guard
mobs:register_mob("pmobs:guard", {
-- animal, monster, npc
type = "npc",
passive = true,
damage = 7,
attack_type = "dogfight",
attacks_monsters = true,
owner = "",
order = "follow",
-- health & armor
hp_min = 10, hp_max = 20, armor = 100,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "guard.x",
drawtype = "front",
textures = {
{"mobs_npc.png", "npcf_skin_armor.png", "default_tool_steelsword.png"},
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 3,
run_velocity = 3,
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:axe_stone",
chance = 3, min = 1, max = 1},
},
-- damaged by
water_damage = 0,
lava_damage = 2,
light_damage = 0,
view_range = 15,
-- model animation
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
-- right clicking with cooked meat will give npc more health
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]})
else
if self.owner == "" then
self.owner = clicker:get_player_name()
else
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end,
})
mobs:register_egg("pmobs:guard", "Guard", "default_steel_block.png", 1)

20
mods/pmobs/init.lua Normal file
View File

@ -0,0 +1,20 @@
-- Animals
dofile(minetest.get_modpath("pmobs").."/wolf.lua") -- KrupnoPavel
dofile(minetest.get_modpath("pmobs").."/dog.lua")
-- Monsters
dofile(minetest.get_modpath("pmobs").."/ninja.lua") -- CProgrammingRU
dofile(minetest.get_modpath("pmobs").."/yeti.lua") -- TenPlus1
-- NPC
dofile(minetest.get_modpath("pmobs").."/npc.lua") -- TenPlus1
dofile(minetest.get_modpath("pmobs").."/npc_female.lua") -- NALC(sys4 fork MFF) nuttmeg20
dofile(minetest.get_modpath("pmobs").."/guard.lua") -- CProgrammingRU
if minetest.setting_get("log_mods") then
minetest.log("action", "pmobs loaded")
end

21
mods/pmobs/license.txt Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Krupnov Pavel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Binary file not shown.

9156
mods/pmobs/models/guard.x Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

123
mods/pmobs/ninja.lua Normal file
View File

@ -0,0 +1,123 @@
-- Ninja
mobs:register_mob("pmobs:ninja", {
-- animal, monster, npc
type = "monster",
-- aggressive, shoots shuriken
passive = false,
damage = 3,
attack_type = "shoot",
shoot_interval = .5,
arrow = "pmobs:shuriken",
shoot_offset = 2,
attacks_monsters = true,
-- health & armor
hp_min = 10, hp_max = 20, armor = 100,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"mobs_ninja.png"},
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 3,
run_velocity = 3,
jump = true,
-- drops shuriken when dead
drops = {
{name = "mobs:shuriken",
chance = 1, min = 1, max = 5},
},
-- damaged by
water_damage = 0,
lava_damage = 2,
light_damage = 0,
fall_damage = 0,
view_range = 15,
-- model animation
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
})
-- ninja spawn on top of trees
mobs:register_spawn("pmobs:ninja", {"default:leaves"}, 5, 0, 10000, 1, 31000)
mobs:register_egg("pmobs:ninja", "Ninja", "default_leaves.png", 1)
mobs:register_arrow("pmobs:shuriken", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"mobs_shuriken.png"},
velocity = 6,
drop = true,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=3},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=3},
}, 0)
end,
hit_node = function(self, pos, node)
end,
})
-- shuriken throwing item
local shuriken_GRAVITY=9
local shuriken_VELOCITY=19
--Shoot shuriken
local mobs_shoot_shuriken=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:shuriken")
local dir=player:get_look_dir()
obj:get_luaentity().velocity = shuriken_VELOCITY -- needed for api internal timing
obj:setvelocity({x=dir.x*shuriken_VELOCITY, y=dir.y*shuriken_VELOCITY, z=dir.z*shuriken_VELOCITY})
obj:setacceleration({x=dir.x*-3, y=-shuriken_GRAVITY, z=dir.z*-3})
item:take_item()
return item
end
-- shuriken item
minetest.register_craftitem("pmobs:shuriken", {
description = "Shuriken",
inventory_image = "mobs_shuriken.png",
on_use = function(item, player)
if mobs_shoot_shuriken(item, player, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
item:add_wear(65535/50)
end
end
return item
end,
})
-- recipe
minetest.register_craft({
output = "pmobs:shuriken 16",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
}
})

106
mods/pmobs/npc.lua Normal file
View File

@ -0,0 +1,106 @@
-- Npc by TenPlus1
mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:apple", "default:sapling", "default:junglesapling",
"shields:shield_enhanced_wood", "3d_armor:chestplate_cactus", "3d_armor:boots_bronze",
"default:sword_steel", "default:pick_steel", "default:shovel_steel", "default:bronze_ingot",
"bucket:bucket_water", "default:stick", "cavestuff:pebble_1", "building_blocks:stick",
"default:cobble", "default:gravel", "default:clay_lump", "default:sand", "default:dirt_with_grass",
"default:dirt", "default:chest", "default:torch"}
mobs:register_mob("pmobs:npc", {
-- animal, monster, npc
type = "npc",
-- aggressive, deals 2 damage to player/monster when hit
passive = false,
damage = 2,
attack_type = "dogfight",
attacks_monsters = true,
-- health & armor
hp_min = 10, hp_max = 20, armor = 100,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"mobs_npc.png"},
},
child_texture = {
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_npc",
damage = "mobs_npc_hit",
attack = "mobs_npc_attack",
death = "mobs_npc_death",
},
-- speed and jump
walk_velocity = 3,
run_velocity = 3,
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:axe_stone",
chance = 3, min = 1, max = 1},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = {"farming:bread", "mobs:meat", "default:diamond"},
view_range = 15,
-- model animation
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
-- right clicking with cooked meat will give npc more health
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "default:sword_steel" then
minetest.add_entity(self.object:getpos(), "pmobs:guard")
self.object:remove()
clicker:get_inventory():remove_item("main", "default:sword_steel")
elseif item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]})
end
end,
})
-- spawning disabled for now
mobs:register_spawn("pmobs:npc", {"default:dirt_with_grass"}, 20, 0, 22000, 1, 31000)
-- register spawn egg
mobs:register_egg("pmobs:npc", "Npc", "default_brick.png", 1)
mobs:alias_mob("mobs:npc", "pmobs:npc")

137
mods/pmobs/npc_female.lua Executable file
View File

@ -0,0 +1,137 @@
-- Npc by TenPlus1
mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:apple", "default:sapling", "default:junglesapling",
"shields:shield_enhanced_wood", "3d_armor:chestplate_cactus", "3d_armor:boots_bronze",
"default:sword_steel", "default:pick_steel", "default:shovel_steel", "default:bronze_ingot",
"bucket:bucket_water", "default:stick", "cavestuff:pebble_1", "building_blocks:stick",
"default:cobble", "default:gravel", "default:clay_lump", "default:sand", "default:dirt_with_grass",
"default:dirt", "default:chest", "default:torch"}
mobs:register_mob("pmobs:npc_female", {
-- animal, monster, npc
type = "npc",
-- aggressive, deals 6 damage to player/monster when hit
passive = false,
group_attack = true,
damage = 4, -- 3 damages if tamed
attack_type = "dogfight",
attacks_monsters = true,
pathfinding = false,
-- health & armor
hp_min = 20,
hp_max = 20,
armor = 200,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"mobs_npc_female.png"}, -- female by nuttmeg20
},
child_texture = {
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
},
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_fnpc", -- 2 sounds
damage = "mobs_fnpc_hit", -- 2 sounds
attack = "mobs_fnpc_attack", -- 1 sound
death = "mobs_fnpc_death", -- 1 sound
},
-- speed and jump
walk_velocity = 3,
run_velocity = 3,
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood", chance = 1, min = 1, max = 3},
{name = "default:apple", chance = 2, min = 1, max = 2},
{name = "flowers:tulip", chance = 4, min = 1, max = 2},
{name = "flowers:rose", chance = 4, min = 1, max = 2},
{name = "default:axe_stone", chance = 6, min = 1, max = 1},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
lava_damage = 6,
light_damage = 0,
-- follow diamond
follow = {"farming:bread", "mobs:meat", "default:diamond"},
view_range = 16,
-- set owner and order
owner = "",
order = "follow",
fear_height = 3,
-- model animation
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
},
-- right clicking with "cooked meat" or "bread" will give npc more health
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if item:get_name() == "default:diamond" then --/MFF (Crabman|07/14/2015) tamed with diamond
if (self.diamond_count or 0) < 4 then
self.diamond_count = (self.diamond_count or 0) + 1
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
if self.diamond_count >= 4 then
self.damages = 3
self.tamed = true
self.owner = clicker:get_player_name()
end
end
return
-- feed to heal npc
elseif not mobs:feed_tame(self, clicker, 8, true, true) then
-- right clicking with gold lump drops random item from mobs.npc_drops
if item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {
name = mobs.npc_drops[math.random(1, #mobs.npc_drops)]
})
return
-- if owner switch between follow and stand
elseif self.owner and self.owner == clicker:get_player_name() then
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
end
end,
})
-- spawning enable for now
--mobs:spawn_specific("pmobs:npc_female", {"default:dirt_with_grass"}, {"air"}, -1, 20, 30, 500000, 1, -31000, 31000, true, true)
mobs:register_spawn("pmobs:npc_female", {"default:dirt_with_grass"}, 20, 0, 22000, 1, 31000)
-- register spawn egg
mobs:register_egg("pmobs:npc_female", "Npc", "mobs_npc_female_inv.png", 1)
mobs:alias_mob("mobs:npc_female", "pmobs:npc_female")

BIN
mods/pmobs/sounds/mobs_fnpc.1.ogg Executable file

Binary file not shown.

BIN
mods/pmobs/sounds/mobs_fnpc.2.ogg Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mods/pmobs/sounds/mobs_npc.1.ogg Executable file

Binary file not shown.

BIN
mods/pmobs/sounds/mobs_npc.2.ogg Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mods/pmobs/sounds/mobs_wolf.ogg Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

65
mods/pmobs/wolf.lua Normal file
View File

@ -0,0 +1,65 @@
-- Wolf by KrupnoPavel
mobs:register_mob("pmobs:wolf", {
type = "animal",
hp_max = 5,
passive = false,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "mobs_wolf.x",
textures = {
{"mobs_wolf.png"},
},
makes_footstep_sound = true,
sounds = {
random = "mobs_wolf",
war_cry = "mobs_wolf_attack",
},
view_range = 7,
walk_velocity = 2,
run_velocity = 3,
stepheight = 1.1,
damage = 2,
armor = 200,
attack_type = "dogfight",
drops = {
{name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
{name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,},
},
drawtype = "front",
water_damage = 0,
lava_damage = 5,
light_damage = 0,
on_rightclick = function(self, clicker)
tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:meat_raw" then
clicker:get_inventory():remove_item("main", "mobs:meat_raw")
minetest.add_entity(self.object:getpos(), "pmobs:dog")
self.object:remove()
end
end,
animation = {
speed_normal = 20,
speed_run = 30,
stand_start = 10,
stand_end = 20,
walk_start = 75,
walk_end = 100,
run_start = 100,
run_end = 130,
punch_start = 135,
punch_end = 155,
},
jump = true,
step = 0.5,
blood_texture = "mobs_blood.png",
})
mobs:register_spawn("pmobs:wolf", {"default:dirt_with_grass","default:dirt","default:snow", "default:snowblock"}, 20, -1, 22000, 1, 31000)
mobs:register_egg("pmobs:wolf", "Wolf", "wool_grey.png", 1)
mobs:alias_mob("mobs:wolf", "pmobs:wolf")

112
mods/pmobs/yeti.lua Normal file
View File

@ -0,0 +1,112 @@
-- Yeti by TenPlus1
mobs:register_mob("pmobs:yeti", {
type = "monster",
hp_min = 10,
hp_max = 35,
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
textures = {
{"mobs_yeti.png"},
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
sounds = {
shoot_attack = "mobs_stonemonster_attack",
death = "mobs_zombie_death",
random = "mobs_stonemonster",
},
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
drops = {
{name = "default:ice",
chance = 1,
min = 1,
max = 3,},
{name = "maptools:silver_coin",
chance = 2, min = 1, max = 1,},
},
armor = 100,
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 1,
on_rightclick = nil,
attack_type = "shoot",
shoot_interval = .7,
arrow = "pmobs:snowball",
shoot_offset = 2,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
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)
mobs:register_egg("pmobs:yeti", "Yeti", "default_snow.png", 1)
mobs:register_arrow("pmobs:snowball", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"default_snowball.png"},
velocity = 6,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
}, 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
})
mobs:alias_mob("mobs:yeti", "pmobs:yeti")