Compare commits
No commits in common. "main" and "feature/task" have entirely different histories.
main
...
feature/ta
@ -8,7 +8,7 @@ grid.__index = grid
|
|||||||
--- adds a value to the grid
|
--- adds a value to the grid
|
||||||
--- @param value any
|
--- @param value any
|
||||||
function grid:add(value)
|
function grid:add(value)
|
||||||
self.__grid[tostring(value.position)] = value
|
grid[tostring(value.position)] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param position Vec3
|
--- @param position Vec3
|
||||||
|
|||||||
@ -40,7 +40,6 @@ end
|
|||||||
function level:update(dt)
|
function level:update(dt)
|
||||||
utils.each(self.deadIds, function(id)
|
utils.each(self.deadIds, function(id)
|
||||||
self.characters[id] = nil
|
self.characters[id] = nil
|
||||||
self.turnOrder:remove(id)
|
|
||||||
end)
|
end)
|
||||||
self.deadIds = {}
|
self.deadIds = {}
|
||||||
|
|
||||||
|
|||||||
@ -117,29 +117,4 @@ function turnOrder:add(id)
|
|||||||
self.actedQueue:insert(id) -- новые персонажи по умолчанию попадают в очередь следующего хода
|
self.actedQueue:insert(id) -- новые персонажи по умолчанию попадают в очередь следующего хода
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Удалить персонажа из очереди хода (например, при смерти)
|
|
||||||
--- @param id Id
|
|
||||||
function turnOrder:remove(id)
|
|
||||||
if self.current == id then
|
|
||||||
self.current = self.pendingQueue:pop()
|
|
||||||
if not self.current then
|
|
||||||
self:endRound()
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local function filterQueue(q, targetId)
|
|
||||||
local newQ = PriorityQueue.new(initiativeComparator)
|
|
||||||
for _, val in ipairs(q.data) do
|
|
||||||
if val ~= targetId then
|
|
||||||
newQ:insert(val)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return newQ
|
|
||||||
end
|
|
||||||
|
|
||||||
self.actedQueue = filterQueue(self.actedQueue, id)
|
|
||||||
self.pendingQueue = filterQueue(self.pendingQueue, id)
|
|
||||||
end
|
|
||||||
|
|
||||||
return { new = new }
|
return { new = new }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user