[Mod] Drowning [drowning]
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
[Mod] Drowning [drowning]
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 ... 231#p59231
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 ... 231#p59231
Last edited by VanessaE on Wed Dec 26, 2012 01:09, edited 1 time in total.
-
- Member
- Posts: 103
- Joined: Thu Feb 16, 2012 18:04
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
- kddekadenz
- Member
- Posts: 323
- Joined: Mon Jun 27, 2011 17:21
- GitHub: tinyworlds
- Location: Germany
- Contact:
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.
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.
-
- Member
- Posts: 103
- Joined: Thu Feb 16, 2012 18:04
-
- Member
- Posts: 51
- Joined: Sun Mar 11, 2012 22:06
Work on the box. But like falling nodes, I think it's better add the chance to add more drowning nodes: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.
Code: Select all
--EDIT: Removed code. Suggestion was added.
Last edited by lord_james on Sun Mar 25, 2012 22:35, edited 1 time in total.
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
-
- Member
- Posts: 51
- Joined: Sun Mar 11, 2012 22:06
:S Work on the box. Add in my suggestion this:sdzen wrote:yes that may work but it should kill you must faster than water
Code: Select all
default.register_drowning_node("default:sand")
- jordan4ibanez
- Member
- Posts: 1923
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
no..sand and gravel can fall on youlord_james wrote::S Work on the box. Add in my suggestion this:sdzen wrote:yes that may work but it should kill you must faster than waterBut I think be inside a solid node is a bug.Code: Select all
default.register_drowning_node("default:sand")
hello, am program. do language in rust. make computer do. okay i go now.
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
-
- Member
- Posts: 51
- Joined: Sun Mar 11, 2012 22:06
Great job! Now, it's only necessary that API allows a custom HUD (for example, bubbles).
http://c55.me/minetest/forum/viewtopic.php?id=1303
Well... I still think a falling solid node must kill you rather drowning haha. But this feature is for another topic:jordan4ibanez wrote:no..sand and gravel can fall on you
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.
- jordan4ibanez
- Member
- Posts: 1923
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
drown as in suffocatelord_james wrote:Great job! Now, it's only necessary that API allows a custom HUD (for example, bubbles).
Well... I still think a falling solid node must kill you rather drowning haha. But this feature is for another topic:jordan4ibanez wrote:no..sand and gravel can fall on you
http://c55.me/minetest/forum/viewtopic.php?id=1303
hello, am program. do language in rust. make computer do. okay i go now.
- jordan4ibanez
- Member
- Posts: 1923
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
then use "if above" or whatever it is to get the node above itCalinou 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).
hello, am program. do language in rust. make computer do. okay i go now.
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
- Death Dealer
- Member
- Posts: 1379
- Joined: Wed Feb 15, 2012 18:46
- Location: Limbo
- Contact:
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^_^
-
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
Who is online
Users browsing this forum: No registered users and 2 guests