Route loot pickup through checkpoints
This commit is contained in:
parent
eb2f1a3d2b
commit
1fadd56464
5 changed files with 83 additions and 2 deletions
|
|
@ -1570,6 +1570,23 @@ public class ActionGameManager : MonoBehaviour
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CommitLootPickup(Entity entity, ItemInstance item)
|
||||
{
|
||||
if (entity == null || item == null)
|
||||
return false;
|
||||
|
||||
foreach (var cargoBay in entity.CargoBays)
|
||||
{
|
||||
if (!cargoBay.TryStore(item))
|
||||
continue;
|
||||
|
||||
QueueRunCheckpoint("loot-pickup");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CommitCargoItemTransfer(
|
||||
EquippedCargoBay origin,
|
||||
EquippedCargoBay destination,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ public class ShieldManager : MonoBehaviour
|
|||
var mine = other.collider.GetComponent<Mine>();
|
||||
if (itemPickup)
|
||||
{
|
||||
if (Entity.CargoBays.Any(c => c.TryStore(itemPickup.Item)))
|
||||
if (ActionGameManager.Instance != null &&
|
||||
ActionGameManager.Instance.CommitLootPickup(Entity, itemPickup.Item))
|
||||
{
|
||||
// TODO: Pickup notification!
|
||||
Destroy(itemPickup.gameObject);
|
||||
|
|
|
|||
Loading…
Reference in a new issue