SHARE
TWEET

lookstg

a guest Feb 16th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local u=fs.open("history","r")
  2. local tArgs={...}
  3.   his=textutils.unserialize(u.readAll())
  4.   u.close()
  5. local time={time,day}
  6.   time.time=os.time()
  7.   time.day=os.day()
  8. local base =vector.new(11425,11,-6554)
  9.  
  10. local function daytom(hday,htime,nday)
  11. local buffer=""
  12. local butime={d=0,h=0,m=0}
  13. local de = nday-hday
  14. if de==0 then
  15.   de=(24-math.floor(htime))+time.time
  16.   de=de*50
  17. else
  18.   de=(24-math.floor(htime))*50+de*20
  19. end
  20. --print("[debug]de="..de)
  21. if de>=60 then
  22.   butime.h=de/60
  23.   --print("[debug]h="..butime.h)
  24.   if (de/60)>24 then
  25.     butime.d=(de/60)/24
  26.   end
  27. end
  28. butime.d=math.modf(butime.d)
  29. butime.h=math.modf(butime.h)
  30. butime.m=math.modf(butime.m)
  31.     buffer=butime.d.." d/"..butime.h.." h/"..butime.m%60
  32.   return buffer
  33. end
  34.  
  35. local function vectorE(hx,hy,hz,base)
  36.   local emy=vector.new(hx,hy,hz)
  37.   local distance = base:sub(emy)
  38.   return distance:length()
  39. end
  40.  
  41. for n,v in pairs(his) do
  42. if type(his[n])=="table" then
  43. if v["fixed"]==nil then
  44.   his[n].position.x=math.floor(his[n].position.x)+base.x
  45.   his[n].position.y=math.floor(his[n].position.y)+base.y
  46.   his[n].position.z=math.floor(his[n].position.z)+base.z
  47.   v["fixed"]=true
  48. end
  49. end
  50. end
  51. if tArgs[1]=="de" then
  52.   textutils.pagedPrint(textutils.serialize(his))
  53. else
  54.   term.setTextColor(colors.red)
  55. for n,v in pairs(his) do
  56.   if type(his[n])=="table" then
  57.   print("[+]"..n)
  58.   print("  [x]: "..v.position.x)
  59.   print("  [y]: "..v.position.y)
  60.   print("  [z]: "..v.position.z)
  61.   print("  [day]:"..v.player.time.day)
  62.   print("  [time]:"..textutils.formatTime(v.player.time.time))
  63.   print("  [before]:"..daytom(v.player.time.day,v.player.time.time,time.day))
  64.   print("  [distance]:"..vectorE(v.position.x,v.position.y,v.position.z,base))
  65.   read()
  66. end
  67. end
  68. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top