Update client_entity.lua
Added skip to remove so we dont call external on remove.
This commit is contained in:
1 parent
a62cb880b0
commit
2fd5c7c08f
1 file changed
+3
-3
@@ -45,7 +45,7 @@ local function SpawnEntity(entityData)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function RemoveEntity(entityData)
|
local function RemoveEntity(entityData, skip)
|
||||||
entityData = entityData and entityData.args or entityData
|
entityData = entityData and entityData.args or entityData
|
||||||
if not entityData then return end
|
if not entityData then return end
|
||||||
ClientEntityActions.StopAction(entityData.id)
|
ClientEntityActions.StopAction(entityData.id)
|
||||||
@@ -55,7 +55,7 @@ local function RemoveEntity(entityData)
|
|||||||
SetEntityAsMissionEntity(entityHandle, false, false)
|
SetEntityAsMissionEntity(entityHandle, false, false)
|
||||||
DeleteEntity(entityHandle)
|
DeleteEntity(entityHandle)
|
||||||
end
|
end
|
||||||
if entityData.OnRemove then
|
if not skip and entityData.OnRemove then
|
||||||
entityData.OnRemove(entityData)
|
entityData.OnRemove(entityData)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -239,7 +239,7 @@ AddEventHandler('onResourceStop', function(resourceName)
|
|||||||
if resourceName == GetCurrentResourceName() then
|
if resourceName == GetCurrentResourceName() then
|
||||||
for id, entityData in pairs(Entities) do
|
for id, entityData in pairs(Entities) do
|
||||||
Point.Remove(id) -- Clean up point registration
|
Point.Remove(id) -- Clean up point registration
|
||||||
RemoveEntity(entityData) -- Clean up spawned game entity
|
RemoveEntity(entityData, true) -- Clean up spawned game entity
|
||||||
end
|
end
|
||||||
Entities = {} -- Clear local cache
|
Entities = {} -- Clear local cache
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user