SharedLiabilityDamage
Host-only solidarity damage: whenever someone dies, deal N% of each survivor's max health to every survivor, without re-triggering on solidarity-caused deaths (0 disables).誰かが死ぬたびに生存者全員へ最大体力N%ダメージ付与 連帯責任ダメージ死では再発動しない(0で無効 ホストのみ)
By REPO_JP
| Last updated | 12 hours ago |
| Total downloads | 48 |
| Total rating | 1 |
| Categories | Mods Server-side |
| Dependency string | REPO_JP-SharedLiabilityDamage-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2304README
SharedLiabilityDamage
- Host-only solidarity damage: whenever someone dies, deal N% of each survivor's max health to every survivor (no re-trigger on solidarity-caused deaths)
Overview
-
What this mod does
- Hooks
PlayerAvatar.PlayerDeathRPC - When any player dies, the host deals damage to every survivor based on that survivor’s own max health
- Prevents chain-trigger when a death was caused by the mod’s solidarity damage
- Hooks
-
Who it is for
- Hosts who want a simple “shared liability” rule where deaths punish all survivors
-
What changes after installation
- On each death event, survivors take
N%of their own max health as damage - Deaths caused by this mod do not trigger the effect again
- On each death event, survivors take
Features
-
Host-only execution
- Runs only in multiplayer (
GameManager.Multiplayer()) - Runs only on the Master Client (
PhotonNetwork.IsMasterClient) - Non-host clients do not run the logic
- Runs only in multiplayer (
-
Per-survivor damage
- Enumerates
PlayerAvatarviaObject.FindObjectsOfType<PlayerAvatar>() - For each survivor, reads
PlayerHealth.maxHealthand calculates damage per survivor - Damage formula:
RoundToInt(maxHealth * (N / 100))clamped to1..maxHealth
- Enumerates
-
1-frame delay for safety
- Uses a coroutine and
yield return nullto run after RPC processing
- Uses a coroutine and
-
Damage application
- Applies damage via
PlayerHealth.HurtOther(damage, Vector3.zero, false, enemyIndex: -1) - Uses
enemyIndex = -1to tag “solidarity-caused” damage events
- Applies damage via
-
No re-trigger on solidarity-caused deaths (anti loop)
- If
PlayerDeathRPCarrives withenemyIndex == -1and the dead player was recently marked, the effect is skipped - Marks are stored per player using
photonView.ViewID - Mark TTL is 2 seconds
- Expired marks are purged before applying damage
- If
Configuration
-
General.DamagePercent- Default:
10 - Range:
0..100 - Meaning: each death deals
N%of each survivor’s max health to that survivor 0disables the mod
- Default:
Usage
-
Minimal steps
- Install the mod on the host
- Start a multiplayer session as the Master Client (host)
- Set
General.DamagePercent - When any player dies, survivors take solidarity damage automatically
-
Notes
- Works only for the host (Master Client)
- This mod is designed for multiplayer (it exits when not multiplayer)
Contact
SharedLiabilityDamage
- 誰かが死ぬたびに 生存者全員へ 生存者ごとの最大体力N%ダメージ付与するホスト専用MOD(連帯責任ダメージ死では再発動しない)
概要
-
このMODが何をするか
PlayerAvatar.PlayerDeathRPCをフック- 誰かが死んだら ホストが生存者全員へ 生存者ごとの最大体力N%ダメージを付与
- 連帯責任ダメージが原因の死亡では 連帯責任を再発動しない
-
どんな人向けか
- 「1人の死亡が全体に影響する」ルールをシンプルに入れたいホスト向け
-
導入で何が変わるか
- 死亡イベントのたびに 生存者は各自の最大体力N%分のダメージを受ける
- 連帯責任ダメージ由来の死亡では連鎖発動しない
特徴
-
ホスト専用動作
GameManager.Multiplayer()が true のときのみ動作PhotonNetwork.IsMasterClient(ホスト)のときのみ動作- 非ホスト参加者では動作しない
-
生存者ごとのダメージ計算
Object.FindObjectsOfType<PlayerAvatar>()でプレイヤー列挙- 各生存者の
PlayerHealth.maxHealthを基準に 個別にダメージ算出 - 算出式:
RoundToInt(maxHealth * (N / 100))を1..maxHealthにクランプ
-
1フレーム遅延
- RPC内処理との干渉回避のため コルーチンで
yield return null
- RPC内処理との干渉回避のため コルーチンで
-
ダメージ付与方法
PlayerHealth.HurtOther(damage, Vector3.zero, false, enemyIndex: -1)で付与enemyIndex = -1を「連帯責任ダメージ」の目印として使用
-
連帯責任ダメージ死で再発動しない(ループ防止)
enemyIndex == -1の死亡 かつ 直前にマーク済みなら発動をスキップ- マークは
photonView.ViewID単位で保持 - マーク保持時間は2秒
- 期限切れマークは掃除してから処理
設定
-
General.DamagePercent- 既定値:
10 - 範囲:
0..100 - 意味: 死亡1回ごとに 生存者それぞれの最大体力N%をその生存者に付与
0は無効化
- 既定値:
使い方
-
最短手順
- ホストにMODを導入
- マスタークライアント(ホスト)としてマルチプレイを開始
General.DamagePercentを設定- 誰かが死ぬと 生存者全員へ自動で連帯責任ダメージが入る
-
注意点
- 動作するのはホストのみ
- 本実装はマルチプレイ専用(シングルプレイでは処理を行わない)