Jump to content

Recommended Posts

Hi, I was looking for a mod to remove the bat spawns of sinkholes once they was oppened, but can't find any, so I decided to do one myself with information of other mods, so the modmain.lua I made was like this:

Spoiler

if GetModConfigData("BATSPAWN") == 0 then   -- from modinfo.lua 
local function CaveEntranceFn(inst)
    inst.components.childspawner:SetRegenPeriod(0)
    inst.components.childspawner:SetSpawnPeriod(0)
    inst.components.childspawner:SetMaxChildren(0)
    inst.components.childspawner.canspawnfn = nospawn
    end
else
--print ("TEST")
--TEST
end

But it didnt change anything, I was looking at the game files, and find a file named cave_entrance on prefabs folder

and I think its something to do with these lines:

Spoiler

local function open_fn()
    local inst = fn("cave_entrance", "cave_entrance", "no_access", "cave_open.png", true)

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("childspawner")
    inst.components.childspawner:SetRegenPeriod(60)
    inst.components.childspawner:SetSpawnPeriod(.1)
    inst.components.childspawner:SetMaxChildren(6)
    inst.components.childspawner.canspawnfn = canspawn
    inst.components.childspawner.childname = "bat"

    inst.components.inspectable.getstatus = GetStatus

    inst:ListenForEvent("migration_available", open)
    inst:ListenForEvent("migration_unavailable", close)
    inst:ListenForEvent("migration_full", full)
    --inst:ListenForEvent("migration_activate", activate)

    --Cave entrance is an overworld entity, so it
    --should be aware of phase and not cavephase.
    --Actually, it could make sense either way...
    --Alternative: -add "cavedweller" tag
    --             -watch iscaveday world state
    OnIsDay(inst, TheWorld.state.isday)
    inst:WatchWorldState("isday", OnIsDay)

    return inst
end

so, anyone can help me out? Thanks in advance

 

 

Edited by Copyist_Monk

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
×
  • Create New...