|
是UP库的自带功能,但是Y3库还没有
function byte2get(n,m)
local t = {}
local v
for i=m,0,-1 do
v = math.floor(n/2^i)
if v == 1 then
table.insert(t,2^i)
end
n = n % 2^i
end
return t
end
--点能否通行
local collisionId = {
['地面'] = 2^0,
['摆件'] = 2^1,
['海洋'] = 2^2,
['悬崖'] = 2^3,
['空中'] = 2^8,
}
function point_can_move(point,collision_type)
local collision = byte2get(gameapi.get_point_ground_collision(point),8)
for _,v in ipairs(collision) do
if v == collisionId[collision_type] then
return false
end
end
return true
end
|
|