Merge remote-tracking branch 'origin/feat/inport-props' into feat/craft-discovery
# Conflicts: # Assets/External/Animated PBR Chest Demo/Materials/WoodChest.mat # Packages/com.distantlands.cozy.core/Content/Integration/Import for BiRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for HDRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for URP.unitypackage.meta
This commit is contained in:
@@ -61,6 +61,15 @@ namespace Ashwild.Network
|
||||
/// Asks the registry (server) to claim this pickup for the local player. Aborts while the player
|
||||
/// is building (the hammer's placement/demolition would otherwise let an interact press snatch an
|
||||
/// item mid-build), if already claimed, or if the local inventory is full.
|
||||
///
|
||||
/// A full inventory is announced rather than ignored: silently doing nothing on a press is
|
||||
/// indistinguishable from a broken pickup, and that ambiguity is what hid the real bugs. A scene
|
||||
/// pickup the registry never accepted (missing or duplicate baked id) is refused here too, with
|
||||
/// the reason spelled out — the server would drop the request anyway.
|
||||
///
|
||||
/// The grab animation fires here, once every refusal is behind us but before the server has
|
||||
/// answered: the hand must reach out on the press, not a round-trip later. A refused pickup
|
||||
/// therefore never animates, and a granted one animates immediately.
|
||||
/// </summary>
|
||||
public void Pickup()
|
||||
{
|
||||
@@ -78,10 +87,21 @@ namespace Ashwild.Network
|
||||
}
|
||||
if (PickableRegistry.Instance.IsClaimed(Id)) return;
|
||||
|
||||
if (Id >= 0 && !PickableRegistry.Instance.IsRegistered(Id))
|
||||
{
|
||||
Debug.LogError($"[Pickable] '{name}' (id {Id}) is not tracked by the registry — the server " +
|
||||
"would drop this pickup. Check the console for an id error at startup.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Client-side pre-check so we don't claim something we can't hold.
|
||||
if (PlayerInventory.Instance != null && !PlayerInventory.Instance.CanFit(itemData, quantity))
|
||||
{
|
||||
PlayerEvents.RaiseInteractionRefused("Inventory full");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerEvents.RaiseGrabPerformed();
|
||||
PickableRegistry.Instance.RequestPickupServerRpc(Id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user