Sign in to follow this  
Lokoluna

Birds eat more

Recommended Posts

Lokoluna    48

Hello there, I used to use this great mod, called "Less Trash" which changed what birds ate

I used this to clean up junk i didn't like being on the ground. I got errors, which I fixed so I thought. I no longer get errors, but birds don't seem to eat anything I've listed, can You help point me in a better direction or, point me towards my error?

_G = GLOBAL
local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS
local resolvefilepath = GLOBAL.resolvefilepath
local modmastersim = GLOBAL.TheNet:GetIsMasterSimulation()

local SpawnPrefab = GLOBAL.SpawnPrefab
local TUNING = GLOBAL.TUNING
local EQUIPSLOTS = GLOBAL.EQUIPSLOTS

local foodtype = GLOBAL.FOODTYPE

local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local Recipe = GLOBAL.Recipe
local TECH = GLOBAL.TECH
local IsServer = GLOBAL.TheNet:GetIsServer()

STRINGS = GLOBAL.STRINGS
RECIPETABS = GLOBAL.RECIPETABS
Recipe = GLOBAL.Recipe
Ingredient = GLOBAL.Ingredient
TECH = GLOBAL.TECH
TUNING = GLOBAL.TUNING


--inst:AddComponent("edible")
    --inst.components.edible.foodtype = FOODTYPE.SEEDS

--Temp
local function f1(inst)
	if not inst.components.edible then
		inst:AddComponent("edible")
		inst.components.edible.foodtype = "SEEDS"
	end
end


AddPrefabPostInit("axe", f1)
AddPrefabPostInit("beefalowool", f1)
AddPrefabPostInit("charcoal", f1)
AddPrefabPostInit("coontail", f1)
AddPrefabPostInit("feather_crow", f1)
AddPrefabPostInit("feather_robin", f1)
AddPrefabPostInit("flint", f1)
AddPrefabPostInit("guano", f1)
AddPrefabPostInit("halloween_ornament_1", f1)
AddPrefabPostInit("halloween_ornament_2", f1)
AddPrefabPostInit("halloween_ornament_3", f1)
AddPrefabPostInit("halloween_ornament_4", f1)
AddPrefabPostInit("halloween_ornament_5", f1)
AddPrefabPostInit("halloween_ornament_6", f1)
AddPrefabPostInit("halloweencandy_1", f1)
AddPrefabPostInit("halloweencandy_10", f1)
AddPrefabPostInit("halloweencandy_11", f1)
AddPrefabPostInit("halloweencandy_12", f1)
AddPrefabPostInit("halloweencandy_13", f1)
AddPrefabPostInit("halloweencandy_14", f1)
AddPrefabPostInit("halloweencandy_2", f1)
AddPrefabPostInit("halloweencandy_3", f1)
AddPrefabPostInit("halloweencandy_4", f1)
AddPrefabPostInit("halloweencandy_5", f1)
AddPrefabPostInit("halloweencandy_6", f1)
AddPrefabPostInit("halloweencandy_7", f1)
AddPrefabPostInit("halloweencandy_8", f1)
AddPrefabPostInit("halloweencandy_9", f1)
AddPrefabPostInit("marblebean", f1)
AddPrefabPostInit("minifan", f1)
AddPrefabPostInit("nitre", f1)
AddPrefabPostInit("pinecone", f1)
AddPrefabPostInit("pitchfork", f1)
AddPrefabPostInit("poop", f1)
AddPrefabPostInit("spoiled_food", f1)
AddPrefabPostInit("stinger", f1)
AddPrefabPostInit("tentaclespike", f1)
AddPrefabPostInit("trinket_1", f1)
AddPrefabPostInit("trinket_10", f1)
AddPrefabPostInit("trinket_11", f1)
AddPrefabPostInit("trinket_12", f1)
AddPrefabPostInit("trinket_13", f1)
AddPrefabPostInit("trinket_14", f1)
AddPrefabPostInit("trinket_15", f1)
AddPrefabPostInit("trinket_16", f1)
AddPrefabPostInit("trinket_17", f1)
AddPrefabPostInit("trinket_18", f1)
AddPrefabPostInit("trinket_19", f1)
AddPrefabPostInit("trinket_2", f1)
AddPrefabPostInit("trinket_20", f1)
AddPrefabPostInit("trinket_21", f1)
AddPrefabPostInit("trinket_22", f1)
AddPrefabPostInit("trinket_23", f1)
AddPrefabPostInit("trinket_24", f1)
AddPrefabPostInit("trinket_25", f1)
AddPrefabPostInit("trinket_26", f1)
AddPrefabPostInit("trinket_27", f1)
AddPrefabPostInit("trinket_28", f1)
AddPrefabPostInit("trinket_29", f1)
AddPrefabPostInit("trinket_3", f1)
AddPrefabPostInit("trinket_30", f1)
AddPrefabPostInit("trinket_31", f1)
AddPrefabPostInit("trinket_32", f1)
AddPrefabPostInit("trinket_33", f1)
AddPrefabPostInit("trinket_34", f1)
AddPrefabPostInit("trinket_35", f1)
AddPrefabPostInit("trinket_36", f1)
AddPrefabPostInit("trinket_37", f1)
AddPrefabPostInit("trinket_38", f1)
AddPrefabPostInit("trinket_39", f1)
AddPrefabPostInit("trinket_40", f1)
AddPrefabPostInit("trinket_41", f1)
AddPrefabPostInit("trinket_42", f1)
AddPrefabPostInit("trinket_43", f1)
AddPrefabPostInit("trinket_44", f1)
AddPrefabPostInit("trinket_45", f1)
AddPrefabPostInit("trinket_46", f1)
AddPrefabPostInit("trinket_5", f1)
AddPrefabPostInit("trinket_6", f1)
AddPrefabPostInit("trinket_7", f1)
AddPrefabPostInit("trinket_8", f1)
AddPrefabPostInit("trinket_9", f1)
AddPrefabPostInit("wetgoop", f1)
AddPrefabPostInit("winter_food1", f1)
AddPrefabPostInit("winter_food2", f1)
AddPrefabPostInit("winter_food3", f1)
AddPrefabPostInit("winter_food4", f1)
AddPrefabPostInit("winter_food5", f1)
AddPrefabPostInit("winter_food6", f1)
AddPrefabPostInit("winter_food7", f1)
AddPrefabPostInit("winter_food8", f1)
AddPrefabPostInit("winter_food9", f1)
AddPrefabPostInit("winter_ornament_boos_antlion", f1)
AddPrefabPostInit("winter_ornament_boos_bearger", f1)
AddPrefabPostInit("winter_ornament_boos_beequeen", f1)
AddPrefabPostInit("winter_ornament_boos_deerclops", f1)
AddPrefabPostInit("winter_ornament_boos_dragonfly", f1)
AddPrefabPostInit("winter_ornament_boos_fuelweaver", f1)
AddPrefabPostInit("winter_ornament_boos_klaus", f1)
AddPrefabPostInit("winter_ornament_boos_krampus", f1)
AddPrefabPostInit("winter_ornament_boos_malbatross", f1)
AddPrefabPostInit("winter_ornament_boos_moose", f1)
AddPrefabPostInit("winter_ornament_boos_noeyeblue", f1)
AddPrefabPostInit("winter_ornament_boos_noeyered", f1)
AddPrefabPostInit("winter_ornament_boos_toadstool", f1)
AddPrefabPostInit("winter_ornament_fancy1", f1)
AddPrefabPostInit("winter_ornament_fancy2", f1)
AddPrefabPostInit("winter_ornament_fancy3", f1)
AddPrefabPostInit("winter_ornament_fancy4", f1)
AddPrefabPostInit("winter_ornament_fancy5", f1)
AddPrefabPostInit("winter_ornament_fancy6", f1)
AddPrefabPostInit("winter_ornament_fancy7", f1)
AddPrefabPostInit("winter_ornament_fancy8", f1)
AddPrefabPostInit("winter_ornament_festivalevents1", f1)
AddPrefabPostInit("winter_ornament_festivalevents2", f1)
AddPrefabPostInit("winter_ornament_festivalevents3", f1)
AddPrefabPostInit("winter_ornament_festivalevents4", f1)
AddPrefabPostInit("winter_ornament_festivalevents5", f1)
AddPrefabPostInit("winter_ornament_plain1", f1)
AddPrefabPostInit("winter_ornament_plain2", f1)
AddPrefabPostInit("winter_ornament_plain3", f1)
AddPrefabPostInit("winter_ornament_plain4", f1)
AddPrefabPostInit("winter_ornament_plain5", f1)
AddPrefabPostInit("winter_ornament_plain6", f1)
AddPrefabPostInit("winter_ornament_plain7", f1)
AddPrefabPostInit("winter_ornament_plain8", f1)
AddPrefabPostInit("winter_ornament_plain9", f1)
AddPrefabPostInit("winter_ornament_plain10", f1)
AddPrefabPostInit("winter_ornament_plain11", f1)
AddPrefabPostInit("winter_ornament_plain12", f1)
AddPrefabPostInit("boomerang", f1)
AddPrefabPostInit("pickaxe", f1)
AddPrefabPostInit("shovel", f1)
AddPrefabPostInit("razor", f1)
AddPrefabPostInit("torch", f1)
AddPrefabPostInit("petals", f1)
AddPrefabPostInit("petals_evil", f1)
AddPrefabPostInit("foilage", f1)
AddPrefabPostInit("succulent_picked", f1)
AddPrefabPostInit("pig_token", f1)

 

Share this post


Link to post
Share on other sites
Ultroman    704

You have all these nice variables telling you whether you're on a server or not, but you don't use them to only call the postinit functions when on the server, like you should.

Share this post


Link to post
Share on other sites
Lokoluna    48

I'm sorry, i'm really new to postinit's and have only copied pasta'd most of this from something else, and had to write and change some things, i'm not good at this, i know this would be way faster so I'm trying my hand at it. Can you elaborate what you mean? I though i would need them as it told me when I crashed that my foodtype came back as null.

Share this post


Link to post
Share on other sites
Lokoluna    48

I've also tried using the dissapears component, but it searches for the Ondropped function to make sure it's dropped before it makes it disappears, currently.. idk how to do that with addprefabposinit, so items are taken from your inventory and removed due to no check for ondropped in place.

Share this post


Link to post
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
Sign in to follow this