Compare commits
No commits in common. "main" and "feature/effects" have entirely different histories.
main
...
feature/ef
@ -6,6 +6,5 @@
|
|||||||
"love.filesystem.load": "loadfile"
|
"love.filesystem.load": "loadfile"
|
||||||
},
|
},
|
||||||
"workspace.ignoreDir": ["dev_utils"],
|
"workspace.ignoreDir": ["dev_utils"],
|
||||||
"diagnostics.ignoredFiles": "Disable",
|
"diagnostics.ignoredFiles": "Disable"
|
||||||
"hint.enable": true
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
local easing = require "lib.utils.easing"
|
local easing = require "lib.utils.easing"
|
||||||
local pf = require "lib.pathfinder"
|
local pf = require "lib.pathfinder"
|
||||||
local utils = require "lib.utils.utils"
|
local utils = require "lib.utils.utils"
|
||||||
local task = require "lib.utils.task"
|
|
||||||
|
|
||||||
--- @alias AIAction fun(self: AIBehavior): Task<nil>
|
--- @alias AIAction fun(self: AIBehavior): Task<nil>
|
||||||
|
|
||||||
@ -157,16 +156,6 @@ local behavior = {}
|
|||||||
behavior.__index = behavior
|
behavior.__index = behavior
|
||||||
behavior.id = "ai"
|
behavior.id = "ai"
|
||||||
|
|
||||||
--- Заставляет ИИ сделать ход
|
|
||||||
---
|
|
||||||
--- По умолчанию ничего не делает
|
|
||||||
--- @return Task<nil>
|
|
||||||
function behavior:makeTurn()
|
|
||||||
return function(callback)
|
|
||||||
callback()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @param class Class
|
--- @param class Class
|
||||||
function behavior.new(class)
|
function behavior.new(class)
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
|
|||||||
@ -37,8 +37,8 @@ function behavior.new(hp, mana, initiative, class, isInTurnOrder)
|
|||||||
hp = hp or 20,
|
hp = hp or 20,
|
||||||
mana = mana or 10,
|
mana = mana or 10,
|
||||||
initiative = initiative or 10,
|
initiative = initiative or 10,
|
||||||
class = class or "dev_warrior",
|
|
||||||
isInTurnOrder = isInTurnOrder or true,
|
isInTurnOrder = isInTurnOrder or true,
|
||||||
|
class = "dev_warrior",
|
||||||
amIAlive = true
|
amIAlive = true
|
||||||
}, behavior)
|
}, behavior)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
local utils = require "lib.utils.utils"
|
local utils = require "lib.utils.utils"
|
||||||
|
local pQueue = require "lib.utils.priority_queue"
|
||||||
--- @class CharacterGrid : Grid
|
--- @class CharacterGrid : Grid
|
||||||
--- @field __grid {string: Id|nil}
|
--- @field __grid {string: Id|nil}
|
||||||
|
--- @field yOrderQueue PriorityQueue<Character> очередь отрисовки сверху вниз
|
||||||
local grid = setmetatable({}, require "lib.level.grid.base")
|
local grid = setmetatable({}, require "lib.level.grid.base")
|
||||||
grid.__index = grid
|
grid.__index = grid
|
||||||
|
|
||||||
@ -27,13 +29,22 @@ function grid:add(id)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param a Character
|
||||||
|
--- @param b Character
|
||||||
|
local function drawCmp(a, b)
|
||||||
|
--- @TODO: это захардкожено, надо разделить поведения
|
||||||
|
return a:has(Tree.behaviors.positioned).position.y < b:has(Tree.behaviors.positioned).position.y
|
||||||
|
end
|
||||||
|
|
||||||
--- fills the grid with the actual data
|
--- fills the grid with the actual data
|
||||||
---
|
---
|
||||||
--- should be called as early as possible during every tick
|
--- should be called as early as possible during every tick
|
||||||
function grid:reload()
|
function grid:reload()
|
||||||
self:reset()
|
self:reset()
|
||||||
|
self.yOrderQueue = pQueue.new(drawCmp)
|
||||||
utils.each(Tree.level.characters, function(c)
|
utils.each(Tree.level.characters, function(c)
|
||||||
self:add(c.id)
|
self:add(c.id)
|
||||||
|
self.yOrderQueue:insert(c)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user