mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Allows players to call for restart or map vote (if everyone is dead and no admins online) (#32883)
* rock the vote * tweaks * Update voting.dm * should work * Update voting.js * Update voting.js * Update voting.dm
This commit is contained in:
@@ -347,11 +347,6 @@
|
|||||||
if("allow_admin_ooccolor")
|
if("allow_admin_ooccolor")
|
||||||
config.allow_admin_ooccolor = 1
|
config.allow_admin_ooccolor = 1
|
||||||
|
|
||||||
if ("allow_vote_restart")
|
|
||||||
config.allow_vote_restart = 1
|
|
||||||
|
|
||||||
if ("allow_vote_mode")
|
|
||||||
config.allow_vote_mode = 1
|
|
||||||
if ("allow_admin_jump")
|
if ("allow_admin_jump")
|
||||||
config.allow_admin_jump = 1
|
config.allow_admin_jump = 1
|
||||||
|
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ var/stacking_limit = 90
|
|||||||
|
|
||||||
if(living_players.len) //if anybody is around and alive in the current round
|
if(living_players.len) //if anybody is around and alive in the current round
|
||||||
last_time_of_population = world.time
|
last_time_of_population = world.time
|
||||||
else if(last_time_of_population && world.time - last_time_of_population > 5 MINUTES && world.time > 15 MINUTES) //if enough time has passed without it
|
else if(last_time_of_population && world.time - last_time_of_population > 1 HOURS) //if enough time has passed without it
|
||||||
ticker.station_nolife_cinematic()
|
ticker.station_nolife_cinematic()
|
||||||
if(world.time > (7 HOURS + 40 MINUTES) && world.time - last_time_of_late_shuttle_call > 1 HOURS && emergency_shuttle.direction == 0) // 8 hour work shift, with time for shuttle to arrive and leave. If recalled, do every hour
|
if(world.time > (7 HOURS + 40 MINUTES) && world.time - last_time_of_late_shuttle_call > 1 HOURS && emergency_shuttle.direction == 0) // 8 hour work shift, with time for shuttle to arrive and leave. If recalled, do every hour
|
||||||
shuttle_autocall("Shift due to end")
|
shuttle_autocall("Shift due to end")
|
||||||
|
|||||||
@@ -21,6 +21,6 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
if(player_list.len) //if anybody is in the current round
|
if(player_list.len) //if anybody is in the current round
|
||||||
last_time_of_players = world.time
|
last_time_of_players = world.time
|
||||||
if(last_time_of_players && world.time - last_time_of_players > 5 MINUTES && world.time > 15 MINUTES) //if enough time has passed without them
|
if(last_time_of_players && world.time - last_time_of_players > 1 HOURS) //if enough time has passed without them
|
||||||
CallHook("Reboot",list())
|
CallHook("Reboot",list())
|
||||||
world.Reboot()
|
world.Reboot()
|
||||||
@@ -71,6 +71,7 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
|
|
||||||
/datum/controller/vote/proc/reset()
|
/datum/controller/vote/proc/reset()
|
||||||
currently_voting = FALSE
|
currently_voting = FALSE
|
||||||
|
lock = FALSE
|
||||||
initiator = null
|
initiator = null
|
||||||
time_remaining = 0
|
time_remaining = 0
|
||||||
mode = null
|
mode = null
|
||||||
@@ -326,13 +327,12 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
if(currently_voting)
|
if(currently_voting)
|
||||||
message_admins("<span class='info'>[initiator_key] attempted to begin a vote, however a vote is already in progress.</span>")
|
message_admins("<span class='info'>[initiator_key] attempted to begin a vote, however a vote is already in progress.</span>")
|
||||||
return
|
return
|
||||||
currently_voting = TRUE
|
|
||||||
if(!mode)
|
if(!mode)
|
||||||
if(started_time != null && !check_rights(R_ADMIN))
|
if(started_time != null && !check_rights(R_ADMIN))
|
||||||
var/next_allowed_time = (started_time + config.vote_delay)
|
var/next_allowed_time = (started_time + config.vote_delay)
|
||||||
if(next_allowed_time > world.time)
|
if(next_allowed_time > world.time)
|
||||||
|
to_chat(user, "You must wait [(next_allowed_time - world.time)/10] seconds to call another vote.")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
reset()
|
reset()
|
||||||
switch(vote_type)
|
switch(vote_type)
|
||||||
if("restart")
|
if("restart")
|
||||||
@@ -377,6 +377,7 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
currently_voting = TRUE
|
||||||
mode = vote_type
|
mode = vote_type
|
||||||
initiator = initiator_key
|
initiator = initiator_key
|
||||||
started_time = world.time
|
started_time = world.time
|
||||||
@@ -490,14 +491,6 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
status_data += list(mode)
|
status_data += list(mode)
|
||||||
status_data += list(question)
|
status_data += list(question)
|
||||||
status_data += list(time_remaining)
|
status_data += list(time_remaining)
|
||||||
if(config.allow_vote_restart)
|
|
||||||
status_data += list(1)
|
|
||||||
else
|
|
||||||
status_data += list(0)
|
|
||||||
if(config.allow_vote_mode)
|
|
||||||
status_data += list(1)
|
|
||||||
else
|
|
||||||
status_data += list(0)
|
|
||||||
if(config.toggle_maps)
|
if(config.toggle_maps)
|
||||||
status_data += list(1)
|
status_data += list(1)
|
||||||
else
|
else
|
||||||
@@ -511,6 +504,12 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
var/mob/user = usr
|
var/mob/user = usr
|
||||||
if(!user || !user.client)
|
if(!user || !user.client)
|
||||||
return //not necessary but meh...just in-case somebody does something stupid
|
return //not necessary but meh...just in-case somebody does something stupid
|
||||||
|
|
||||||
|
var/living_players = 0
|
||||||
|
for(var/client/C in clients)
|
||||||
|
if(C && C.mob && C.mob.stat == CONSCIOUS)
|
||||||
|
living_players++
|
||||||
|
break
|
||||||
switch(href_list["vote"])
|
switch(href_list["vote"])
|
||||||
if ("cancel_vote")
|
if ("cancel_vote")
|
||||||
cancel_vote(user)
|
cancel_vote(user)
|
||||||
@@ -524,46 +523,56 @@ var/global/datum/controller/vote/vote = new()
|
|||||||
log_admin("[user] has cancelled a vote currently taking place. Vote type: [mode], question, [question].")
|
log_admin("[user] has cancelled a vote currently taking place. Vote type: [mode], question, [question].")
|
||||||
message_admins("[user] has cancelled a vote currently taking place. Vote type: [mode], question, [question].")
|
message_admins("[user] has cancelled a vote currently taking place. Vote type: [mode], question, [question].")
|
||||||
reset()
|
reset()
|
||||||
update()
|
else
|
||||||
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
if("rig")
|
if("rig")
|
||||||
if(user.client.holder)
|
if(user.client.holder)
|
||||||
rigvote()
|
rigvote()
|
||||||
update()
|
else
|
||||||
if("toggle_restart")
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
if(user.client.holder)
|
|
||||||
config.allow_vote_restart = !config.allow_vote_restart
|
|
||||||
update()
|
|
||||||
if("toggle_gamemode")
|
|
||||||
if(user.client.holder)
|
|
||||||
config.allow_vote_mode = !config.allow_vote_mode
|
|
||||||
update()
|
|
||||||
if("restart")
|
if("restart")
|
||||||
if(config.allow_vote_restart || user.client.holder)
|
if(user.client.holder)
|
||||||
initiate_vote("restart",user)
|
initiate_vote("restart",user)
|
||||||
|
else if(!length(admins) && !living_players)
|
||||||
|
initiate_vote("restart",user)
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='notice'> An admin is currently online. Ask them for a restart.")
|
||||||
if("gamemode")
|
if("gamemode")
|
||||||
if(config.allow_vote_mode || user.client.holder)
|
if(user.client.holder)
|
||||||
initiate_vote("gamemode",user)
|
initiate_vote("gamemode",user)
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='notice'> You can't do that! This doesn't work anyway.")
|
||||||
if("crew_transfer")
|
if("crew_transfer")
|
||||||
if(config.allow_vote_restart || user.client.holder)
|
if(user.client.holder)
|
||||||
initiate_vote("crew_transfer",user)
|
initiate_vote("crew_transfer",user)
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
if("custom")
|
if("custom")
|
||||||
if(user.client.holder)
|
if(user.client.holder)
|
||||||
initiate_vote("custom",user)
|
initiate_vote("custom",user)
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
if("map")
|
if("map")
|
||||||
if(user.client.holder)
|
if(user.client.holder)
|
||||||
initiate_vote("map",user)
|
initiate_vote("map",user)
|
||||||
update()
|
else if(!length(admins) && !living_players)
|
||||||
|
initiate_vote("restart",user)
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='notice'> An admin is currently online. Ask them for a map vote.")
|
||||||
if("toggle_map")
|
if("toggle_map")
|
||||||
if(user.client.holder)
|
if(user.client.holder)
|
||||||
config.toggle_maps = !config.toggle_maps
|
config.toggle_maps = !config.toggle_maps
|
||||||
update()
|
else
|
||||||
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
if("toggle_vote_method")
|
if("toggle_vote_method")
|
||||||
if(user.client.holder)
|
if(user.client.holder)
|
||||||
config.toggle_vote_method = config.toggle_vote_method % 4 + 1
|
config.toggle_vote_method = config.toggle_vote_method % 4 + 1
|
||||||
|
else
|
||||||
update()
|
to_chat(user, "<span class='notice'> You can't do that!")
|
||||||
|
//If not calling a vote, submit a vote
|
||||||
else
|
else
|
||||||
submit_vote(user, round(text2num(href_list["vote"])))
|
submit_vote(user, round(text2num(href_list["vote"])))
|
||||||
|
update()
|
||||||
user.vote()
|
user.vote()
|
||||||
|
|
||||||
/mob/verb/vote()
|
/mob/verb/vote()
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
var mode = null;
|
var mode = null;
|
||||||
var question = null;
|
var question = null;
|
||||||
var time_left = 0;
|
var time_left = 0;
|
||||||
var allow_restart = 0;
|
|
||||||
var allow_mode = 0 ;
|
|
||||||
var toggle_map = 0;
|
var toggle_map = 0;
|
||||||
var toggle_vote_method = 1;
|
var toggle_vote_method = 1;
|
||||||
var selected_vote = 0;
|
var selected_vote = 0;
|
||||||
@@ -10,7 +8,6 @@ var admin = 0;
|
|||||||
var updates = 0;
|
var updates = 0;
|
||||||
var clearallup = 0;
|
var clearallup = 0;
|
||||||
|
|
||||||
|
|
||||||
function clearAll(){
|
function clearAll(){
|
||||||
clearallup += 1;
|
clearallup += 1;
|
||||||
$("#vote_main").empty();
|
$("#vote_main").empty();
|
||||||
@@ -29,42 +26,24 @@ function client_data(selection, privs){
|
|||||||
admin = parseInt(privs) || 0;
|
admin = parseInt(privs) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_mode(newMode, newQuestion, newTimeleft, vrestart, vmode, vmap, vmethod){
|
function update_mode(newMode, newQuestion, newTimeleft, vmap, vmethod){
|
||||||
mode = newMode;
|
mode = newMode;
|
||||||
question = newQuestion;
|
question = newQuestion;
|
||||||
allow_mode = parseInt(vmode) || 0;
|
time_left = parseInt(newTimeleft) || 0;
|
||||||
allow_restart = parseInt(vrestart) || 0;
|
|
||||||
toggle_map = parseInt(vmap) || 0;
|
toggle_map = parseInt(vmap) || 0;
|
||||||
toggle_vote_method = parseInt(vmethod) || 1;
|
toggle_vote_method = parseInt(vmethod) || 1;
|
||||||
time_left = parseInt(newTimeleft) || 0;
|
|
||||||
$("#vote_choices").append($("<div class='item'></div>").append($("<div class='itemLabel'></div>").html("Time Left")).append($("<div class='itemContent'></div>").html(displayBar(time_left, 0, 60, (time_left >= 50) ? 'good' : (time_left >= 25) ? 'average' : 'bad', '<center>' + time_left + '</center>'))));
|
$("#vote_choices").append($("<div class='item'></div>").append($("<div class='itemLabel'></div>").html("Time Left")).append($("<div class='itemContent'></div>").html(displayBar(time_left, 0, 60, (time_left >= 50) ? 'good' : (time_left >= 25) ? 'average' : 'bad', '<center>' + time_left + '</center>'))));
|
||||||
$("#vote_choices").append($("<div class='item'></div>").append($("<div class='itemLabel'></div>").html("<br />Question")).append($("<div class='itemContentMedium'></div>").append($("<div class='statusDisplay'></div>").text(question))));
|
$("#vote_choices").append($("<div class='item'></div>").append($("<div class='itemLabel'></div>").html("<br />Question")).append($("<div class='itemContentMedium'></div>").append($("<div class='statusDisplay'></div>").text(question))));
|
||||||
if(admin > 0 || allow_restart > 0){
|
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=restart'>Restart</a>" + (admin == 2 ? "(<a href='?src=" + hSrc + ";vote=toggle_restart'>" + (allow_restart?"Allowed":"Disallowed") + "</a>)" : ""))));
|
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=crew_transfer'>Crew Transfer</a>")));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<font color='grey'>Restart</font>")));
|
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<font color='grey'>Crew Transfer</font>")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(admin > 0 || allow_mode > 0){
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=restart'>Call Restart Vote</a>")));
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=gamemode'>GameMode</a>" + (admin == 2 ? "(<a href='?src=" + hSrc + ";vote=toggle_gamemode'>" + (allow_mode?"Allowed":"Disallowed") + "</a>)" : ""))));
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=gamemode'>Call Gamemode Vote</a>")));
|
||||||
}
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=crew_transfer'>Call Crew Transfer Vote</a>")));
|
||||||
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=custom'>Call Custom Vote</a>")));
|
||||||
if(admin > 0){
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=map'>Call Map Vote</a>" + (admin == 2 ? "(<a href='?src=" + hSrc + ";vote=toggle_map'>" + (toggle_map?"All Compiled":"Votable") + "</a>)" : ""))));
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=custom'>Custom Vote</a>")));
|
if(admin > 0) {
|
||||||
}
|
|
||||||
|
|
||||||
if(admin > 0){
|
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=map'>Map</a>" + (admin == 2 ? "(<a href='?src=" + hSrc + ";vote=toggle_map'>" + (toggle_map?"All Compiled":"Votable") + "</a>)" : ""))));
|
|
||||||
}
|
|
||||||
if(admin > 0){
|
|
||||||
var a = ((toggle_vote_method == 1) ? "Weighted" : (toggle_vote_method == 2) ? "Majority" : (toggle_vote_method == 3) ? "Persistent" : (toggle_vote_method == 4) ? "Random" : "Null");
|
var a = ((toggle_vote_method == 1) ? "Weighted" : (toggle_vote_method == 2) ? "Majority" : (toggle_vote_method == 3) ? "Persistent" : (toggle_vote_method == 4) ? "Random" : "Null");
|
||||||
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=toggle_vote_method'>" + a + "</a>")));
|
$("#vote_main").append($("<div class='item'></div>").append($("<div class='itemContent'></div>").html("<a href='?src=" + hSrc + ";vote=toggle_vote_method'>" + a + "</a>")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode != null && mode != ""){
|
if(mode != null && mode != ""){
|
||||||
$("#vote_main").hide();
|
$("#vote_main").hide();
|
||||||
if(admin > 0){
|
if(admin > 0){
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ var/auxtools_path
|
|||||||
s["mode"] = master_mode
|
s["mode"] = master_mode
|
||||||
s["respawn"] = config ? abandon_allowed : 0
|
s["respawn"] = config ? abandon_allowed : 0
|
||||||
s["enter"] = enter_allowed
|
s["enter"] = enter_allowed
|
||||||
s["vote"] = config.allow_vote_mode
|
|
||||||
s["ai"] = config.allow_ai
|
s["ai"] = config.allow_ai
|
||||||
s["host"] = host ? host : null
|
s["host"] = host ? host : null
|
||||||
s["players"] = list()
|
s["players"] = list()
|
||||||
@@ -330,9 +329,6 @@ var/auxtools_path
|
|||||||
|
|
||||||
features += abandon_allowed ? "respawn" : "no respawn"
|
features += abandon_allowed ? "respawn" : "no respawn"
|
||||||
|
|
||||||
if (config && config.allow_vote_mode)
|
|
||||||
features += "vote"
|
|
||||||
|
|
||||||
if (config && config.allow_ai)
|
if (config && config.allow_ai)
|
||||||
features += "AI allowed"
|
features += "AI allowed"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user