forked from minetest-mods/warps
Version MFF.
This commit is contained in:
parent
0f2900fa55
commit
be1f8d5dad
0
depends.txt
Normal file → Executable file
0
depends.txt
Normal file → Executable file
0
description.txt
Normal file → Executable file
0
description.txt
Normal file → Executable file
21
init.lua
Normal file → Executable file
21
init.lua
Normal file → Executable file
@ -13,7 +13,7 @@ of the license, or (at your option) any later version.
|
|||||||
warps = {}
|
warps = {}
|
||||||
warps_queue = {}
|
warps_queue = {}
|
||||||
queue_state = 0
|
queue_state = 0
|
||||||
local warps_freeze = 5
|
local warps_freeze = 1
|
||||||
-- t = time in usec
|
-- t = time in usec
|
||||||
-- p = player obj
|
-- p = player obj
|
||||||
-- w = warp name
|
-- w = warp name
|
||||||
@ -46,15 +46,17 @@ do_warp_queue = function()
|
|||||||
local t = minetest.get_us_time()
|
local t = minetest.get_us_time()
|
||||||
for i = table.getn(warps_queue),1,-1 do
|
for i = table.getn(warps_queue),1,-1 do
|
||||||
local e = warps_queue[i]
|
local e = warps_queue[i]
|
||||||
if e.p:getpos().x == e.pos.x and e.p:getpos().y == e.pos.y and e.p:getpos().z == e.pos.z then
|
if e.p:getpos() then
|
||||||
if t > e.t then
|
if e.p:getpos().x == e.pos.x and e.p:getpos().y == e.pos.y and e.p:getpos().z == e.pos.z then
|
||||||
warp(e.p, e.w)
|
if t > e.t then
|
||||||
|
warp(e.p, e.w)
|
||||||
|
table.remove(warps_queue, i)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.sound_stop(e.sh)
|
||||||
|
minetest.chat_send_player(e.p:get_player_name(), "You have to stand still for " .. warps_freeze .. " seconds!")
|
||||||
table.remove(warps_queue, i)
|
table.remove(warps_queue, i)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
minetest.sound_stop(e.sh)
|
|
||||||
minetest.chat_send_player(e.p:get_player_name(), "You have to stand still for " .. warps_freeze .. " seconds!")
|
|
||||||
table.remove(warps_queue, i)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if table.getn(warps_queue) == 0 then
|
if table.getn(warps_queue) == 0 then
|
||||||
@ -147,6 +149,9 @@ minetest.register_chatcommand("setwarp", {
|
|||||||
end
|
end
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
|
if not pos then
|
||||||
|
return false, "Internal error while getting your position. Please try again later"
|
||||||
|
end
|
||||||
table.insert(warps, { name = param, x = pos.x, y = pos.y, z = pos.z, yaw = player:get_look_yaw(), pitch = player:get_look_pitch() })
|
table.insert(warps, { name = param, x = pos.x, y = pos.y, z = pos.z, yaw = player:get_look_yaw(), pitch = player:get_look_pitch() })
|
||||||
save()
|
save()
|
||||||
minetest.log("action", name .. " " .. h .. " warp \"" .. param .. "\": " .. pos.x .. ", " .. pos.y .. ", " .. pos.z)
|
minetest.log("action", name .. " " .. h .. " warp \"" .. param .. "\": " .. pos.x .. ", " .. pos.y .. ", " .. pos.z)
|
||||||
|
0
models/warps_warpstone.obj
Normal file → Executable file
0
models/warps_warpstone.obj
Normal file → Executable file
0
sounds/LICENSE
Normal file → Executable file
0
sounds/LICENSE
Normal file → Executable file
Binary file not shown.
Binary file not shown.
BIN
textures/warps_warpstone.png
Normal file → Executable file
BIN
textures/warps_warpstone.png
Normal file → Executable file
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
textures/warps_warpstone_guide.png
Normal file → Executable file
BIN
textures/warps_warpstone_guide.png
Normal file → Executable file
Binary file not shown.
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 199 B |
Loading…
Reference in New Issue
Block a user