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
|
|
@ -40,6 +40,9 @@ namespace RacesOfValheim
|
|||
private static readonly string[] LocalKeyParts =
|
||||
{
|
||||
"marker light", "tint", "colour", "color", "glow", "swarm scale", "log rounds", "debug",
|
||||
// Each player picks their own True Form: a player model mod (VRM and the like) breaks
|
||||
// under the troll costume, so a server cannot be allowed to force the costume on.
|
||||
"legacy true form",
|
||||
};
|
||||
|
||||
public static void Apply(ConfigFile config)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace RacesOfValheim
|
|||
public static ConfigEntry<float> TrueFormCooldown;
|
||||
public static ConfigEntry<float> TrueFormScaleNormal;
|
||||
public static ConfigEntry<float> TrueFormScaleAdvanced;
|
||||
public static ConfigEntry<bool> TrueFormUseTrollModel;
|
||||
public static ConfigEntry<bool> TrueFormLegacy;
|
||||
public static ConfigEntry<float> TrueFormModelSize;
|
||||
public static ConfigEntry<float> TrueFormTrollDamageShare;
|
||||
public static ConfigEntry<float> TrueFormAttackReach;
|
||||
|
|
@ -138,8 +138,8 @@ namespace RacesOfValheim
|
|||
new ConfigDescription("Model scale while in True Form, tier 5-6.", new AcceptableValueRange<float>(1f, 4f)));
|
||||
TrueFormScaleAdvanced = config.Bind(trueForm, "Scale (Tier 7+)", 2.5f,
|
||||
new ConfigDescription("Model scale while in True Form, tier 7+.", new AcceptableValueRange<float>(1f, 4f)));
|
||||
TrueFormUseTrollModel = config.Bind(trueForm, "Troll Model", true,
|
||||
new ConfigDescription("Wear Valheim's own troll in True Form, with its own punch and ground slam instead of your weapons. Off: the old True Form, a bigger Trol with weapons in hand."));
|
||||
TrueFormLegacy = config.Bind(trueForm, "Legacy True Form", false,
|
||||
new ConfigDescription("Off: True Form wears Valheim's own troll, with its punch and ground slam instead of your weapons. On: the old True Form, your own Trol grown bigger with weapons in hand. Turn it on if you use a player model mod such as VRM, which needs the player's body to stay visible. Your own choice: other players see you the way you picked."));
|
||||
TrueFormModelSize = config.Bind(trueForm, "Troll Model Size", 1f,
|
||||
new ConfigDescription("How tall the troll stands, as a share of the True Form size set by Scale above. 1 = exactly as tall as the old True Form.", new AcceptableValueRange<float>(0.5f, 2f)));
|
||||
TrueFormTrollDamageShare = config.Bind(trueForm, "Troll Attack Damage", 0.5f,
|
||||
|
|
|
|||
|
|
@ -483,7 +483,8 @@ namespace RacesOfValheim
|
|||
if (nview == null || !nview.IsValid()) return;
|
||||
|
||||
ZDO zdo = nview.GetZDO();
|
||||
bool active = TrolConfig.TrueFormUseTrollModel.Value &&
|
||||
// The owner's choice, not this client's: see TrolTrueFormModel.LegacyKey.
|
||||
bool active = !zdo.GetBool(TrolTrueFormModel.LegacyKey, false) &&
|
||||
!player.IsDead() &&
|
||||
zdo.GetString("RacesOfValheim_Race", "Human") == "Trol" &&
|
||||
zdo.GetBool(Trol_PlayerUpdate_Patch.TrueFormKey, false);
|
||||
|
|
|
|||
|
|
@ -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