[Mod] Drowning [drowning]

User avatar
Death Dealer
Member
 
Posts: 1379
Joined: Wed Feb 15, 2012 18:46

by Death Dealer » Tue Mar 27, 2012 23:33

randomproof wrote:
Death Dealer wrote:
randomproof wrote:It doesn't. It depends on "default" (actually I don't think it does)


Hmmm... I don't use the oil mod so I don't know why. I can't see why if you are using the most recent version from github.

i am using ver 20120320. i think thats the newest.

Edit: It looks like you are using a version from March 20th. Sound was added on the 24th. The version you can pull from github and compile yourself is always the most recent. If you go to https://github.com/celeron55/minetest you can see the most recent commit and its date.
Until a Windows build is made you can comment out the 'sound_play' functions by placing two minus symbols in from of them.

: / darn i think ill wait til the next windows release comes out, i got the mod in my backup mods tho:D
Keep calm and code python^_^
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Wed Mar 28, 2012 12:52

i quite like this..now only if there was an "air" gui this would be perfect
If you can think it, you can make it.
 

User avatar
Death Dealer
Member
 
Posts: 1379
Joined: Wed Feb 15, 2012 18:46

by Death Dealer » Wed Mar 28, 2012 12:54

jordan4ibanez wrote:i quite like this..now only if there was an "air" gui this would be perfect

no it doesnt work well with other mods. its not perfect. yet.
Keep calm and code python^_^
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Wed Mar 28, 2012 12:57

Death Dealer wrote:
jordan4ibanez wrote:i quite like this..now only if there was an "air" gui this would be perfect

no it doesnt work well with other mods. its not perfect. yet.

use what sfan5, jeija, and randomproof's mods use and have a cookie cutter code, which if the drawtype is liquid then it works like water and air works now!
If you can think it, you can make it.
 

User avatar
Death Dealer
Member
 
Posts: 1379
Joined: Wed Feb 15, 2012 18:46

by Death Dealer » Wed Mar 28, 2012 13:02

jordan4ibanez wrote:
Death Dealer wrote:
jordan4ibanez wrote:i quite like this..now only if there was an "air" gui this would be perfect

no it doesnt work well with other mods. its not perfect. yet.

use what sfan5, jeija, and randomproof's mods use and have a cookie cutter code, which if the drawtype is liquid then it works like water and air works now!

i dont develop code, and these are not my mods so what are you talking about? why would i spend time on someone else's modXD
Keep calm and code python^_^
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Mar 28, 2012 16:24

Death Dealer wrote:ya ive tryed this several times on differrent recent versions here is the error text i get after the program crashs when trying to call the field "sound play"


