getpos to get_pos, get_pitch/yaw to get_look_vertical/horizontal
This commit is contained in:
parent
c81191df2a
commit
8f02711af4
4 changed files with 8 additions and 8 deletions
|
|
@ -121,7 +121,7 @@ minetest.register_chatcommand("protector_show", {
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
local pos = player:getpos()
|
local pos = player:get_pos()
|
||||||
local r = protector.radius -- max protector range.
|
local r = protector.radius -- max protector range.
|
||||||
|
|
||||||
-- find the protector nodes
|
-- find the protector nodes
|
||||||
|
|
|
||||||
10
init.lua
10
init.lua
|
|
@ -283,8 +283,8 @@ function minetest.is_protected(pos, digger)
|
||||||
-- flip player when protection violated
|
-- flip player when protection violated
|
||||||
if protector.flip then
|
if protector.flip then
|
||||||
-- yaw + 180°
|
-- yaw + 180°
|
||||||
--local yaw = player:get_look_horizontal() + math.pi
|
local yaw = player:get_look_horizontal() + math.pi
|
||||||
local yaw = player:get_look_yaw() + math.pi
|
--local yaw = player:get_look_yaw() + math.pi
|
||||||
|
|
||||||
if yaw > 2 * math.pi then
|
if yaw > 2 * math.pi then
|
||||||
yaw = yaw - 2 * math.pi
|
yaw = yaw - 2 * math.pi
|
||||||
|
|
@ -294,11 +294,11 @@ function minetest.is_protected(pos, digger)
|
||||||
player:set_look_yaw(yaw)
|
player:set_look_yaw(yaw)
|
||||||
|
|
||||||
-- invert pitch
|
-- invert pitch
|
||||||
--player:set_look_vertical(-player:get_look_vertical())
|
player:set_look_vertical(-player:get_look_vertical())
|
||||||
player:set_look_pitch(-player:get_look_pitch())
|
--player:set_look_pitch(-player:get_look_pitch())
|
||||||
|
|
||||||
-- if digging below player, move up to avoid falling through hole
|
-- if digging below player, move up to avoid falling through hole
|
||||||
local pla_pos = player:getpos()
|
local pla_pos = player:get_pos()
|
||||||
|
|
||||||
if pos.y < pla_pos.y then
|
if pos.y < pla_pos.y then
|
||||||
|
|
||||||
|
|
|
||||||
2
pvp.lua
2
pvp.lua
|
|
@ -29,7 +29,7 @@ if minetest.settings:get_bool("enable_pvp") and protector.pvp then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- no pvp at spawn area
|
-- no pvp at spawn area
|
||||||
local pos = player:getpos()
|
local pos = player:get_pos()
|
||||||
|
|
||||||
if pos.x < statspawn.x + protector.spawn
|
if pos.x < statspawn.x + protector.spawn
|
||||||
and pos.x > statspawn.x - protector.spawn
|
and pos.x > statspawn.x - protector.spawn
|
||||||
|
|
|
||||||
2
tool.lua
2
tool.lua
|
|
@ -11,7 +11,7 @@ minetest.register_craftitem("protector:tool", {
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
|
|
||||||
-- check for protector near player (2 block radius)
|
-- check for protector near player (2 block radius)
|
||||||
local pos = user:getpos()
|
local pos = user:get_pos()
|
||||||
local pp = minetest.find_nodes_in_area(
|
local pp = minetest.find_nodes_in_area(
|
||||||
vector.subtract(pos, 2), vector.add(pos, 2),
|
vector.subtract(pos, 2), vector.add(pos, 2),
|
||||||
{"protector:protect", "protector:protect2"})
|
{"protector:protect", "protector:protect2"})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue