Add new quest
parent
071737f871
commit
cd4d40fda4
|
@ -710,7 +710,7 @@ function mobs:register_mob(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- see if there are any NPCs to shower you with rewards
|
-- see if there are any NPCs to shower you with rewards
|
||||||
if self.type ~= "npc" then
|
if self.type ~= "npc" and self.type ~= "animal" then
|
||||||
local inradius = minetest.get_objects_inside_radius(hitter:getpos(),10)
|
local inradius = minetest.get_objects_inside_radius(hitter:getpos(),10)
|
||||||
for _, oir in pairs(inradius) do
|
for _, oir in pairs(inradius) do
|
||||||
local obj = oir:get_luaentity()
|
local obj = oir:get_luaentity()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
default
|
default
|
||||||
fire
|
fire
|
||||||
cottages?
|
cottages?
|
||||||
throwing?
|
throwing?
|
||||||
|
quests?
|
|
@ -136,7 +136,7 @@ type = "npc",
|
||||||
water_damage = 1,
|
water_damage = 1,
|
||||||
lava_damage = 5,
|
lava_damage = 5,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
on_rightclick = nil,
|
on_rightclick = function ( self, clicker ) quests.chest.go(self, clicker) end,
|
||||||
activity_level = 5,
|
activity_level = 5,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
animation = {
|
animation = {
|
||||||
|
@ -161,9 +161,10 @@ type = "npc",
|
||||||
blood_amount = 35,
|
blood_amount = 35,
|
||||||
blood_offset = 0.25,
|
blood_offset = 0.25,
|
||||||
rewards = {
|
rewards = {
|
||||||
{chance=90, item="default:bread"},
|
{chance=100, item="farming:bread 6"},
|
||||||
{chance=40, item="experience:6_exp"},
|
{chance=70, item="food:cheese 6"},
|
||||||
{chance=60, item="potions:magic_replenish1"},
|
{chance=80, item="experience:6_exp 2"},
|
||||||
|
{chance=40, item="potions:magic_replenish1"},
|
||||||
},
|
},
|
||||||
walk_chance = 10,
|
walk_chance = 4,
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
quests.chest = {}
|
||||||
|
|
||||||
|
quests.chest.go = function(npc,player)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local pos = npc.object:getpos()
|
||||||
|
if inv:contains_item("main","farming:flour") and inv:contains_item("main","food:bowl") then
|
||||||
|
inv:remove_item("main","farming:flour")
|
||||||
|
inv:remove_item("main","food:bowl")
|
||||||
|
chat.local_chat(pos,"'Thank you very much, take this as a token of my appreciation!'",6)
|
||||||
|
local lp = player:getpos()
|
||||||
|
local yaw = mobs:face_pos(npc,lp)
|
||||||
|
local vec = {x=lp.x-pos.x, y=1, z=lp.z-pos.z}
|
||||||
|
local x = math.sin(yaw) * -2
|
||||||
|
local z = math.cos(yaw) * 2
|
||||||
|
local acc = {x=x, y=-5, z=z}
|
||||||
|
if inv:contains_item("main","default:chest_locked") == false then
|
||||||
|
default.drop_item(pos,"default:chest_locked",vec,acc)
|
||||||
|
end
|
||||||
|
if npc.rewards ~= nil then
|
||||||
|
print("Get rewards")
|
||||||
|
for _, r in pairs(npc.rewards) do
|
||||||
|
print(r.item)
|
||||||
|
if math.random(0,100) < r.chance then
|
||||||
|
default.drop_item(pos,r.item, vec, acc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
chat.local_chat(pos,"'Can you help me?'",12)
|
||||||
|
minetest.after(2,chat.local_chat,pos,"'I need to finish my baking but I have ran out of flour and lost my bowl!'",12)
|
||||||
|
minetest.after(3,chat.local_chat,pos,"'Can you bring me some flour and a bowl?'",12)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
quests = {}
|
quests = {}
|
||||||
|
|
||||||
dofile(minetest.get_modpath("quests").."/treasure.lua")
|
dofile(minetest.get_modpath("quests").."/treasure.lua")
|
||||||
|
dofile(minetest.get_modpath("quests").."/chest.lua")
|
Loading…
Reference in New Issue