14:13:27: INFO[main]: Client packetcounter (20s):
14:13:27: INFO[main]: cmd 16 count 0
14:13:27: INFO[main]: cmd 32 count 14
14:13:27: INFO[main]: cmd 39 count 0
14:13:27: INFO[main]: cmd 41 count 0
14:13:27: INFO[main]: cmd 49 count 0
14:13:27: INFO[main]: cmd 50 count 93
14:13:27: INFO[main]: cmd 51 count 0
14:13:27: INFO[main]: cmd 52 count 0
14:13:27: INFO[main]: cmd 54 count 0
14:13:27: INFO[main]: cmd 56 count 0
14:13:27: INFO[main]: cmd 58 count 0
14:13:27: INFO[main]: cmd 60 count 0
14:13:27: INFO[main]: cmd 61 count 0
14:13:28: INFO[main]: Client: avg_rtt=0
14:13:28: INFO[ServerThread]: ServerMap: Unloaded 42 blocks from memory, of which 19 were written, 163 blocks in memory.
14:13:28: INFO[ServerThread]: ServerMap: Blocks modified by:
14:13:28: INFO[ServerThread]: setTimestamp: - - - - - - - - - - - - - - 19
14:13:31: INFO[ServerThread]: ServerMap: Unloaded 38 blocks from memory, of which 0 were written, 125 blocks in memory.
14:13:37: VERBOSE[main]: Client: time_of_day=11623 time_speed=96 dr=1000
14:13:38: INFO[main]: Client: avg_rtt=0
14:13:47: INFO[main]: Client packetcounter (20s):
14:13:47: INFO[main]: cmd 16 count 0
14:13:47: INFO[main]: cmd 32 count 0
14:13:47: INFO[main]: cmd 39 count 0
14:13:47: INFO[main]: cmd 41 count 1
14:13:47: INFO[main]: cmd 49 count 0
14:13:47: INFO[main]: cmd 50 count 94
14:13:47: INFO[main]: cmd 51 count 0
14:13:47: INFO[main]: cmd 52 count 0
14:13:47: INFO[main]: cmd 54 count 0
14:13:47: INFO[main]: cmd 56 count 0
14:13:47: INFO[main]: cmd 58 count 0
14:13:47: INFO[main]: cmd 60 count 0
14:13:47: INFO[main]: cmd 61 count 0
14:13:47: INFO[ServerThread]: Players:
14:13:47: INFO[ServerThread]: * singleplayer RemoteClient 2: m_blocks_sent.size()=63, m_blocks_sending.size()=0, m_nearest_unsent_d=0, m_excess_gotblocks=0
14:13:48: INFO[main]: Client: avg_rtt=0
14:13:53: ERROR[ServerThread]: ERROR: An unhandled exception occurred: LuaError: error: ...0120320-win32\bin\..\mods\mesetint\drowning\init.lua:39: attempt to call field 'sound_play' (a nil value)
14:13:53: ERROR[ServerThread]: stack traceback:

