warvulture
This commit is contained in:
parent
3095198539
commit
1d66b00374
29 changed files with 7236 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ namespace RacesOfValheim
|
|||
FurlingConfig.Bind(Config);
|
||||
SkadiConfig.Bind(Config);
|
||||
SkeletonConfig.Bind(Config);
|
||||
SvermConfigManagement.Bind(Config);
|
||||
TrentaConfigManagement.Bind(Config);
|
||||
TrolConfig.Bind(Config);
|
||||
// Not a race: a summoned mount two races share, so it binds after the races rather
|
||||
|
|
@ -49,6 +50,7 @@ namespace RacesOfValheim
|
|||
gameObject.AddComponent<DraughRace>();
|
||||
gameObject.AddComponent<DvergarRace>();
|
||||
gameObject.AddComponent<TrentaRace>();
|
||||
gameObject.AddComponent<SvermRace>();
|
||||
// Not a race: a perk two races share (Skadi and Trol build inside troll caves), so it
|
||||
// gets its own component rather than living inside either one's Update.
|
||||
gameObject.AddComponent<RaceCaveBuilding>();
|
||||
|
|
@ -122,6 +124,7 @@ namespace RacesOfValheim
|
|||
DraughRace.Instance.CreateModAssets();
|
||||
DvergarRace.Instance.CreateModAssets();
|
||||
TrentaRace.Instance.CreateModAssets();
|
||||
SvermRace.Instance.CreateModAssets();
|
||||
WarVultureItem.Register();
|
||||
}
|
||||
// --- RACE SELECTION UI ---
|
||||
|
|
@ -266,6 +269,7 @@ namespace RacesOfValheim
|
|||
// Row 3 (y = -140)
|
||||
CreateRaceButtonWithConfirm("Dvergar", new Vector2(-450, -140), GetDvergarIcon(), "Small, stubborn smiths of the deep. Frail of frame, but masters of metal, mine and market.", SelectDvergar);
|
||||
CreateRaceButtonWithConfirm("Trenta", new Vector2(-150, -140), GetTrentaIcon(), "Tree-born folk, kin to root and leaf. Patient and hard to fell.", SelectTrenta);
|
||||
CreateRaceButtonWithConfirm("Sverm", new Vector2(150, -140), GetSvermIcon(), "Chitin-born swarm kin. Armoured from birth and never slowed, venomous, at peace with every crawling thing - but blunt trauma and fire find the seams.", SelectSverm);
|
||||
|
||||
GUIManager.BlockInput(true);
|
||||
}
|
||||
|
|
@ -632,6 +636,58 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
private void SelectSverm()
|
||||
{
|
||||
if (Player.m_localPlayer != null)
|
||||
{
|
||||
Player.m_localPlayer.m_customData["Race"] = SvermConfig.RaceId;
|
||||
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", SvermConfig.RaceId);
|
||||
|
||||
Player.m_localPlayer.GetSEMan().AddStatusEffect(SvermConfig.StatsSE.GetStableHashCode(), true);
|
||||
|
||||
// The carapace seals chest, legs and helmet, so whatever the player was wearing in
|
||||
// those slots has to come off before the visual rebuild - otherwise the old chest
|
||||
// stays on screen underneath a carapace that the equip patch will refuse to remove
|
||||
// later, because the refusal is on EQUIPPING, not on unequipping.
|
||||
Humanoid humanoid = Player.m_localPlayer;
|
||||
foreach (ItemDrop.ItemData.ItemType slot in SvermConfig.SealedSlots)
|
||||
{
|
||||
ItemDrop.ItemData worn = null;
|
||||
foreach (ItemDrop.ItemData item in humanoid.GetInventory().GetEquippedItems())
|
||||
{
|
||||
if (item != null && item.m_shared != null && item.m_shared.m_itemType == slot) { worn = item; break; }
|
||||
}
|
||||
if (worn != null) humanoid.UnequipItem(worn, false);
|
||||
}
|
||||
|
||||
VisEquipment visEq = Player.m_localPlayer.GetComponent<VisEquipment>();
|
||||
if (visEq != null)
|
||||
{
|
||||
visEq.GetType().GetMethod("UpdateVisuals", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Sverm.");
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private Sprite GetSvermIcon()
|
||||
{
|
||||
GameObject prefab = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophySeekerBrute")?.gameObject;
|
||||
if (prefab == null) prefab = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophySeeker")?.gameObject;
|
||||
if (prefab == null) prefab = PrefabManager.Cache.GetPrefab<ItemDrop>("Chitin")?.gameObject;
|
||||
if (prefab != null)
|
||||
{
|
||||
ItemDrop drop = prefab.GetComponent<ItemDrop>();
|
||||
if (drop != null && drop.m_itemData.m_shared.m_icons.Length > 0)
|
||||
{
|
||||
return drop.m_itemData.m_shared.m_icons[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Sprite GetDvergarIcon()
|
||||
{
|
||||
GameObject prefab = PrefabManager.Cache.GetPrefab<ItemDrop>("HelmetDverger")?.gameObject;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue