feat(trol): Legacy True Form switch, chosen per player
The Troll Model option becomes Legacy True Form, off by default. On, True Form is the old one: the player's own Trol grown bigger, weapons in hand, body untouched, which player model mods such as VRM need. It is a local preference, not a synced one, so a server cannot force the troll costume on a VRM user. The owner publishes the choice on the ZDO and every other client reads it from there, so onlookers see each Trol the way that Trol's owner picked.
This commit is contained in:
parent
a9e66aeeb7
commit
b2346c1437
4 changed files with 20 additions and 5 deletions
|
|
@ -37,6 +37,10 @@ namespace RacesOfValheim
|
|||
// Published by the owner after every trigger it fires, with a running count so the same
|
||||
// punch twice in a row still reads as two - see FenrirAttackSync.
|
||||
public const string AttackTriggerKey = "RacesOfValheim_TrolTrueFormAttack";
|
||||
|
||||
// The owner's Legacy True Form choice, so every other client draws this Trol the way its
|
||||
// owner picked rather than the way the onlooker's own setting says.
|
||||
public const string LegacyKey = "RacesOfValheim_TrolTrueFormLegacy";
|
||||
private static int attackSeq;
|
||||
|
||||
private static readonly int TrueFormHash = "SE_TrolTrueForm".GetStableHashCode();
|
||||
|
|
@ -96,7 +100,14 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (player == null || player != Player.m_localPlayer) return;
|
||||
|
||||
bool wanted = TrolConfig.TrueFormUseTrollModel.Value &&
|
||||
bool legacy = TrolConfig.TrueFormLegacy.Value;
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid() && nview.GetZDO().GetBool(LegacyKey, false) != legacy)
|
||||
{
|
||||
nview.GetZDO().Set(LegacyKey, legacy);
|
||||
}
|
||||
|
||||
bool wanted = !legacy &&
|
||||
!player.IsDead() &&
|
||||
TrolRace.IsTrol() &&
|
||||
player.GetSEMan().HaveStatusEffect(TrueFormHash);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue