change gamerule's logic to function

This commit is contained in:
notify 2023-03-14 01:21:09 +08:00
parent 6ae86a1e3e
commit 5f8a06e7df
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
---@field minPlayer integer ---@field minPlayer integer
---@field maxPlayer integer ---@field maxPlayer integer
---@field rule TriggerSkill ---@field rule TriggerSkill
---@field logic GameLogic ---@field logic fun()
local GameMode = class("GameMode") local GameMode = class("GameMode")
function GameMode:initialize(name, min, max) function GameMode:initialize(name, min, max)

View File

@ -117,7 +117,7 @@ function Room:run()
end end
local mode = Fk.game_modes[self.settings.gameMode] local mode = Fk.game_modes[self.settings.gameMode]
self.logic = (mode.logic or GameLogic):new(self) self.logic = (mode.logic and mode.logic() or GameLogic):new(self)
if mode.rule then self.logic:addTriggerSkill(mode.rule) end if mode.rule then self.logic:addTriggerSkill(mode.rule) end
self.logic:run() self.logic:run()
end end