Update init.lua

This commit is contained in:
Max 2022-11-15 11:56:31 -06:00 committed by GitHub
parent 368b0c1a77
commit 29be312612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
--!strict --!strict
local Util = { local Util = {
TruncateRaycasts = true,
GlobalTimer = 0, GlobalTimer = 0,
Scale = 1 / 16, Scale = 1 / 16,
} }
@ -103,18 +104,22 @@ function Util.RaycastSM64(pos: Vector3, dir: Vector3, rayParams: RaycastParams?,
end end
function Util.FindFloor(pos: Vector3): (number, RaycastResult?) function Util.FindFloor(pos: Vector3): (number, RaycastResult?)
local newPos = pos
if Util.TruncateRaycasts then
local trunc = Vector3int16.new(pos.X, pos.Y, pos.Z) local trunc = Vector3int16.new(pos.X, pos.Y, pos.Z)
local height = -11000
if math.abs(trunc.X) >= 0x2000 then if math.abs(trunc.X) >= 0x2000 then
return height, nil return -11000, nil
end end
if math.abs(trunc.Z) >= 0x2000 then if math.abs(trunc.Z) >= 0x2000 then
return height, nil return -11000, nil
end
newPos = Vector3.new(trunc.X, trunc.Y, trunc.Z)
end end
local newPos = Vector3.new(trunc.X, trunc.Y, trunc.Z)
local result = Util.RaycastSM64(newPos + (Vector3.yAxis * 100), -Vector3.yAxis * 10000) local result = Util.RaycastSM64(newPos + (Vector3.yAxis * 100), -Vector3.yAxis * 10000)
if result then if result then