scuba v0.0.0

Post Reply
leetelate
Member
Posts: 205
Joined: Thu Aug 29, 2013 18:07
Location: 한인 타운, Huntsville,Alabama,USA

scuba v0.0.0

by leetelate » Post

i think it requires minetest 0.4.7 to work (or some version with player:breath exposed)

make a folder in mods called scuba
make a empty init.lua file and put the code in it
create a folder inside the scuba folder called textures
download and put this image in it: Image
name the image psi.png

enable the new 'scuba' mod
go diving! - tank recharge is approx 5 minutes - wish it were as simple irl lol
todo: add a fill station, crafting tanks, dive skin, etc
enjoy

DEVELOPERS: yeah, I know the hud stuff isn't finished yet but wow, nice job on the hud y'all - much love to all who are working on it <3 <3 - you have great ideas plizadam! - and the hud_remove(hud_id) works wonderfully!

Image

the code for init.lua:

--scuba v0.0.0 ( requires a minetest version of 4.7 or some version with player:breath exposed )

local a = 100
local t = 0
local zid = -1
local c = "psi.png"
local timer = 0

local function scuba()
local players = minetest.get_connected_players()
if #players == 0 then return end
for i,player in ipairs(players) do
local b = player:get_breath()
if b < 10 then
if zid == -1 then
zid = player:hud_add( {
hud_elem_type = "statbar",
position = {x=0.52,y=0.88},
offset = {x=0, y=0},
name = "scuba air gauge",
text = c,
number = a,
alignment = {x=-1,y=-1},
scale = {x=1, y=1},
} )
else
player:hud_change(zid, "number", a)
end --if
a=a-1
if a > 0 then player:set_breath(9) end
else
if zid ~= -1 then
player:hud_remove(zid)
zid = -1
end --if
t=t+1
if t > 300 then --5 minute recharge
t=0
a=100
--print ("tank recharged")
end --if
end --if
end --for
--print (zid,t)
end --function

minetest.after(3, function()
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer < 1 then return end
timer = 0
scuba()
end) --function
end) --function
Last edited by leetelate on Tue Sep 10, 2013 16:44, edited 1 time in total.
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

  • You should provide the images
  • Package the mod folder in a zip and upload it, OR:p/*]
  • Use something like github
  • Topic title should be [Mod] Scuba [v0][scuba]
  • You can use

    Code: Select all

     and [ /code] to show your code (although, for a mod, you should provide the init.lua files[/*]
    [/list]
Last edited by rubenwardy on Tue Sep 10, 2013 16:54, edited 1 time in total.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
hansuke123
Member
Posts: 20
Joined: Mon Mar 11, 2013 11:36

by hansuke123 » Post

cool

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

The mod linked to below would go very well with this:
viewtopic.php?id=4627

leetelate
Member
Posts: 205
Joined: Thu Aug 29, 2013 18:07
Location: 한인 타운, Huntsville,Alabama,USA

by leetelate » Post

rubenwardy wrote:
  • You should provide the images
  • Package the mod folder in a zip and upload it, OR:p/*]
  • Use something like github
  • Topic title should be [Mod] Scuba [v0][scuba]
  • You can use

    Code: Select all

     and [ /code] to show your code (although, for a mod, you should provide the init.lua files[/*]
    [/list][/quote]
    
    
    i did provide the one tiny image necessary, download it and put it in the textures folder naming it psi.png
    if you can't follow simple directions...
    i have no website, don't care, and i saw no place to put images, folders, zips on the free github
    topic title is what it is because that is what it is, a simple preview version 0.0.0 major.minor.build
    meh, this is why i'm antisocial...nevermind
    thanks for the fun game anyway
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Inocudom wrote:The mod linked to below would go very well with this:
viewtopic.php?id=4627
The models in that mod are so big and laggy :P
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

by Topywo » Post

Nice useful mod!
leetelate wrote: if you can't follow simple directions...
Just in case:

https://dl.dropboxusercontent.com/u/65428713/scuba.zip

rubenwardy wrote:
Inocudom wrote:The mod linked to below would go very well with this:
viewtopic.php?id=4627
The models in that mod are so big and laggy :P
I'm busy reworking the sea-modpack. I was trying out some scuba stuff too, but this mod is more efficient. Maybe I'll release the modpack very soon without the clams, just to find out if I improved the performance.

ElectricSolstice
Member
Posts: 90
Joined: Tue Aug 20, 2013 02:00

by ElectricSolstice » Post

O_O I just crafted one airfill station and now it just lets me place that one block in my inventory infinitely.

EDIT: Nevermind, I now see where on your other forum post you say it doesn't come out of your inventory for testing purposes.

Can I take this mod and modify it to put in my voltbuild mod? Everything in it is just WTFPL, right?
Last edited by ElectricSolstice on Sat Oct 12, 2013 19:11, edited 1 time in total.

User avatar
Pitriss
Member
Posts: 254
Joined: Mon Aug 05, 2013 17:09
GitHub: Pitriss
IRC: pitriss
In-game: pitriss
Location: Czech republic, Bohumin

by Pitriss » Post

i have idea how to improve that airfill station. Make it not working under water... It will prevent cheating by taking airfill station in your inventory..

And second idea:after consuming of all air, turn a scuba tank to empty one.
I reject your reality and substitute my own. (A. Savage, Mythbusters)
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.

leetelate
Member
Posts: 205
Joined: Thu Aug 29, 2013 18:07
Location: 한인 타운, Huntsville,Alabama,USA

by leetelate » Post

yes and yes - have at it, it is wtfpl

the trick to stopping it from being used underwater is how to know if it is underwater? (furnaces can also be used underwater) - once you use a scuba tank (like eating an apple) it goes to empty scuba tank (there is no half-empty unfortuntely)

i have found another weird thing - since i used the funace as the backend of the airfill station you can maguyver a full tank by putting it in a furnace with fuel - OH THE LULZ!

inventory FIXED - GET THE NEW ONE ATTACHED HERE
Attachments
scuba.tar.gz
(7.05 KiB) Downloaded 311 times
Last edited by leetelate on Sun Nov 03, 2013 17:24, edited 1 time in total.
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...

User avatar
Pitriss
Member
Posts: 254
Joined: Mon Aug 05, 2013 17:09
GitHub: Pitriss
IRC: pitriss
In-game: pitriss
Location: Czech republic, Bohumin

by Pitriss » Post

leetelate wrote:yes and yes - have at it, it is wtfpl

the trick to stopping it from being used underwater is how to know if it is underwater?
How about to check adjacent blocks (at sides and on top) and allow reffiling only when atleast one is air? (if you check also bottom node then it can work also underwater because water will be directed by station to not flow under)

Edit:
About that switching between full and empty tank.. I mean when you are diving and pressure is at zero, to switch to empty one.. I saw this at watch mod:)
Last edited by Pitriss on Sun Nov 03, 2013 19:15, edited 1 time in total.
I reject your reality and substitute my own. (A. Savage, Mythbusters)
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Post

I just finished making an initial SCUBA mod, then saw this one.

I'm considering publishing mine, but I'm not extremely happy with the HUD yet. I wanted to take advantage of being able to show another inventory list using the new HUD API, but unfortunately the inventory HUD type doesn't scale (well) with the window size. I wanted to put the display on the right because that area often isn't used much, but maybe I'll just put it on the left and/or make it easily configurable.

Anyway, I chose a slightly different approach. The major differences are:
  • When you use a SCUBA tank, it "equips" it by putting it in a completely standalone inventory slot. Currently it stays there forever unless it wears out all the way, but I may provide another way of removing it in the future.
  • The mod runs a timer every second, looping through all connected players and testing whether they have SCUBA tanks "equipped". The HUD is shown or hidden depending on whether a tank is found, and simply shows the inventory slot where the tank is equipped.
  • An equipped tank refills its owner's breath bubbles to full if it can, adding wear to itself for every bubble added. It does this any time the owner's breath is less than maximum (10).
  • When it isn't refilling its owner's breath, an equipped tank slowly refills itself when its owner's head is in air (literally an "air" node—nothing else).
  • Using a SCUBA tank when you already have one equipped transfers as much wear as it can from the tank already equipped to itself instead of replacing the equipped one.
  • Constructing a SCUBA tank requires 6 steel, 1 coal (carbony type material for rubber hoses), and 1 glass (for a mask), so it only depends on the "default" mod.
Last edited by prestidigitator on Wed Jan 01, 2014 22:23, edited 1 time in total.

User avatar
Mihobre
Member
Posts: 101
Joined: Tue Oct 30, 2012 08:45
Location: In your mouth

by Mihobre » Post

Okay, guys, how about this? (I don't know how to code, so I dunno if my idea is possible)
The scuba tank "thingy" is a tool. When going underwater, its life decreases (life is the air in the tank). When it is out of "life", it turns into an empty scuba tank (is that even possible?). Now, the air "refill" station is a block. You click it with the empty scuba tank and the tank disappears from your inventory. Then, the texture of the empty scuba tank overlaps the front texture of the refill station, with a meter at the side of the tank. The bar in the meter will slowly rise, until, when full, a full scuba tank will pop out of the refill station. Or, if possible, when tank is full, you click the station to claim it.
ImageImageImage
These are some texture suggestions. I didn't make the refill station texture, by the way. I was too lazy XD
I wanna fly!!!
I wanna have feathery wings of silver, blue, and white!!!
I wanna soar high and touch the sky!!!
I wanna fly!!!

Post Reply

Who is online

Users browsing this forum: Unacceptium_core and 33 guests