Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local u=fs.open("history","r")
- local tArgs={...}
- his=textutils.unserialize(u.readAll())
- u.close()
- local time={time,day}
- time.time=os.time()
- time.day=os.day()
- local base =vector.new(11425,11,-6554)
- local function daytom(hday,htime,nday)
- local buffer=""
- local butime={d=0,h=0,m=0}
- local de = nday-hday
- if de==0 then
- de=(24-math.floor(htime))+time.time
- de=de*50
- else
- de=(24-math.floor(htime))*50+de*20
- end
- --print("[debug]de="..de)
- if de>=60 then
- butime.h=de/60
- --print("[debug]h="..butime.h)
- if (de/60)>24 then
- butime.d=(de/60)/24
- end
- end
- butime.d=math.modf(butime.d)
- butime.h=math.modf(butime.h)
- butime.m=math.modf(butime.m)
- buffer=butime.d.." d/"..butime.h.." h/"..butime.m%60
- return buffer
- end
- local function vectorE(hx,hy,hz,base)
- local emy=vector.new(hx,hy,hz)
- local distance = base:sub(emy)
- return distance:length()
- end
- for n,v in pairs(his) do
- if type(his[n])=="table" then
- if v["fixed"]==nil then
- his[n].position.x=math.floor(his[n].position.x)+base.x
- his[n].position.y=math.floor(his[n].position.y)+base.y
- his[n].position.z=math.floor(his[n].position.z)+base.z
- v["fixed"]=true
- end
- end
- end
- if tArgs[1]=="de" then
- textutils.pagedPrint(textutils.serialize(his))
- else
- term.setTextColor(colors.red)
- for n,v in pairs(his) do
- if type(his[n])=="table" then
- print("[+]"..n)
- print(" [x]: "..v.position.x)
- print(" [y]: "..v.position.y)
- print(" [z]: "..v.position.z)
- print(" [day]:"..v.player.time.day)
- print(" [time]:"..textutils.formatTime(v.player.time.time))
- print(" [before]:"..daytom(v.player.time.day,v.player.time.time,time.day))
- print(" [distance]:"..vectorE(v.position.x,v.position.y,v.position.z,base))
- read()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement