Grey, tall and thin, with black eyes. Eitr is armour and fuel (shield, diet, soft fall, levitation), Heimkall sends a lethal blow home at one health every 20 minutes. Caster powers from Skrid to the archon Sameining, with on-screen cooldowns. Automated base around the Ljoskjarne: drones, three constructs, crystals, Ljosgard, Prismavard. Compendium page in EN/IT/RU. README: New in block, race section, progression, station line, changelog. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
108 lines
4.9 KiB
C#
108 lines
4.9 KiB
C#
using System.Collections.Generic;
|
|
using Jotunn.Configs;
|
|
using Jotunn.Entities;
|
|
using Jotunn.Managers;
|
|
using UnityEngine;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
/// <summary>
|
|
/// The LJOSGARD, the garden of light (Alfar_Progettazione.txt sec. 8.6 and 12): the module of the
|
|
/// Nexus that mixes the two mushrooms of the Mistlands into SAP, very slowly.
|
|
///
|
|
/// It is a clone of the stone furnace with its recipe turned: MAGECAP is the "ore" and JOTUN PUFFS
|
|
/// the "fuel", one of each per sap, so mixing the two is exactly what a smelter already does with
|
|
/// its two inputs. Being a Smelter it needs no new code to be served: the drones feed it (a
|
|
/// Smelter-family station) and carry the sap away, and the refinery (vanilla, sap as fuel and soft
|
|
/// tissue as ore) is served by them too. Output falls where a furnace's does.
|
|
/// </summary>
|
|
public static class AlfarLjosgard
|
|
{
|
|
public const string PieceName = "AlfarLjosgard";
|
|
public const string PieceDisplay = "$rov_piece_alfar_ljosgard_name";
|
|
|
|
public static void Register()
|
|
{
|
|
GameObject source = PrefabManager.Cache.GetPrefab<GameObject>("smelter");
|
|
ItemDrop magecap = PrefabManager.Cache.GetPrefab<ItemDrop>("MushroomMagecap");
|
|
ItemDrop puffs = PrefabManager.Cache.GetPrefab<ItemDrop>("MushroomJotunPuffs");
|
|
ItemDrop sap = PrefabManager.Cache.GetPrefab<ItemDrop>("Sap");
|
|
|
|
if (source == null || magecap == null || puffs == null || sap == null)
|
|
{
|
|
Jotunn.Logger.LogWarning("[Alfar] The Ljosgard needs the 'smelter' piece and the Magecap, Jotun Puffs and Sap items: not registered.");
|
|
return;
|
|
}
|
|
|
|
GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(PieceName, source);
|
|
if (prefab == null) return;
|
|
|
|
// The furnace's heat and its fire: the Ljosgard is cool to the touch (guide 5.1).
|
|
AswidBloodRefinery.StripOffensive(prefab, "Ljosgard");
|
|
|
|
Smelter smelter = prefab.GetComponent<Smelter>();
|
|
if (smelter == null)
|
|
{
|
|
Jotunn.Logger.LogWarning("[Alfar] The cloned smelter has no Smelter component: no Ljosgard.");
|
|
return;
|
|
}
|
|
|
|
smelter.m_name = PieceDisplay;
|
|
smelter.m_conversion = new List<Smelter.ItemConversion>
|
|
{
|
|
new Smelter.ItemConversion { m_from = magecap, m_to = sap },
|
|
};
|
|
smelter.m_fuelItem = puffs;
|
|
smelter.m_fuelPerProduct = 1;
|
|
smelter.m_maxOre = AlfarNexusConfig.GardCapacity.Value;
|
|
smelter.m_maxFuel = AlfarNexusConfig.GardCapacity.Value;
|
|
smelter.m_secPerProduct = AlfarNexusConfig.GardSecondsPerSap.Value;
|
|
smelter.m_requiresRoof = false;
|
|
smelter.m_spawnStack = false;
|
|
smelter.m_windmill = null;
|
|
|
|
AlfarConstructs.Tint(prefab, new Color(0.55f, 0.85f, 0.7f, 1f));
|
|
|
|
Piece piece = prefab.GetComponent<Piece>();
|
|
if (piece == null) { Jotunn.Logger.LogWarning("[Alfar] The cloned smelter has no Piece."); return; }
|
|
|
|
piece.m_craftingStation = null;
|
|
piece.m_name = PieceDisplay;
|
|
piece.m_description = "$rov_piece_alfar_ljosgard_desc";
|
|
|
|
PieceManager.Instance.AddPiece(new CustomPiece(prefab, fixReference: false, new PieceConfig
|
|
{
|
|
Name = PieceDisplay,
|
|
Description = "$rov_piece_alfar_ljosgard_desc",
|
|
PieceTable = PieceTables.Hammer,
|
|
Category = PieceCategories.Crafting,
|
|
Icon = piece.m_icon,
|
|
Requirements = new[]
|
|
{
|
|
new RequirementConfig("Bronze", AlfarNexusConfig.GardBronze.Value, 0, true),
|
|
new RequirementConfig("MushroomJotunPuffs", AlfarNexusConfig.GardMushrooms.Value, 0, true),
|
|
new RequirementConfig("MushroomMagecap", AlfarNexusConfig.GardMushrooms.Value, 0, true),
|
|
},
|
|
}));
|
|
|
|
// One per Ljoskjarne, inside its reach, and only for the Alfar.
|
|
PieceDensityLimit.Register(PieceName, AlfarNexusConfig.NexusRadius.Value, 1, "rov_msg_build_limit_alfar_ljosgard");
|
|
PieceDensityLimit.RegisterGate(PieceName, (player, position) =>
|
|
{
|
|
if (!AlfarRace.IsLocalAlfar())
|
|
{
|
|
if (player != null) player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_alfar_only_alfar"));
|
|
return false;
|
|
}
|
|
if (AlfarNexusBehaviour.Covering(position) == null)
|
|
{
|
|
if (player != null) player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_alfar_gard_needs_nexus"));
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
|
|
AlfarPieces.Extra.Add(PieceName);
|
|
}
|
|
}
|
|
}
|