Remplissage du dépôt

This commit is contained in:
sys4-fr 2018-09-30 15:55:14 +02:00
commit 85ffe36a8a
45 changed files with 17965 additions and 0 deletions

7
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.
2.5 - Added Npc, Guard, Archer, Ninja, Wolf, Dog and Yeti
Special thanks to TenPlus1.

172
archer.lua Normal file
View File

@ -0,0 +1,172 @@
-- Guard
mobs:register_mob("pmobs:archer", {
-- animal, monster, npc
type = "npc",
passive = true,
damage = 7,
attack_type = "shoot",
shoot_interval = 1,
arrow = "pmobs:arrow",
shoot_offset = 2,
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", "pmobs_bow.png"},
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 4,
run_velocity = 4,
floats = {x=0,y=0,z=0},
jump = true,
stepheight = 1.1,
-- 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,
},
-- rotate arrows
do_custom = function(self)
local s = self.object:getpos()
local obj = nil
for _,oir in ipairs(minetest.get_objects_inside_radius(s, self.view_range)) do
obj = oir:get_luaentity()
if obj then
if obj.name == "pmobs:arrow" then
obj.object:setyaw(self.object:getyaw()-1.57)
break
end
end
end
end,
-- 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
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;afollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;astand;stand]"
formspec = formspec .. "button_exit[0,2;4,4;afandp;follow and protect]"
formspec = formspec .. "button_exit[4,2;4,4;asandp;stand and protect]"
formspec = formspec .. "button_exit[1,2;2,2;agohome; go home]"
formspec = formspec .. "button_exit[5,2;2,2;asethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.afollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.astand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.afandp then
self.order = "follow"
self.attacks_monsters = true
end
if fields.asandp then
self.order = "stand"
self.attacks_monsters = true
end
if fields.asethome then
self.floats = self.object:getpos()
end
if fields.agohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
end)
end
end
end,
})
mobs:register_egg("pmobs:archer", "Archer", "default_tree.png", 1)
mobs:register_arrow("pmobs:arrow", {
physical = false,
timer=0,
view_range = 15,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"pmobs:arrow_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
velocity = 6,
drop = true,
hit_player = function(self, player)
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,
})

86
arrow.lua Normal file
View File

@ -0,0 +1,86 @@
minetest.register_craftitem("pmobs:arrow", {
description = "Arrow",
inventory_image = "pmobs_arrow.png",
})
minetest.register_node("pmobs:arrow_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"pmobs_arrow.png", "pmobs_arrow.png", "pmobs_arrow_back.png", "pmobs_arrow_front.png", "pmobs_arrow_2.png", "pmobs_arrow.png"},
groups = {not_in_creative_inventory=1},
})
local pmobs_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"pmobs:arrow_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
pmobs_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.env:get_node(pos)
if self.timer>0.2 then
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "pmobs:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 3
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
end
else
local damage = 3
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
minetest.env:add_item(self.lastpos, 'pmobs:arrow')
self.object:remove()
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("pmobs:arrow_entity", pmobs_ARROW_ENTITY)
minetest.register_craft({
output = 'pmobs:arrow 16',
recipe = {
{'default:stick', 'default:stick', 'default:steel_ingot'},
}
})

3
depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
mobs
sethome

109
dog.lua Normal file
View File

@ -0,0 +1,109 @@
-- 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 = {
war_cry = "mobs_wolf_attack",
},
view_range = 15,
stepheight = 1.1,
owner = "",
order = "follow",
floats = {x=0,y=0,z=0},
walk_velocity = 4,
run_velocity = 4,
stepheight = 1.1,
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
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;dfollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;dstand;stand]"
formspec = formspec .. "button_exit[0,2;4,4;dfandp;follow and protect]"
formspec = formspec .. "button_exit[4,2;4,4;dsandp;stand and protect]"
formspec = formspec .. "button_exit[1,2;2,2;dgohome; go home]"
formspec = formspec .. "button_exit[5,2;2,2;dsethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.dfollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.dstand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.dfandp then
self.order = "follow"
self.attacks_monsters = true
end
if fields.dsandp then
self.order = "stand"
self.attacks_monsters = true
end
if fields.dsethome then
self.floats = self.object:getpos()
end
if fields.dgohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
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)

