Fix manager: string has no HashCode(); key cooldown map by UID string

GetPlainId() returns a string and string has no HashCode() in Enforce. Key the
per-player proximity cooldown map by the UID string directly (map<string,float>)
instead of an int hash. Verified the rest of the mod's engine calls against
P:\scripts (CreateObject/GetPlayerList/CallLater/RandomIntInclusive/etc.).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
smthspec 2026-06-20 00:19:19 +03:00
parent 249dcc6134
commit f490d45001

View file

@ -18,13 +18,13 @@ class YALootBoxesManager
{
protected ref array<ref YALB_ActiveBoxEntry> m_ActiveBoxes;
protected ref array<string> m_FreeLocationNames; // locations currently unused (the live pool)
protected ref map<int, float> m_PlayerMessageCooldown; // playerId -> last message world time
protected ref map<string, float> m_PlayerMessageCooldown; // player UID -> last message world time
void YALootBoxesManager()
{
m_ActiveBoxes = new array<ref YALB_ActiveBoxEntry>();
m_FreeLocationNames = new array<string>();
m_PlayerMessageCooldown = new map<int, float>();
m_PlayerMessageCooldown = new map<string, float>();
}
void Init()
@ -192,7 +192,7 @@ class YALootBoxesManager
if (!nearest) continue;
// Light cooldown per player so we're not spamming every 1.5s
int playerId = player.GetIdentity().GetPlainId().HashCode();
string playerId = player.GetIdentity().GetPlainId();
float lastShown = 0;
m_PlayerMessageCooldown.Find(playerId, lastShown);
if (now - lastShown < 4.0) continue;