In thread 700:
C:\tmp\minetest\src\server.cpp:118: ServerThread::Thread: Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 444:
#0 main
#1 ClientMap::renderMap
(Leftover data: #2 ClientEnvironment::step)
(Leftover data: #3 Client::Receive)
(Leftover data: #4 Client::ProcessData)
(Leftover data: #5 MeshUpdateQueue::addBlock)
DEBUG STACK FOR THREAD 700:
#0 ServerThread::Thread
(Leftover data: #1 Server::AsyncRunStep)
(Leftover data: #2 ServerEnvironment::step)
(Leftover data: #3 RemoteClient::GetNextBlocks)
(Leftover data: #4 BlockEmergeQueue::addBlock)
DEBUG STACK FOR THREAD ff4:
#0 MeshUpdateThread::Thread

You need to compile the latest git
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Wed Mar 28, 2012 16:31

sfan5 wrote:
Death Dealer wrote:ya ive tryed this several times on differrent recent versions here is the error text i get after the program crashs when trying to call the field "sound play"


14:13:27: INFO[main]: Client packetcounter (20s):
14:13:27: INFO[main]: cmd 16 count 0
14:13:27: INFO[main]: cmd 32 count 14
14:13:27: INFO[main]: cmd 39 count 0
14:13:27: INFO[main]: cmd 41 count 0
14:13:27: INFO[main]: cmd 49 count 0
14:13:27: INFO[main]: cmd 50 count 93
14:13:27: INFO[main]: cmd 51 count 0
14:13:27: INFO[main]: cmd 52 count 0
14:13:27: INFO[main]: cmd 54 count 0
14:13:27: INFO[main]: cmd 56 count 0
14:13:27: INFO[main]: cmd 58 count 0
14:13:27: INFO[main]: cmd 60 count 0
14:13:27: INFO[main]: cmd 61 count 0
14:13:28: INFO[main]: Client: avg_rtt=0
14:13:28: INFO[ServerThread]: ServerMap: Unloaded 42 blocks from memory, of which 19 were written, 163 blocks in memory.
14:13:28: INFO[ServerThread]: ServerMap: Blocks modified by:
14:13:28: INFO[ServerThread]: setTimestamp: - - - - - - - - - - - - - - 19
14:13:31: INFO[ServerThread]: ServerMap: Unloaded 38 blocks from memory, of which 0 were written, 125 blocks in memory.
14:13:37: VERBOSE[main]: Client: time_of_day=11623 time_speed=96 dr=1000
14:13:38: INFO[main]: Client: avg_rtt=0
14:13:47: INFO[main]: Client packetcounter (20s):
14:13:47: INFO[main]: cmd 16 count 0
14:13:47: INFO[main]: cmd 32 count 0
14:13:47: INFO[main]: cmd 39 count 0
14:13:47: INFO[main]: cmd 41 count 1
14:13:47: INFO[main]: cmd 49 count 0
14:13:47: INFO[main]: cmd 50 count 94
14:13:47: INFO[main]: cmd 51 count 0
14:13:47: INFO[main]: cmd 52 count 0
14:13:47: INFO[main]: cmd 54 count 0
14:13:47: INFO[main]: cmd 56 count 0
14:13:47: INFO[main]: cmd 58 count 0
14:13:47: INFO[main]: cmd 60 count 0
14:13:47: INFO[main]: cmd 61 count 0
14:13:47: INFO[ServerThread]: Players:
14:13:47: INFO[ServerThread]: * singleplayer RemoteClient 2: m_blocks_sent.size()=63, m_blocks_sending.size()=0, m_nearest_unsent_d=0, m_excess_gotblocks=0
14:13:48: INFO[main]: Client: avg_rtt=0
14:13:53: ERROR[ServerThread]: ERROR: An unhandled exception occurred: LuaError: error: ...0120320-win32\bin\..\mods\mesetint\drowning\init.lua:39: attempt to call field 'sound_play' (a nil value)
14:13:53: ERROR[ServerThread]: stack traceback:

In thread 700:
C:\tmp\minetest\src\server.cpp:118: ServerThread::Thread: Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 444:
#0 main
#1 ClientMap::renderMap
(Leftover data: #2 ClientEnvironment::step)
(Leftover data: #3 Client::Receive)
(Leftover data: #4 Client::ProcessData)
(Leftover data: #5 MeshUpdateQueue::addBlock)
DEBUG STACK FOR THREAD 700:
#0 ServerThread::Thread
(Leftover data: #1 Server::AsyncRunStep)
(Leftover data: #2 ServerEnvironment::step)
(Leftover data: #3 RemoteClient::GetNextBlocks)
(Leftover data: #4 BlockEmergeQueue::addBlock)
DEBUG STACK FOR THREAD ff4:
#0 MeshUpdateThread::Thread

You need to compile the latest git

Erm, I have tried it but, it cant find Vorbis or OGG. (Cmake can't for MiniGW OR MSVS)

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Mar 28, 2012 16:34

Jordach wrote:
sfan5 wrote:
Death Dealer wrote:ya ive tryed this several times on differrent recent versions here is the error text i get after the program crashs when trying to call the field "sound play"



You need to compile the latest git

Erm, I have tried it but, it cant find Vorbis or OGG. (Cmake can't for MiniGW OR MSVS)

You must install something like libvorbis-dev
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Wed Mar 28, 2012 16:38

Jordach wrote:
sfan5 wrote:
Death Dealer wrote:ya ive tryed this several times on differrent recent versions here is the error text i get after the program crashs when trying to call the field "sound play"



You need to compile the latest git

Erm, I have tried it but, it cant find Vorbis or OGG. (Cmake can't for MiniGW OR MSVS)



Here are libvorbis and libvorbis-dev
http://packages.ubuntu.com/search?keywords=libvorbis&searchon=names&suite=oneiric§ion=all

Here are libogg and libogg-dev
http://packages.ubuntu.com/search?suite=oneiric§ion=all&arch=any&searchon=names&keywords=libogg
Last edited by bgsmithjr on Wed Mar 28, 2012 16:39, edited 1 time in total.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Wed Mar 28, 2012 16:46

bgsmithjr wrote:
Jordach wrote:
sfan5 wrote:You need to compile the latest git

Erm, I have tried it but, it cant find Vorbis or OGG. (Cmake can't for MiniGW OR MSVS)



Here are libvorbis and libvorbis-dev
http://packages.ubuntu.com/search?keywords=libvorbis&searchon=names&suite=oneiric§ion=all

Here are libogg and libogg-dev
http://packages.ubuntu.com/search?suite=oneiric§ion=all&arch=any&searchon=names&keywords=libogg

Derp, I am using windows.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Wed Mar 28, 2012 16:49

Jordach wrote:
bgsmithjr wrote:
Jordach wrote:Erm, I have tried it but, it cant find Vorbis or OGG. (Cmake can't for MiniGW OR MSVS)



Here are libvorbis and libvorbis-dev
http://packages.ubuntu.com/search?keywords=libvorbis&searchon=names&suite=oneiric§ion=all

Here are libogg and libogg-dev
http://packages.ubuntu.com/search?suite=oneiric§ion=all&arch=any&searchon=names&keywords=libogg

Derp, I am using windows.



That doesn't matter. Well besides for decompressing the tar.gz files which can be done with winRAR
Just download the source on the right, not the .deb. I compiled it for windows on 26 using those files, cmake and visual studio. I had sound function but there was some other bug that could have been from node_ownership. That's why I compiled from source
Last edited by bgsmithjr on Wed Mar 28, 2012 16:51, edited 1 time in total.
 

randomproof
Member
 
Posts: 214
Joined: Thu Nov 17, 2011 06:31

by randomproof » Wed Mar 28, 2012 18:54

I've redone the mod checking for air instead of water, but I haven't uploaded it yet. I will when I get home later today.
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Sat Mar 31, 2012 16:16

Does this have a function to turn it on and off?
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Mar 31, 2012 16:38

Nope
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Tue Apr 03, 2012 12:02

How come there is no splash when you first enter the water.
 

randomproof
Member
 
Posts: 214
Joined: Thu Nov 17, 2011 06:31

by randomproof » Wed Apr 04, 2012 23:25

bgsmithjr wrote:How come there is no splash when you first enter the water.

Because I didn't think of it. That and there is a little bit of a delay and I don't care to check how fast the player enters the water to see if it make sense to play a splashing sound. The gasping sound is only to give the player feedback that they have been above water long enough to reset the timer and they can go back down.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Sat Aug 04, 2012 15:54

Currently there is a bug in this mod, because it checks for air, you can drown while standing in a door and things like that. So I tried to let it check for the group "liquid". But it don't works, the game loads, but nothing happens.

I changed "IsPlayerInAir" to the following.
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
function IsPlayerInLiquid(player)
    pos = player:getpos()
    pos.x = math.floor(pos.x+0.5)
    pos.y = math.floor(pos.y+1.5)
    pos.z = math.floor(pos.z+0.5)
   
    -- Here it is looking which kind of node is at the players head.
    local n_head = minetest.env:get_node(pos).name
    -- Now checking if the node has the group "liquid". I think the mistake is somewhere here.
    if minetest.get_item_group(n_head, "liquid") ~= 0 then
        return true
    end
    return false
end


p.s. I am not a programmer, have no experience and am learning by doing here.

[edit]Forgot some "". Now it works. The next thing is to change the time between two hurts to be exponential (e.g. 40,20,10,5,3,2,1...).[/edit]
Last edited by Casimir on Sat Aug 04, 2012 17:56, edited 1 time in total.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Sat Aug 04, 2012 19:16

Done.
http://www.filedropper.com/drowning

- Drowning in all liquids. water, lava, flowing water, flowing lava
- Hurts 1/2 heart all DROWNING_SECONDS while DROWNING_SECONDS is reduced exponential by factor 2 until it reaches MIN_DROWNING_SECONDS (2 Seconds). So you recognise when your drowning and have enough time to get back to the surface before it is to late. And it is intuitive so you not necessarily need a drowningbar.
- Starting with 40s you can stay underwater for 1min and 42s until you die.
- No more strange gaspingsounds when walking throw a door, a torch, or at the beginning of the game.

licence like original: WTFPL
 

Clahymore
Member
 
Posts: 11
Joined: Wed Jun 20, 2012 10:30

by Clahymore » Tue Aug 07, 2012 09:34

Could you add something to tell you how much air you have, like bubbles or an oxygen tank?
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Tue Aug 07, 2012 12:05

That's far more complicated and to complicated for me. Cause you would have to write it into the sourcecode in C++ (afaik). If somebody does it, it should be included into the normal game anyway.

btw. Found a Bug. In line 56 it should be:
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
    pos.y = math.floor(pos.y+2.0)
Last edited by Casimir on Tue Aug 07, 2012 12:05, edited 1 time in total.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Mon Sep 17, 2012 20:04

New version.
- working in Multiplayer. You can now use it on your server.
- some bugs cleaned out.

http://ompldr.org/vZmozNg/drowning%2020120917.zip
(WTFPL)

By the way, there is no oxygentank and no bubbles, but I like that. After the first "hurt" you still have time to get to the surface, at least as much as you needed to dive down. And you learn very fast how long you can stay underwater. It feels very intuitive and you don't have your screen full of bars like in minecraft.
Last edited by Casimir on Mon Sep 17, 2012 20:20, edited 1 time in total.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Sep 19, 2012 15:28

Bugfix: http://ompldr.org/vZmp5Zw/drowning%2020120919.zip
Now I believe it to be bugfree.
 

User avatar
Feorth
Member
 
Posts: 27
Joined: Sat Sep 08, 2012 00:06

by Feorth » Wed Sep 19, 2012 16:16

Works great !! Thank you very much for the update :D
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Thu Sep 20, 2012 21:36

Yet another update.
- code cleaned
- saves the timer when you quit

http://ompldr.org/vZmtscw/drowning%2020120920.zip
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Dec 26, 2012 00:43

Update!
http://ompldr.org/vZ3R2eA/drowning%2020121226.zip

- made the code easier, more beautiful, smaller.
- due to that there are no more bugs (I know of).

p.s. It would be nice it there could be a hint in the first post pointing here.
 

Iqualfragile
Member
 
Posts: 160
Joined: Tue Sep 18, 2012 22:11

by Iqualfragile » Wed Dec 26, 2012 01:06

casimir: im asking mods to do so, but you can allways create a new topic for your modifications
Gr8 b8, m8. I rel8, str8 appreci8, and congratul8. I r8 this b8 an 8/8. Plz no h8, I'm str8 ir8. Cr8 more, can't w8. We should convers8, I won't ber8, my number is 8888888, ask for N8. No calls l8 or out of st8. If on a d8, ask K8 to loc8. Even with a full pl8, I always have time to communic8 so don't hesit8.
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Wed Dec 26, 2012 01:43

Iqualfragile wrote:casimir: im asking mods to do so, but you can allways create a new topic for your modifications


True. I did that with inventory_plus. The moderators were nice, and moved the new topic for the old plugin to the right forum.
 

cheesecake
 

by cheesecake » Wed Dec 26, 2012 10:37

I slightly modified this mod as follows:

  • Added some documentation that hopefully enables more people to play around with the code.
  • Refactored the code into smaller functions with the same goals as above.
  • Added kind of a visual feedback for the amount of breath that remains until you get hurt. It comes as a tool in your inventory that misuses the progress bar used normally for a tool's degradation. This tool cannot be crafted, you have to give it to yourself. Its name is "drowning:breath_meter".

Get it here: http://ompldr.org/vZ3R6dA

Note that the tool surely has its flaws. One such flaw is that, though you may give yourself multiple copies of the tool, only one of them works. I figured updating more than one tool per player would have been a waste of time that the Minetest server could better be spending on other things.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Fri Dec 28, 2012 20:09

Thank you! The code is very nice to read now. Additional by cleaning up you fixed a bug I made in the last version. And it works very well.
 

acridstone
Member
 
Posts: 14
Joined: Sat Mar 02, 2013 06:53

by acridstone » Tue Mar 12, 2013 23:12

please make a github thing! it is very convenient for my local server.
 

PreviousNext

Return to Old Mods

Who is online

Users browsing this forum: No registered users and 23 guests

cron