NeddoFreddo Posted August 3, 2016 Share Posted August 3, 2016 (edited) heyo, I've added a custom fridge structure, and all is good except for one thing. I'd like it to only accept meats and vegetables, also not accept a specific custom prefab which happens to be meat. Thanks if you can help! Edited August 3, 2016 by NeddoFreddo tanks - thanks Link to comment https://forums.kleientertainment.com/forums/topic/69310-custom-fridge-structure/ Share on other sites More sharing options...
Joachim Posted August 3, 2016 Share Posted August 3, 2016 (edited) Inside your custom container prefab constructor function, you need to call: inst.components.container:WidgetSetup("custom_container", data) This is the code from the icebox for data: -------------------------------------------------------------------------- --[[ icebox ]] -------------------------------------------------------------------------- local data = { widget = { slotpos = {}, animbank = "ui_chest_3x3", animbuild = "ui_chest_3x3", pos = Vector3(0, 200, 0), side_align_tip = 160, }, type = "chest", } for y = 2, 0, -1 do for x = 0, 2 do table.insert(data.widget.slotpos, Vector3(80 * x - 80 * 2 + 80, 80 * y - 80 * 2 + 80, 0)) end end data.itemtestfn = function(container, item, slot) if item:HasTag("icebox_valid") then return true end --Perishable if not (item:HasTag("fresh") or item:HasTag("stale") or item:HasTag("spoiled")) then return false end --Edible for k, v in pairs(FOODTYPE) do if item:HasTag("edible_"..v) then return true end end return false end If you want it to only accept meats and vegetables, except for one custom prefab, then you mold itemtestfn into this: data.itemtestfn = function(container, item, slot) return item.components.edible and (item.components.edible.foodtype == FOODTYPE.MEAT or item.components.edible.foodtype == FOODTYPE.VEGGIE) and not item.prefab == "banned_custom_meat_prefab" end Edited August 3, 2016 by Joachim Link to comment https://forums.kleientertainment.com/forums/topic/69310-custom-fridge-structure/#findComment-800101 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