Jump to content

Dock kit in the cave


Recommended Posts

Hello! I'm not very good at moding, please help. I want to make it possible to place the Dock Kit in caves in a void. I do this code:

Spoiler
local WORLD_TILES = WORLD_TILES.TUNING
local function CLIENT_CanDeployDockKit(inst, pt, mouseover, deployer, rotation)
    local tile = GLOBAL.TheWorld.Map:GetTileAtPoint(pt.x, 0, pt.z)
    if (tile == WORLD_TILES.OCEAN_COASTAL_SHORE or tile == WORLD_TILES.OCEAN_COASTAL or tile == WORLD_TILES.IMPASSABLE or tile == WORLD_TILES.UNDERGROUND) then
        local tx, ty = GLOBAL.TheWorld.Map:GetTileCoordsAtPoint(pt.x, 0, pt.z)
        local found_adjacent_safetile = false
        for x_off = -1, 1, 1 do
            for y_off = -1, 1, 1 do
                if (x_off ~= 0 or y_off ~= 0) and IsLandTile(GLOBAL.TheWorld.Map:GetTile(tx + x_off, ty + y_off)) then
                    found_adjacent_safetile = true
                    break
                end
            end

            if found_adjacent_safetile then break end
        end

        if found_adjacent_safetile then
            local center_pt = Vector3(GLOBAL.TheWorld.Map:GetTileCenterPoint(tx, ty))
            return found_adjacent_safetile and GLOBAL.TheWorld.Map:CanDeployDockAtPoint(center_pt, inst, mouseover)
        end
    end

    return false
end

AddPrefabPostInit("dock_kit", function(inst)
    if GLOBAL.TheWorld.ismastersim then
        if inst._custom_candeploy_fn then
            inst._custom_candeploy_fn = CLIENT_CanDeployDockKit
        end
    end
end)

 

but nothing happens, I also cannot use the Dock Kit in caves on a void.

Edited by AnnaIgor
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...