[mod] Air tanks [airtanks]

Post Reply
FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

[mod] Air tanks [airtanks]

by FaceDeer » Post

A simple mod for extending one's underwater excursion time.

Image

Air tanks are crafted from copper, steel, or bronze ingots and are wielded like tools. A compressor is crafted from steel, mese shard, and wood.

Place a compressor in world and click on it with an empty air tank to fill it. A compressor needs to have air adjacent to it for it to function. Compressors can also recharge partly-used tanks.

When running low on breath use a filled air tank to recharge your breath bar. One use will replenish 5 steps of breath (out of 10). By default a steel air tank will hold 30 uses, a bronze one holds 20, and a copper one holds 10 - these settings can be changed in the mod's section under Advanced Settings. Once a tank runs out of uses it turns into an empty tank, which can be recharged again with a compressor.

To automatically draw air from air tanks, craft a breathing tube and put it in your quick-use inventory row. When your breath bar drops below 5 steps it will automatically attempt to use an air tank from your quick-use inventory row to replenish it.

This mod supports the doc extension.

Dependencies: default
License: MIT

Links
Last edited by FaceDeer on Sun Jun 03, 2018 17:52, edited 5 times in total.

User avatar
klunk
New member
Posts: 3
Joined: Fri Jan 18, 2013 14:55
In-game: subreptice

Re: [mod] Air tanks [airtanks]

by klunk » Post

Hello
There is a problem with "metal_sound" wich can't be found because it is not in default, at line 124 of init.lua, maybe because I'm running MT 0.4.14.
Once this line comented, this is a great mod. I really like the sound of compressed air from the bottle !

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Air tanks [airtanks]

by azekill_DIABLO » Post

great! useful for under water expeditions!

FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Air tanks [airtanks]

by FaceDeer » Post

klunk wrote:Hello
There is a problem with "metal_sound" wich can't be found because it is not in default, at line 124 of init.lua, maybe because I'm running MT 0.4.14.
Yeah, the metal sounds were added to default in 0.4.15. I'll add a fallback so it won't crash on older versions.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Air tanks [airtanks]

by texmex » Post

Another high quality mod from FaceDeer! As this developer somehow is able to read my mind of what feature is needed next time and time again, I'll add this to my server asap.

I have a feature question right off the bat: Could an optional feature be made so that new breaths of air is supplied to the player automatically as long as the tank sits in the hotbar? As I understand the description the player has to wield the item to get some air, currently. Hotbar check routine is available from the orienteering mod.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Air tanks [airtanks]

by azekill_DIABLO » Post

yeah but should need to craft something like a breating tub or something like a pipe.

FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Air tanks [airtanks]

by FaceDeer » Post

Thanks. This mod was actually something I came up with last-minute when I went to post dfcaverns, since there are water-flooded caves in that mod and I wasn't able to find any good scuba mods with a cursory search. Figured this would be handy for exploring them. :)

Good ideas for new features, I will look into implementing them (both auto-breathing and requiring an extra accessory for auto-breathing). The tricky bit is not so much the checking of whether an item's in the hotbar, it's knowing when the player is out of breath. Just did some poking around in the code and it looks like there's an undocumented API called register_playerevent that sends a "breath_changed" event for players to a registered event handler, I think that might be the way to do it. It's what the built-in statbar code uses for updating the breath statbar so it's probably a stable part of the API.

User avatar
D00Med
Member
Posts: 943
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: [mod] Air tanks [airtanks]

by D00Med » Post

Nice idea!
For some reason I thought this was going to be like the 'air sword'
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Air tanks [airtanks]

by FaceDeer » Post

I've updated the mod with a breathing tube. If the breathing tube is in your inventory quick-use slots, then when your breath bar goes below 5 you will automatically take a breath from any non-empty air tank that is also in your inventory quick-use slot. If there are no air tanks to get air from it'll generate a gasping sound to let the player know he's close to drowning and should either surface or swap fresh tanks into his quick-use slots.

Let me know what you think of the balance. The crafting recipe for the breathing tube is just something I threw together without much thought. In testing it took me quite a while to drain a steel air tank so if you've got 7 of them in your quick-use slots that could take a very long time indeed, so maybe I should reduce the default number of uses a bit.

dawgdoc
Member
Posts: 253
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: [mod] Air tanks [airtanks]

by dawgdoc » Post

FaceDeer wrote:... so maybe I should reduce the default number of uses a bit.
You do that and all of the characters will be like I was when I first learned to scuba dive.
I had an instructor call me and "Air Sucking Dog" ;-D
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Air tanks [airtanks]

by texmex » Post

