[Mod] Thirsty [thirsty] (WIP)

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Wed Jul 08, 2015 20:57

programmingchicken wrote:Erm, for the fountain crafting recipes copper should be replaced with copper pipes.
[…]
that way it's not too easy to get your fountain.


Thanks for the feedback! About the cost of a fountain: are you counting in the fact that a single fountain gets you only a 5-block radius, and you'll typically build more (or rather, extenders) anyway?

On the other hand, you're right, fountains are group efforts (there are easier ways for a single player to keep hydrated), and the nodes I've defined are trivial for a multi-player settlement. I'm just not comfortable with adding too many new items which have no use outside this mod, just to raise the price.

The good news is: the last release made it easy to disable my fountains, and swap in your own! I'll have to write a little tutorial on it, when I have the time.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Wed Jul 08, 2015 20:59

mahmutelmas06 wrote:how about adding drinking sound ?


I haven't worked with sound effects before – know any good sources ?-)

A single sound should be enough for the wooden bowl, canteens, and drinking fountain (I must get a better name for this, one day :-/ ) – I'm pretty sure noone wants constant gulping sounds while standing in water, or close enough to a fountain :-P
 

User avatar
programmingchicken
Member
 
Posts: 537
Joined: Sat Apr 18, 2015 02:20
GitHub: ProgrammingChicken
IRC: gamer chicken
In-game: gamerdude

Re: [Mod] Thirsty [thirsty] (WIP)

by programmingchicken » Thu Jul 09, 2015 02:27

Speaking about names...
hyper-quenching beacon?
ranged thirst-quencher beacon 3.0?
something technical, needs to be complicated...
water beacon? too simple
Ranged Automatic Water Machine Edition Alpha Theta
R.A.W.M.E.A.T.
i like this one :D
or this one:
Water Access Table Edition Rho
W.A.T.E.R.
I'm bold. I'm sarcastic. I'm PChicken.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Fri Jul 10, 2015 19:01

programmingchicken wrote:Speaking about names...
hyper-quenching beacon?
ranged thirst-quencher beacon 3.0?
Ranged Automatic Water Machine Edition Alpha Theta
R.A.W.M.E.A.T.
Water Access Table Edition Rho
W.A.T.E.R.


Nice :-D

However, I usually think of these things as "fountains", and am looking for a good name for the "drinking fountain". In my head, I call it a "bird bath" (hey, my version looks like one), or maybe "water cooler" could work.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Fri Jul 10, 2015 19:02

Version 0.8.1 released

Adds river water (source and flowing) for you to stand in and/or drink from; thanks Nathan for the tip!. (I'll probably also have to add river water buckets to recipes, I'm still checking how these work…)
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Tue Jul 14, 2015 18:44

Version 0.9.0 released

This version adds a few API methods, thanks again to Nathan for the inspiration!

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

thirsty
.drink(player, amount, [max])      --# instantly drink a bit (up to a max value, default 20)
thirsty.get_hydro(player)                 --# returns the current hydration of a player
thirsty.set_thirst_factor(player, factor) --# how fast does the given player get thirsty (default is 1.0)
thirsty.get_thirst_factor(player)         --# returns the current thirst factor of a player
 


The Thirsty mod does not use these functions itself, but they can be useful if you have a consumable that should "drink a bit too", or if you want players to get thirstier in the desert or when sprinting.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Thirsty [thirsty] (WIP)

by Nathan.S » Tue Jul 14, 2015 23:36

It seems as if this will throw an error if you upgrade without creating a new world. I could be wrong, but I got an error about it trying to read the thirst_factor.

Edit:
Well I just tried to re-enter a new world and am getting the same error.
+ Spoiler


Edit 2:
I think I've narrowed it down, but I could be entirely wrong. I'm pretty sure that the saving of the file doesn't save the thirst_factor and it's never read. The value is set for a new player, but if you already exist that value isn't set and the mod crashes the game. However when I delete the thirsty.dat file and relaunch the game I get the same error, so I'm unsure if that is the problem or not.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Fri Jul 17, 2015 20:20

I've got a new version out, 0.9.1, which should fix this bug. I'm leaving 0.9.0 and 0.9.1 listed as "current versions" in the top post, if anyone else runs into this problem and can't access the GitHub commit I did yesterday.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Thirsty [thirsty] (WIP)

by Nathan.S » Fri Jul 17, 2015 21:34

Sorry to keep finding all these bugs.
I have an apple with the following code,
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 
on_use = function(player)
      thirsty.drink(player, hydration, 20) minetest.item_eat(health)

hydration is a variable which is defined elsewhere, as is the health variable.

which gives this error when I try to eat the apple. I've commented out the eating part, thinking maybe that might be a problem, but the same error. Unfortunately I have no ideas on this one. I tried using the get_hydro just to see what would happen, and I get the same error about an attempt to call global 'get_player_name' (a nil value).



