Fix: Compile errors - variable naming and missing using

- Rename lambda variable 'v' to 'w' to avoid conflict with local 'v'
- Rename local Villager 'v' to 'newVillager' for clarity
- Add missing 'using Assets.Interface' for IResourceStorage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-14 11:02:01 +01:00
parent dd17030e56
commit 8f3d83e807
2 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using Assets.Code;
using Assets.Interface;
using Riptide;
using Riptide.Transports;
using Steamworks;

View File

@@ -21,7 +21,7 @@ namespace KCM.Packets.Game.GamePlayer
if (KCClient.client.Id == clientId) return;
// Check for duplicate villager by guid
var existingVillager = player.inst.Workers.data.FirstOrDefault(v => v != null && v.guid == guid);
var existingVillager = player.inst.Workers.data.FirstOrDefault(w => w != null && w.guid == guid);
if (existingVillager != null)
{
Main.helper.Log($"Villager with guid {guid} already exists, skipping duplicate");
@@ -30,17 +30,17 @@ namespace KCM.Packets.Game.GamePlayer
Main.helper.Log("Received add villager packet from " + player.name + $"({player.id})");
Villager v = Villager.CreateVillager();
v.guid = guid;
Villager newVillager = Villager.CreateVillager();
newVillager.guid = guid;
// Set villager position
if (position != Vector3.zero)
{
v.TeleportTo(position);
newVillager.TeleportTo(position);
}
player.inst.Workers.Add(v);
player.inst.Homeless.Add(v);
player.inst.Workers.Add(newVillager);
player.inst.Homeless.Add(newVillager);
}
catch (Exception e)