Сборка под игру 3.3: хранилище, Пирамида, проверка версии
- Пирамида: StreamModeWrite/Read теперь глобальные перечисления (в 3.2 были внутри TileEntity). - Хранилище: Bag поверх ItemStackGrid (конструктор с местом хранения, Resize, ItemGrid), запись и чтение через PooledBinaryWriter/Reader. Формат хранилища 2; формат 1 из сейвов 3.2 читается. Незнакомый номер формата больше не считается «хранилища нет» - байты сохраняются. - Сфера на браслете: ModificationCount/GetModification/SetModification. - Непустой сундук: TEFeatureStorage.IsEmpty (ITileEntityLootable в 3.3 нет). - Поиск ножа в инвентаре через ItemGrid. - GameVersionGuard пускает только 3.3. Проверено в игре на V 3.3.0 b14: хранилище из сейва 3.2 (24 стопки) прочиталось, сохранилось и перечиталось; Пирамида включается; «Жертва», обыск трупа и мешки работают. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4470b784f
commit
e8e21d5a58
@@ -457,16 +457,16 @@ namespace NecromancerTome
|
||||
public static float SpendCharge(PickupJob _job)
|
||||
{
|
||||
ItemValue bracelet = _job.Bracelet;
|
||||
if (bracelet == null || bracelet.Modifications == null || _job.ChannelSeconds <= 0f)
|
||||
if (bracelet == null || bracelet.ModificationCount == 0 || _job.ChannelSeconds <= 0f)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
float spent = 0f;
|
||||
bool emptied = false;
|
||||
for (int i = 0; i < bracelet.Modifications.Length; i++)
|
||||
for (int i = 0; i < bracelet.ModificationCount; i++)
|
||||
{
|
||||
ItemValue mod = bracelet.Modifications[i];
|
||||
ItemValue mod = bracelet.GetModification(i);
|
||||
if (mod == null || mod.IsEmpty())
|
||||
{
|
||||
continue;
|
||||
@@ -497,7 +497,7 @@ namespace NecromancerTome
|
||||
// ItemValue.None is what an empty mod slot holds - type 0, which is exactly
|
||||
// what IsEmpty() tests for, so the slot reads as free to every other piece of
|
||||
// code including the gate in Begin.
|
||||
bracelet.Modifications[i] = ItemValue.None;
|
||||
bracelet.SetModification(i, ItemValue.None);
|
||||
emptied = true;
|
||||
Debug.Log("[NecromancerTome] SpatialVaultPickup: sphere in slot " + i +
|
||||
" ran out (" + mod.UseTimes.ToString("0.#") + "/" + max +
|
||||
@@ -585,7 +585,7 @@ namespace NecromancerTome
|
||||
// a composite tile entity with a storage FEATURE rather than as their own class, so
|
||||
// the question has to be asked of the feature - the same TryGetSelfOrFeature call the
|
||||
// engine's own storage code uses.
|
||||
if (tileEntity.TryGetSelfOrFeature(out ITileEntityLootable lootable) && !lootable.IsEmpty())
|
||||
if (tileEntity.TryGetSelfOrFeature(out TEFeatureStorage storage) && !storage.IsEmpty())
|
||||
{
|
||||
Deny(_player, MsgNotEmpty);
|
||||
return false;
|
||||
@@ -616,15 +616,12 @@ namespace NecromancerTome
|
||||
|
||||
if (!Patch_ItemActionEat_ExecuteAction_SpatialVault.PlayerVaults.TryGetValue(_player.entityId, out Bag bag))
|
||||
{
|
||||
bag = SpatialVaultPersistence.LastLoadedVault ?? new Bag(slotCount);
|
||||
bag = SpatialVaultPersistence.LastLoadedVault ?? new Bag(new Vector2i(slotCount, 1), XUiC_ItemStack.StackLocationTypes.LootContainer, null);
|
||||
Patch_ItemActionEat_ExecuteAction_SpatialVault.PlayerVaults[_player.entityId] = bag;
|
||||
}
|
||||
if (bag.SlotCount < slotCount)
|
||||
{
|
||||
ItemStack[] oldSlots = bag.GetSlots();
|
||||
ItemStack[] newSlots = ItemStack.CreateArray(slotCount);
|
||||
System.Array.Copy(oldSlots, newSlots, oldSlots.Length);
|
||||
bag.SetSlots(newSlots);
|
||||
bag.Resize(new Vector2i(slotCount, 1));
|
||||
}
|
||||
return bag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user