prop_portal

From Valve Developer Community
(Redirected from Portals)
Jump to: navigation, search
Class hierarchy
CProp_Portal
CBaseAnimating
CBaseEntity
portal/prop_portal.cpp

prop_portal is a point entity available in Portal (series) Portal (series).

Entity description

The entity that represents a portal, exactly like one fired from a weapon_portalgun.

Note.pngNote:In order for a prop_portal to link up to the player's portal gun, the portal pair ID must be set to 0.
Warning.pngWarning:Removing one through methods such as Kill may crash the game. Instead, use Fizzle or SetActivatedState 0 to remove portals.
Note.pngNote:The distinction is that Fizzle plays a sound effect and removes the portal, while SetActivatedState 0 silently closes the portal but does not remove it. However, if another portal with the same pair ID and color becomes active, the inactive portal will be removed.
Tip.pngTip:This is useful for silently clearing out fixed portals before activating other fixed portals in the same map.
Warning.pngWarning:When a portal is active but not linked, activating another portal of the same pair ID and color will cause the portal that was activated first to switch its color. This can be avoided by deactivating the first portal before the second one is activated.
Icon-Bug.pngBug: When using portals in Garry's Mod Garry's Mod, weird bugs occur relating to collision when moving through portals, such as clipping into the floor.  [todo tested in?]

Placement Rules for Portal 2

Warning.pngWarning:In Portal 2, bad placement of a prop_portal will cause the location of the portal to revert to the map's origin. The rules are as follows:
  • Must not start active.
  • Must have its pitch, yaw and roll facing the exact same direction of the surface it's placed on. Use the yellow line in the 2D view and the blue line (Z-axis) in the 3D view as guides to help with this.
  • Must be 0-8 units from the surface the portal is to be placed on.
  • The center of the entity must be at least 57 units away from any adjacent surfaces on the top and bottom, and at least 32 units away from any adjacent surfaces on the sides.

Keyvalues

Start Activated (Activated) <boolean>
Is this portal activated at start?
Icon-Bug.pngBug:Portal 2 This will cause the portal to appear at the world origin. To work around this, use a logic_auto.  [todo tested in?]
Icon-Bug.pngBug:Portal This will cause the player to be unable to walk out of this portal from its linked partner, requiring them to jump to pass through.  [todo tested in?]
Portal Number (PortalTwo) <choices>
Is this portal a blue portal or orange portal?
  • 0 : Portal 1 (blue)
  • 1 : Portal 2 (orange)
Half-Width of the Portal. (HalfWidth) <float> (in all games since Portal 2)
Half of this portal's width. Defaults to 32 when left at 0.
Half-Height of the Portal. (HalfHeight) <float> (in all games since Portal 2)
Half of this portal's height. Defaults to 54 when left at 0.
Portal pair ID that it belongs to (LinkageGroupID) <integer>
Portal pair ID. Must be a value between 0 and 255.
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

Pitch Yaw Roll (Y Z X) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

Inputs

SetName
Set the targetname of this portal.
SetActivatedState <boolean>
Set this portal to be inactive or active.
Fizzle
Fizzle and remove.
NewLocation <string>
Sets this portal's location and angles. This expects 6 floats with space delimiters, the format is 'x y z pitch yaw roll'
Resize <string> (in all games since Portal 2)
Changes the size of the portals. Note that portals only function if they are the same size, and the coloured border remains the same size and proportions.
SetLinkageGroupID <integer> (in all games since Portal 2)


Outputs

OnPlacedSuccessfully
Fired when the portal spawns successfully.
OnEntityTeleportFromMe  (in all games since Portal 2)
Fired when any entity is teleported from this portal to the linked partner.
OnPlayerTeleportFromMe  (in all games since Portal 2)
Fired when the player is teleported from this portal to the linked partner.
OnEntityTeleportToMe  (in all games since Portal 2)
Fired when any entity is teleported from this linked partner to the portal.
OnPlayerTeleportToMe  (in all games since Portal 2)
Fired when the player is teleported from this linked partner to the portal.


External links

Example Map VMF