SimulationChamber
Adds utilities for firing guns that are not bound to a player.
模組介紹 作者原文
Simulation Chamber
A mod to make it easy to fire a gun anywhere you need it on the map.
Change log
v 0.0.2
- Mod ID changed to correct format.
- Small Fixes, example made better.
v 0.0.2
- Fixed issues with multiplayer.
v0.0.0
- Initial Release
Simulated Gun
SimulatedAttack()
bool SimulatedAttack(int playerID, Vector3 spawnPos, Vector3 shootAngle, float charge, float damageM, Transform followTransform = null, bool useTransformForward = false)
Description
Fires the SimulatedGun.
Parameters
- int playerID the playerID of the player that is attacking.
- Vector3 spawnPos the spawnPosition of the attack.
- Vector3 shootAngle the angle of the attack.
- float charge the charge of the attack. Only matters if Gun::useCharge is true and GunChargePatch is installed.
- float damageM the damage multiplier of the attack.
- Transform followTransform an optional transform to use for the attacks. Useful if the gun has bursts and you want it to move with an object while firing.
- bool useTransformForward requires followTransform to be set. Optional parameter to use the followTransform's forward vector for the firing angle.
Example Usage
xGun.SimulatedAttack(this.player.playerID, new Vector3(obj.transform.position.x -1f, obj.transform.position.y, 0), new Vector3(player.data.input.aimDirection.x -1f, player.data.input.aimDirection.y, 0), 1f, 1);
CopyGunStatsExceptActions()
void CopyGunStatsExceptActions(Gun copyFromGun)
Description
Copies the stats from a gun onto the simulated gun with the exception of actions.
Parameters
- Gun copyFromGun
Example Usage
yGun.CopyGunStatsExceptActions(this.gun);
CopyShootProjectileAction()
void CopyShootProjectileAction(Gun copyFromGun)
Description
Copies the shootPojectileAction from a gun onto the simulated gun as a distinct stack of its delegates.
Parameters
- Gun copyFromGun
Example Usage
yGun.CopyShootProjectileAction(this.gun);
CopyAttackAction()
void CopyAttackAction(Gun copyFromGun)
Description
Copies the attack action from a gun onto the simulated gun as a distinct stack of its delegates.
Parameters
- Gun copyFromGun
Example Usage
xGun.CopyAttackAction(this.gun);
Example Mono
A mono included in the library for the purposes of doing this.
///
/// A mono for the purposes of explaining how the mod works.
///
public class MirrorSimulation: MonoBehaviour
{
Player player;
Gun gun;
// A list of guns created for this mono saved here.
// Ideally you'll make a pool of guns for your mod to use.
public SimulatedGun savedGuns = new SimulatedGun[2];
public static GameObject _stopRecursionObj = null;
public static GameObject StopRecursionObj
{
get
{
if (_stopRecursionObj == null)
{
_stopRecursionObj = new GameObject("A_StopRecursion", typeof(StopRecursion));
DontDestroyOnLoad(_stopRecursionObj);
}
return _stopRecursionObj;
}
}
public static ObjectsToSpawn StopRecursionSpawn
{
get
{
return new ObjectsToSpawn { new ObjectsToSpawn() { AddToProjectile = StopRecursionObj } };
}
}
public void Start()
{
// Get Player
this.player = this.GetComponentInParent();
// Get Gun
this.gun = this.player.data.weaponHandler.gun;
// Hook up our action.
this.gun.ShootPojectileAction += this.OnShootProjectileAction;
// Checks to see if we have a saved gun already, if not, we make one.
if (savedGuns[0] == null)
{
// We spawn a new object since this allows us manipulate the gun object's position without messing with the player's gameobjest.
savedGuns[0] = new GameObject("X-Gun").AddComponent();
}
// Checks to see if we have a second saved gun already, if not, we make one.
if (savedGuns[1] == null)
{
savedGuns[1] = new GameObject("Y-Gun").AddComponent();
}
}
public void OnShootProjectileAction(GameObject obj)
{
// If the bullet has the StopRecursion component in it somewhere, we don't want to trigger.
if (obj.GetComponentsInChildren().Length > 0)
{
return;
}
/***********************************************************************
- Here's where we s
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: