weapon_portalgun

From Source Entities
Jump to navigation Jump to search
Portal gun shot.png

Code classes:

weapon_portalgun is a point entity present in both P1.pngP2.pngPortal games. It's a portal gun.

Note: In Portal 2, players will spawn already holding a portal gun on all maps with the sp_ prefix (including custom ones). This can be avoided in four ways:

  • Remove the prefix.
  • Use a logic_auto to kill failsafe_transition_script at the start of the map. (This entity is added automatically by the game.)
  • Use a trigger_weapon_strip.
  • If you're making a mod, copy common\Portal 2\portal2\scripts\vscripts\transitions\sp_transition_list.nut to scripts\vscripts\transitions inside your mod folder and modify it for your mod.

Note: A weapon_portalgun firing on its own will not target info_placement_helpers (even ones with Force Placement (force_placement) enabled).

Keyvalues[edit | edit source]

Can Fire Portal 1 (CanFirePortal1) <choices>
Lets this gun fire blue/purple/red portals.
Can Fire Portal 2 (CanFirePortal2) <choices>
Lets this gun fire orange/cyan/yellow portals.
Starting Team (StartingTeamNum) <choices> (only available in P2.png)
Sets the Portal pair ID (LinkageGroupID) of the prop_portals the gun fires. Any number can be used if entered manually.
  • 0: Single Player
  • 1: ATLAS (Not in FGD)
  • 2: P-Body
  • 3: Blue - Not used.
Show Potatos (ShowingPotatos) <boolean> (only available in P2.png)
Supposed to show potato glados on the portal gun, but doesn't work. Instead, use the AddPotatosToPortalgun input from logic_playerproxy or the command upgrade_potatogun.

Inputs[edit | edit source]

ChargePortal1
Does the charging effect for blue portals.
ChargePortal2
Does the charging effect for orange portals.
FirePortal1
Makes the gun fire portal 1 where it's pointed, even when held by a player.
FirePortal2
Makes the gun fire portal 2 where it's pointed, even when held by a player.
FirePortalDirection1 <angle>
Makes the gun fire portal 1 in the specified angle.
FirePortalDirection2 <angle>
Makes the gun fire portal 2 in the specified angle.

Outputs[edit | edit source]

OnFiredPortal1
Fires when portal 1 is shot. Fires even if not successfully placed.
OnFiredPortal2
Fires when portal 2 is shot. Fires even if not successfully placed.