From cb9dbdf61057e09189e7339308d2c0728644c42d Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Wed, 3 Sep 2025 01:23:01 -0500 Subject: [PATCH] Adjust entity movement threshold and follow behavior Increased the movement threshold for entity updates from 0.05 to 1.0 to reduce unnecessary position updates. Modified follow behavior to offset the entity's coordinates by -1 on the Z axis when updating, possibly to account for ground level or animation adjustments. --- lib/entities/client/client_entity.lua | 5 +---- lib/entities/shared/behaviors/follow.lua | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index a4faabc..443baec 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -8,9 +8,6 @@ ClientEntity = { } -- Renamed from BaseEntity ClientEntity.Behaviors = Behaviors - - - -------------------- local function SpawnEntity(entityData) @@ -81,7 +78,7 @@ local function UpdateEntity(_entityData) local coords = vector3(entityData.coords.x, entityData.coords.y, entityData.coords.z) entityData.oldCoords = vector3(entityData.oldCoords.x, entityData.oldCoords.y, entityData.oldCoords.z) local dist = #(coords.xyz - entityData.oldCoords.xyz) - if dist > 0.05 then + if dist > 1.0 then if entityData.spawned then print("Moving entity:", entityData.id) SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, true) diff --git a/lib/entities/shared/behaviors/follow.lua b/lib/entities/shared/behaviors/follow.lua index b5361a9..9a4c2c4 100644 --- a/lib/entities/shared/behaviors/follow.lua +++ b/lib/entities/shared/behaviors/follow.lua @@ -42,7 +42,7 @@ function Follow.PedWalkToPos(entityData) TaskGoStraightToCoord(entity, targetCoords.x, targetCoords.y, targetCoords.z, speed, -1, heading, 0.0) entityData.coords = GetEntityCoords(entity) entityData.follow.walking = true - Bridge.ClientEntity.Set(entityData.id, "coords", entityData.coords) + Bridge.ClientEntity.Set(entityData.id, "coords", entityData.coords - vector3(0,0,1)) Bridge.ClientEntity.Set(entityData.id, "follow", entityData.follow) if entityData.follow.OnExit then entityData.follow.OnExit(entityData) end return false