Tesumoto Posted July 4, 2018 Share Posted July 4, 2018 (edited) Hello! Please tell me, how can I remove unnecessary lines in a file of a certain prefab using this or similar function? AddPrefabPostInit("bedroll_straw", function(inst) if TUNING.BEDROLL_STRAW_USES > 1 then inst:AddComponent("finiteuses") inst.components.finiteuses:SetConsumption(GLOBAL.ACTIONS.SLEEPIN, 1) inst.components.finiteuses:SetMaxUses(TUNING.BEDROLL_STRAW_USES) inst.components.finiteuses:SetUses(TUNING.BEDROLL_STRAW_USES) end end) I need to remove these two lines of code for prefab "bedroll_straw": inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEMI don't want to modify this prefab file. Can I do this using only code in modmain.lua? Thank you for attention. Edited July 4, 2018 by Tezumoto Link to comment https://forums.kleientertainment.com/forums/topic/93084-working-on-function-need-help/ Share on other sites More sharing options...
CarlZalph Posted July 4, 2018 Share Posted July 4, 2018 if inst.components.stackable then inst:RemoveComponent("stackable") end Link to comment https://forums.kleientertainment.com/forums/topic/93084-working-on-function-need-help/#findComment-1059209 Share on other sites More sharing options...
Tesumoto Posted July 4, 2018 Author Share Posted July 4, 2018 (edited) 11 minutes ago, CarlZalph said: if inst.components.stackable then inst:RemoveComponent("stackable") end So it's so simple Thanks, with this code everything works great. Edited July 4, 2018 by Tezumoto Link to comment https://forums.kleientertainment.com/forums/topic/93084-working-on-function-need-help/#findComment-1059213 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