Jump to content

Reducing Min Spacing


Recommended Posts

I'm pretty new to Lua in general so I scavenged the forums only to find one thread where I got the following code. I like structures having a smaller min_spacing, but deployables don't seem to be listening. Berrybushes, mainly. I have not been able to see if the second part of the code is working or not, but either way it's not doing bushes.

for _,v in pairs(GLOBAL.AllRecipes) do   v.min_spacing = 1endAddComponentPostInit("deployable", function(comp)   if not comp.inst:HasTag("structure") then      comp.min_spacing = comp.min_spacing or 1      comp.min_spacing = math.min(comp.min_spacing, 1)   endend)

Any help would be much appreciated.

Link to comment
Share on other sites

This may be of your interest:

 

        if data.mediumspacing then
            inst.components.deployable:SetDeploySpacing(DEPLOYSPACING.MEDIUM)
        end

 

[...]

    {
        name = "berrybush",
    },
    {
        name = "berrybush2",
    },
    {
        name = "sapling",
        mediumspacing = true
    },
    {
        name = "grass",
        mediumspacing = true
    },
    {
        name = "marsh_bush",
        mediumspacing = true
    },

 

Link to comment
Share on other sites

AddPrefabPostInit("dug_berrybush", function(inst)

if inst.components.deployable then

inst.components.deployable:SetDeploySpacing(GLOBAL.DEPLOYSPACING.MEDIUM)

end

end)

-- DEPLOYSPACING.MEDIUM is 1 on constants.lua, the number acts as id

-- DEPLOYSPACING_RADIUS[DEPLOYSPACING.MEDIUM] is 1 on constants.lua, this number acts as the min_spacing on CanDeployAtPoint on components/map.lua

-- Using SetDeploySpacing of deployable propagates the spacing change to inventoryitem which propagates to its replica, reaching the client

Edited by DarkXero
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...