MovingBlocks/Terasology — pull request #1109 by Josephtsessions (2014-05-22 06:09:53+00:00)
Title: NOT READY - #651 - Extracts drowning into a module

These are commits that remove the drowning logic from the engine. They're paired with the module here: https://github.com/Terasology/Breathing

Before it'll be ready to merge, there are a few problems.

Firstly, I discussed #1076 with Cervator and we came to the conclusion that breath regeneration should be logarithmic, with a quick burst of recovery when low on air. This should eliminate the usability problem when swimming. I'm having trouble finding a formula that works well and as expected in the SuffocatingComponent in the Breathing module.

Secondly, I modeled the registration of new UI elements after the Hunger and Thirst modules, which use UILoadBars. I tried doing the same thing with the old drowning system's UIIconBar, but the UI elements will not draw to the screen. The logic for these is contained in Breathing/src/main/java/org/terasology/ breathing/ui/BreathingWindow.java and Breathing/src/main/java/org/terasology/breathing/BreathingClientSystem.java

Lastly, because of the way that location calculation works, onEnterBlock events are being triggered when the player presses up against a surface. This means that when a player stands next to a wall, they can begin suffocating. We need an elegant solution to this problem - Cervator and I discussed using int positions calculated from the user's float position.

Thoughts? Once I get some feedback on these issues, I'll fix them up, refactor and clean up a bit, write a few tests and let it go. Thanks!