121
fire_arrow.lua Normal file
View File

@ -0,0 +1,121 @@
minetest.register_craftitem("pmobs:arrow_fire", {
description = "Fire Arrow",
inventory_image = "pmobs_arrow_fire.png",
})
minetest.register_node("pmobs:arrow_fire_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"pmobs_arrow_fire.png", "pmobs_arrow_fire.png", "pmobs_arrow_fire_back.png", "pmobs_arrow_fire_front.png", "pmobs_arrow_fire_2.png", "pmobs_arrow_fire.png"},
groups = {not_in_creative_inventory=1},
})
local pmobs_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"pmobs:arrow_fire_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
pmobs_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.env:get_node(pos)
if self.timer>0.2 then
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "pmobs:arrow_fire_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 5
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
end
else
local damage = 5
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" and node.name ~= "pmobs:light" then
minetest.env:set_node(self.lastpos, {name="fire:basic_flame"})
self.object:remove()
end
if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then
if minetest.env:get_node(self.lastpos).name == "pmobs:light" then
minetest.env:remove_node(self.lastpos)
end
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, {name="pmobs:light"})
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("pmobs:arrow_fire_entity", pmobs_ARROW_ENTITY)
minetest.register_craft({
output = 'pmobs:arrow_fire 4',
recipe = {
{'default:stick', 'default:stick', 'bucket:bucket_lava'},
},
replacements = {
{"bucket:bucket_lava", "bucket:bucket_empty"}
}
})
minetest.register_node("pmobs:light", {
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
tiles = {"pmobs_empty.png"},
light_source = LIGHT_MAX-4,
selection_box = {
type = "fixed",
fixed = {
{0,0,0,0,0,0}
}
},
groups = {not_in_creative_inventory=1}
})
minetest.register_abm({
nodenames = {"pmobs:light"},
interval = 10,
chance = 1,
action = function(pos, node)
minetest.env:remove_node(pos)
end
})

126
guard.lua Normal file
View File

@ -0,0 +1,126 @@
-- 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 = 4,
run_velocity = 4,
jump = true,
floats = {x=0,y=0,z=0},
stepheight = 1.1,
-- 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
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;gfollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;gstand;stand]"
formspec = formspec .. "button_exit[0,2;4,4;gfandp;follow and protect]"
formspec = formspec .. "button_exit[4,2;4,4;gsandp;stand and protect]"
formspec = formspec .. "button_exit[1,2;2,2;ggohome; go home]"
formspec = formspec .. "button_exit[5,2;2,2;gsethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.gfollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.gstand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.gfandp then
self.order = "follow"
self.attacks_monsters = true
end
if fields.gsandp then
self.order = "stand"
self.attacks_monsters = true
end
if fields.gsethome then
self.floats = self.object:getpos()
end
if fields.ggohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
end)
end
end
end,
})
mobs:register_egg("pmobs:guard", "Guard", "default_steel_block.png", 1)

27
init.lua Normal file
View File

@ -0,0 +1,27 @@
-- Animals
dofile(minetest.get_modpath("pmobs").."/wolf.lua") -- KrupnoPavel
dofile(minetest.get_modpath("pmobs").."/dog.lua") -- CProgrammerRU
-- Monsters
dofile(minetest.get_modpath("pmobs").."/ninja.lua") -- CProgrammerRU
dofile(minetest.get_modpath("pmobs").."/yeti.lua") -- TenPlus1
-- NPC
dofile(minetest.get_modpath("pmobs").."/npc.lua") -- TenPlus1
dofile(minetest.get_modpath("pmobs").."/npc_women.lua") -- CProgrammerRU (texture by TenPlus1)
dofile(minetest.get_modpath("pmobs").."/npc_nurse.lua") -- CProgrammerRU
dofile(minetest.get_modpath("pmobs").."/guard.lua") -- CProgrammerRU
dofile(minetest.get_modpath("pmobs").."/archer.lua") -- CProgrammerRU
dofile(minetest.get_modpath("pmobs").."/throwing.lua")
dofile(minetest.get_modpath("pmobs").."/arrow.lua")
dofile(minetest.get_modpath("pmobs").."/fire_arrow.lua")
if minetest.setting_get("log_mods") then
minetest.log("action", "pmobs loaded")
end

