[mod] Air tanks [airtanks]

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

[mod] Air tanks [airtanks]

by FaceDeer » Sun Mar 26, 2017 08:08

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.

Links
Last edited by FaceDeer on Sat Apr 01, 2017 23:57, edited 4 times in total.
 

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

Re: [mod] Air tanks [airtanks]

by klunk » Sun Mar 26, 2017 11:41

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: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [mod] Air tanks [airtanks]

by azekill_DIABLO » Sun Mar 26, 2017 14:17

great! useful for under water expeditions!
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

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

Re: [mod] Air tanks [airtanks]

by FaceDeer » Sun Mar 26, 2017 15:44

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: 226
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [mod] Air tanks [airtanks]

by texmex » Mon Mar 27, 2017 14:38

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.
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [mod] Air tanks [airtanks]

by azekill_DIABLO » Mon Mar 27, 2017 15:02

yeah but should need to craft something like a breating tub or something like a pipe.
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

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

Re: [mod] Air tanks [airtanks]

by FaceDeer » Mon Mar 27, 2017 15:16

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: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: [mod] Air tanks [airtanks]

by D00Med » Mon Mar 27, 2017 20:21

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

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

Re: [mod] Air tanks [airtanks]

by FaceDeer » Mon Mar 27, 2017 20:58

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: 14
Joined: Mon Feb 27, 2017 01:10

Re: [mod] Air tanks [airtanks]

by dawgdoc » Tue Mar 28, 2017 01:59

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
 

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

Re: [mod] Air tanks [airtanks]

by texmex » Tue Mar 28, 2017 08:27

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.
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

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

Re: [mod] Air tanks [airtanks]

by dawgdoc » Tue Mar 28, 2017 09:03

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.
 

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

Re: [mod] Air tanks [airtanks]

by FaceDeer » Tue Mar 28, 2017 13:43

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: 226
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [mod] Air tanks [airtanks]

by texmex » Tue Mar 28, 2017 14:47

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. :)
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

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

Re: [mod] Air tanks [airtanks]

by texmex » Tue Mar 28, 2017 17:22

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!
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

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

Re: [mod] Air tanks [airtanks]

by FaceDeer » Tue Mar 28, 2017 19:44

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.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 51 guests

cron