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

Func areaportal: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎See also: CAreaPortal)
m (Add Portal Version keyvalue)
 
(36 intermediate revisions by 19 users not shown)
Line 1: Line 1:
{{wrongtitle|title=func_areaportal}}
{{LanguageBar}}
{{base_brush}}
{{distinguish|linked_portal_door|desc1={{p2}} An unrelated entity, sometimes referred to as a "world portal"}}


== Entity description ==
Creates an [[areaportal]], used to manage visibility in maps. Portals define areas, or spaces that are connected in the map. Both sides of a portal cannot touch the same area, for example, a doughnut-shaped map would require at least two portals to divide the map into two areas. A linear map could be divided into two areas with a single areaportal.


{{optim_brush}}
{{CD|CAreaPortal|file1=func_areaportal.cpp}}
{{This is a|semi-internal=1|brush entity|name=func_areaportal|sprite=Toolsareaportal.gif}} It creates an [[areaportal]], used to manage visibility in maps. When the portal is open it stops objects not visible through it from rendering; when the portal is closed it cannot be seen through at all.


* Behavior with linked doors can be tricky. If the areaportal is doing the opposite of what it should, closing when the door is open and vice versa, change the areaportal's initial state.
These are not really brush entities. They are brush entities from a mapper/Hammer perspective, but by the time they reach the game, the brush is gone and this is, in effect, a point entity.
* Areaportals do not take into account geometry between the portal volume and the player when considering visibility.


To learn how areaportals work, see [[areaportal]]. For a tutorial on the subject, see [[areaportal tutorial]].
While it is {{Tooltip|line=dashed|It will work the same if textured with a world texture, Nodraw, or trigger textures|not necessary for the entity to function}}, the texture [[Tool_textures_(Source)#Optimization|tools/toolsareaportal]] (seen on the left) is intended to be used on areaportals.
 
== See also ==
* [[Areaportal]]
* [[Areaportal tutorial]]
* <code>[[CAreaPortal]]</code>
* [[func_areaportalwindow]]


== Keyvalues ==
== Keyvalues ==
* {{kv targetname}}
{{KV Targetname}}
 
{{KV|Name of Linked Door|intn=target|targetname|A entity (usually {{ent|prop_door_rotating}} or {{ent|func_door}}) whose open/closed state controls the on/off state of the portal. This is optional.}}
* '''target'''
{{KV|Initial State|intn=StartOpen|bool|Initial state of the portal.}}
: <target_destination> (Optional) The name of a door whose open/closed state controls the on/off state of this areaportal.
{{KV|Portal Version|intn=PortalVersion|integer|since={{Source 2006}}|Read-only version number that differentiates between shipping HL2 maps and maps using new engine features.}}
 
:* 0 : Backwards-compatible with Source 2004 (also called "shipping Half-Life 2 era")
* '''StartOpen'''
:* 1 : New and default version
: {{boolean}} Choose the initial state of this entity.


== Inputs ==
== Inputs ==
* {{i targetname}}
{{I|Open|Sets the portal to the open state.}}
{{I|Close|Sets the portal to the closed state.}}
{{I|Toggle|Opens the portal if closed. Closes the portal if open.}}


* '''Open'''
== See also ==
: Open the portal. When the portal is open is can be seen through.
* {{ent|func_areaportalwindow}}
 
* [[areaportal]]
* '''Close'''
* [[Optimization/Level_Design|Optimization (Level Design)]]
: Close the portal. When the portal is closed it cannot be seen through.
 
* '''Toggle'''
: Toggle the open/closed state of the portal.


== Outputs ==
[[Category:Optimization Brush Entities]]
* {{o targetname}}

Latest revision as of 11:35, 18 August 2025

English (en)Hrvatski (hr)Русский (ru)中文 (zh)Translate (Translate)
Not to be confused with linked_portal_door (Portal 2 An unrelated entity, sometimes referred to as a "world portal").


C++ Class hierarchy
CAreaPortal
CFuncAreaPortalBase
CBaseEntity
C++ func_areaportal.cpp
Toolsareaportal.gif

func_areaportal is a semi-internal brush entity available in all Source Source games. It creates an areaportal, used to manage visibility in maps. When the portal is open it stops objects not visible through it from rendering; when the portal is closed it cannot be seen through at all.

These are not really brush entities. They are brush entities from a mapper/Hammer perspective, but by the time they reach the game, the brush is gone and this is, in effect, a point entity.

While it is not necessary for the entity to function, the texture tools/toolsareaportal (seen on the left) is intended to be used on areaportals.

Keyvalues

Name (targetname) <string>[ Edit ]
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

Name of Linked Door (target) <targetname>
A entity (usually prop_door_rotating or func_door) whose open/closed state controls the on/off state of the portal. This is optional.
Initial State (StartOpen) <boolean>
Initial state of the portal.
Portal Version (PortalVersion) <integer> (in all games since Source 2006)
Read-only version number that differentiates between shipping HL2 maps and maps using new engine features.
  • 0 : Backwards-compatible with Source 2004 (also called "shipping Half-Life 2 era")
  • 1 : New and default version

Inputs

Open
Sets the portal to the open state.
Close
Sets the portal to the closed state.
Toggle
Opens the portal if closed. Closes the portal if open.

See also