1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 18:20:36 +01:00

[warps] Update

This commit is contained in:
LeMagnesium 2016-01-03 14:10:05 +01:00
parent f9413db441
commit 6678118c35
3 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,8 @@ 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 and e.p and e.p:getpos() and 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 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 t > e.t then if t > e.t then
warp(e.p, e.w) warp(e.p, e.w)
table.remove(warps_queue, i) table.remove(warps_queue, i)
@ -57,6 +58,7 @@ do_warp_queue = function()
table.remove(warps_queue, i) table.remove(warps_queue, i)
end end
end end
end
if table.getn(warps_queue) == 0 then if table.getn(warps_queue) == 0 then
queue_state = 0 queue_state = 0
return return
@ -137,6 +139,7 @@ minetest.register_chatcommand("setwarp", {
description = "Set a warp location to the players location", description = "Set a warp location to the players location",
privs = { warp_admin = true }, privs = { warp_admin = true },
func = function(name, param) func = function(name, param)
param = param:gsub("%W", "")
local h = "created" local h = "created"
for i = 1,table.getn(warps) do for i = 1,table.getn(warps) do
if warps[i].name == param then if warps[i].name == param then
@ -147,9 +150,6 @@ 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)

BIN
mods/warps/sounds/warps_plop.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/warps/sounds/warps_woosh.ogg Executable file → Normal file

Binary file not shown.