Zh/Weapon portalgun: Difference between revisions
(Created page with "{{LanguageBar|Weapon portalgun}} {{this is a|模型实体|name=weapon_portalgun|series=Portal}} {{CD|CWeaponPortalgun|base=CBasePortalCombatWeapon|file1=weapon_portalgun.cpp}} 这是贯穿整个系列的核心道具——光圈科学手持传送门装置。在被拾取前即可发射传送门,常被放置在{{L|Creating a rotating portalgun|基座}}上。可抓取重量不超过85kg的物理对象。 与其他武器实体相同,传送枪被拾取后仍会存在,...") |
m (→{{portal2}} 初始携带传送枪: <<tt></tt>>) |
||
Line 18: | Line 18: | ||
<!-- 编辑注意:本页面中的"supress"并非拼写错误,这是游戏实际检测的实体名称 --> | <!-- 编辑注意:本页面中的"supress"并非拼写错误,这是游戏实际检测的实体名称 --> | ||
Valve的单人过渡脚本(< | Valve的单人过渡脚本(<<tt>transitions/sp_transition_list.nut</tt>>)会在非默认地图中始终给予玩家双枪。该脚本包含在<<tt>arrival_departure_transition_ents</tt>>实例中,但若地图名以<<tt>sp_</tt>>开头也会自动添加。若要在独立地图中禁用此功能,最简单的方法是在电梯井放置{{L|trigger_weapon_strip}}在给予新枪前移除初始武器。制作模组时应修改过渡脚本来指定每张地图的传送枪配置。 | ||
技术细节:当地图名以< | 技术细节:当地图名以<<tt>sp_</tt>>开头时,游戏会寻找名为<<tt>@transition_script</tt>>的{{L|logic_script}}。若不存在则自动创建<<tt>failsafe_transition_script</tt>>并运行过渡脚本。通过放置同名但留空脚本的实体可完全禁用该功能。 | ||
=== 合作模式 === | === 合作模式 === | ||
合作模式中玩家默认携带传送枪(通过代码而非脚本实现)。要禁用此功能,地图中需存在名为< | 合作模式中玩家默认携带传送枪(通过代码而非脚本实现)。要禁用此功能,地图中需存在名为<<tt>supress_blue_portalgun_spawn</tt>>(禁用Atlas)和/或<<tt>supress_orange_portalgun_spawn</tt>>(禁用P-Body)的实体。这些设置每次重生都会检测,可通过{{L|point_template}}动态控制。 | ||
{{note|虽然{{L|info_coop_spawn}}和{{L|env_global}}有相关键值,但实际无效,必须使用上述方法。}} | {{note|虽然{{L|info_coop_spawn}}和{{L|env_global}}有相关键值,但实际无效,必须使用上述方法。}} |
Latest revision as of 15:26, 6 October 2025
weapon_portalgun
是一个模型实体,可在 传送门(系列)中使用。
![]() |
---|
CWeaponPortalgun |
![]() |
这是贯穿整个系列的核心道具——光圈科学手持传送门装置。在被拾取前即可发射传送门,常被放置在基座 上。可抓取重量不超过85kg的物理对象。
与其他武器实体相同,传送枪被拾取后仍会存在,但会清除targetname 。通过VScript 、point_entity_finder 或直接向weapon_portalgun
类名发送输出,可让玩家手持的传送枪自动发射传送门,或使用AddOutput 改变可发射的传送门类型。
在中可通过give_portalgun命令获取,使用upgrade_portalgun命令升级。




初始携带传送枪
在 传送门2中,玩家可能在不同情况下自动获得传送枪,单人与合作模式机制不同。
单人模式
Valve的单人过渡脚本(<transitions/sp_transition_list.nut>)会在非默认地图中始终给予玩家双枪。该脚本包含在<arrival_departure_transition_ents>实例中,但若地图名以<sp_>开头也会自动添加。若要在独立地图中禁用此功能,最简单的方法是在电梯井放置trigger_weapon_strip 在给予新枪前移除初始武器。制作模组时应修改过渡脚本来指定每张地图的传送枪配置。
技术细节:当地图名以<sp_>开头时,游戏会寻找名为<@transition_script>的logic_script 。若不存在则自动创建<failsafe_transition_script>并运行过渡脚本。通过放置同名但留空脚本的实体可完全禁用该功能。
合作模式
合作模式中玩家默认携带传送枪(通过代码而非脚本实现)。要禁用此功能,地图中需存在名为<supress_blue_portalgun_spawn>(禁用Atlas)和/或<supress_orange_portalgun_spawn>(禁用P-Body)的实体。这些设置每次重生都会检测,可通过point_template 动态控制。

键值
- Can Fire Portal 1 (CanFirePortal1) <布尔值 >
- 是否可发射蓝色传送门
- Can Fire Portal 2 (CanFirePortal2) <布尔值 >
- 是否可发射橙色传送门

AddPotatosToPortalgun
输入或upgrade_potatogun
命令实现。 [todo tested in ?]- Starting Team ([todo internal name (i)]) <choices> (存在于自
以来)
- 初始所属队伍(决定拾取前的发射颜色)
- 0 : 单人模式
- 1 : 使用0号传送门链路ID(不存在于FGD!)
- 2 : 橙色队伍
- 3 : 蓝色队伍
- Name (目标名称) <target_source>[ Edit ]
- 这个名称是其他实体通过 输入/输出 或其他 关键值 (如
parentname
或target
) 来引用该实体时使用的标识符。
该名称也会显示在 Hammer 编辑器的 2D 视图和 实体报告 中。参见: 所有实体均可使用的 通用键值、输入与输出
- Pitch Yaw Roll (Y Z X) (angles) <QAngle >
- 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.
BaseFadeProp:
- Start Fade Dist (fademindist) <浮点型 >
- Distance at which the entity starts to fade.
- End Fade Dist (fademaxdist) <浮点型 >
- Max fade distance at which the entity is visible.
- If start fade is <0, the entity will disappear instantly when end fade is hit.
- If end fade is <0, the entity won't disappear at all. (This is the default behavior.)
- The values will scale appropriately if the entity is in a 3D Skybox.
- Fade Scale (fadescale) <浮点型 >
- If you specify so in worldspawn, or if the engine is running below DirectX 8 (DX7 in
), props will fade out even if the fade distances above aren't specified. This value gives you some control over when this happens: numbers smaller than 1 cause the prop to fade out at further distances, while those greater than 1 cause it to fade out at closer distances. Using 0 turns off the forced fade altogether. See also the QC command $noforcedfade.
标志
- Start Constrained : [1]
- 固定
注意:禁止模型移动
错误:解除父级关联会导致位置异常 [todo tested in ?]
错误:多个实体共存时,接近会播放拾取音效但实际无法拾取 [todo tested in ?]
- Deny player pickup (reserve for NPC) : [2]
- 禁止玩家拾取(保留给NPC)
- Not puntable by Gravity Gun : [4]
- 不被重力枪影响
输入
- ChargePortal1
- 蓝色传送门充能效果
- ChargePortal2
- 橙色传送门充能效果
- FirePortal1
- 朝枪口方向发射蓝色传送门
- FirePortal2
- 朝枪口方向发射橙色传送门
- HideWeapon 不存在于FGD!
- If this weapon is being held, hide the worldmodel and/or viewmodel via EF_NODRAW. Weapon will still be useable. The weapon will become visible again if the holder is to switch between weapons in their inventory.
输出
- OnFiredPortal1
- 发射蓝色传送门时触发
- OnFiredPortal2
- 发射橙色传送门时触发
Weapon:
- OnNPCPickup
- !activator = NPC
!caller = this entity
Fires when an NPC picks up this weapon.
- OnPlayerUse
- !activator = player
!caller = this entity
Fires when the player +uses this weapon.
- OnPlayerPickup
- !activator = player
!caller = this entity
Fires when a player picks up this weapon.
- OnCacheInteraction
- Fires when the player 'proves' they've found this weapon. Fires on: Player Touch, +USE pickup, Physcannon pickup, Physcannon punt.