-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
36 lines (29 loc) · 883 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
local function start_night_vote(name, param)
vote.new_vote(name, {
description = "Make night " .. param,
help = "/yes, /no or /abstain",
name = name,
duration = 60,
on_result = function(self, result, results)
if result == "yes" then
minetest.chat_send_all("Vote passed, " ..
#results.yes .. " to " .. #results.no .. ", Time will be set to night ")
minetest.set_timeofday(0)
else
minetest.chat_send_all("Vote failed, " ..
#results.yes .. " to " .. #results.no .. ", "
)
end
end,
on_vote = function(self, name, value)
minetest.chat_send_all(name .. " voted " .. value .. " to '" ..
self.description .. "'")
end
})
end
minetest.register_chatcommand("vote_night", {
privs = {
vote_starter = true
},
func = start_night_vote
})