diff options
author | Och Noe <och_noe@forksworld.de> | 2021-07-21 15:19:37 +0200 |
---|---|---|
committer | Och Noe <och_noe@forksworld.de> | 2021-07-21 15:19:37 +0200 |
commit | 274bc7abbfdb069fce417aad444c244897e3a5b9 (patch) | |
tree | 6c2b1c1a4f4c8261d465e5101ade093bc4dc1943 | |
parent | 01e27c77577f60b715242298bfe536fedb36866b (diff) | |
download | cs_waypoints-274bc7abbfdb069fce417aad444c244897e3a5b9.tar.gz cs_waypoints-274bc7abbfdb069fce417aad444c244897e3a5b9.tar.bz2 cs_waypoints-274bc7abbfdb069fce417aad444c244897e3a5b9.zip |
countdown for .bounce - by Mavarick2797
-rw-r--r-- | init.lua | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -4,7 +4,7 @@ local mod_name = minetest.get_current_modname() -local mod_version = "2.13" +local mod_version = "2.14" local function log(level, message) minetest.log(level, ('[%s] %s'):format(mod_name, message)) @@ -418,6 +418,32 @@ local function teleport_bounce(params) local pstr = tostring_point(bouncetarget) local point = minetest.localplayer:get_pos() + +-- from Maverick2897 with some small changes + local player = minetest.localplayer + local hud_id = player:hud_add({ + hud_elem_type = "text", + position = {x=0.0,y=0.8}, + size = {x=-20,y=-20}, + alignment = {x=1,y=0}, + offset = {x=8,y=0}, + number = 0xffffff, + }) + for i=bouncedelay,1,-1 do + minetest.after(bouncedelay-i, + function() + local text = "" + if i == 1 then + text = "Returning Now" + else + text = "Returning in "..i.."s\nTarget Pos: "..bouncepos.." ("..pstr..")\nReturn Pos: "..tostring_point(point) + end + player:hud_change(hud_id,"text",text) + end) + end + minetest.after(bouncedelay,function()player:hud_remove(hud_id)end) +-- + minetest.after(bouncedelay,teleport_day_back,point.x,point.y,point.z) minetest.display_chat_message("position "..pstr) minetest.run_server_chatcommand('teleport', pstr) |