[Suggestion] More conditions/Document them
TomaszewskiPatryk opened this issue ยท 2 comments
Conditions are great, but there are 2 big problems.
- They aren't documented on the wiki nor in the in-game guide, meaning only way to know how to use them is to analyze the example book from the wiki, which isn't ideal solution.
- From what is written on mod overview (because again, there is no documentation about conditions) and example book on the wiki, there are only three types of conditions available: mod presence, game stage and advancement.
So I present to you a list of possible conditions that would allow for making better books which are also more cross-modpack friendly.
- Item exists - checks if item with given name exists
- Key set - check if given keybind is set (from #72)
- Is in inventory - checks if item with given name is in players inventory. If item doesn't exists returns false
- Creative - returns true if player is in creative mode
- Config value - check if config value from given mod is equal to given value. This doesn't require any fancy config parsing, just checking what's the value for key A in file with name B
- Config contains - it's similiar to the previous one, however, since config value can be a list as well, it detect if given value is inside that list
- Mod version - detect if mod version is higher or lower from specified one
- Singleplayer/Multiplayer - detect is player is playing on a singleplayer or multiplayer world. Could be usefull in hiding information that's on usable on one of those
- Has permission - it just simply detects if player reading this book has a given permission. This one is a little more dynamic, since that permission can change during gameplay, without reloading the world. If given permission doesn't exists returns false
- Is op - returns true if given player is op
- Has crafted - checks if player has ever crafted item with given name. If item doesn't exists returns false
- Is in dimension - checks if player is currently in dimension with given name. If dimension doesn't exists returns false
- Visited dimension - check if player was ever in dimension with given name. If dimension doesn't exists returns false
- Dimension exists - check if dimension with given name exists
- Mob exists - checks if mob with given name exists
- Mob spawns - checks if mob with given name can spawn in given dimension. If no dimension is specified checks all of them
- Is craftable - simply checks if item with given name has a crafting recipe. If item doesn't exists returns false
- Can be fished - checks if item with given name can be obtained using a fishing rod. If item doesn't exists returns false
- Does drop - checks if item with given name can be dropped by any mob. If item doesn't exists returns false
- Does generate - check if item with given name is present in any loot table. If item doesn't exists returns false
- Is obtainable - checks if given item can be obtained without using creative mode. In most cases it would be just those four previous conditions combined
- [Agricraft] Is crop - checks if given item can be planted via Agricraft crop system. If Agricraft isn't installed returns false
- [Tinkers Construct] Is material - checks if given item can be used to make a tool part. If Tinkers Construct isn't installed returns false
- [Tinkers Construct] Is metal material - checks if given item has to be smelted to make a tool part. If Tinkers Construct isn't installed returns false
Yes I agree that I lack documentation. It is something that has always been an issue to me: I don't enjoy writing docuimentation at all, and with my mods being a hobby project, I neglect those tasks.
Some comments about the conditions:
Some of these conditions would require storing separate statistics. I don't think it's Guidebook's place to keep track of such things. But I would be OK with supporting an external API, like I did for Game Stages.
Also, dynamic conditions are perfectly doable. In fact, both gamestages and advancement conditions need to be reevaluated every time you open the book, to see if they changed since last time. So dynamic conditions are perfectly supported.
As for "can be fished"/"drops from a mob"/"generates"/... I would also prefer to keep the implementation of such things separate from Guidebook. If no library mod exists for those things, then an addon to guidebook could be created.
As for "item exists", that's already a thing. This is the list of conditions:
All others, I will keep them in mind.
Here you go, I documented conditions for you :)