-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutil
32 lines (25 loc) · 997 Bytes
/
util
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
util={}
function util.magnitude(x,y)
return ((x^2)+(y^2))^0.5
end
function util.isBallInPitch()
local currLoc=readFloat(literalLengthAddr)
if currLoc==nil then return false end
if currLoc>(-pitchLength) and currLoc<pitchLength and readByte(isBallOutOfBowlersHandAddr)==1 and readByte(isBallHit)==0 then return true else return false end
end
function util.waitForRunUpComplete()
local currLoc=readFloat(literalLengthAddr)
if currLoc==nil then return end
if LazyAction then while not isBallInPitch() do end end
end
function util.isSafeToRun()
if readFloat(LineAddr)==nil or readFloat(LengthAddr)==nil or readFloat(frontAddr)==nil or readFloat(literalLengthAddr)==nil then return false else return true end
end
function util.Mover(change,addr)
local speed=readFloat(addr)
if (readFloat(addr)) then
speed=speed+change
writeFloat(addr,speed)
end
end
return util