[Mod] Thirsty [thirsty] (WIP)

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

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

by Ben » Thu May 07, 2015 20:15

Nathan.S wrote:I thought I had seen you posting about loosing more thirst depending on location, maybe that was one of the mana threads


Could be – I had talked about gaining and losing mana depending on location, but nothing is coded yet. And as prestidigitor said, some other thirst mods do just that.
 

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

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

by Ben » Thu May 07, 2015 20:28

Version 0.7.0 released

This one completes the tiers, so all features should be included. Warning: the last tier is coded quite inefficiently; it might not work well in multiplayer. I'm working on it.

Here are the last two items:

The water extractor
Image

The water injector
Image

These two can work alone, though they work best together, of course (oh, and they have confusingly similar textures, at the moment :-P ). What happens is this: the water extractor gets water "out of nowhere", and fills a water container (i.e. a canteen) in your inventory. The water injector takes water from a canteen in your inventory, and… fills you up. Or drinks it for you. Into you. It's either magic, or high tech, or both.

If you have one of them, you either don't have to look for water anymore, or do not need to drink by yourself. If you have both (and a canteen!), thirst becomes a "solved problem".

It would have been much easier to code a single item that just keeps you hydrated. So why these two, and why do you still need a canteen? Firstly to drive up the cost, secondly to make it sensible to go half the way first, and thirdly so that you block three inventory slots, one more than carrying a full water bucket and a wooden bowl. Whether this works remains to be seen.
Attachments
craft_injector.png
(3.33 KiB) Not downloaded yet
craft_extractor.png
(3.37 KiB) Not downloaded yet
 

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

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

by Ben » Sun Jul 05, 2015 13:05

Not dead, just resting :-P

I've released version 0.8.0. There is no real added functionality with this version, but now everything has been refactored and should now be configurable via user configuration (including disabling the built-in components like fountains and amulets or even the wooden bowl). Just copy the thirsty.conf.example file to thirsty.conf, edit away, and enjoy!

In theory, this should allow this mod to work much better / smoother with other mods or preexisting components. In practice, it probably won't matter much, because I haven't received many requests for this yet ;-)

I consider this version a "release candidate", by the way. If you do use it, and have any comments or suggestions, please let me know!
 

User avatar
programmingchicken
Member
 
Posts: 540
Joined: Sat Apr 18, 2015 02:20
Location: not here
GitHub: pchicken
IRC: chicken pchicken

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

by programmingchicken » Tue Jul 07, 2015 16:23

Erm, for the fountain crafting recipes copper should be replaced with copper pipes.
and copper pipes should be craftable like this:
c c c
- - -
c c c
for one copper pipe
c=copper
- = nothing
that way it's not too easy to get your fountain.
Good mod, btw.
<gamerdude> I apologize for the above content
 

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

User avatar
Ben
Member
 
Posts: 160
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: 160
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: 540
Joined: Sat Apr 18, 2015 02:20
Location: not here
GitHub: pchicken
IRC: chicken pchicken

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.
<gamerdude> I apologize for the above content
 

User avatar
Ben
Member
 
Posts: 160
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: 160
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: 160
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!

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: 804
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
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, and brand new Minetest Modding Course
 

User avatar
Ben
Member
 
Posts: 160
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: 804
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
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,
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.
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, and brand new Minetest Modding Course
 

User avatar
Ben
Member
 
Posts: 160
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: 160
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

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:

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: 160
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):

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: 804
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
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, and brand new Minetest Modding Course
 

User avatar
Ben
Member
 
Posts: 160
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: 160
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
Moderator
 
Posts: 5494
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
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: 337
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: 160
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:

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: 540
Joined: Sat Apr 18, 2015 02:20
Location: not here
GitHub: pchicken
IRC: chicken pchicken

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?
<gamerdude> I apologize for the above content
 

User avatar
TenPlus1
Member
 
Posts: 2402
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...
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: Inocudom and 13 guests