Small fixes

master
francisco athens 2020-07-28 07:48:50 -07:00
parent 7db75fe2fe
commit 2f3d32714f
5 changed files with 27 additions and 7 deletions

View File

@ -9,7 +9,8 @@ The MIT License (MIT)
Witches inhabit the land! They are currently in development but, can already:
* Spawn near wood above ground.
* Witches have magic! They will defend themselves and each other!
* If you are repeatedly helpful to a witch...
* Witch cottages adapted from Sokomine's basic_houses:
(https://github.com/Sokomine/basic_houses) mod under under MIT license
with permission from author.

View File

@ -531,7 +531,7 @@ witches.bh.place_chest = function( p, sizex, sizez, chest_places, wall_with_ladd
if minetest.get_modpath("fireflies") then
inv:add_item( "main", {name = "fireflies:bug_net"})
end
inv:add_item( "main", {name = "default:mese_lamp"})
inv:add_item( "main", {name = "default:meselamp"})
if math.random() < 0.50 then
for i=1,math.random(3) do
inv:add_item( "main", {name = "default:diamond"})

View File

@ -244,6 +244,7 @@ local witch_template = { --your average witch,
},
do_punch = function(self,hitter)
witches.magic.teleport(self,hitter)
self.attack=hitter
end,
on_rightclick = function(self,clicker)
@ -253,6 +254,20 @@ local witch_template = { --your average witch,
do_custom = function(self)
if self.do_custom_addendum then
self.do_custom_addendum(self)
end
if self.attack and self.attack:is_player() then
local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, 2)
for n = 1, #objs do
local ent = objs[n]:get_luaentity()
-- are we a player?
if objs[n]:is_player() then
witches.magic.teleport(self,objs[n],5,2)
end
end
end
end,

View File

@ -16,9 +16,12 @@ else
magic_animation = nil
end
function witches.magic.teleport(self,target)
function witches.magic.teleport(self,target,strength,height)
local mob_pos = self.object:get_pos()
local player_pos = {}
strength = strength or 8
height = height or 5
if target then
if target:is_player() then
@ -28,9 +31,9 @@ function witches.magic.teleport(self,target)
else
end
witches.stop_and_face(self,player_pos)
--witches.stop_and_face(self,player_pos)
local new_player_pos = vector.add(player_pos, vector.multiply(vector.direction(mob_pos, player_pos),8))
local new_player_pos = vector.add(player_pos, vector.multiply(vector.direction(mob_pos, player_pos),strength))
new_player_pos.y = player_pos.y +5
--print(minetest.pos_to_string(player_pos))
--print(minetest.pos_to_string(mob_pos))
@ -57,7 +60,7 @@ function witches.magic.teleport(self,target)
player = target:get_player_name()
})
witches.stop_and_face(self,new_player_pos)
--witches.stop_and_face(self,new_player_pos)
end
end

View File

@ -335,8 +335,9 @@ function witches.award_witches_chest(self,player)
local pos_string = minetest.pos_to_string(info[3])
local reward_text = S("You receive permission from @1 to access the magic chest of @2!\n(@3)",
info[1],info[2],pos_string)
local reward = {r_text = reward_text, r_item = "default:locked_chest"}
local reward = {r_text = reward_text, r_item = "default:chest"}
meta:set_string("infotext",S("@1's chest of @2",info[1],info[2]))
self.witches_chest_owner = pname
return reward
end
end