1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

fixed adding player to chunk crash

This commit is contained in:
Aaron Veden 2021-12-27 09:48:49 -08:00
parent 9c032a3167
commit 64078e5e84
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
2 changed files with 7 additions and 5 deletions

View File

@ -5,6 +5,7 @@ Date: 17. 12. 2021
- Added RTStasisRealm to surface exclusion list
Bugfixes:
- Fixed onBuilderArrived if the builder was a unit and not a group (Thanks DBotThePony for reporting)
- Fixed adding player to chunk crash
---------------------------------------------------------------------------------------------------
Version: 2.0.3

View File

@ -451,11 +451,10 @@ function chunkPropertyUtils.decayDeathGenerator(map, chunk)
end
function chunkPropertyUtils.addPlayerToChunk(map, chunk, name)
local playerChunks = map.playerToChunk
local playerCountChunks = map.chunkToPlayerCount
local playerChunk = playerChunks[name]
local playerChunk = map.playerToChunk[name]
if not playerChunk then
playerChunks[name] = chunk
map.playerToChunk[name] = chunk
local playerCount = playerCountChunks[chunk.id]
if not playerCount then
playerCountChunks[chunk.id] = 1
@ -463,9 +462,11 @@ function chunkPropertyUtils.addPlayerToChunk(map, chunk, name)
playerCountChunks[chunk.id] = playerCount + 1
end
elseif (playerChunk.id ~= chunk.id) then
playerChunks[name] = chunk
map.playerToChunk[name] = chunk
local playerCount = playerCountChunks[playerChunk.id]
chunkPropertyUtils.setPlayersOnChunk(map, playerChunk, playerCount - 1)
if playerCount then
chunkPropertyUtils.setPlayersOnChunk(map, playerChunk, playerCount - 1)
end
playerCount = playerCountChunks[chunk.id]
if not playerCount then
playerCountChunks[chunk.id] = 1