Skip to content

Conversation

@k4mcz4
Copy link

@k4mcz4 k4mcz4 commented Nov 4, 2025

  • Setting checkMapTemperature: false in CanEverPlantAt condition check enables nano cultivator to sow plants during extreme temperatures on a map

… `checkMapTemperature: false` in `CanEverPlantAt` condition check
@Sn1p3rr3c0n
Copy link
Collaborator

Well yea that works, I would personally like a comment explaining why we set that argument, as it is really quite unexpected.
maybe something like:
// despite CanEverPlantAt getting passed the cell, the temperature check is for the Tile and NOT the actual location

@k4mcz4
Copy link
Author

k4mcz4 commented Nov 4, 2025

Thanks for the hint, I'm fairly new into this. I don't know how verbose I should be in code comments :)

// CanEverPlantAt checks if tile is suitable for planting by checking fertility, polution, bounds, temperature, etc
// When checkMapTemperature is true, then plant temperature requirements are checked against Tile instead of a cell
// if (checkMapTemperature && (map.TileInfo.MinTemperature > plantDef.plant.maxGrowthTemperature || map.TileInfo.MaxTemperature < plantDef.plant.minGrowthTemperature))

There is a small caveat to this change though.
Nano Cultivator will now ignore temperature checks completely, and will sow plants disregarding its required temp.
20251104225903_1

I was thinking on implementing additional temperature check using something like Verse.GenTemperature.GetTemperatureForCell or even Verse.Room.Temperature directly. Latter could also open door to vacuum checks.
But I don't know what is best practice here.

@Sn1p3rr3c0n
Copy link
Collaborator

Overly verbose Comments should be avoided.
I would only comment when it is required and keep it short and concise.
for something like this at most one line

regarding the Temperature checks, I would recommend checking what is used for pawns.
I have a feeling we should also check the performance impact of the Themp check, whatever it is that we will be using

@k4mcz4
Copy link
Author

k4mcz4 commented Nov 5, 2025

Looks like Pawns has AmbientTemperature which mostly uses GenTemperature.GetTemperatureForCell. With exceptions when traveling (checks Tile temperature) and when pawn is being held (which in most cases temp will be 14.0 and if checks fails it gives 21.0).
I will play with it and give some feedback. Maybe implement temp checking periodically, since it isn't necessary to do it every cell pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants