Jump to content
Banjo

Fixing inability to manually drink water (if not a bug)

Recommended Posts

I posted this as a possible bug report here

 

However, if this turns out to not be a bug but an intended 'feature' (as I am now suspecting), I'm trying to mod this to undo the change so that drinking manually from water bottles, bowls, mugs, etc. is possible even when not Thirsty (just like you can drink Orange Soda regardless of thirst).

 

My first instinct was to make a mod that added the 'Drink' interaction to Water Bottle item (notably missing in the original code compared to that of Orange Soda), but this didn't work. I took a look in the code and found that making a mod containint a modified version of 'ISInventoryPaneContextMenu.lua', edited to remove the thirst check - as below - fixed the issue:

 

    if waterContainer then        local drinkOption = context:addOption(getText("ContextMenu_Drink"), items, nil)        local subMenuDrink = context:getNew(context)        context:addSubMenu(drinkOption, subMenuDrink)        subMenuDrink:addOption(getText("ContextMenu_Eat_All"), items, ISInventoryPaneContextMenu.onDrink, waterContainer, 1, player)        subMenuDrink:addOption(getText("ContextMenu_Eat_Half"), items, ISInventoryPaneContextMenu.onDrink, waterContainer, 0.5, player)        subMenuDrink:addOption(getText("ContextMenu_Eat_Quarter"), items, ISInventoryPaneContextMenu.onDrink, waterContainer, 0.25, player)    end

 

Obviously, though, modding existing files isn't the best way to go, but creating a standalone lua file to implement this fix is way beyond my understanding. I've been able to do this sort of thing before with simpler lua, as with professions, traits, items, etc. but 'ISInventoryPaneContextMenu.lua' is far more complicated than I'm used to trying to deal with!

 

If anyone can point me in the right direction of what I need to do, I'd really appreciate it, as it's driving me nuts not being able to simply drink from a bottle of water at will.

Share this post


Link to post
Share on other sites

You would have to stop and drink way too much in my opinion. Try not having a water bottle in your inventory and see how long it takes for your thirst to go up. I like it the way it is personally and it makes the most sense. You wouldn't drink unless thirsty anyway. Orange soda in reality should increase thirst if it doesn't already. The difference is that soda gives bonuses like happiness within the game it would be a waste of beneficial modifiers to just auto-drink the soda, comparably to the water which is what you need to survive. I see a lot of people drinking when not thirsty and if you were to play this game on hardcore survival settings you would be wasting a tremendous amount of water because of that. It has no benefit to drinking water unless your thirst increases because there's no perk associated with it other than its necessity.

Share this post


Link to post
Share on other sites

My main desire was to allow the player to drink whenever they want, thirsty or not, not disable the auto-drink function. This is because not allowing manual drinking seems strange and confusing to me; all other items can be eaten and drunk regardless of hunger/thirst, so why not water? That I achieved by editing 'ISInventoryPaneContextMenu.lua', though I was hoping someone could suggest a less 'edit core files' intrusive method.

 

Being able to turn off or disable 'auto drinking' would be great though, IMO. I understand why some people like how it reduces 'busy work', but to me it is a bit out of place and seems counter-intuitive to the sense of realism the rest of the game presents (and now we're getting calories for food and such, this is even more 'hardcore'). A setting (as we have for reloading) where one can enable/disable 'auto drinking' would IMO be the best solution.

Share this post


Link to post
Share on other sites

Line 488 of   C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\client\ISUI\ISInventoryPaneContextMenu.lua

    if waterContainer and getSpecificPlayer(player):getStats():getThirst() > 0.1 then

 

Remove the > 0.1 part. Should probably mean you can then drink no matter what the thirst level of the player is.

Share this post


Link to post
Share on other sites

Thanks. That's what I did above, EnigmaGrey, and it indeed lets you drink whever you want. I use this as a personal mod now. :) What I'm hoping for, though, is a way to make this a mod that doesn't replace the whole 'ISInventoryPaneContextMenu.lua' file (just overwrites that function), but my lua skills are severely lacking!

 

Regardless, I really wish that was 'vanilla' behaviour, as it seems really odd not to be able to drink water whenever you want yet you can drink anything else at any time. Can I ask why this is now the case? Not auto-drinking, just the "can't drink unless thirsty"?

 

I do understand the reason for auto-drinking (less 'busy work' for the player), though, and my suggestion in the 'Suggestions' forum are more to do with that. In the meantime though, what code would I need to edit to mod (turn off) auto-drinking completely for personal use?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...