change gamerule's logic to function
This commit is contained in:
parent
6ae86a1e3e
commit
5f8a06e7df
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue