Jump to content

Recommended Posts

image.png.511a264cf832be5af77d8a2280ba62c8.png

Recently I have been developing a mod for mechanical small animals, aiming to replace the farming module to reduce CPU load.
 
When I was researching the Pacu's recipes, I found that the method "BasePacuConfig.SeedDiet()" — which is used to obtain seed recipes — has no actual effect. When I ran it in the mod code, the number of recipes obtained was 0, and I also did not find any other code related to Pacu's recipes.

image.png.0d972a5c03b531388c3600d3cf30aa0f.png
Analogous code used to obtain metal ore recipes in Hatch functions properly.

My programming skills are rather limited, so the speculations above might be incorrect. Please don’t blame me.

8 hours ago, Tigin said:

该方法至今仍在使用(参见 BasePacuConfig.CreatePrefab 和 PacuConfig.CreatePacu)。你怎么确认食谱数量是0的?

image.png.dae9f9069595237265d878cd4231f88c.png

The above is the code to obtain the Pacu seed recipe in the mod code.
image.png.fe877692c841fe346d41df63685bec2a.png

The above is the code to obtain Hatch food recipes.
image.png.362583767ec1a49ae11006a0dc6d3641.png
The above is the log output.

Can my guess be verified based on the above content?

This seems like an initialization order issue. The seed diet looks at the plantable seed prefabs which are loaded in entities, but you're logging during PostConfigureComplete which is when buildings are loaded (and buildings are loaded before entities)

29 minutes ago, Tigin said:

这看起来像是初始化顺序的问题。种子饮食会查看可种植的种子预制件,这些预制件已经加载到实体中,但你是在PostConfigureComplete期间记录的,那时建筑物是加载的(建筑物是在实体之前加载的)

This question is too profound for me. I have manually added seed formulas one by one using a clumsy method. Thank you very much for your answer.

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
×
  • Create New...