dawgdoc wrote:You do that and all of the characters will be like I was when I first learned to scuba dive.
I had an instructor call me and "Air Sucking Dog" ;-D
Cash fan perhaps? ;)
FaceDeer wrote:I've updated the mod with a breathing tube. If the breathing tube is in your inventory quick-use slots, then when your breath bar goes below 5 you will automatically take a breath from any non-empty air tank that is also in your inventory quick-use slot. If there are no air tanks to get air from it'll generate a gasping sound to let the player know he's close to drowning and should either surface or swap fresh tanks into his quick-use slots.
Great! The only objection i have is that now players have to have one more item in the already crowded hotbar, but that could also be intentional (that it should be "expensive" to use"). In another case I imagine a craft recipe with some sticks and the tank in order to make the new item "tank with tube", or similar.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

dawgdoc
Member
Posts: 253
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: [mod] Air tanks [airtanks]

by dawgdoc » Post

texmex wrote:
dawgdoc wrote:You do that and all of the characters will be like I was when I first learned to scuba dive.
I had an instructor call me and "Air Sucking Dog" ;-D
Cash fan perhaps? ;)

I would have said yes, but then I realized I wasn't familiar with that song.
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Air tanks [airtanks]

by FaceDeer » Post

texmex wrote: Great! The only objection i have is that now players have to have one more item in the already crowded hotbar, but that could also be intentional (that it should be "expensive" to use"). In another case I imagine a craft recipe with some sticks and the tank in order to make the new item "tank with tube", or similar.
Exactly, it's a tradeoff. I had originally considered some kind of special inventory slot system like the armor mod has, but this way is much simpler (both for player and for the poor overwhelmed coder :) and makes extended underwater adventures something you need to plan for.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Air tanks [airtanks]

by texmex » Post

FaceDeer wrote:Exactly, it's a tradeoff. I had originally considered some kind of special inventory slot system like the armor mod has, but this way is much simpler (both for player and for the poor overwhelmed coder :) and makes extended underwater adventures something you need to plan for.
Sounds good. Luckily my hotbar is 16 slots big. :)
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Air tanks [airtanks]

by texmex » Post

I tried it out, it works well. I love the audible refill sound. A few ideas more, of course:
  • A visible wear level on the tank would be good, just like any other tool has. However, I see you put a badge on empty ones, perhaps you want it that way, that it's not so precise how much air is left.
  • The instant refill from the compressor feels a bit to quick and spammy. It would be neat if you had to mount the tank on the compressor and let it sit for 10 seconds or so before it was filled back up.
  • All tanks have the same color, shouldn't they differ?
  • Bronze level tank have (config.steel_uses + config.copper_uses)/2 number of uses, but bronze tools are better than steel tools and require more material. I propose (config.steel_uses + config.copper_uses) number of uses. :)
Thanks for this mod!
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

FaceDeer
Member
Posts: 478
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Air tanks [airtanks]

by FaceDeer » Post

Okay, I got home and tested airtanks with a 0.4.15 release build of Minetest, and sure enough the [multiply: modifier was the culprit. As a temporary measure until 0.4.16 comes out I've switched over to a colorize-and-mask approach that looks a bit more garish but that at least clearly distinguishes the metal types.

I was able to see the wear-down bar, so that's not a result of a version incompatibility. TexMex, perhaps you were in creative mode when you were using the air tanks? I decided to follow the pattern of other tools and have them not wear out in creative mode. Perhaps these air tanks should behave differently, though, they're not exactly "tools" in the usual sense. I'll make them wear out in creative mode and add a configuration option to disable that if desired.

Anyway, the other points.
  • Bronze. Ugh, I hate the metallurgy of the default minetest-game. I'd forgotten that the standard recipe is "1 copper + 1 steel = 1 bronze." I'll adjust the number of uses, though I must protest at how "gamey" this feels and some day when I do further work to bring further Dwarf Fortress elements into Minetest I'm going to fix that. :)
  • Adding a waiting period to fill tanks. I have nothing against this, but I think I'll probably put it off for the time being. I'm mainly focused on polishing dfcaverns right now, and I unexpectedly committed to upgrading hopper with new functionality, so it seems like a low-reward-high-cost thing to do right now. But I'll keep it in mind, maybe add an interface like my anvil mod when I've got spare time and no bigger ideas to fill it.

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: [mod] Air tanks [airtanks]

by Sergey » Post

Bronze is harder to craft than steel, so it must have more uses.

Brian Gaucher
Member
Posts: 76
Joined: Wed Jan 10, 2018 01:56
GitHub: BrianGaucher
In-game: Camasia

Re: [mod] Air tanks [airtanks]

by Brian Gaucher » Post

I have relaunched the Modding Competition Oceans: viewtopic.php?f=47&t=22416

I also extended the deadline because of the forum rollback.
Current projects: Making a CTF map, Learning C++, Learning Programmer's Dvorak

ThorfinnS
Member
Posts: 281
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [mod] Air tanks [airtanks]

by ThorfinnS » Post

Issued a PR to resolve a couple recipe conflicts, xindustrial's mold and something else.

It requires the compressor to be a part of the recipe, and returns it to the crafting guide when done, so work out the same, apart from you might have to dig the compressor if you want a second tank.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests