weapon_portalgun

From Valve Developer Community
< Zh
Jump to navigation Jump to search
English (en)中文 (zh)Translate (Translate)

weapon_portalgun是一个模型实体,可在传送门(系列) 传送门(系列)中使用。

类层级
CWeaponPortalgun
CBasePortalCombatWeapon
CWeaponPortalBase
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
weapon_portalgun.cpp

这是贯穿整个系列的核心道具——光圈科学手持传送门装置。在被拾取前即可发射传送门,常被放置在基座(en)上。可抓取重量不超过85kg的物理对象。

与其他武器实体相同,传送枪被拾取后仍会存在,但会清除targetname(en)。通过VScript(en)point_entity_finder(en)或直接向weapon_portalgun类名发送输出,可让玩家手持的传送枪自动发射传送门,或使用AddOutput(en)改变可发射的传送门类型。

传送门2中可通过give_portalgun命令获取,使用upgrade_portalgun命令升级。

Icon-Bug.png错误:若传送枪已发射过传送门,再通过trigger_weapon_strip(en)将其丢入trigger_portal_cleanser(en)会导致游戏崩溃。该问题已在Strata修复。  (tested in: 传送门2, 传送门 2:社区特供版)
正在发射的weapon_portalgun
Note.png注意:自主发射的weapon_portalgun不会以info_placement_helper(en)为目标(即使启用了强制放置)。

传送门2 初始携带传送枪

传送门2 传送门2中,玩家可能在不同情况下自动获得传送枪,单人与合作模式机制不同。

单人模式

Valve的单人过渡脚本(transitions/sp_transition_list.nut)会在非默认地图中始终给予玩家双枪。该脚本包含在arrival_departure_transition_ents实例中,但若地图名以sp_开头也会自动添加。若要在独立地图中禁用此功能,最简单的方法是在电梯井放置trigger_weapon_strip(en)在给予新枪前移除初始武器。制作模组时应修改过渡脚本来指定每张地图的传送枪配置。

技术细节:当地图名以sp_开头时,游戏会寻找名为@transition_scriptlogic_script(en)。若不存在则自动创建failsafe_transition_script并运行过渡脚本。通过放置同名但留空脚本的实体可完全禁用该功能。

合作模式

合作模式中玩家默认携带传送枪(通过代码而非脚本实现)。要禁用此功能,地图中需存在名为supress_blue_portalgun_spawn(禁用Atlas)和/或supress_orange_portalgun_spawn(禁用P-Body)的实体。这些设置每次重生都会检测,可通过point_template(en)动态控制。

Note.png注意:虽然info_coop_spawn(en)env_global(en)有相关键值,但实际无效,必须使用上述方法。

键值

Can Fire Portal 1 (CanFirePortal1) <布尔值(en)>
是否可发射蓝色传送门
Can Fire Portal 2 (CanFirePortal2) <布尔值(en)>
是否可发射橙色传送门
Show PotatOS ([todo internal name (i)]) <布尔值(en)> (存在于自 传送门2 以来)
是否显示土豆OS组件
Icon-Bug.png错误:实际无效,需通过logic_playerproxy(en)AddPotatosToPortalgun输入或upgrade_potatogun命令实现。  [todo tested in ?]
Starting Team ([todo internal name (i)]) <choices> (存在于自 传送门2 以来)
初始所属队伍(决定拾取前的发射颜色)
  • 0 : 单人模式
  • 1 : 使用0号传送门链路ID(不存在于FGD!
  • 2 : 橙色队伍
  • 3 : 蓝色队伍
参见:  Generic Keyvalues, Inputs and Outputs available to all entities
Name(en) (targetname) <target_source>
其他实体引用该实体的目标名称。
Pitch Yaw Roll (Y Z X) (angles) <QAngle(en)>
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) <浮点型(en)>
Distance at which the entity starts to fade.
End Fade Dist (fademaxdist) <浮点型(en)>
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) <浮点型(en)>
If you specify so in worldspawn, or if the engine is running below DirectX 8 (DX7 in 起源2006), 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]
固定
Note.png注意:禁止模型移动
Icon-Bug.png错误:解除父级关联会导致位置异常  [todo tested in ?]
Icon-Bug.png错误:多个实体共存时,接近会播放拾取音效但实际无法拾取  [todo tested in ?]
Deny player pickup (reserve for NPC) : [2]
禁止玩家拾取(保留给NPC)
Not puntable by Gravity Gun : [4]
不被重力枪影响
Disable pickup sound 传送门 2:社区特供版 : [8]
禁用拾取音效传送门 2:社区特供版

输入

ChargePortal1
蓝色传送门充能效果
ChargePortal2
橙色传送门充能效果
FirePortal1
朝枪口方向发射蓝色传送门
FirePortal2
朝枪口方向发射橙色传送门
FirePortalDirection1 <angle(en)>
按指定角度发射蓝色传送门
Icon-Bug.png错误:传送门2中使用会导致崩溃  [todo tested in ?]
FirePortalDirection2 <angle(en)>
按指定角度发射橙色传送门
Icon-Bug.png错误:传送门2中使用会导致崩溃  [todo tested in ?]
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.