10

主题

10

回帖

580

积分

优秀创作者

积分
580

夏日·闪闪发光勋章

发表于  2023-6-18 00:11:21 | 显示全部楼层 |阅读模式 3202 1



是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



53

主题

102

回帖

2367

积分

精英创作者

积分
2367

夏日·活跃之王勋章

发表于  2023-6-19 15:35:23 | 显示全部楼层
真不错先抄了66666666666666