mobs_fallout/esnpc.lua

1290 lines
37 KiB
Lua

--mobs_fallout v0.0.4
--maikerumine
--made for Extreme Survival game
--dofile(minetest.get_modpath("mobs_fallout").."/api.lua")
--REFERENCE
--fix
--mobs.npc_drops = { "cityscape:canned_food", "shooter:rocket_gun_loaded", "mobs_fallout:meat 4", "shooter:rifle", "default:shovel_steel", "farming:bread", "default:wood","shooter:ammo","default:duct_tape 3", "default:health_kit" }--Added 20151121
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "default:wood" }--Added 20151121
mobs.npc2_drops = { "default:pick_mese", "mobs:meat", "default:sword_diamond", "default:pick_diamond", "farming:bread", "default:wood" }--Added 20151121
mobs.npc_drops = { "shooter:rocket_gun_loaded", "mobs_fallout:meat 4", "shooter:rifle", "default:shovel_steel", "farming:bread", "default:wood","shooter:ammo","default:duct_tape 3", "default:health_kit" }--Added 20151121
mobs:register_spawn("mobs_fallout:Bajan", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:Bajan", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 25,
hp_max = 35,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Bajancanadian_by_bajanhgk.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:rifle"].inventory_image,
}},
visual_size = {x=1, y=1.0},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
drops = {
{name = "default:apple",
chance = 1,
min = 1,
max = 2,},
{name = "shooter:rifle",
chance = 2,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 13,
max=30,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Sam: Let's go kick some Mob butt!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Bajan: Let's go kick some Mob butt!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_death1",
attack = "default_punch",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:John", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:John", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 27,
hp_max = 34,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Castaway_by_Gold.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:shotgun"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:apple",
chance = 1,
min = 1,
max = 5,},
{name = "default:carbon_steel_sword",
chance = 1,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 13,
max=30,},
},
armor = 85,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"John: Let's go grief some monsters!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"John: Let's go grief some monsters!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_death2",
attack = "shooter_shotgun",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:Krock", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:Krock", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 13,
hp_max = 15,
collisionbox = {-0.3, -0.8, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Red-brown-shirt-dude_by_Krock.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:ammo"].inventory_image,
}},
visual_size = {x=1, y=.8},
makes_footstep_sound = true,
view_range = 19,
walk_velocity = 1.6,
run_velocity = 1,
damage = 2.5,
drops = {
{name = "default:leaves",
chance = 1,
min = 3,
max = 5,},
{name = "shooter:rifle",
chance = 2,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 13,
max=30,},
},
armor = 40,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
follow = "default:apple",
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Jannette: Stop flirting with me!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Krock: Stop flirting with me!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_oerkki_attack",
death = "mobs_death1",
attack = "default_punch",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
--mobs:register_egg("mobs_fallout:badplayer13", "Girl In Red", "character_13_preview.png", 1)
mobs:register_spawn("mobs_fallout:Just_Test_Griefer", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:Just_Test_Griefer", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 27,
hp_max = 45,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Just_Test_Griefer_by_maikerumine.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_wood"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:papyrus",
chance = 1,
min = 3,
max = 5,},
{name = "shooter:rifle",
chance = 2,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 1,
max=3,},
},
armor = 90,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Crybaby: I am too whimpy to fight mobs, but I can do my best!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Just_Test_Griefer: I am too whimpy to fight mobs, but I can do my best!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_death1",
attack = "default_punch2",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:SepiaSam", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:SepiaSam", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 47,
hp_max = 55,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"badplayer_15.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:rifle"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 17,
walk_velocity = 1.3,
run_velocity = 3.9,
damage = 3,
drops = {
{name = "shooter:rifle",
chance = 2,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 1,
min = 0,
max = 1,},
{name = "default:apple",
chance = 2,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Sepia Sam: MESE sword + Monster = My pleasure!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Sepia Sam: MESE sword + Monster = My pleasure!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_death2",
attack = "default_punch3",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:Hobo", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:Hobo", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 37,
hp_max = 45,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Hobo8Homeless_person_by_Minetestian.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_wood"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2.3,
damage = 4,
drops = {
{name = "default:apple",
chance = 1,
min = 0,
max = 5,},
{name = "default:machete_bronze",
chance = 1,
min = 1,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 4,
max=12,},
},
armor = 90,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"O.G. Sam: Mobs, let me at 'em, I'll splat 'em!!!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Hobo: Mobs, let me at 'em, I'll splat 'em!!!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_death1",
attack = "default_punch2",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:Simon", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, 31000)
mobs:register_mob("mobs_fallout:Simon", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 28,
hp_max = 35,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Hunky_Simon_with_Jacket_by_Andromeda.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:rifle"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 25,
walk_velocity = 1.6,
run_velocity = 2.8,
damage = 3,
drops = {
{name = "default:torch",
chance = 1,
min = 3,
max = 5,},
{name = "shooter:rifle",
chance = 1,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 13,
max=30,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Vanessa: I'll code out the very instance of those mobs!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Simon: I'll code out the very instance of those mobs!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_fireball",
death = "mobs_slash_attack",
attack = "default_punch",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:Infantry_man", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 20, 10, 9000, 1, -10)
mobs:register_mob("mobs_fallout:Infantry_man", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 92,
hp_max = 125,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"Infantry_man_by_philipbenr.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:rocket_gun_loaded"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1.7,
run_velocity = 2.5,
damage = 4,
drops = {
{name = "shooter:rocket_gun_loaded",
chance = 4,
min = 0,
max = 2,},
{name = "shooter:rifle",
chance = 7,
min = 0,
max = 1,},
{name = "shooter:ammo",
chance = 2,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Female Sam: Minetest is the greatest voxel game ever created!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Infantry_man: Minetest is the greatest voxel game ever created!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_stone",
death = "mobs_slash_attack",
attack = "default_punch2",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_spawn("mobs_fallout:Mage", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 15, -1,9000, 1, -50)
mobs:register_mob("mobs_fallout:Mage", {
type = "npc",
group_attack = true,
pathfinding = true,
hp_min = 157,
hp_max = 180,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {{"mage_by_Ginsu23.png",
"3d_armor_trans.png",
minetest.registered_items["shooter:rocket_gun_loaded"].inventory_image,
}},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 14,
walk_velocity = 2.5,
run_velocity = 7,
damage = 4,
drops = {
{name = "shooter:rocket_gun_loaded",
chance = 2,
min = 0,
max = 1,},
{name = "shooter:rifle",
chance = 1,
min = 0,
max = 1,},
{name = "default:apple",
chance = 1,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 0,
--[[
--Maikerumine added hackish follow code
on_rightclick = function (self, clicker)
mobs:face_pos(self,clicker:getpos())
mobs:team_player(self,clicker:getpos())
if self.state ~= "path" and self.state ~= "following" then
local_chat(clicker:getpos(),"Battlefield 3 Soldier: All suited up, let's roll out and destroy those creatures!",3)
if not self.tamed then
self.tamed = true
self.follow = true
end
end
end,]]
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Mage: All suited up, let's roll out and destroy those creatures!",3)
if item:get_name() == "mobs_fallout: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,
attack_type = "dogfight",
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,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})