2015-03-18 21:28:40 +01:00
|
|
|
|
|
|
|
-- Npc by TenPlus1
|
|
|
|
|
2015-05-22 19:28:57 +02:00
|
|
|
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",
|
2015-07-28 22:44:29 +02:00
|
|
|
"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"}
|
2015-03-18 21:28:40 +01:00
|
|
|
|
2015-04-09 12:25:45 +02:00
|
|
|
|
2015-03-18 21:28:40 +01:00
|
|
|
mobs:register_mob("mobs:npc", {
|
|
|
|
-- animal, monster, npc
|
|
|
|
type = "npc",
|
2015-03-26 20:08:30 +01:00
|
|
|
-- aggressive, deals 6 damage to player/monster when hit
|
2015-03-18 21:28:40 +01:00
|
|
|
passive = false,
|
2015-07-22 00:11:38 +02:00
|
|
|
group_attack = true,
|
2015-07-13 23:12:30 +02:00
|
|
|
damage = 5, -- 3 damages if tamed
|
2015-03-18 21:28:40 +01:00
|
|
|
attack_type = "dogfight",
|
|
|
|
attacks_monsters = true,
|
2016-02-18 13:39:47 +01:00
|
|
|
pathfinding = true,
|
2015-03-18 21:28:40 +01:00
|
|
|
-- health & armor
|
2016-02-01 12:45:12 +01:00
|
|
|
hp_min = 20,
|
|
|
|
hp_max = 20,
|
|
|
|
armor = 100,
|
2015-03-18 21:28:40 +01:00
|
|
|
-- textures and model
|
|
|
|
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "character.b3d",
|
2015-05-22 10:37:17 +02:00
|
|
|
drawtype = "front",
|
Update mobs mod
- api.lua (many improves, chicken egg more frequent, NPC attack nearly
mobs, textures code, etc…)
- Bee (spawn on group:flower now, textures code updated)
- Bunny (textures code updated)
- Chicken (two times more eggs, textures code updated)
- Cow (textures code updated)
- Creeper (finish reorganize the code, textures code updated, new eggs
inventory texture)
- Dirt Monster (textures code updated)
- Dungeon Master (textures code updated)
- init.lua (small credits tweaks)
- Kitten (textures code updated, now drop sometimes farming:string)
- Lava Flan (textures code updated, now 3 can spawn per chunck)
- Mese Monster (textures code updated)
- NPC (textures code updated, revert give raw meat versus health code
for tests)
- Oerkki (textures code updated, now 1 light damage)
- Rat (textures code updated)
- Sand Monster (textures code updated)
- Sheep (textures code updated, now give 2 to 3 wool when sheared)
- Spider (textures code updated, change credits, comments our
modifications)
- Stone Monster (textures code updated)
- Tree Monster (textures code updated)
- Warthog (textures code updated)
- Wolf (finish reorganize the code, textures code updated, add spawner
egg and an inventory texture)
- Tweaks some sounds
2015-03-31 19:32:46 +02:00
|
|
|
textures = {
|
|
|
|
{"mobs_npc.png"},
|
2015-03-18 21:28:40 +01:00
|
|
|
},
|
2015-08-18 17:09:53 +02:00
|
|
|
child_texture = {
|
|
|
|
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
|
|
|
|
},
|
2015-03-18 21:28:40 +01:00
|
|
|
-- sounds
|
|
|
|
makes_footstep_sound = true,
|
2015-07-29 23:06:18 +02:00
|
|
|
sounds = {
|
|
|
|
random = "mobs_npc",
|
|
|
|
damage = "mobs_npc_hit",
|
|
|
|
attack = "mobs_npc_attack",
|
|
|
|
death = "mobs_npc_death",
|
|
|
|
},
|
2015-03-18 21:28:40 +01:00
|
|
|
-- speed and jump
|
2015-04-18 23:11:19 +02:00
|
|
|
walk_velocity = 3,
|
2015-04-02 19:16:47 +02:00
|
|
|
run_velocity = 3,
|
2015-03-18 21:28:40 +01:00
|
|
|
jump = true,
|
|
|
|
-- drops wood and chance of apples when dead
|
|
|
|
drops = {
|
2016-02-10 05:02:17 +01:00
|
|
|
{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,},
|
2015-03-18 21:28:40 +01:00
|
|
|
},
|
|
|
|
-- damaged by
|
|
|
|
water_damage = 0,
|
Mobs update (because of the mapgen), mainly spawn/nodes improve
Many small adjustments :
- 10% less for the spawn rate of the Creeper
- Dirt Monster now spawn also on DryGrass, and the spawn rate is increased by 5%
- Dungeon Master now spawn on sandstone, and now only under -250
- Mese Monster now spawn on sandstone, and now only under -125
- Minotaur now spawn only on DryGrass, and the spawn rate is increased of +20%
- NPC spawns rate is increased by 300%, BUT the NPC now spawns on many nodes ! ("Beach" Sand, Jungle Grass, Dirt, Dirt With Grass)
- Oerkki now spawn on sandstone and below -75
- Spider spawns rate is decreased by 30% due to the new mapgen (jungletrees have less leaves)
- Stone Monster now spawn on sandstone, only under -25
- Wolf spawns rate is increased by 5%
- Zombies now spawn 10% lesser
2015-07-13 13:14:17 +02:00
|
|
|
lava_damage = 6,
|
2015-03-18 21:28:40 +01:00
|
|
|
light_damage = 0,
|
|
|
|
-- follow diamond
|
2015-08-18 17:09:53 +02:00
|
|
|
follow = {"farming:bread", "mobs:meat", "default:diamond"},
|
2015-03-18 21:28:40 +01:00
|
|
|
view_range = 16,
|
2015-04-02 19:16:47 +02:00
|
|
|
-- set owner and order
|
|
|
|
owner = "",
|
|
|
|
order = "follow",
|
2015-12-18 21:13:20 +01:00
|
|
|
fear_height = 3,
|
2015-03-18 21:28:40 +01:00
|
|
|
-- model animation
|
|
|
|
animation = {
|
2015-12-18 21:13:20 +01:00
|
|
|
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,
|
2015-03-18 21:28:40 +01:00
|
|
|
},
|
2015-03-22 10:29:11 +01:00
|
|
|
-- right clicking with "cooked meat" or "bread" will give npc more health
|
2015-03-18 21:28:40 +01:00
|
|
|
on_rightclick = function(self, clicker)
|
2015-12-18 21:13:20 +01:00
|
|
|
|
2015-08-18 23:44:59 +02:00
|
|
|
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
|
2015-07-14 20:27:36 +02:00
|
|
|
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
|
2015-09-30 03:43:51 +02:00
|
|
|
self.tamed = true
|
2015-07-14 20:27:36 +02:00
|
|
|
self.owner = clicker:get_player_name()
|
2015-08-18 23:44:59 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
return
|
|
|
|
-- feed to heal npc
|
2015-09-22 00:01:24 +02:00
|
|
|
elseif not mobs:feed_tame(self, clicker, 8, true, true) then
|
2015-08-18 23:44:59 +02:00
|
|
|
-- 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
|
2016-02-01 12:45:12 +01:00
|
|
|
|
2015-08-18 17:09:53 +02:00
|
|
|
local pos = self.object:getpos()
|
|
|
|
pos.y = pos.y + 0.5
|
2015-09-01 00:40:11 +02:00
|
|
|
minetest.add_item(pos, {
|
2015-12-18 21:13:20 +01:00
|
|
|
name = mobs.npc_drops[math.random(1, #mobs.npc_drops)]
|
2015-09-01 00:40:11 +02:00
|
|
|
})
|
2015-08-18 23:44:59 +02:00
|
|
|
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"
|
2015-08-18 17:09:53 +02:00
|
|
|
end
|
2015-07-14 20:27:36 +02:00
|
|
|
end
|
2015-08-18 23:44:59 +02:00
|
|
|
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
|
2015-03-18 21:28:40 +01:00
|
|
|
end
|
2016-02-01 12:45:12 +01:00
|
|
|
|
2015-03-18 21:28:40 +01:00
|
|
|
end,
|
|
|
|
})
|
2015-08-18 23:44:59 +02:00
|
|
|
|
2015-03-22 10:29:11 +01:00
|
|
|
-- spawning enable for now
|
2016-02-10 05:02:17 +01:00
|
|
|
mobs:spawn_specific("mobs:npc", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true, true)
|
2015-03-18 21:28:40 +01:00
|
|
|
-- register spawn egg
|
2015-08-17 22:52:29 +02:00
|
|
|
mobs:register_egg("mobs:npc", "Npc", "mobs_npc_male_inv.png", 1)
|