Though the new AirTime counter is lovley, at the moment there is no way to check whether the player is actively underwater or not. A special type of sub-block that executes when underwater would be very handy.
I can see someone using this to emulate Duke 3D's scuba tank effect, among other things.
[SBARINFO] "underwater" sub-block
Moderator: GZDoom Developers
- The Slimeinator
- Posts: 44
- Joined: Fri Jun 26, 2009 1:23 pm
Re: [SBARINFO] "underwater" sub-block
I don't think this would be useful as far as SBARINFO goes, but instead as an "inventory" function. For example, an extension to A_JumpIf.
Such as, in a CustomInventory item:
A_JumpIf(playerwaterlevel > 2, "Use2")
And then the item would jump to a state and then carry out its function that changes or could only work while underwater.
Such as, in a CustomInventory item:
A_JumpIf(playerwaterlevel > 2, "Use2")
And then the item would jump to a state and then carry out its function that changes or could only work while underwater.
- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
Re: [SBARINFO] "underwater" sub-block
Code: Select all
A_JumpIf(waterlevel > 2, "Use2")
No, seriously, that will work.
In the pickup and use states and states that follow them, anyway. But I can't think of a use for a inventory item to check for a player's water level except in those conditions.
- The Slimeinator
- Posts: 44
- Joined: Fri Jun 26, 2009 1:23 pm
Re: [SBARINFO] "underwater" sub-block
What about for a flamethrower weapon that cannot be used underwater? 

- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
Re: [SBARINFO] "underwater" sub-block
Weapons are inventory items.
I probally should've explained better; checks with items that are in a player's inventory call the player's value, so as long as you're not doing something silly like putting it in the Spawn state, it'd jump if the player was underwater.
I probally should've explained better; checks with items that are in a player's inventory call the player's value, so as long as you're not doing something silly like putting it in the Spawn state, it'd jump if the player was underwater.
Re: [SBARINFO] "underwater" sub-block
I've used the method XutaWoo posted to do just that. You just can't check for this with SBARINFO and that's the reason this suggestion's here.The Slimeinator wrote:What about for a flamethrower weapon that cannot be used underwater?
Re: [SBARINFO] "underwater" sub-block
Hmm, I normally don't condone bumping of suggestion threads, but I'm bringing this to light again now that the SBARINFO rewrite is done-ish.
I tried to go ahead and implement an AirTime counter in Psychic's numbers-only minimal-HUD when I realized that because of the way things work, the AirTime counter would always be displayed, which looks pretty silly telling you there's still 20 seconds worth of air left even when you're above water.
Basically, without a way to check if the player's actually underwater or not, I can't see the AirTime counter getting much use, leaving the feature a bit crippled in its current state.
I tried to go ahead and implement an AirTime counter in Psychic's numbers-only minimal-HUD when I realized that because of the way things work, the AirTime counter would always be displayed, which looks pretty silly telling you there's still 20 seconds worth of air left even when you're above water.

Basically, without a way to check if the player's actually underwater or not, I can't see the AirTime counter getting much use, leaving the feature a bit crippled in its current state.
Re: [SBARINFO] "underwater" sub-block
Perhaps you can have a sub-block appear only when the airtime is less than the max?Xaser wrote:Hmm, I normally don't condone bumping of suggestion threads, but I'm bringing this to light again now that the SBARINFO rewrite is done-ish.
I tried to go ahead and implement an AirTime counter in Psychic's numbers-only minimal-HUD when I realized that because of the way things work, the AirTime counter would always be displayed, which looks pretty silly telling you there's still 20 seconds worth of air left even when you're above water.
Basically, without a way to check if the player's actually underwater or not, I can't see the AirTime counter getting much use, leaving the feature a bit crippled in its current state.
Judging on how the number differs per map I don't think this would be as reliable though, but it's a start.