Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- world
- name = "Voting Demo - Your Favorite Melee Weapon"
- hub = "ComplexRobot.VotingDemo"
- hub_password = /* password removed */
- mob
- Stat()
- statpanel("Poll")
- stat(POLL_QUESTION, "")
- stat("------------------", "")
- var/list/votes = GetVotes()
- var/list/percs = Percentages(votes)
- for (var/X in votes)
- stat(X, "[percs[X]]% ([votes[X]])")
- proc
- GetVotes()
- var/params = world.GetScores(, POLL_SCORE_NAME)
- if (isnull(params))
- return list()
- params = params2list(params)
- var/val
- for (var/X in params)
- val = params2list(world.GetScores(X, POLL_SCORE_NAME))
- params[X] = text2num(val[POLL_SCORE_NAME])
- return params
- Percentages(list/L)
- var/total = 0
- var/list/result = new
- for (var/X in L)
- total += L[X]
- for (var/X in L)
- result[X] = round(100 * L[X] / (total || 1), 1)
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement