Tumalu Posted March 3, 2017 Share Posted March 3, 2017 So, I want to make it so you can't use cooked/dried monster meat on the Birdcage; it feels really exploity and Klei even tried to bugfix it out but people complained. Anyway, I can't figure it out- even though birdcage.lua already has it, just commented out. :S I looked at a mod I helped on in the past to edit Willow's lighter and made this, but I can still feed the birds cooked meat. Tried a bunch of other stuff but it all crashed. local invalid_foods = { "bird_egg", "rottenegg", "monstermeat", "cookedmonstermeat", "monstermeat_dried", } AddPrefabPostInit("birdcage") Link to comment https://forums.kleientertainment.com/forums/topic/75283-how-to-edit-existing-prefabs-via-mod/ Share on other sites More sharing options...
CarlZalph Posted March 3, 2017 Share Posted March 3, 2017 @Tumalu local banned_prefabs = {} banned_prefabs["cookedmonstermeat"] = true banned_prefabs["monstermeat_dried"] = true AddPrefabPostInit( "birdcage", function(inst) if not GLOBAL.TheWorld.ismastersim then return end if inst.components.trader and inst.components.trader.test then local trader_test_old = inst.components.trader.test inst.components.trader.test = function(self, item, giver, ...) if banned_prefabs[item.prefab]==true then return false end return trader_test_old(self, item, giver, ...) end end end ) Link to comment https://forums.kleientertainment.com/forums/topic/75283-how-to-edit-existing-prefabs-via-mod/#findComment-876783 Share on other sites More sharing options...
Tumalu Posted March 3, 2017 Author Share Posted March 3, 2017 Oh wow, that doesn't look even remotely like what I would have expected! I guess to edit that sort of table just isn't as easy as adding new functions on Willow's Lighter, heh! Tested and it worked! Thanks a whole bunch <3 With this and the "no ice as filler" mod, I don't have to self-restrict to avoid exploit-y food recipes. Link to comment https://forums.kleientertainment.com/forums/topic/75283-how-to-edit-existing-prefabs-via-mod/#findComment-876800 Share on other sites More sharing options...
Developer zarklord_klei Posted March 5, 2017 Developer Share Posted March 5, 2017 you also can copy the prefab into your scripts/prefabs folder and edit that and changes take effect Link to comment https://forums.kleientertainment.com/forums/topic/75283-how-to-edit-existing-prefabs-via-mod/#findComment-877804 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now