whismerhill

[Solved]GetRecipe().Tab always blank ?

Recommended Posts

whismerhill    34

hi,

I have a bit of a problem I'm unable to solve by myself in one of my released mods. this piece of code  never returns :
(NOTE: I have stripped the sanity checks & whatnot to make it compact, I can show you more code if desired)

local bestweapon = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
print("GetRecipe(bestweapon.prefab).Tab", GetRecipe(bestweapon.prefab).Tab)
if GetRecipe(bestweapon.prefab).Tab == RECIPETABS.WAR then return bestweapon end 
print("code is still running, it didn't return")

I believe the root of the issue is that GetRecipe(bestweapon.prefab).Tab is always blank. in the log file or console

I also tried this : 

local recipes = GetAllRecipes()
if recipes[bestweapon.prefab].Tab == RECIPETABS.WAR then return bestweapon end

with the exact same result

the thing is : I already used the GetAllRecipes technique in another mod successfully so I'm not sure what mistake I made ...
and I'm pretty sure this mod was working fine a long time ago (my last update was in may 2017 ....)

 

Additional Note : the file is in the scripts folder so doesn't need the usual : local RECIPETABS = GLOBAL.RECIPETABS from modmain

Edited by whismerhill

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