Merge pull request #13507 from LetterN/subsystem-updoots

Ports the better statpannel design, fixes missing icons, and fixes statvoting [ready]
This commit is contained in:
silicons
2020-10-06 00:46:13 -07:00
committed by GitHub
26 changed files with 456 additions and 336 deletions
+1
View File
@@ -1,6 +1,7 @@
PROCESSING_SUBSYSTEM_DEF(dcs)
name = "Datum Component System"
flags = SS_NO_INIT
wait = 1 SECONDS
var/list/elements_by_type = list()
+3 -3
View File
@@ -60,9 +60,9 @@ SUBSYSTEM_DEF(economy)
secmedsrv_payout() // Payout based on crew safety, health, and mood.
civ_payout() // Payout based on ??? Profit
car_payout() // Cargo's natural gain in the cash moneys.
for(var/A in bank_accounts)
var/datum/bank_account/B = A
B.payday(1)
for(var/account in bank_accounts)
var/datum/bank_account/bank_account = account
bank_account.payday(1)
/datum/controller/subsystem/economy/proc/get_dep_account(dep_id)
+1 -1
View File
@@ -100,7 +100,7 @@ SUBSYSTEM_DEF(events)
// REEEEEEEEE
/client/proc/forceEvent()
set name = "Trigger Event"
set category = "Fun"
set category = "Admin.Events"
if(!holder ||!check_rights(R_FUN))
return
+1 -1
View File
@@ -447,7 +447,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
//Manual loading of away missions.
/client/proc/admin_away()
set name = "Load Away Mission / Virtual Reality"
set category = "Fun"
set category = "Admin.Events"
if(!holder ||!check_rights(R_FUN))
return
+25 -22
View File
@@ -27,28 +27,6 @@ SUBSYSTEM_DEF(statpanels)
var/ETA = SSshuttle.emergency.getModeStr()
if(ETA)
global_data += "[ETA] [SSshuttle.emergency.getTimerStr()]"
/* Please fix
if(SSvote.mode)
var/static/list/supported = list(PLURALITY_VOTING, APPROVAL_VOTING)
global_data += "Vote active!, There is currently a vote running. Question: [SSvote.question]"
if(!(SSvote.vote_system in supported))
global_data += "<STATPANEL VOTING DISABLED>, The current vote system is not supported by statpanel rendering. Please vote manually by opening the vote popup using the action button or chat link."
return
global_data += "Time Left:, [round(SSvote.end_time - world.time)] seconds"
global_data += "Choices:"
for(var/i in 1 to SSvote.choice_statclicks.len)
var/choice = SSvote.choice_statclicks[i]
var/ivotedforthis = FALSE
if(usr.ckey)
switch(SSvote.vote_system)
if(APPROVAL_VOTING)
ivotedforthis = SSvote.voted[usr.ckey] && (i in SSvote.voted[usr.ckey])
if(PLURALITY_VOTING)
ivotedforthis = SSvote.voted[usr.ckey] == i
global_data += (ivotedforthis? "\[X\]" : "\[ \]", SSvote.choice_statclicks[choice])
*/
encoded_global_data = url_encode(json_encode(global_data))
src.currentrun = GLOB.clients.Copy()
@@ -63,6 +41,31 @@ SUBSYSTEM_DEF(statpanels)
var/ping_str = url_encode("Ping: [round(target.lastping, 1)]ms (Average: [round(target.avgping, 1)]ms)")
var/other_str = url_encode(json_encode(target.mob.get_status_tab_items()))
target << output("[encoded_global_data];[ping_str];[other_str]", "statbrowser:update")
if(SSvote.mode)
var/list/vote_arry = list(
list("Vote active!", "There is currently a vote running. Question: [SSvote.question]")
) //see the MC on how this works.
if(!(SSvote.vote_system in list(PLURALITY_VOTING, APPROVAL_VOTING)))
vote_arry[++vote_arry.len] += list("STATPANEL VOTING DISABLED!", "The current vote system is not supported by statpanel rendering. Please vote manually by opening the vote popup using the action button or chat link.", "disabled")
//does not return.
else
vote_arry[++vote_arry.len] += list("Time Left:", " [round(SSvote.end_time - world.time)] seconds")
vote_arry[++vote_arry.len] += list("Choices:", "")
for(var/choice in SSvote.choice_statclicks)
var/choice_id = SSvote.choice_statclicks[choice]
var/ivotedforthis = FALSE
if(target.ckey)
switch(SSvote.vote_system)
if(APPROVAL_VOTING)
ivotedforthis = SSvote.voted[target.ckey] && (text2num(choice_id) in SSvote.voted[usr.ckey])
if(PLURALITY_VOTING)
ivotedforthis = (SSvote.voted[target.ckey] == text2num(choice_id))
vote_arry[++vote_arry.len] += list(ivotedforthis ? "\[X\]" : "\[ \]", choice, "[REF(SSvote)];vote=[choice_id];statpannel=1")
var/vote_str = url_encode(json_encode(vote_arry))
target << output("[vote_str]", "statbrowser:update_voting")
else
var/null_bullet = url_encode(json_encode(list(list(null))))
target << output("[null_bullet]", "statbrowser:update_voting")
if(!target.holder)
target << output("", "statbrowser:remove_admin_tabs")
else
+6 -48
View File
@@ -16,6 +16,7 @@ SUBSYSTEM_DEF(vote)
var/question = null
var/list/choices = list()
/// List of choice = object for statclick objects for statpanel voting
/// statclick rework? 2: list("name"="id")
var/list/choice_statclicks = list()
var/list/scores = list()
var/list/choice_descs = list() // optional descriptions
@@ -49,34 +50,6 @@ SUBSYSTEM_DEF(vote)
client_popup.open(0)
next_pop = world.time+VOTE_COOLDOWN
/**
* Renders a statpanel. Directly uses statpanel/stat calls since this is called from base of mob/Stat().
*/
/datum/controller/subsystem/vote/proc/render_statpanel(mob/M)
if(!mode) // check if vote is running
return
if(!statpanel("Status")) // don't bother if they're not focused on this panel
return
var/static/list/supported = list(PLURALITY_VOTING, APPROVAL_VOTING)
stat("Vote active!", "There is currently a vote running. Question: [question]")
if(!(vote_system in supported))
stat("<STATPANEL VOTING DISABLED>", "The current vote system is not supported by statpanel rendering. Please vote manually by opening the vote popup using the action button or chat link.")
return
stat("Time Left:", "[round(end_time - world.time)] seconds")
stat(null, null)
stat("Choices:", null)
stat(null, null)
for(var/i in 1 to choice_statclicks.len)
var/choice = choice_statclicks[i]
var/ivotedforthis = FALSE
switch(vote_system)
if(APPROVAL_VOTING)
ivotedforthis = voted[usr.ckey] && (i in voted[usr.ckey])
if(PLURALITY_VOTING)
ivotedforthis = voted[usr.ckey] == i
stat(ivotedforthis? "\[X\]" : "\[ \]", choice_statclicks[choice])
stat(null, null)
/datum/controller/subsystem/vote/proc/reset()
initiator = null
end_time = 0
@@ -87,26 +60,10 @@ SUBSYSTEM_DEF(vote)
voted.Cut()
voting.Cut()
scores.Cut()
cleanup_statclicks()
choice_statclicks = list()
display_votes = initial(display_votes) //CIT CHANGE - obfuscated votes
remove_action_buttons()
/datum/controller/subsystem/vote/proc/cleanup_statclicks()
for(var/choice in choice_statclicks)
qdel(choice_statclicks[choice])
choice_statclicks = list()
/obj/effect/statclick/vote
name = "ERROR"
var/choice
/obj/effect/statclick/vote/Click()
SSvote.submit_vote(choice)
/obj/effect/statclick/vote/New(loc, choice, name)
src.choice = choice
src.name = name
/datum/controller/subsystem/vote/proc/get_result()
//get the highest number of votes
var/greatest_votes = 0
@@ -582,10 +539,10 @@ SUBSYSTEM_DEF(vote)
to_chat(world, "\n<font color='purple'><b>[text]</b>\nType <b>vote</b> or click <a href='?src=[REF(src)]'>here</a> to place your votes.\nYou have [DisplayTimeText(vp)] to vote.</font>")
end_time = started_time+vp
// generate statclick list
cleanup_statclicks()
choice_statclicks = list()
for(var/i in 1 to choices.len)
var/choice = choices[i]
choice_statclicks[choice] = new /obj/effect/statclick/vote(null, i, choice)
choice_statclicks[choice] = "[i]"
//
for(var/c in GLOB.clients)
SEND_SOUND(c, sound('sound/misc/server-ready.ogg'))
@@ -785,7 +742,8 @@ SUBSYSTEM_DEF(vote)
submit_vote(round(text2num(href_list["vote"])),round(text2num(href_list["score"])))
else
submit_vote(round(text2num(href_list["vote"])))
usr.vote()
if(!href_list["statpannel"])
usr.vote()
/datum/controller/subsystem/vote/proc/remove_action_buttons()
for(var/v in generated_actions)