21
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.

BIN
models/character.b3d Normal file

Binary file not shown.

9156
models/guard.x Normal file

File diff suppressed because it is too large Load Diff

7420
models/mobs_wolf.x Normal file

File diff suppressed because it is too large Load Diff

123
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"}, 20, 0, 15000, 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", ""},
}
})

100
npc.lua Normal file
View File

@ -0,0 +1,100 @@
-- Npc by TenPlus1
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water" }
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"},
},
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()
local guard
local ent
if item:get_name() == "default:sword_steel" then
guard = minetest.add_entity(self.object:getpos(), "pmobs:guard")
ent = guard:get_luaentity()
ent.owner = clicker:get_player_name()
self.object:remove()
clicker:get_inventory():remove_item("main", "default:sword_steel")
elseif item:get_name() == "pmobs:bow_steel" then
guard = minetest.add_entity(self.object:getpos(), "pmobs:archer")
ent = guard:get_luaentity()
ent.owner = clicker:get_player_name()
self.object:remove()
clicker:get_inventory():remove_item("main", "pmobs:bow_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, 15000, 1, 31000)
-- register spawn egg
mobs:register_egg("pmobs:npc", "Npc", "default_brick.png", 1)

125
npc_nurse.lua Normal file
View File

@ -0,0 +1,125 @@
-- Npc by TenPlus1
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water" }
mobs:register_mob("pmobs:npc_nurse", {
-- animal, monster, npc
type = "npc",
-- aggressive, deals 2 damage to player/monster when hit
passive = false,
damage = 2,
attack_type = "dogfight",
attacks_monsters = false,
-- 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",
floats = {x=0,y=0,z=0},
drawtype = "front",
owner = "",
order = "follow",
textures = {
{"mobs_npc_nurse.png"},
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 4,
run_velocity = 4,
jump = true,
stepheight = 1.1,
-- 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
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;nfollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;nstand;stand]"
formspec = formspec .. "button_exit[3,1;2,2;nheal;heal]"
formspec = formspec .. "button_exit[1,2;2,2;ngohome; go home]"
formspec = formspec .. "button_exit[5,2;2,2;nsethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.nfollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.nstand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.nheal then
clicker:set_hp(20)
end
if fields.nsethome then
self.floats = self.object:getpos()
end
if fields.ngohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
end)
end
end
end,
})
-- register spawn egg
mobs:register_egg("pmobs:npc_nurse", "Npc", "default_brick.png", 1)

94
npc_women.lua Normal file
View File

@ -0,0 +1,94 @@
-- Npc by TenPlus1
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water" }
mobs:register_mob("pmobs:npc_women", {
-- animal, monster, npc
type = "npc",
-- aggressive, deals 2 damage to player/monster when hit
passive = false,
damage = 2,
attack_type = "dogfight",
attacks_monsters = false,
-- 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_women.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()
local guard
local ent
if item:get_name() == "default:diamond" then
guard = minetest.add_entity(self.object:getpos(), "pmobs:npc_nurse")
ent = guard:get_luaentity()
ent.owner = clicker:get_player_name()
self.object:remove()
clicker:get_inventory():remove_item("main", "default:diamond")
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,
})
mobs:register_spawn("pmobs:npc_women", {"default:dirt_with_grass"}, 20, 0, 15000, 1, 31000)
-- register spawn egg
mobs:register_egg("pmobs:npc_women", "Npc", "default_brick.png", 1)

