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:
2026-07-25 19:42:26 +02:00
954 changed files with 999772 additions and 26193 deletions
+29 -4
View File
@@ -112,19 +112,38 @@ namespace Ashwild.Network
/// <summary>
/// Owner-side entry: asks the server to claim a pickup and grant its item.
///
/// Nothing leaves the world before the grant is known to be possible: the pickup is only marked
/// claimed, and a drop record only removed, once the item and the requesting inventory have both
/// been resolved. Resolving them afterwards is how a pickup could disappear while granting
/// nothing. Anything the client could not have foreseen is reported back to it; losing the race
/// to another player is left silent, since the object visibly vanishes.
/// </summary>
[ServerRpc(RequireOwnership = false)]
public void RequestPickupServerRpc(int id, NetworkConnection conn = null)
{
PlayerInventory inventory = ResolveInventory(conn);
if (inventory == null) return;
if (inventory == null)
{
ReportFailure(conn, id, "the requesting player's inventory could not be resolved — the item would be lost");
return;
}
if (id >= 0)
{
// Scene pickup — the server reads the item from its own copy of the object.
if (IsInactive(id)) return;
if (!TryGetObject(id, out WorldObject obj) || obj is not Pickable pickup) return;
if (pickup.ItemData == null) return;
if (!TryGetObject(id, out WorldObject obj) || obj is not Pickable pickup)
{
ReportFailure(conn, id, "no pickup is registered with this id on the server");
return;
}
if (pickup.ItemData == null)
{
ReportFailure(conn, id, $"'{pickup.name}' has no ItemData assigned");
return;
}
MarkInactive(id);
inventory.GrantItemFromServer(pickup.ItemData, pickup.Quantity);
@@ -133,10 +152,16 @@ namespace Ashwild.Network
{
// Runtime drop — the server reads the item from the synced record.
if (!activeDrops.TryGetValue(id, out DropRecord record)) return;
ItemData item = ItemDatabase.Instance != null ? ItemDatabase.Instance.GetItem(record.itemId) : null;
if (item == null)
{
ReportFailure(conn, id, $"item id {record.itemId} is not in the ItemDatabase — run Rebuild Item Database");
return;
}
activeDrops.Remove(id);
if (item != null) inventory.GrantItemFromServer(item, record.quantity, record.uses);
inventory.GrantItemFromServer(item, record.quantity, record.uses);
}
}