Here is the error Minetest gives me.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
2015-07-17 16:27:31: ACTION[ServerThread]: singleplayer uses food:apple, pointing at [nothing]
16:27:31: WARNING: Undeclared global variable "player" accessed at /home/nathan/.minetest/games/Survive/mods/food/fruits.lua:41
16:27:31: WARNING: Undeclared global variable "get_player_name" accessed at ...athan/.minetest/games/Survive/mods/thirsty/functions.lua:57
2015-07-17 16:27:31: ERROR[main]: ServerError: ...athan/.minetest/games/Survive/mods/thirsty/functions.lua:57: attempt to call global 'get_player_name' (a nil value)
2015-07-17 16:27:31: ERROR[main]: stack traceback:
2015-07-17 16:27:31: ERROR[main]:    ...athan/.minetest/games/Survive/mods/thirsty/functions.lua:57: in function 'drink'
2015-07-17 16:27:31: ERROR[main]:    /home/nathan/.minetest/games/Survive/mods/food/fruits.lua:41: in function </home/nathan/.minetest/games/Survive/mods/food/fruits.lua:40>
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sat Jul 18, 2015 20:00

Nathan.S wrote:Sorry to keep finding all these bugs.
...


Nonsense, I'm grateful for it! I'll look into this bug as soon as I can.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sat Jul 18, 2015 20:10

Which "on_use" function are you calling? Are you passing it to "register_node"? Because the on_use handler's signature is more like

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
on_use = function(itemstack, user, pointed_thing)


So your function should expect those parameters, too. You should be able to do something like this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
on_use = function(itemstack, user, pointed_thing)
    thirsty.drink(user, hydration, 20)


(Also, I don't think you can call "item_eat" directly – according to the specs, item_eat is executed and returns a function (more precisely, a closure), which can then be used as an on_use handler. But I may be wrong.)
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sat Jul 18, 2015 20:21

Got it, I think:

Try the following code (hydration and food are hardcoded, but you get the idea):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.override_item('default:apple', {
    on_use = function(itemstack, user, pointed_thing)
        thirsty.drink(user, 2, 20)
        local eat_func = minetest.item_eat(1)
        return eat_func(itemstack, user, pointed_thing)
    end
}) 
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Thirsty [thirsty] (WIP)

by Nathan.S » Sat Jul 18, 2015 20:57

I'm just an idiot and was doing it wrong. After following your advice all is working. thanks again.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sat Aug 15, 2015 19:30

Version 0.10.0 released

No user-visible changes, but this version no longer saves the current hydration of players in a file in the world, but in a hidden inventory slot. Warning: this means players will start at "not thirsty" again. But hopefully, few people will mind :-P
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Mon Sep 07, 2015 19:47

The mod seems stable enough; I'm going through all the points I'd still like to get to before declaring this mod "released". At the moment, I can think of two things:

  1. A player's hydration level is saved by my attempt at a "shareable mixin", which I've since concluded is not worth it. It won't have any outward effect, but I'd like to get this refactored before declaring 1.0.0 .
  2. I'm not happy with the configuration. Ideally, I'd like to have a single, well-nested configuration file with all the defaults, and players / server admins can copy this file to configure stuff without their changes being clobbered by the next update. The mod code would then simply merge these by top-level key or something.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Thirsty [thirsty] (WIP)

by rubenwardy » Tue Sep 08, 2015 08:39

Once again, using the inventory to store an integer value is incredibly hacky.
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: [Mod] Thirsty [thirsty] (WIP)

by Ferk » Tue Sep 08, 2015 10:39

Another mod that adds an interesting aspect to survival :)

If river water was used more extensively by the mapgen it would have been interesting to make river water the only drinkable one (not only it's more rare but it's also not infinitely re-generating). But since river water hardly makes an apparition in any world it would be too hardcore of a change.

Though maybe adding a "water purifier" tool (or container) that turns normal water into drinkable river water would be interesting.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Tue Sep 08, 2015 20:33

rubenwardy wrote:Once again, using the inventory to store an integer value is incredibly hacky.


Yes. Yes, it is. And it gets even hackier once you realise that each inventory slot can store a 16-bit count and a 16-bit wear and an arbitrary string of metadata.

Luckily, I've encapsulated all of this in a separate submodule (in persistent_player_attributes.lua) in anticipation of code like this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local hydro = player:get_saved_value("thirsty_hydro"

So once something like that is available, the switch is easy.

Ferk wrote:[…] it would have been interesting to make river water the only drinkable one (not only it's more rare but it's also not infinitely re-generating). […]

Though maybe adding a "water purifier" tool (or container) that turns normal water into drinkable river water would be interesting.


It's already possible to toss normal water out and leave only river water via the configuration; you should give it a try on a new world, and let us know how it went. The "infinitely re-generating" aspect is not quite as important as the fact that you can pick up water in a bucket and carry it around with you. I must confess I'm not to familiar with river water yet; do buckets work on them?
 

User avatar
programmingchicken
Member
 
Posts: 537
Joined: Sat Apr 18, 2015 02:20
GitHub: ProgrammingChicken
IRC: gamer chicken
In-game: gamerdude

Re: [Mod] Thirsty [thirsty] (WIP)

