mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-01-01 05:01:40 +09:00
Update to polls hope no desync
This commit is contained in:
@@ -26,7 +26,18 @@ local global = global{
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
local function _poll_end(self)
|
||||
local function _poll_data(question,answers)
|
||||
local poll = {
|
||||
uuid=Server.uuid(),
|
||||
question=question,
|
||||
answers=answers or {'None'},
|
||||
votes={},
|
||||
voted={}
|
||||
}
|
||||
Server.new_thread{
|
||||
data={poll_uuid=poll.uuid},
|
||||
timeout=poll_time_out*60
|
||||
}:on_event('timeout',function(self)
|
||||
local uuid = tostring(self.data.poll_uuid)
|
||||
local poll = global.active[uuid]
|
||||
if not poll then return end
|
||||
@@ -46,21 +57,7 @@ local function _poll_end(self)
|
||||
game.print({'ExpGamingPlayer-polls.end',poll.question},defines.textcolor.info)
|
||||
game.print({'ExpGamingPlayer-polls.winner',highest[1]},defines.textcolor.info)
|
||||
verbose('Ended Poll: '..poll.question..' ('..uuid..') Highest: '..highest[1])
|
||||
end
|
||||
|
||||
local function _poll_data(question,answers)
|
||||
local poll = {
|
||||
uuid=Server.uuid(),
|
||||
question=question,
|
||||
answers=answers or {'None'},
|
||||
votes={},
|
||||
voted={}
|
||||
}
|
||||
Server.new_thread{
|
||||
data={poll_uuid=poll.uuid},
|
||||
timeout=poll_time_out*60
|
||||
}:on_event('timeout',_poll_end):open()
|
||||
-- This time out is known to cause desyncs and so I have moved it to a hard coded function
|
||||
end):open()
|
||||
global.active[tostring(poll.uuid)]=poll
|
||||
verbose('Created Poll: '..question..' ('..poll.uuid..')')
|
||||
return poll.uuid
|
||||
|
||||
Reference in New Issue
Block a user