PortalGun
A portal gun that actually works. Shoot a blue and an orange portal, walk through keeping your momentum, and haul loot between them. One per run, works in co-op. Still in testing.
模組介紹 作者原文
Portal Gun
Adds the Aperture Science Handheld Portal Device to the list of shop items. Press E to toggle portal gun mode while holding the item, and then it controls like the portal gun controls in its games. Semibots, enemies, loot, and everything else should pass through fine.
Still in testing. Portals touch a lot of game systems, so expect some jank. Everyone in the lobby needs the mod installed. Portal placement is synced, and there is one gun per run.
What it does
- Shop item: appears in the shop rotation priced $15,000 to $20,000, one in the shop at a time, one gun per run.
- Controls: hold the gun and press E to enter portal mode. The gun is force-held in portal mode, so left-click fires instead of dropping it. LMB fires the blue portal, RMB the orange, MMB clears the pair.
- Portals: door-sized at 1.3m by 2.2m, fired at the flat surface under your crosshair up to 60m away. Re-firing a portal moves it. Once both exist they link, with a live view through the opening, and things pass through.
- What goes through: you, other players, held and thrown loot, and enemies. Momentum carries. Enemies also hear and see through a linked pair, so a lure played near one portal draws them to the other side.
- Performance: portals show a live view of the other side, which costs frames to render. The PortalQuality setting lowers the resolution of that view to save performance. Its default, Auto, does that on its own when your framerate drops.
Configuration
- PortalQuality, default Auto: Auto drops the resolution under load, High renders it at full resolution, Balanced at half, Performance at a third.
- DevKeys, default false: developer test keys, off for normal play.
- PortalGunShopChance, default 0.6: the chance, from 0 to 1, that the Portal Gun is forced into a shop when the normal roll didn't already pick it.
- PortalGunGuaranteeEveryNShops, default 3: if the Portal Gun has been missing from this many shops in a row, the next shop is guaranteed to stock it. Set to 0 to turn the guarantee off.
For developers - detailed breakdown
Requires REPOLib for item registration and the networking below. The rendering math, relative-transform camera mirroring with an oblique near-clip projection, is ported from Sebastian Lague's MIT-licensed Portals project, and the portal screen shader is his Custom/Portal shader shipped as-is in the asset bundle.
Teleport core. Crossing detection is an analytic FixedUpdate check with no Unity trigger callbacks or collision-matrix involvement. The trigger volume extrudes 0.4m out from the portal face, 1.4m for items whose centers sit farther from walls. A body-center plane check alone can never fire on a wall-mounted portal, because the wall's own collider stops the player capsule about 0.3 to 0.4m short of a quad 0.05m off the surface. Exit placement is inset 0.8m from the destination wall, outside that portal's own trigger volume so arriving cannot re-trigger, with a minimum exit speed of 1 m/s and a 1s per-object cooldown against ping-pong. Velocity carries through the portal-pair rotation delta, and camera rotation applies through CameraAim.SetPlayerAim, since raw Transform writes lose to CameraAim's per-frame recompute. One measured value matters when forking this: REPO's player rigidbody falls at about 2.5x Physics.gravity, so vertical-launch math has to use the measured figure.
Rendering. The portal camera's far plane is computed per render, the player-to-portal distance plus the main camera's fog-tight view distance of about 23m, clamped to 30 to 150. PortalQuality maps to a render-texture downscale of 1 for High, 2 for Balanced, 3 for Performance, and Auto also skips portal-camera renders under sustained frame-time load.
Enemy awareness. Sound events near one portal are remapped through EnemyDirector.SetInvestigate to the paired opening, and throttled master-only EnemyVision.VisionTrigger relays let an enemy that sees one portal react to a player at the other. Enemies cannot path through. They
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: