Version nalc inspiré de la version MFF.

This commit is contained in:
sys4-fr 2018-09-30 15:57:05 +02:00
parent 85ffe36a8a
commit 2dfcf120c1
49 changed files with 266 additions and 872 deletions

View File

@ -2,6 +2,6 @@ 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
0.1 - Added Npc, Guard, Ninja, Wolf, Dog and Yeti
Special thanks to TenPlus1.

View File

@ -1,172 +0,0 @@
-- 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,
})

View File

@ -1,86 +0,0 @@
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'},
}
})

View File

@ -1,3 +1,4 @@
default
mobs
sethome
maptools?
zombie?

46
dog.lua
View File

@ -13,16 +13,15 @@ mobs:register_mob("pmobs:dog", {
},
makes_footstep_sound = true,
sounds = {
random = "mobs_wolf",
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,
@ -51,42 +50,11 @@ mobs:register_mob("pmobs:dog", {
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)
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end,
@ -107,3 +75,5 @@ mobs:register_mob("pmobs:dog", {
blood_texture = "mobs_blood.png",
})
mobs:register_egg("pmobs:dog", "Dog", "wool_brown.png", 1)
mobs:alias_mob("mobs:dog", "pmobs:dog")

View File

@ -1,121 +0,0 @@
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
})

View File

@ -25,11 +25,9 @@ mobs:register_mob("pmobs:guard", {
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 4,
run_velocity = 4,
walk_velocity = 3,
run_velocity = 3,
jump = true,
floats = {x=0,y=0,z=0},
stepheight = 1.1,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
@ -79,43 +77,11 @@ mobs:register_mob("pmobs:guard", {
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)
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end,

View File

@ -2,24 +2,17 @@
-- Animals
dofile(minetest.get_modpath("pmobs").."/wolf.lua") -- KrupnoPavel
dofile(minetest.get_modpath("pmobs").."/dog.lua") -- CProgrammerRU
dofile(minetest.get_modpath("pmobs").."/dog.lua")
-- Monsters
dofile(minetest.get_modpath("pmobs").."/ninja.lua") -- CProgrammerRU
--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_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")
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")

View File

@ -52,7 +52,7 @@ mobs:register_mob("pmobs:ninja", {
})
-- ninja spawn on top of trees
mobs:register_spawn("pmobs:ninja", {"default:leaves"}, 20, 0, 15000, 1, 31000)
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", {

34
npc.lua
View File

@ -1,7 +1,12 @@
-- Npc by TenPlus1
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water" }
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
@ -21,10 +26,18 @@ mobs:register_mob("pmobs:npc", {
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 = {},
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,
@ -37,12 +50,14 @@ mobs:register_mob("pmobs:npc", {
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 = {
@ -55,20 +70,10 @@ mobs:register_mob("pmobs:npc", {
-- 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()
minetest.add_entity(self.object:getpos(), "pmobs:guard")
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
@ -93,8 +98,9 @@ mobs:register_mob("pmobs:npc", {
end,
})
-- spawning disabled for now
mobs:register_spawn("pmobs:npc", {"default:dirt_with_grass"}, 20, 0, 15000, 1, 31000)
mobs:register_spawn("pmobs:npc", {"default:dirt_with_grass"}, 20, 0, 500000, 1, 31000)
-- register spawn egg
mobs:register_egg("pmobs:npc", "Npc", "default_brick.png", 1)
mobs:alias_mob("mobs:npc", "pmobs:npc")

137
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, 500000, 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")

View File

@ -1,125 +0,0 @@
-- 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)

View File

@ -1,94 +0,0 @@
-- 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_fnpc.1.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_fnpc.2.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_fnpc_attack.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_fnpc_death.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_fnpc_hit.1.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_fnpc_hit.2.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_npc.1.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_npc.2.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_npc_attack.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_npc_death.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_npc_hit.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_wolf.ogg Executable file

Binary file not shown.

BIN
sounds/mobs_yeti_death.ogg Executable file

Binary file not shown.

Binary file not shown.

View File

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

BIN
textures/mobs_npc_baby.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
textures/mobs_npc_female.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

BIN
textures/mobs_npc_female_inv.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

View File

@ -1,101 +0,0 @@
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

138
wolf.lua
View File

@ -1,64 +1,82 @@
-- 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)
local drop_coin = nil -- NALC : Drop silver coin by chance if maptools mod loaded
if minetest.get_modpath("maptools") then
drop_coin = {
name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,
}
end
mobs:register_mob(
"pmobs:wolf",
{
type = "monster",
docile_by_day = true,
passive = false,
pathfinding = false,
reach = 2,
hp_min = 15,
hp_max = 20,
armor = 200,
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 = 3,
attack_type = "dogfight",
drops = {
{
name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,
},
drop_coin -- NALC
},
drawtype = "front",
water_damage = 0,
lava_damage = 5,
light_damage = 0,
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item():get_name()
if tool == "mobs:meat_raw" or
(minetest.get_modpath("zombie") and tool == "zombie:rotten_flesh") then
clicker:get_inventory():remove_item("main", tool)
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, 100000, 1, 31000)
mobs:register_egg("pmobs:wolf", "Wolf", "wool_grey.png", 1)
mobs:alias_mob("mobs:wolf", "pmobs:wolf")

View File

@ -14,6 +14,8 @@ mobs:register_mob("pmobs:yeti", {
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,
@ -21,10 +23,12 @@ mobs:register_mob("pmobs:yeti", {
run_velocity = 3,
damage = 2,
drops = {
{name = "default:snow",
{name = "default:ice",
chance = 1,
min = 1,
max = 3,},
{name = "maptools:silver_coin",
chance = 2, min = 1, max = 1,},
},
armor = 100,
drawtype = "front",
@ -46,7 +50,7 @@ mobs:register_mob("pmobs:yeti", {
jump = true,
floats = 0,
})
mobs:register_spawn("pmobs:yeti", {"default:dirt_with_snow", "default:snowblock", "default:ice"}, 20, 0, 15000, 5, 31000)
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)
@ -104,3 +108,5 @@ minetest.override_item("default:snow", {
on_use = mobs_shoot_snowball
})
mobs:alias_mob("mobs:yeti", "pmobs:yeti")