Items and sockets can reveal ship log facts

This commit is contained in:
Joshua Thome 2023-11-02 22:30:10 -05:00
parent 157b30610a
commit 5d4e09a3f8
5 changed files with 32 additions and 2 deletions

View File

@ -81,8 +81,9 @@ namespace NewHorizons.Builder.Props
}
item.PickupCondition = info.pickupCondition;
item.ClearPickupConditionOnDrop = info.clearPickupConditionOnDrop;
item.PickupFact = info.pickupFact;
Delay.FireInNUpdates(() =>
Delay.FireOnNextUpdate(() =>
{
if (item != null && !string.IsNullOrEmpty(info.pathToInitialSocket))
{
@ -111,7 +112,7 @@ namespace NewHorizons.Builder.Props
NHLogger.LogError($"Could not find a socket to parent item {itemName} to at path {socketGO}");
}
}
}, 1);
});
return item;
}
@ -144,8 +145,10 @@ namespace NewHorizons.Builder.Props
socket.UseGiveTakePrompts = info.useGiveTakePrompts;
socket.InsertCondition = info.insertCondition;
socket.ClearInsertConditionOnRemoval = info.clearInsertConditionOnRemoval;
socket.InsertFact = info.insertFact;
socket.RemovalCondition = info.removalCondition;
socket.ClearRemovalConditionOnInsert = info.clearRemovalConditionOnInsert;
socket.RemovalFact = info.removalFact;
Delay.FireInNUpdates(() =>
{

View File

@ -21,6 +21,7 @@ namespace NewHorizons.Components.Props
public AudioType UnsocketAudio;
public string PickupCondition;
public bool ClearPickupConditionOnDrop;
public string PickupFact;
public ItemType ItemType
{
@ -72,6 +73,10 @@ namespace NewHorizons.Components.Props
{
DialogueConditionManager.SharedInstance.SetConditionState(PickupCondition, true);
}
if (!string.IsNullOrEmpty(PickupFact))
{
Locator.GetShipLogManager().RevealFact(PickupFact);
}
}
internal void TriggerDropConditions()

View File

@ -12,8 +12,10 @@ namespace NewHorizons.Components.Props
public bool UseGiveTakePrompts;
public string InsertCondition;
public bool ClearInsertConditionOnRemoval;
public string InsertFact;
public string RemovalCondition;
public bool ClearRemovalConditionOnInsert;
public string RemovalFact;
public ItemType ItemType
{
@ -65,6 +67,10 @@ namespace NewHorizons.Components.Props
{
DialogueConditionManager.SharedInstance.SetConditionState(RemovalCondition, false);
}
if (!string.IsNullOrEmpty(InsertFact))
{
Locator.GetShipLogManager().RevealFact(InsertFact);
}
}
internal void TriggerRemovalConditions()
@ -77,6 +83,10 @@ namespace NewHorizons.Components.Props
{
DialogueConditionManager.SharedInstance.SetConditionState(InsertCondition, false);
}
if (!string.IsNullOrEmpty(RemovalFact))
{
Locator.GetShipLogManager().RevealFact(RemovalFact);
}
}
}
}

View File

@ -67,6 +67,10 @@ namespace NewHorizons.External.Modules.Props.Item
/// </summary>
[DefaultValue(true)] public bool clearPickupConditionOnDrop = true;
/// <summary>
/// A ship log fact to reveal when picking up this item.
/// </summary>
public string pickupFact;
/// <summary>
/// A relative path from the planet to a socket that this item will be automatically inserted into.
/// </summary>
public string pathToInitialSocket;

View File

@ -39,6 +39,10 @@ namespace NewHorizons.External.Modules.Props.Item
/// </summary>
[DefaultValue(true)] public bool clearInsertConditionOnRemoval = true;
/// <summary>
/// A ship log fact to reveal when inserting an item into this socket.
/// </summary>
public string insertFact;
/// <summary>
/// A dialogue condition to set when removing an item from this socket, or when the socket is empty.
/// </summary>
public string removalCondition;
@ -46,5 +50,9 @@ namespace NewHorizons.External.Modules.Props.Item
/// Whether the removal condition should be cleared when inserting a socketed item. Defaults to true.
/// </summary>
[DefaultValue(true)] public bool clearRemovalConditionOnInsert = true;
/// <summary>
/// A ship log fact to reveal when removing an item from this socket, or when the socket is empty.
/// </summary>
public string removalFact;
}
}