Weapon portalgun

This is the Aperture Science Handheld Portal Device, the main item used throughout the series. Before being picked up, it can fire portals and is often placed on a pedestal. It can be used to pick up physics objects that weigh up to 85kg.
As with all weapon entities, the portal gun will continue to exist after being picked up, but have its targetname cleared. Using VScript, point_entity_finder, or simply by pointing outputs at the weapon_portalgun classname, a portal gun being carried by a player can be made to fire portals automatically, or change which portals it can fire using AddOutput.
The portal gun can be obtained with the command , and upgraded with the command.
== Spawning with a portal gun ==
In Portal 2, players may automatically recieve a portal gun on spawn in certain cases, which vary between singleplayer and co-op.
=== Singleplayer ===
Valve's singleplayer transition VScript (transitions/sp_transition_list.nut) will always give the player a dual portal gun on spawn in non-default maps. This script is included in the arrival_departure_transition_ents instance, but it also gets automatically added to the map if the map name starts with sp_. If you don't want the player to spawn with a portal gun in a standalone map, the easiest way to work around this is to add a in the elevator shaft, which removes the player's gun before giving them a new one if desired. If you're making a mod, you should instead modify the singleplayer transition script to include your mod's maps instead of the default ones, which will allow you to specify which portal gun the player has in each map.
Internally, if the map name starts with sp_, the game checks for a logic_script called @transition_script on load. If one doesn't exist, it creates a new logic_script called failsafe_transition_script and sets it to run transitions/sp_transition_list.nut. Note that the Entity Scripts keyvalue is not checked on the original @transition_script entity, so this can be used to prevent the transition script from running at all - place the entity in Hammer and give it that name, but leave the entity scripts blank. It may be useful to create a modified version of the arrival_departure_transition_ents which uses this method to get rid of the script entirely, since standalone maps don't really need it.
=== Co-op ===
In cooperative mode, players will spawn with portal guns by default. This is done in code, not VScript like in singleplayer. To prevent players from spawning with portal guns, any entity named supress_blue_portalgun_spawn (for Atlas) and/or supress_orange_portalgun_spawn (for P-Body) must be present in the map. These work independently from each other, allowing a portal gun to be given to one player only, and are checked on every respawn, so they can be Killed to enable portal guns on respawn, or spawned from a to disable portal guns on respawn mid-map.
If you want players to pick up portal guns partway through the map, the easiest way to handle this is to give these names to the weapon_portalguns themselves. Picking up a portal gun automatically clears its name, allowing that player to spawn with a portal gun on every subsequent respawn.
==Keyvalues==
:* 0 : Single Player
:* 2 : Orange
:* 3 : Blue
==Flags==
:
:
==Inputs==
:
:
==Outputs==
Category:Weapons