[Mod] Drowning [drowning]

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

[Mod] Drowning [drowning]

by randomproof » Sun Mar 25, 2012 16:43

Drowning Damage

Description:

NOW WITH SOUNDS!

I haven't had time to test this just yet. I'm not sure if the function IsPlayerUnderWater() is right. I think that the position you get from the player is at the feet and if you add one node up you get where the head is. If someone knows otherwise let me know. But otherwise you will get DROWNING_DAMAGE every DROWNING_SECONDS seconds (default to 1 damage every 30 seconds under water). On my computer globalstep runs pretty regularly at a little under once a second so popping out of water for at least a second or two should be good to reset the timer. I'm thinking of adding some feedback to the user, such as a countdown with chat messages.

License of code and textures:
WTFPL

Download (old version)

Updated version:
Casimir has continued to work on this mod in Randomproof's absence. See post #55 and surrounding context for details on his updates.

http://minetest.net/forum/viewtopic.php?pid=59231#p59231
Last edited by VanessaE on Wed Dec 26, 2012 01:09, edited 1 time in total.
 

Utilisatrice
Member
 
Posts: 103
Joined: Thu Feb 16, 2012 18:04

by Utilisatrice » Sun Mar 25, 2012 17:07

Hi randomproof,

Your mod works 100%.
 

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

by randomproof » Sun Mar 25, 2012 17:16

Ok, good. I have to go out shopping with the wife right now, but later I'm going to make a small change so you can set how long you can be underwater before damage starts. So say you want it so that you can be underwater for 60 seconds and then every 10 seconds you get 1 point of damage.
 

User avatar
kddekadenz
Member
 
Posts: 323
Joined: Mon Jun 27, 2011 17:21
GitHub: tinyworlds

by kddekadenz » Sun Mar 25, 2012 17:19

Works!
But I would use a smaller value for the drowning_seconds.

EDIT: You replied faster then me.. Your way would be better, but I would suggest after 30 s and then every 3 seconds.
Last edited by kddekadenz on Sun Mar 25, 2012 17:21, edited 1 time in total.
 

Utilisatrice
Member
 
Posts: 103
Joined: Thu Feb 16, 2012 18:04

by Utilisatrice » Sun Mar 25, 2012 17:36

kddekadenz wrote:Works!
But I would use a smaller value for the drowning_seconds.

EDIT: You replied faster then me.. Your way would be better, but I would suggest after 30 s and then every 3 seconds.


+1 Good Idea.
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Sun Mar 25, 2012 17:39

randomproof wrote:Ok, good. I have to go out shopping with the wife right now, but later I'm going to make a small change so you can set how long you can be underwater before damage starts. So say you want it so that you can be underwater for 60 seconds and then every 10 seconds you get 1 point of damage.


Work on the box. But like falling nodes, I think it's better add the chance to add more drowning nodes:

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
--EDIT: Removed code. Suggestion was added.


Also, add a checker for "Enable damage"
Last edited by lord_james on Sun Mar 25, 2012 22:35, edited 1 time in total.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Sun Mar 25, 2012 17:41

you should make it if sand falls on top of you, you begin to drown
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

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

by sfan5 » Sun Mar 25, 2012 17:56

+1 for this Mod!
I've been waiting for this!
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

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

by sfan5 » Sun Mar 25, 2012 18:07

Topic moved without Request
Hope thats ok ;)
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

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

by randomproof » Sun Mar 25, 2012 18:40

sdzen wrote:you should make it if sand falls on top of you, you begin to drown

Could just check if node is not air? Would have to see if free_move is on though.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Sun Mar 25, 2012 18:52

yes that may work but it should kill you must faster than water
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Sun Mar 25, 2012 19:21

sdzen wrote:yes that may work but it should kill you must faster than water


:S Work on the box. Add in my suggestion this:
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
default.register_drowning_node("default:sand")


But I think be inside a solid node is a bug.
 

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

by jordan4ibanez » Sun Mar 25, 2012 19:54

lord_james wrote:
sdzen wrote:yes that may work but it should kill you must faster than water


:S Work on the box. Add in my suggestion this:
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
default.register_drowning_node("default:sand")


But I think be inside a solid node is a bug.

no..sand and gravel can fall on you
If you can think it, you can make it.
 

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

by randomproof » Sun Mar 25, 2012 21:50

Code is updated. If you want sand and gravel to drown your players add this to the end of the file:
drowning.register_drowning_node("default:sand")
drowning.register_drowning_node("default:gravel")

Any other mod can depend on this one and add there own as well.
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Sun Mar 25, 2012 22:51

Great job! Now, it's only necessary that API allows a custom HUD (for example, bubbles).

jordan4ibanez wrote:no..sand and gravel can fall on you


Well... I still think a falling solid node must kill you rather drowning haha. But this feature is for another topic:

http://c55.me/minetest/forum/viewtopic.php?id=1303
Last edited by lord_james on Sun Mar 25, 2012 22:52, edited 1 time in total.
 

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

by jordan4ibanez » Mon Mar 26, 2012 01:27

lord_james wrote:Great job! Now, it's only necessary that API allows a custom HUD (for example, bubbles).

jordan4ibanez wrote:no..sand and gravel can fall on you


Well... I still think a falling solid node must kill you rather drowning haha. But this feature is for another topic:

http://c55.me/minetest/forum/viewtopic.php?id=1303

drown as in suffocate
If you can think it, you can make it.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Mon Mar 26, 2012 20:27

okay then a suffocation mod!
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Tue Mar 27, 2012 11:33

Could be easy: all nodes deal 2 HP damage per second (= 1 heart). However, you would "suffocate" if only your feet were inside solid blocks and would not suffocate if only your head was (like lava).
 

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

by jordan4ibanez » Tue Mar 27, 2012 11:56

Calinou wrote:Could be easy: all nodes deal 2 HP damage per second (= 1 heart). However, you would "suffocate" if only your feet were inside solid blocks and would not suffocate if only your head was (like lava).

then use "if above" or whatever it is to get the node above it
If you can think it, you can make it.
 

Scott
Member
 
Posts: 100
Joined: Sun Nov 13, 2011 06:35

by Scott » Tue Mar 27, 2012 19:16

not working for me, im on latest unstable
ubuntu would be #1, without unity
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Tue Mar 27, 2012 19:46

but what if your flying!
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

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

by randomproof » Tue Mar 27, 2012 20:36

sdzen wrote:but what if your flying!

I can't test to see if you have free_move on so you can drown if flying.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Tue Mar 27, 2012 20:42

so suffocation or no freemove i think ill just move fast enough where it cant hurt me :P
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

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

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

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
Keep calm and code python^_^
 

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

by randomproof » Tue Mar 27, 2012 21:53

I think it might be because I forgot the depends.txt file. I've updated the download, but you could add the depends.txt file with "default" in it.
 

Scott
Member
 
Posts: 100
Joined: Sun Nov 13, 2011 06:35

by Scott » Tue Mar 27, 2012 22:06

why does it depend on growing?
ubuntu would be #1, without unity
 

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

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

randomproof wrote:I think it might be because I forgot the depends.txt file. I've updated the download, but you could add the depends.txt file with "default" in it.

thanks^_^ it still crashs when swim in oil tho
Last edited by Death Dealer on Tue Mar 27, 2012 22:26, edited 1 time in total.
Keep calm and code python^_^
 

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

by randomproof » Tue Mar 27, 2012 23:18

Scott wrote:why does it depend on growing?

It doesn't. It depends on "default" (actually I don't think it does)

Death Dealer wrote:
randomproof wrote:I think it might be because I forgot the depends.txt file. I've updated the download, but you could add the depends.txt file with "default" in it.

thanks^_^ it still crashs when swim in oil tho

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.
Edit: It looks like you are using a version from March 20th. Sound was added on the 24th.
Last edited by randomproof on Tue Mar 27, 2012 23:23, edited 1 time in total.
 

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

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

randomproof wrote:
Scott wrote:why does it depend on growing?

It doesn't. It depends on "default" (actually I don't think it does)

Death Dealer wrote:
randomproof wrote:I think it might be because I forgot the depends.txt file. I've updated the download, but you could add the depends.txt file with "default" in it.

thanks^_^ it still crashs when swim in oil tho

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.
Keep calm and code python^_^
 

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

by randomproof » Tue Mar 27, 2012 23:30

Death Dealer wrote:
randomproof wrote:
Scott wrote:why does it depend on growing?

It doesn't. It depends on "default" (actually I don't think it does)

Death Dealer wrote:thanks^_^ it still crashs when swim in oil tho

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.
 

Next

Return to Old Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron