Patriarachnid Posted April 9, 2015 Share Posted April 9, 2015 So I'm trying to add a food type to my mod character. However, since the code used to do that differs between the normal game and Reign of Giants (for some reason), I can't have the code for one and have it work for the other. So I try to do the code below, to make it check to see if RoG is enabled... if IsDLCEnabled(REIGN_OF_GIANTS) then table.insert(self.preferseating, "NIGHTMARE") table.insert(self.caneat, "NIGHTMARE") else table.insert(inst.components.eater.foodprefs, "NIGHTMARE") end...and it doesn't work. It acts like RoG isn't enabled, even if it is. I checked the dlcsupport_worldgen file, and that seems to be the variable it's asking for. Is there something I'm doing wrong? Link to comment Share on other sites More sharing options...
DarkXero Posted April 9, 2015 Share Posted April 9, 2015 http://forums.kleientertainment.com/topic/52178-rog-or-old-dst-how-to-check/ Link to comment Share on other sites More sharing options...
Zackreaver Posted April 9, 2015 Share Posted April 9, 2015 @Patriarachnid, Long story short, RoG will be integrated into DST, it won't be DLC so changeif IsDLCEnabled(REIGN_OF_GIANTS) thento something likeif SEASONS.AUTUMN then--orif GLOBAL.SEASONS.AUTUMN thenyou get the same result as what your looking for. Link to comment Share on other sites More sharing options...
Maris Posted April 9, 2015 Share Posted April 9, 2015 (edited) You can check if the feature exists.if inst.components.eater.preferseating then --RoG version table.insert(inst.components.eater.preferseating, "NIGHTMARE") table.insert(inst.components.eater.caneat, "NIGHTMARE")else --non-RoG table.insert(inst.components.eater.foodprefs, "NIGHTMARE")endI do so in other places of the code. For example: if inst.components.equippable.dapperness then --RoG version inst.components.equippable.dapperness = TUNING.CRAZINESS_MED else --non-Rog inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.CRAZINESS_MED endAnother example: local Eater = require "components/eater"if Eater.TestFood then --RoG version local old_TestFood = Eater.TestFood function Eater:TestFood(food, testvalues,...) if self.inst and self.inst:HasTag("stormcaller") and food.prefab and forbidden_foodset[food.prefab] then return false end return old_TestFood(self,food,testvalues,...) endelse --non-RoG local old_TestFood = Eater.CanEat function Eater:CanEat(food,...) if self.inst and self.inst:HasTag("stormcaller") and food.prefab and forbidden_foodset[food.prefab] then return nil end return old_TestFood(self,food,...) endendetc Edited April 9, 2015 by Maris Link to comment Share on other sites More sharing options...
Patriarachnid Posted April 9, 2015 Author Share Posted April 9, 2015 Oh, goodie, I've got it working now. Thanks much Link to comment 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