Jump to content

Adding stuff globally to all Prefabs of a specific Type


Recommended Posts

Hey Buzzies,

I've been wondering how could one apply something to all of a specific prefab type? I've been trying to add some stuff with AddPrefabPostInit() but it doesn't seem to be added to all specific prefabs generated in the world, only new ones. is there a way to do that? I've been trying to modify something in the Tall Birchnut Tree
 

Quote

GLOBAL.STRINGS.ACTIONS.ACTIVATE.PUNCH = "Punch"

local function TreePostInit(inst)
    
    local function GetVerb()
        return "PUNCH"
    end
  
    inst.GetActivateVerb = GetVerb
    
    if inst.components then
        inst:AddComponent("activatable")
        inst.components.activatable.inactive = true
        inst.components.activatable.OnActivate = function() end
    end
    
    inst.hasNuts = true
end



AddPrefabPostInit("dedicioustree_tall", TreePostInit)

(There's more to be written, but for now I want this to work)
But I can only Punch new ones instead of already generated ones

I'd appreciete any help you'd give me here

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...