This article's documentation is for anything that uses the Source engine. Click here for more information.

Func water (Source): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(not relevant enough to be at the start of description and too simplified)
(Undo revision 490178 by CHILLMODEA (talk) intentional)
Tag: Undo
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{tabs|func_water|goldsrc=1|source=1|source2=1}}
{{TabsBar}}
{{CD|CBaseDoor|file1=doors.cpp}}
{{CD|CBaseDoor|file1=doors.cpp}}
{{Ent not in fgd}}
{{Ent not in fgd}}
{{obsolete|entity=1|replacement=[[func_water_analog]]. Non-moving water brushes should be part of [[worldspawn]]}}
{{obsolete|entity=1|replacement=[[func_water_analog]]. Non-moving water brushes should be part of [[worldspawn]]}}
{{this is a|brush entity|name=func_water}} Legacy entity from the {{Gldsrc|4}} engine, deprecated by {{ent|func_water_analog}}.
{{This is a|semi-internal=1|brush entity|name=func_water}} An entity-based water brush, being assigned [[CONTENTS_WATER|water contents]] by [[VBSP]]. A legacy entity from the {{goldsrc|4}} engine, deprecated by {{ent|func_water_analog}}. It is still used in some {{hls|2}} maps.
 
{{toc-right}}
{{important|Does not work with materials using real time reflections and/or refractions, as seen in {{ent|water (shader)|alt=Water}} and {{ent|Refract}}.<br>Use a material which uses a regular brush shader, such as:
{{important|Does not work with the {{ent|water (shader)|alt=Water}} shader.<br>{{ent|Refract}} can be used as a workaround for dynamic refraction with cubemapped reflections, although Valve does not provide any materials which do this.<br>Existing materials which are compatible include:
* {{file|nature/water_movingplane|vmt}} ([[LightmappedGeneric]])
* {{file|nature/water_movingplane|vmt}} ([[LightmappedGeneric]])
* {{file|nature/water_dx70|vmt}} ([[LightmappedGeneric]])
* {{file|nature/water_dx70|vmt}} ([[LightmappedGeneric]])
* {{file|nature/hazard_liquid|vmt}} ([[LightmappedGeneric]]) {{only|{{portal}}}}
* {{file|nature/hazard_liquid|vmt}} ([[LightmappedGeneric]]) {{only|{{portal}}}}
* {{file|liquids/!greenslime|vmt}} ([[UnlitTwoTexture]]) {{only|{{hls}} {{hldms}} {{jbep3}} }}
* {{file|liquids/!greenslime|vmt}} ([[UnlitTwoTexture]]) {{only|{{hls}} {{hldms}} {{jbep3}} }}
}}
{{Confirm|Does the Water shader work if using cubemap reflections and refractions, instead of the real-time versions? This would still be beneficial for the ability to have two normal maps scrolling in different directions.}} }}
{{bug|This entity always has its contents set to [[BSP flags (Source)|CONTENTS_WATER]] (regardless of brush contents), with no way of setting its contents to [[BSP flags (Source)|CONTENTS_SLIME]]. In most games, this will only affect splash particles.
{{bug|Water must be part of the world in {{l4ds}} otherwise it doesn't work properly and acts as non-solid brush.|hidetested=1}}
{{code fix|Add a KV that is read by {{code|CBaseDoor::CreateVPhysics}} to set {{code|fluid.contents}} (defaulting to CONTENTS_WATER if KV is absent)}}
{{codenote|Both <code>func_water</code> and {{ent|func_door}} are linked to [[CBaseDoor]] C++ class. The game code checks the {{mono|classname}} KV to distinguish between them, applying specific behaviors if the classname is "func_water". As such, using [[AddOutput]] to change the classname of a func_water may have unexpected effects.}}
}}
{{note|Both <code>func_water</code> and {{ent|func_door}} are linked to CBaseDoor c++ class which makes them very similar}}


==Keyvalues==
== Keyvalues ==
{{KV Targetname}}
{{KV Targetname}}
{{KV|Move Direction (Pitch Yaw Roll)|intn=movedir|angle|The direction the water will move when it is told to 'Open'. Default value is "0 0 0".}}
{{OtherKIO|func_door|All}}
{{KV|Wave Height|intn=WaveHeight|string|Default value is 3.0. No effect on stock shaders, as GoldSrc-style waves were removed in Retail Half-Life 2 (only existing in the leaked "beta").|deprecated=1}}
{{KV Door}}
 
==Flags==
{{fl|1|"Starts Open"}}
{{fl|256|"Use Only"}}


==Inputs==
== FGD Code ==
{{I Door}}
While {{mono|func_water}} exists in {{codelink|base.fgd}}, it is commented out. It can either be uncommented, or this simpler FGD entry can be added anywhere after the {{ent|func_door}} entry.
<syntaxhighlight lang=cpp>
@SolidClass base(func_door) = func_water : "A water brush entity that moves linearly along a given distance, in a given direction." []
</syntaxhighlight>


==Outputs==
== See also ==
{{O Door}}
* {{ent|func_water_analog}}

Latest revision as of 05:04, 10 October 2025

English (en)Translate (Translate)
Edit Tabs
C++ Class hierarchy
CBaseDoor
CBaseToggle
CBaseEntity
C++ doors.cpp
Icon-NotInFGD.png
This entity is not in the FGD by default.
See below for instructions on making it available.
Obsolete-notext.png
This entity is obsolete. Its use is discouraged. It may only exist/function in older engine branches.
It has since been deprecated by: func_water_analog. Non-moving water brushes should be part of worldspawn.

func_water is a semi-internal brush entity available in all Source Source games. An entity-based water brush, being assigned water contents by VBSP. A legacy entity from the GoldSrc GoldSrc engine, deprecated by func_water_analog. It is still used in some Half-Life: Source Half-Life: Source maps.

Icon-Important.pngImportant:Does not work with the Water shader.
Refract can be used as a workaround for dynamic refraction with cubemapped reflections, although Valve does not provide any materials which do this.
Existing materials which are compatible include:
Confirm:Does the Water shader work if using cubemap reflections and refractions, instead of the real-time versions? This would still be beneficial for the ability to have two normal maps scrolling in different directions.
Icon-Bug.pngBug:Water must be part of the world in Left 4 Dead seriesLeft 4 Dead series otherwise it doesn't work properly and acts as non-solid brush.
Cpp.pngCode:Both func_water and func_door are linked to CBaseDoor C++ class. The game code checks the classname KV to distinguish between them, applying specific behaviors if the classname is "func_water". As such, using AddOutput to change the classname of a func_water may have unexpected effects.

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also: Generic Keyvalues, Inputs and Outputs available to all entities
Note.pngNote:All Keyvalues / Inputs / Outputs are same as func_door.

FGD Code

While func_water exists in base.fgd, it is commented out. It can either be uncommented, or this simpler FGD entry can be added anywhere after the func_door entry.

@SolidClass base(func_door) = func_water : "A water brush entity that moves linearly along a given distance, in a given direction." []

See also