fix cant choose npc in first section

This commit is contained in:
Chomper9981
2026-01-14 17:30:37 +07:00
parent 5246829473
commit b26e76b92f
2 changed files with 5 additions and 3 deletions
@@ -6,6 +6,7 @@ using PerfectWorld.Scripts;
using CSNetwork;
using UnityEngine;
using static BrewMonster.Scripts.CECHPWork;
using System.Linq;
namespace BrewMonster
{
@@ -149,9 +150,11 @@ namespace BrewMonster
// For now, we'll proceed with raycast
if (Physics.RaycastNonAlloc(ray, hits) > 0)
{
//sort hits by distance. skip null hits.
hits = hits.OrderBy(h => h.distance).Where(h => h.collider != null).ToArray();
// Check if hit terrain, building, or forest (no CECObject component)
if (!hits[0].collider.gameObject.TryGetComponent<CECObject>(out CECObject clickedObject))
{
{
//ENABLE LATER - CURRENT WORKING FINE
// Hit terrain / building / forest / Hit terrain
// if (m_pWorkMan.IsSitting())
@@ -55,8 +55,7 @@ namespace BrewMonster.UI
return -1;
m_Item[nIndex].strDataName[nSubIndex] = strName;
m_Item[nIndex].dwData[nSubIndex] = dwItemData;
Debug.Log("[THN]AUIListBox: SetItemData: nIndex: " + nIndex + ", dwItemData: " + dwItemData + ", nSubIndex: " + nSubIndex + ", strName: " + strName);
m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex);
return nIndex;
}