mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
fix(entity): proximity and pathfinding from a script only when the client makes the script
The client's script allocator adds them only for a script component it makes (a registry script with a non-zero id, or a custom script in the config it is sent). Characters and the registry-id-0 script LOTs no longer get them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -488,7 +488,12 @@ void Entity::DoObjectComponentLoad(ObjectLoadState& state) {
|
||||
const bool hasCustomScript = !GetVarAsString(u"custom_script_server").empty() || !GetVarAsString(u"custom_script_client").empty();
|
||||
if (scriptComponentID >= 0 || m_Character || hasCustomScript) {
|
||||
AddComponent<ScriptComponent>(scriptComponentID);
|
||||
addProximityAndPathfinding();
|
||||
// The client's script allocator adds these only when it makes a script component: a registry script with a
|
||||
// non-zero id or a custom script in the config it is sent (a character's script is the server's own)
|
||||
const auto clientCustomScript = [this](const std::u16string& key) { return IsVarSentToClient(key) && !GetVarAsString(key).empty(); };
|
||||
if (scriptComponentID > 0 || (m_TemplateID != 176 && (clientCustomScript(u"custom_script_server") || clientCustomScript(u"custom_script_client")))) {
|
||||
addProximityAndPathfinding();
|
||||
}
|
||||
}
|
||||
|
||||
// ZoneControl script
|
||||
|
||||
Reference in New Issue
Block a user