Merge branch 'main' into race-chains-and-stations
# Conflicts: # JotunnModStub/Aswid/AswidRace.cs # JotunnModStub/Factions/FactionHostilityPatch.cs # JotunnModStub/Factions/FactionMerchantCatalog.cs # JotunnModStub/Furling/FurlingPatches.cs
This commit is contained in:
commit
f60b8d8f7d
48 changed files with 1865 additions and 380 deletions
|
|
@ -175,6 +175,87 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F8 debug: fires a ray from the camera and logs whatever it hits. Cosmetic pieces
|
||||
/// (hair, beard, helmet) carry no collider, so this mostly confirms terrain/creature hits
|
||||
/// - LogHeadCosmeticsState below is what actually answers "what is that floating chunk."
|
||||
/// Kept anyway because it is the general-purpose "what am I looking at" tool for any other
|
||||
/// bone or prefab placement question that comes up later.
|
||||
/// </summary>
|
||||
private void LogRaycastHit()
|
||||
{
|
||||
Camera cam = Camera.main;
|
||||
if (cam == null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo("[F8] No camera found for raycast.");
|
||||
return;
|
||||
}
|
||||
|
||||
Ray ray = new Ray(cam.transform.position, cam.transform.forward);
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, 50f))
|
||||
{
|
||||
Jotunn.Logger.LogInfo("--- F8 RAYCAST HIT ---");
|
||||
Jotunn.Logger.LogInfo($"Collider: '{hit.collider.gameObject.name}' at {hit.point:F2}, distance={hit.distance:F2}");
|
||||
Jotunn.Logger.LogInfo($"Full path: {GetFullPath(hit.collider.transform)}");
|
||||
Renderer renderer = hit.collider.GetComponentInParent<Renderer>();
|
||||
if (renderer != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"Nearest renderer: '{renderer.gameObject.name}' ({renderer.GetType().Name}), enabled={renderer.enabled}, scale={renderer.transform.lossyScale:F3}");
|
||||
}
|
||||
Jotunn.Logger.LogInfo("----------------------");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo("[F8] Raycast hit nothing within 50m (cosmetic pieces usually have no collider anyway).");
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetFullPath(Transform t)
|
||||
{
|
||||
string path = t.name;
|
||||
for (Transform parent = t.parent; parent != null; parent = parent.parent)
|
||||
{
|
||||
path = parent.name + "/" + path;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F8 debug: dumps the exact state of the three item slots this race hides (hair, beard,
|
||||
/// helmet) - active flag, renderer enabled flag and scale for every renderer underneath.
|
||||
/// This is the direct answer to "what is still visible and why": a chunk that survives
|
||||
/// hiding will show up here as active=true, or as a renderer with enabled=true even while
|
||||
/// its wrapper is scaled to zero (the skinned-mesh case scale alone cannot hide).
|
||||
/// </summary>
|
||||
private void LogHeadCosmeticsState()
|
||||
{
|
||||
if (Player.m_localPlayer == null) return;
|
||||
VisEquipment vis = Player.m_localPlayer.GetComponent<VisEquipment>();
|
||||
if (vis == null) return;
|
||||
|
||||
Jotunn.Logger.LogInfo("--- F8 SKELETON HEAD COSMETICS ---");
|
||||
DumpItemInstanceField(vis, "m_hairItemInstance");
|
||||
DumpItemInstanceField(vis, "m_beardItemInstance");
|
||||
DumpItemInstanceField(vis, "m_helmetItemInstance");
|
||||
Jotunn.Logger.LogInfo("----------------------------------");
|
||||
}
|
||||
|
||||
private static void DumpItemInstanceField(VisEquipment vis, string fieldName)
|
||||
{
|
||||
GameObject go = HarmonyLib.Traverse.Create(vis).Field<GameObject>(fieldName).Value;
|
||||
if (go == null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[F8] {fieldName}: null (nothing equipped/instantiated).");
|
||||
return;
|
||||
}
|
||||
|
||||
Jotunn.Logger.LogInfo($"[F8] {fieldName}: '{go.name}' active={go.activeSelf} scale={go.transform.localScale:F3}");
|
||||
foreach (Renderer r in go.GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[F8] renderer '{r.gameObject.name}' ({r.GetType().Name}) enabled={r.enabled}");
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.F8))
|
||||
|
|
@ -185,6 +266,9 @@ namespace RacesOfValheim
|
|||
DumpTransformHierarchy(Hud.instance.transform, "");
|
||||
Jotunn.Logger.LogInfo("--------------------------");
|
||||
}
|
||||
|
||||
LogRaycastHit();
|
||||
LogHeadCosmeticsState();
|
||||
}
|
||||
|
||||
if (Player.m_localPlayer == null) return;
|
||||
|
|
@ -250,10 +334,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
// Hide Helmets (Valheim uses singular GameObject for helmet)
|
||||
var helmetObj = HarmonyLib.Traverse.Create(currentVis).Field<GameObject>("m_helmetItemInstance").Value;
|
||||
if (helmetObj != null && helmetObj.transform.localScale != Vector3.zero)
|
||||
{
|
||||
helmetObj.transform.localScale = Vector3.zero;
|
||||
}
|
||||
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
|
||||
|
||||
// Scale Body Armor (Chest, Legs, Shoulder) by 5%
|
||||
string[] armorFields = { "m_chestItemInstances", "m_legItemInstances", "m_shoulderItemInstances" };
|
||||
|
|
@ -355,18 +436,17 @@ namespace RacesOfValheim
|
|||
// rate, which is the player's own field.
|
||||
if (rules.EnhancedRegen)
|
||||
{
|
||||
// Speed up regen ticks by 20% (1.25x faster timer accumulation)
|
||||
float currentTimer = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<float>("m_foodRegenTimer").Value;
|
||||
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_foodRegenTimer").SetValue(currentTimer + Time.deltaTime * 0.25f);
|
||||
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_foodRegenTimer").SetValue(currentTimer + Time.deltaTime * SkeletonConfig.EnhancedRegenTickSpeedBonus.Value);
|
||||
}
|
||||
|
||||
// Flames on the skull, worn with the fire-tier model and nothing else.
|
||||
headFlame.Apply(Player.m_localPlayer, rules.ModelPrefab == SkeletonProgression.FireModel);
|
||||
headFlame.Apply(Player.m_localPlayer, SkeletonConfig.HeadFireVFXEnabled.Value && rules.ModelPrefab == SkeletonProgression.FireModel);
|
||||
|
||||
if (rules.FireAura)
|
||||
{
|
||||
EnsureFireAuraVFX(true);
|
||||
if (Time.time - lastAuraTime >= 1f)
|
||||
if (Time.time - lastAuraTime >= SkeletonConfig.FireAuraTickInterval.Value)
|
||||
{
|
||||
ApplyFireAura();
|
||||
lastAuraTime = Time.time;
|
||||
|
|
@ -475,10 +555,10 @@ namespace RacesOfValheim
|
|||
if (Player.m_localPlayer == null) return;
|
||||
|
||||
Vector3 center = Player.m_localPlayer.transform.position;
|
||||
float radius = 5f;
|
||||
|
||||
float radius = SkeletonConfig.FireAuraRadius.Value;
|
||||
|
||||
HitData hitData = new HitData();
|
||||
hitData.m_damage.m_fire = 30f; // 30 fire damage per second
|
||||
hitData.m_damage.m_fire = SkeletonConfig.FireAuraDamagePerTick.Value;
|
||||
hitData.SetAttacker(Player.m_localPlayer);
|
||||
hitData.m_dir = Vector3.zero;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue