New Resources Question

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,370
Location
Dallas, TX
Hello, I'm trying to add some new Resources to the game, bringing together the disparate efforts of several modders. Looking at the legacy code, I've noticed there are two tables that are confusing me:

1. Resource_FeatureBooleans
2. Resource_FeatureTerrainBooleans

Both have the same schema (Resource Type, Terrain Type). Additionally, there are overlaps in the game's versions of these table, representing duplicate entries between the two tables, and also entries in each that are unique to the table.


Question: Does anyone know the difference between the 2 tables, and/or what their relationships to each other are?


I'm not sure if I should only use one table, duplicate data into both tables, or get creative on which terrain type goes with which resource type in which table?

Thanks!
 
BOTH are only considered if there is a feature on the plot, first the Resource_FeatureBooleans expects a feature type and determines if the resource can occur, then the Resource_FeatureTerrainBooleans expects a terrain type and determines is the resource can occur. So you can set a resource up to occur on any tile that has a forest (feature) or any tile that is a tundra (terrain) that has ANY feature. If you want any plot that is tundra without a feature you need to use the Resource_TerrainBooleans table.

Neither table is used directly by the DLL, so they are only used by the map scripts.
 
Last edited:
Forgive me. I'm such a jackass. The question should have been: what's the difference between the Resource_TerrainBooleans and the Resource_FeatureTerrainBooleans tables?

Those are the 2 tables that share the same schema (ResourceType, TerrainType), and have similar, but not always identical data inside.

I've read a lot about the advantages of not changing the "AssignStartingPlots" code when adding map features. So, I plan on adding the Resources to the map using a function that executes after the map script has ran (like @Horem did here: https://forums.civfanatics.com/resources/horems-new-resources-hnr.21758/), then would either of these tables have an impact on my new resources?

Thanks, and sorry for the confusion. :wallbash:
 
Answer is (edited) above.

The code in CanHaveResource is
if (plot has ANY feature) {
if (plot has feature in Resource_FeatureBooleans) {
can place resource on plot = true
} else if (plot has terrain in Resource_FeatureTerrainBooleans) {
can place resource on plot = true
}
} else {
if (plot has terrain in Resource_TerrainBooleans) {
can place resource on plot = true
}
}
 
Thanks, @whoward69, for such a good explanation. My dyslexia is a real pain sometimes in trying to keep things like these straight. Appreciate it!
 
BOTH are only considered if there is a feature on the plot, first the Resource_FeatureBooleans expects a feature type and determines if the resource can occur, then the Resource_FeatureTerrainBooleans expects a terrain type and determines is the resource can occur. So you can set a resource up to occur on any tile that has a forest (feature) or any tile that is a tundra (terrain) that has ANY feature. If you want any plot that is tundra without a feature you need to use the Resource_TerrainBooleans table.

Neither table is used directly by the DLL, so they are only used by the map scripts.

For anyone who's searching it, the older answer is more updated? WorldBuilder and Civilopedia use this but nothing else really.
 
Top Bottom