BIN
sounds/mobs_wolf_attack.ogg Normal file

Binary file not shown.

BIN
sounds/throwing_sound.ogg Normal file

Binary file not shown.

4
textures/.directory Normal file
View File

@ -0,0 +1,4 @@
[Dolphin]
PreviewsShown=true
Timestamp=2015,7,18,22,17,28
Version=3

BIN
textures/mobs_blood.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

BIN
textures/mobs_dog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
textures/mobs_ninja.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

BIN
textures/mobs_npc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

BIN
textures/mobs_npc_nurse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

BIN
textures/mobs_npc_women.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

BIN
textures/mobs_shuriken.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

BIN
textures/mobs_wolf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
textures/mobs_yeti.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

BIN
textures/pmobs_arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
textures/pmobs_arrow_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

BIN
textures/pmobs_bow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

BIN
textures/pmobs_bow_wood.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

BIN
textures/pmobs_empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

101
throwing.lua Normal file
View File

@ -0,0 +1,101 @@
arrows = {
{"pmobs:arrow", "pmobs:arrow_entity"},
{"pmobs:arrow_fire", "pmobs:arrow_fire_entity"},
}
local pmobs_shoot_arrow = function(itemstack, player)
for _,arrow in ipairs(arrows) do
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
if not minetest.setting_getbool("creative_mode") then
player:get_inventory():remove_item("main", arrow[1])
end
local playerpos = player:getpos()
local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19})
obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
obj:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos})
if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player
end
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
return true
end
end
return false
end
minetest.register_tool("pmobs:bow_wood", {
description = "Wood Bow",
inventory_image = "pmobs_bow_wood.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if pmobs_shoot_arrow(itemstack, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/50)
end
end
return itemstack
end,
})
minetest.register_craft({
output = 'pmobs:bow_wood',
recipe = {
{'farming:string', 'default:wood', ''},
{'farming:string', '', 'default:wood'},
{'farming:string', 'default:wood', ''},
}
})
minetest.register_tool("pmobs:bow_stone", {
description = "Stone Bow",
inventory_image = "pmobs_bow_stone.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if pmobs_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/100)
end
end
return itemstack
end,
})
minetest.register_craft({
output = 'pmobs:bow_stone',
recipe = {
{'farming:string', 'default:cobble', ''},
{'farming:string', '', 'default:cobble'},
{'farming:string', 'default:cobble', ''},
}
})
minetest.register_tool("pmobs:bow_steel", {
description = "Steel Bow",
inventory_image = "pmobs_bow_steel.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if pmobs_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/200)
end
end
return itemstack
end,
})
minetest.register_craft({
output = 'pmobs:bow_steel',
recipe = {
{'farming:string', 'default:steel_ingot', ''},
{'farming:string', '', 'default:steel_ingot'},
{'farming:string', 'default:steel_ingot', ''},
}
})
if minetest.setting_get("log_mods") then
minetest.log("action", "pmobs loaded")
end

64
wolf.lua Normal file
View File

@ -0,0 +1,64 @@
-- 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 = {
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,},
},
drawtype = "front",
water_damage = 0,
lava_damage = 5,
light_damage = 0,
on_rightclick = function(self, clicker)
tool = clicker:get_wielded_item()
local dog
local ent
if tool:get_name() == "mobs:meat_raw" then
clicker:get_inventory():remove_item("main", "mobs:meat_raw")
dog = minetest.add_entity(self.object:getpos(), "pmobs:dog")
ent = dog:get_luaentity()
ent.owner = clicker:get_player_name()
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, 0, 15000, 5, 31000)
mobs:register_egg("pmobs:wolf", "Wolf", "wool_grey.png", 1)

106
yeti.lua Normal file
View File

@ -0,0 +1,106 @@
-- 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 = {
random = "mobs_stonemonster",
},
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
drops = {
{name = "default:snow",
chance = 1,
min = 1,
max = 3,},
},
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"}, 20, 0, 15000, 5, 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
})