by programmingchicken » Tue Sep 08, 2015 20:44

I think there are river water buckets, so maybe you could make a purification through furnace craft?
I'm bold. I'm sarcastic. I'm PChicken.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Thirsty [thirsty] (WIP)

by TenPlus1 » Tue Sep 08, 2015 20:49

Placing a bucket of sea water in a furnace should give back salt so maybe a distiller block would be handy...
 

User avatar
programmingchicken
Member
 
Posts: 537
Joined: Sat Apr 18, 2015 02:20
GitHub: ProgrammingChicken
IRC: gamer chicken
In-game: gamerdude

Re: [Mod] Thirsty [thirsty] (WIP)

by programmingchicken » Tue Sep 08, 2015 21:07

:3
Yes, maybe snow could be used?
I'm bold. I'm sarcastic. I'm PChicken.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Tue Sep 08, 2015 21:30

Neat ideas, but ultimately beyond the scope of this mod.

But have a look at Nathan's Survival mod. It makes use of Thirsty, but is already tackling the "water purification angle".
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sun Nov 01, 2015 21:56

Version 0.10.1 released

No new functionality. There were two points I had wanted to refactor before declaring this mod ready to release:
Ben wrote:
  1. A player's hydration level is saved by my attempt at a "shareable mixin", which I've since concluded is not worth it. It won't have any outward effect, but I'd like to get this refactored before declaring 1.0.0 .
  2. I'm not happy with the configuration. Ideally, I'd like to have a single, well-nested configuration file with all the defaults, and players / server admins can copy this file to configure stuff without their changes being clobbered by the next update. The mod code would then simply merge these by top-level key or something.


Both of these have been achieved with this version. Please let me know if you find any problems.

Warning: If you have configured this mod by copying the "thirsty.conf.example" file, then things should probably work by coincidence. But I would recommend copying the "thirsty.default.conf" anew, and recreating your local changes in it. Just remember to use a new, temporary file name for the new config file, so as not to clobber the very "thirsty.conf" whose changes you're trying to save.
 

User avatar
mahmutelmas06
Member
 
Posts: 355
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: [Mod] Thirsty [thirsty] (WIP)

by mahmutelmas06 » Fri Nov 27, 2015 21:51

I have released a mod as a main purpose of this mod.

viewtopic.php?f=9&t=13601
My Mods:

Beverage
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sun Dec 06, 2015 21:56

mahmutelmas06 wrote:I have released a mod as a main purpose of this mod.

viewtopic.php?f=9&t=13601


Wow, looks very good! Nice :-D
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Thirsty [thirsty] (WIP)

by Nathan.S » Sun Jan 17, 2016 23:10

So I'm integrating this mod with the mymonths mod, integrating is probably the wrong word, anyway, I'm wondering does thirsty.set_thirst_factor 2 mean you get thirsty twice as fast or half as fast, I couldn't find anything that said.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Tue Jan 19, 2016 19:49

Nathan.S wrote:So I'm integrating this mod with the mymonths mod, integrating is probably the wrong word, anyway, I'm wondering does thirsty.set_thirst_factor 2 mean you get thirsty twice as fast or half as fast, I couldn't find anything that said.


Good point, the docs are probably too thin on this. A factor of 2 makes you thirsty twice as fast; the relevant line is about here: https://github.com/bendeutsch/minetest-thirsty/blob/version_0.10.1/functions.lua#L208

I've been out of the loop a bit; when I get back, though, I'd like to overhaul this system a bit. Instead of changing the factor or flatly adjusting hydration, I'd like to implement a kind of "thirst debt". Dig a block, incur 0.2 hydration debt. Craft an item: 0.3 debt. Cast a fireball: 1.5 debt. This "debt" is then repaid by getting thirsty twice as hard until it is paid off.

Another interesting mechanic: instead of a single factor, have a set of bonuses / maluses (or boni / mali). Sprinting? +30% thirst. Wearing Boots of Rain? -20% thirst. Together +10%, or 110% as opposed to the default 100%. And if you stop sprinting, the sprinting malus drops back to +0%, making the new total 100%-20%=80%. Yes, this can work, as long as I work out what happens at 0%, 100%, 200% etc.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Thirsty [thirsty] (WIP)

by Nathan.S » Wed Jan 20, 2016 00:24

Thanks for the reply, I probably could have dug through the code myself, but just looked at the documentation.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Echoes91
Member
 
Posts: 67
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes

Re: [Mod] Thirsty [thirsty] (WIP)

by Echoes91 » Tue May 24, 2016 17:19

I've included your mod within my new Minesim subgame and corrected a typo that prevented the bar to be displayed with the correct size.
"It wasn't easy to break so many functions by editing a single line"
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Thirsty [thirsty] (WIP)

by Ben » Sun Jun 19, 2016 13:29

Echoes91 wrote:I've included your mod within my new Minesim subgame


Neat!

Echoes91 wrote:and corrected a typo that prevented the bar to be displayed with the correct size.


Oops! Thanks for catching that, merged (also sorry for the delay).
 

PreviousNext

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 18 guests

cron