draughfirstdraft
This commit is contained in:
parent
272adddd75
commit
be2f7a73cd
8 changed files with 555 additions and 163 deletions
|
|
@ -12,9 +12,10 @@ namespace RacesOfValheim
|
|||
private static Dictionary<string, string> mobToTrophyMap = new Dictionary<string, string>
|
||||
{
|
||||
{ "Boar", "TrophyBoar" },
|
||||
{ "Greyling", "TrophyGreyling" },
|
||||
{ "Neck", "TrophyNeck" },
|
||||
{ "Greydwarf", "TrophyGreydwarf" },
|
||||
{ "Greydwarf_Elite", "TrophyGreydwarfElite" },
|
||||
{ "Greydwarf_Elite", "TrophyGreydwarfBrute" },
|
||||
{ "Greydwarf_Shaman", "TrophyGreydwarfShaman" },
|
||||
{ "Troll", "TrophyFrostTroll" },
|
||||
{ "Deer", "TrophyDeer" },
|
||||
|
|
@ -119,7 +120,7 @@ namespace RacesOfValheim
|
|||
}
|
||||
else
|
||||
{
|
||||
customItem = new Jotunn.Entities.CustomItem(foodName, "RawMeat", config);
|
||||
customItem = new Jotunn.Entities.CustomItem(foodName, "CookedMeat", config);
|
||||
}
|
||||
|
||||
if (customItem != null && customItem.ItemDrop != null)
|
||||
|
|
@ -244,50 +245,18 @@ namespace RacesOfValheim
|
|||
// Locally generate the visual
|
||||
if (!activeSensesLight.ContainsKey(c))
|
||||
{
|
||||
GameObject prefab = ZNetScene.instance?.GetPrefab("piece_groundtorch_green");
|
||||
if (prefab != null)
|
||||
{
|
||||
ZNetView.m_forceDisableInit = true;
|
||||
GameObject tempObj = Instantiate(prefab);
|
||||
ZNetView.m_forceDisableInit = false;
|
||||
GameObject lightObj = new GameObject("AswidSensesLight");
|
||||
lightObj.transform.SetParent(c.transform);
|
||||
lightObj.transform.position = c.GetCenterPoint();
|
||||
|
||||
GameObject lightObj = new GameObject("AswidSensesLight");
|
||||
lightObj.transform.SetParent(c.transform);
|
||||
lightObj.transform.localPosition = Vector3.zero;
|
||||
Light pLight = lightObj.AddComponent<Light>();
|
||||
pLight.type = LightType.Point;
|
||||
pLight.color = Color.green;
|
||||
pLight.range = 10f;
|
||||
pLight.intensity = 2f;
|
||||
pLight.shadows = LightShadows.None;
|
||||
|
||||
Transform enabledNode = tempObj.transform.Find("_enabled");
|
||||
if (enabledNode != null)
|
||||
{
|
||||
enabledNode.SetParent(lightObj.transform);
|
||||
enabledNode.localPosition = Vector3.zero;
|
||||
enabledNode.localScale = new Vector3(2.2f, 2.2f, 2.2f);
|
||||
|
||||
// FORCE ACTIVE because Fireplace script might have disabled it due to no fuel!
|
||||
enabledNode.gameObject.SetActive(true);
|
||||
|
||||
foreach (var col in enabledNode.GetComponentsInChildren<Collider>(true)) Destroy(col);
|
||||
foreach (var audio in enabledNode.GetComponentsInChildren<AudioSource>(true)) Destroy(audio);
|
||||
|
||||
foreach (var l in enabledNode.GetComponentsInChildren<Light>(true))
|
||||
{
|
||||
if (l != null) l.range *= 2.2f;
|
||||
}
|
||||
|
||||
foreach (var mb in enabledNode.GetComponentsInChildren<MonoBehaviour>(true))
|
||||
{
|
||||
if (mb == null) continue;
|
||||
string typeName = mb.GetType().Name;
|
||||
if (typeName != "ParticleSystem" && typeName != "LightFlicker")
|
||||
{
|
||||
Destroy(mb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Destroy(tempObj);
|
||||
|
||||
activeSensesLight[c] = lightObj;
|
||||
}
|
||||
activeSensesLight[c] = lightObj;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -354,111 +323,7 @@ namespace RacesOfValheim
|
|||
|
||||
UpdateSuperhumanSenses();
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F8))
|
||||
{
|
||||
Jotunn.Logger.LogInfo("[AswidDebug] F8 Pressed. Dumping Player Visuals:");
|
||||
VisEquipment vis = Player.m_localPlayer.GetComponentInChildren<VisEquipment>();
|
||||
if (vis != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] m_bodyModel.enabled: {(vis.m_bodyModel != null ? vis.m_bodyModel.enabled.ToString() : "null")}");
|
||||
|
||||
var legItems = Traverse.Create(vis).Field("m_legItemInstances").GetValue<List<GameObject>>();
|
||||
if (legItems != null)
|
||||
{
|
||||
foreach (var go in legItems) Jotunn.Logger.LogInfo($"[AswidDebug] LegItem: {go.name}, Active: {go.activeSelf}");
|
||||
}
|
||||
|
||||
var chestItems = Traverse.Create(vis).Field("m_chestItemInstances").GetValue<List<GameObject>>();
|
||||
if (chestItems != null)
|
||||
{
|
||||
foreach (var go in chestItems) Jotunn.Logger.LogInfo($"[AswidDebug] ChestItem: {go.name}, Active: {go.activeSelf}");
|
||||
}
|
||||
}
|
||||
|
||||
Transform visual = Player.m_localPlayer.transform.Find("Visual");
|
||||
if (visual != null)
|
||||
{
|
||||
foreach (var smr in visual.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] Player SMR: {smr.name} | Active: {smr.gameObject.activeSelf} | Enabled: {smr.enabled}");
|
||||
}
|
||||
}
|
||||
|
||||
GameObject geirrhafaPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("Fenring_Cultist_Hildir");
|
||||
if (geirrhafaPrefab != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo("[AswidDebug] GEIRRHAFA PREFAB DUMP:");
|
||||
foreach (var smr in geirrhafaPrefab.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] Geirrhafa SMR: {smr.name} | Bones: {smr.bones.Length}");
|
||||
}
|
||||
}
|
||||
|
||||
List<Character> allChars = Character.GetAllCharacters();
|
||||
Vector3 myPos = Player.m_localPlayer.transform.position;
|
||||
|
||||
int charsInRange = 0;
|
||||
foreach (var c in allChars)
|
||||
{
|
||||
if (c == null || c == Player.m_localPlayer || c.IsDead() || c.IsTamed()) continue;
|
||||
float dist = Vector3.Distance(c.transform.position, myPos);
|
||||
if (dist <= 100f)
|
||||
{
|
||||
charsInRange++;
|
||||
bool hasLight = activeSensesLight.ContainsKey(c);
|
||||
bool hasMalus = c.GetSEMan() != null && c.GetSEMan().HaveStatusEffect("SE_AswidSensesMark".GetStableHashCode());
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] In range: {c.name} (Dist: {dist}), HasLight: {hasLight}, HasMalus: {hasMalus}");
|
||||
|
||||
if (hasLight)
|
||||
{
|
||||
GameObject lightObj = activeSensesLight[c];
|
||||
if (lightObj != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] LightObj: {lightObj.name}, ActiveSelf: {lightObj.activeSelf}, ActiveInHierarchy: {lightObj.activeInHierarchy}");
|
||||
Jotunn.Logger.LogInfo(DumpGameObject(lightObj, " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] LightObj is NULL!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] Total valid chars in range: {charsInRange}");
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] activeSensesLight count: {activeSensesLight.Count}");
|
||||
|
||||
Jotunn.Logger.LogInfo("[AswidDebug] F8 pressed! Finding nearest mob to consume...");
|
||||
Character nearest = null;
|
||||
float minDist = 10f;
|
||||
foreach (Character c in Character.GetAllCharacters())
|
||||
{
|
||||
if (c != Player.m_localPlayer && c.GetHealth() > 0)
|
||||
{
|
||||
float dist = UnityEngine.Vector3.Distance(Player.m_localPlayer.transform.position, c.transform.position);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
nearest = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nearest != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[AswidDebug] Consuming {nearest.name} via F8!");
|
||||
TryConsumeMob(nearest, nearest.GetMaxHealth());
|
||||
|
||||
HitData hit = new HitData();
|
||||
hit.m_damage.m_damage = 99999f;
|
||||
hit.m_hitType = HitData.HitType.Undefined;
|
||||
hit.m_attacker = Player.m_localPlayer.GetZDOID();
|
||||
nearest.ApplyDamage(hit, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo("[AswidDebug] No mob found near player to consume.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -518,7 +383,7 @@ namespace RacesOfValheim
|
|||
TryCastEclipse(state);
|
||||
return;
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.K))
|
||||
if (Input.GetKeyDown(KeyCode.U))
|
||||
{
|
||||
TryTameHoverObject(state);
|
||||
return;
|
||||
|
|
@ -1222,3 +1087,8 @@ namespace RacesOfValheim
|
|||
|
||||
public class NightAuraTintFlag : MonoBehaviour { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue