Makes all global variables handled by the GLOB controller (#13152)

* Handlers converted, now to fix 3532 compile errors

* 3532 compile fixes later, got runtimes on startup

* Well the server loads now atleast

* Take 2

* Oops
This commit is contained in:
AffectedArc07
2020-03-20 21:56:37 -06:00
committed by GitHub
parent c8dbd0190e
commit 210f8badf4
667 changed files with 4243 additions and 4240 deletions
+6 -6
View File
@@ -1,15 +1,15 @@
/mob/new_player/Login()
update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying
if(join_motd)
to_chat(src, "<div class=\"motd\">[join_motd]</div>")
if(GLOB.join_motd)
to_chat(src, "<div class=\"motd\">[GLOB.join_motd]</div>")
if(!mind)
mind = new /datum/mind(key)
mind.active = 1
mind.current = src
if(length(newplayer_start))
loc = pick(newplayer_start)
if(length(GLOB.newplayer_start))
loc = pick(GLOB.newplayer_start)
else
loc = locate(1,1,1)
lastarea = loc
@@ -29,11 +29,11 @@
spawn(30)
// Annoy the player with polls.
establish_db_connection()
if(dbcon.IsConnected() && client && client.can_vote())
if(GLOB.dbcon.IsConnected() && client && client.can_vote())
var/isadmin = 0
if(client && client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
+31 -31
View File
@@ -27,11 +27,11 @@
return TRUE
establish_db_connection()
if(!dbcon.IsConnected())
if(!GLOB.dbcon.IsConnected())
tos_consent = TRUE
return TRUE
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM [format_table_name("privacy")] WHERE ckey='[src.ckey]' AND consent=1")
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("privacy")] WHERE ckey='[src.ckey]' AND consent=1")
query.Execute()
while(query.NextRow())
tos_consent = TRUE
@@ -80,11 +80,11 @@
if(!IsGuestKey(src.key))
establish_db_connection()
if(dbcon.IsConnected() && client.can_vote())
if(GLOB.dbcon.IsConnected() && client.can_vote())
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
@@ -111,13 +111,13 @@
stat("Game Mode:", "Secret")
else
if(SSticker.hide_mode == 0)
stat("Game Mode:", "[master_mode]") // Old setting for showing the game mode
stat("Game Mode:", "[GLOB.master_mode]") // Old setting for showing the game mode
else
stat("Game Mode: ", "Secret")
if((SSticker.current_state == GAME_STATE_PREGAME) && going)
if((SSticker.current_state == GAME_STATE_PREGAME) && SSticker.ticker_going)
stat("Time To Start:", round(SSticker.pregame_timeleft/10))
if((SSticker.current_state == GAME_STATE_PREGAME) && !going)
if((SSticker.current_state == GAME_STATE_PREGAME) && !SSticker.ticker_going)
stat("Time To Start:", "DELAYED")
if(SSticker.current_state == GAME_STATE_PREGAME)
@@ -143,7 +143,7 @@
if(href_list["consent_signed"])
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
var/DBQuery/query = dbcon.NewQuery("REPLACE INTO [format_table_name("privacy")] (ckey, datetime, consent) VALUES ('[ckey]', '[sqltime]', 1)")
var/DBQuery/query = GLOB.dbcon.NewQuery("REPLACE INTO [format_table_name("privacy")] (ckey, datetime, consent) VALUES ('[ckey]', '[sqltime]', 1)")
query.Execute()
src << browse(null, "window=privacy_consent")
tos_consent = 1
@@ -152,7 +152,7 @@
tos_consent = 0
to_chat(usr, "<span class='warning'>You must consent to the terms of service before you can join!</span>")
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
var/DBQuery/query = dbcon.NewQuery("REPLACE INTO [format_table_name("privacy")] (ckey, datetime, consent) VALUES ('[ckey]', '[sqltime]', 0)")
var/DBQuery/query = GLOB.dbcon.NewQuery("REPLACE INTO [format_table_name("privacy")] (ckey, datetime, consent) VALUES ('[ckey]', '[sqltime]', 0)")
query.Execute()
if(href_list["show_preferences"])
@@ -232,7 +232,7 @@
if(href_list["SelectedJob"])
if(!enter_allowed)
if(!GLOB.enter_allowed)
to_chat(usr, "<span class='notice'>There is an administrative lock on entering the game!</span>")
return
@@ -304,7 +304,7 @@
if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING)
to_chat(usr, "<span class='warning'>The round is either not ready, or has already finished...</span>")
return 0
if(!enter_allowed)
if(!GLOB.enter_allowed)
to_chat(usr, "<span class='notice'>There is an administrative lock on entering the game!</span>")
return 0
if(!IsJobAvailable(rank))
@@ -338,25 +338,25 @@
if(IsAdminJob(rank))
if(IsERTSpawnJob(rank))
character.loc = pick(ertdirector)
character.loc = pick(GLOB.ertdirector)
else if(IsSyndicateCommand(rank))
character.loc = pick(syndicateofficer)
character.loc = pick(GLOB.syndicateofficer)
else
character.forceMove(pick(aroomwarp))
character.forceMove(pick(GLOB.aroomwarp))
join_message = "has arrived"
else
if(spawning_at)
S = spawntypes[spawning_at]
S = GLOB.spawntypes[spawning_at]
if(S && istype(S))
if(S.check_job_spawning(rank))
character.forceMove(pick(S.turfs))
join_message = S.msg
else
to_chat(character, "Your chosen spawnpoint ([S.display_name]) is unavailable for your chosen job. Spawning you at the Arrivals shuttle instead.")
character.forceMove(pick(latejoin))
character.forceMove(pick(GLOB.latejoin))
join_message = "has arrived on the station"
else
character.forceMove(pick(latejoin))
character.forceMove(pick(GLOB.latejoin))
join_message = "has arrived on the station"
character.lastarea = get_area(loc)
@@ -375,7 +375,7 @@
else
SSticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. //TODO!!!!! ~Carn
if(!IsAdminJob(rank))
data_core.manifest_inject(character)
GLOB.data_core.manifest_inject(character)
AnnounceArrival(character, rank, join_message)
AddEmploymentContract(character)
@@ -412,11 +412,11 @@
if((character.mind.assigned_role != "Cyborg") && (character.mind.assigned_role != character.mind.special_role))
if(character.mind.role_alt_title)
rank = character.mind.role_alt_title
global_announcer.autosay("[character.real_name],[rank ? " [rank]," : " visitor," ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
GLOB.global_announcer.autosay("[character.real_name],[rank ? " [rank]," : " visitor," ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
/mob/new_player/proc/AddEmploymentContract(mob/living/carbon/human/employee)
spawn(30)
for(var/C in employmentCabinets)
for(var/C in GLOB.employmentCabinets)
var/obj/structure/filingcabinet/employment/employmentCabinet = C
if(!employmentCabinet.virgin)
employmentCabinet.addFile(employee)
@@ -436,7 +436,7 @@
if(character.mind)
if(character.mind.assigned_role != character.mind.special_role)
// can't use their name here, since cyborg namepicking is done post-spawn, so we'll just say "A new Cyborg has arrived"/"A new Android has arrived"/etc.
global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
GLOB.global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
/mob/new_player/proc/LateChoices()
var/mills = ROUND_TIME // 1/10 of a second, not real milliseconds but whatever
@@ -467,15 +467,15 @@
var/num_jobs_available = 0
var/list/activePlayers = list()
var/list/categorizedJobs = list(
"Command" = list(jobs = list(), titles = command_positions, color = "#aac1ee"),
"Engineering" = list(jobs = list(), titles = engineering_positions, color = "#ffd699"),
"Security" = list(jobs = list(), titles = security_positions, color = "#ff9999"),
"Command" = list(jobs = list(), titles = GLOB.command_positions, color = "#aac1ee"),
"Engineering" = list(jobs = list(), titles = GLOB.engineering_positions, color = "#ffd699"),
"Security" = list(jobs = list(), titles = GLOB.security_positions, color = "#ff9999"),
"Miscellaneous" = list(jobs = list(), titles = list(), color = "#ffffff", colBreak = 1),
"Synthetic" = list(jobs = list(), titles = nonhuman_positions, color = "#ccffcc"),
"Support / Service" = list(jobs = list(), titles = service_positions, color = "#cccccc"),
"Medical" = list(jobs = list(), titles = medical_positions, color = "#99ffe6", colBreak = 1),
"Science" = list(jobs = list(), titles = science_positions, color = "#e6b3e6"),
"Supply" = list(jobs = list(), titles = supply_positions, color = "#ead4ae"),
"Synthetic" = list(jobs = list(), titles = GLOB.nonhuman_positions, color = "#ccffcc"),
"Support / Service" = list(jobs = list(), titles = GLOB.service_positions, color = "#cccccc"),
"Medical" = list(jobs = list(), titles = GLOB.medical_positions, color = "#99ffe6", colBreak = 1),
"Science" = list(jobs = list(), titles = GLOB.science_positions, color = "#e6b3e6"),
"Supply" = list(jobs = list(), titles = GLOB.supply_positions, color = "#ead4ae"),
)
for(var/datum/job/job in SSjobs.occupations)
if(job && IsJobAvailable(job.title) && !job.barred_by_disability(client))
@@ -495,7 +495,7 @@
else
jobs += job
else // Put heads at top of non-command jobs
if(job.title in command_positions)
if(job.title in GLOB.command_positions)
jobs.Insert(1, job)
else
jobs += job
@@ -584,7 +584,7 @@
/mob/new_player/proc/ViewManifest()
var/dat = "<html><body>"
dat += "<h4>Crew Manifest</h4>"
dat += data_core.get_manifest(OOC = 1)
dat += GLOB.data_core.get_manifest(OOC = 1)
src << browse(dat, "window=manifest;size=370x420;can_close=1")
+45 -45
View File
@@ -12,12 +12,12 @@
/client/proc/handle_player_polling()
establish_db_connection()
if(dbcon.IsConnected())
if(GLOB.dbcon.IsConnected())
var/isadmin = 0
if(holder)
isadmin = 1
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, question, (id IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = '[ckey]') OR id IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = '[ckey]')) AS voted FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT id, question, (id IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = '[ckey]') OR id IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = '[ckey]')) AS voted FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime")
select_query.Execute()
var/output = "<div align='center'><B>Player polls</B>"
@@ -29,7 +29,7 @@
var/color1 = "#ececec"
var/color2 = "#e2e2e2"
var/i = 0
output += "<tr><th>Active Polls</th></tr>"
while(select_query.NextRow())
var/pollid = select_query.item[1]
@@ -39,14 +39,14 @@
if(can_vote() && !voted)
output += "<tr><td>[poll_player(pollid, 1)]</tr></td>"
i++
// Show expired polls. Non admins can view admin polls at this stage
// Show expired polls. Non admins can view admin polls at this stage
// (just like tgstation's web interface so don't complain)
// (Also why was there no ingame interface tg not having an ingame
// interface is retarded because it cucks downstreams)
select_query = dbcon.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() > endtime ORDER BY id DESC")
select_query = GLOB.dbcon.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() > endtime ORDER BY id DESC")
select_query.Execute()
output += "<tr><th>Expired Polls</th></tr>"
while(select_query.NextRow())
var/pollid = select_query.item[1]
@@ -61,9 +61,9 @@
if(pollid == -1)
return
establish_db_connection()
if(!dbcon.IsConnected())
if(!GLOB.dbcon.IsConnected())
return
var/DBQuery/select_query = dbcon.NewQuery("SELECT polltype, question, adminonly, multiplechoiceoptions, starttime, endtime FROM [format_table_name("poll_question")] WHERE id = [pollid] AND endtime < Now()")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT polltype, question, adminonly, multiplechoiceoptions, starttime, endtime FROM [format_table_name("poll_question")] WHERE id = [pollid] AND endtime < Now()")
select_query.Execute()
var/question = ""
var/polltype = ""
@@ -84,15 +84,15 @@
if(!found)
to_chat(src, "<span class='warning'>Poll question details not found. (Maybe the poll isn't expired yet?)</span>")
return
if(polltype == POLLTYPE_MULTI)
question += " (Choose up to [multiplechoiceoptions] options)"
if(adminonly)
question = "(<font color='#997700'>Admin only poll</font>) " + question
var output = "<!DOCTYPE html><html><body>"
if(polltype == POLLTYPE_MULTI || polltype == POLLTYPE_OPTION)
select_query = dbcon.NewQuery("SELECT text, percentagecalc, (SELECT COUNT(optionid) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id GROUP BY optionid) AS votecount FROM [format_table_name("poll_option")] WHERE pollid = [pollid]");
select_query = GLOB.dbcon.NewQuery("SELECT text, percentagecalc, (SELECT COUNT(optionid) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id GROUP BY optionid) AS votecount FROM [format_table_name("poll_option")] WHERE pollid = [pollid]");
select_query.Execute()
var/list/options = list()
var/total_votes = 1
@@ -140,7 +140,7 @@
<tr bgcolor='#ddffdd'>
<th colspan='4' align='center'>[question]<br><font size='1'><b>[starttime] - [endtime]</b></font></th>
</tr>"}
select_query = dbcon.NewQuery("SELECT id, text, (SELECT AVG(rating) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id AND rating != 'abstain') AS avgrating, (SELECT COUNT(rating) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id AND rating != 'abstain') AS countvotes, minval, maxval FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
select_query = GLOB.dbcon.NewQuery("SELECT id, text, (SELECT AVG(rating) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id AND rating != 'abstain') AS avgrating, (SELECT COUNT(rating) FROM [format_table_name("poll_vote")] WHERE optionid = poll_option.id AND rating != 'abstain') AS countvotes, minval, maxval FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
select_query.Execute()
while(select_query.NextRow())
output += {"
@@ -156,7 +156,7 @@
var/maxvote = 1
var/list/votecounts = list()
for(var/I in minval to maxval)
var/DBQuery/rating_query = dbcon.NewQuery("SELECT COUNT(rating) AS countrating FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND rating = [I] GROUP BY rating")
var/DBQuery/rating_query = GLOB.dbcon.NewQuery("SELECT COUNT(rating) AS countrating FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND rating = [I] GROUP BY rating")
rating_query.Execute()
var/votecount = 0
while(rating_query.NextRow())
@@ -177,7 +177,7 @@
output += "</table></td></tr>"
output += "</table>"
if(polltype == POLLTYPE_TEXT)
select_query = dbcon.NewQuery("SELECT replytext, COUNT(replytext) AS countresponse, GROUP_CONCAT(DISTINCT ckey SEPARATOR ', ') as ckeys FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] GROUP BY replytext ORDER BY countresponse DESC");
select_query = GLOB.dbcon.NewQuery("SELECT replytext, COUNT(replytext) AS countresponse, GROUP_CONCAT(DISTINCT ckey SEPARATOR ', ') as ckeys FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] GROUP BY replytext ORDER BY countresponse DESC");
select_query.Execute()
output += {"
<table width='900' align='center' bgcolor='#eeffee' cellspacing='0' cellpadding='4'>
@@ -195,15 +195,15 @@
</tr>"}
output += "</table>"
output += "</body></html>"
src << browse(output,"window=pollresults;size=950x500")
/client/proc/poll_player(var/pollid = -1, var/inline = 0)
if(pollid == -1) return
establish_db_connection()
if(dbcon.IsConnected())
if(GLOB.dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
select_query.Execute()
var/pollstarttime = ""
@@ -229,7 +229,7 @@
switch(polltype)
//Polls that have enumerated options
if(POLLTYPE_OPTION)
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
voted_query.Execute()
var/voted = 0 // If the can't vote then consider them voted
@@ -241,21 +241,21 @@
var/list/datum/polloption/options = list()
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
var/DBQuery/options_query = GLOB.dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
options_query.Execute()
while(options_query.NextRow())
var/datum/polloption/PO = new()
PO.optionid = text2num(options_query.item[1])
PO.optiontext = options_query.item[2]
options += PO
var/output
if(!inline)
output += "<div align='center'><B>Player poll</B>"
output +="<hr>"
output += "<b>Question: [pollquestion]</b><br>"
output += "<font size='2'>Poll runs from <b>[pollstarttime]</b> until <b>[pollendtime]</b></font><p>"
if(canvote && !voted) //Only make this a form if we have not voted yet
output += "<form name='cardcomp' action='byond://' method='get'>"
output += "<input type='hidden' name='votepollid' value='[pollid]'>"
@@ -278,7 +278,7 @@
output += "</form>"
output += "</div>"
if(inline)
return output
else
@@ -286,7 +286,7 @@
//Polls with a text input
if(POLLTYPE_TEXT)
var/DBQuery/voted_query = dbcon.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
voted_query.Execute()
var/voted = 0
@@ -296,7 +296,7 @@
voted = 1
break
var/output
if(!inline)
output += "<div align='center'><B>Player poll</B>"
@@ -323,7 +323,7 @@
output += "</form>"
else
output += "[vote_text]"
if(inline)
return output
else
@@ -331,9 +331,9 @@
//Polls with a text input
if(POLLTYPE_RATING)
var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM [format_table_name("poll_option")] o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[ckey]' AND o.id = v.optionid")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT o.text, v.rating FROM [format_table_name("poll_option")] o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[ckey]' AND o.id = v.optionid")
voted_query.Execute()
var/output
if(!inline)
output += "<div align='center'><B>Player poll</B>"
@@ -358,7 +358,7 @@
var/minid = 999999
var/maxid = 0
var/DBQuery/option_query = dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
var/DBQuery/option_query = GLOB.dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
option_query.Execute()
while(option_query.NextRow())
var/optionid = text2num(option_query.item[1])
@@ -404,7 +404,7 @@
else
src << browse(output,"window=playerpoll;size=500x500")
if(POLLTYPE_MULTI)
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
voted_query.Execute()
var/list/votedfor = list()
@@ -417,7 +417,7 @@
var/maxoptionid = 0
var/minoptionid = 0
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
var/DBQuery/options_query = GLOB.dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
options_query.Execute()
while(options_query.NextRow())
var/datum/polloption/PO = new()
@@ -478,9 +478,9 @@
if(!isnum(pollid) || !isnum(optionid))
return
establish_db_connection()
if(dbcon.IsConnected())
if(GLOB.dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
select_query.Execute()
var/validpoll = 0
@@ -498,7 +498,7 @@
to_chat(usr, "<span class='warning'>Poll is not valid.</span>")
return
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE id = [optionid] AND pollid = [pollid]")
var/DBQuery/select_query2 = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE id = [optionid] AND pollid = [pollid]")
select_query2.Execute()
var/validoption = 0
@@ -513,7 +513,7 @@
var/alreadyvoted = 0
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
voted_query.Execute()
while(voted_query.NextRow())
@@ -534,7 +534,7 @@
adminrank = usr.client.holder.rank
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank) VALUES (null, Now(), [pollid], [optionid], '[ckey]', '[usr.client.address]', '[adminrank]')")
var/DBQuery/insert_query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank) VALUES (null, Now(), [pollid], [optionid], '[ckey]', '[usr.client.address]', '[adminrank]')")
insert_query.Execute()
to_chat(usr, "<span class='notice'>Vote successful.</span>")
@@ -548,9 +548,9 @@
if(!isnum(pollid) || !istext(replytext))
return
establish_db_connection()
if(dbcon.IsConnected())
if(GLOB.dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
select_query.Execute()
var/validpoll = 0
@@ -567,7 +567,7 @@
var/alreadyvoted = 0
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
voted_query.Execute()
while(voted_query.NextRow())
@@ -592,7 +592,7 @@
to_chat(usr, "The text you entered was blank, contained illegal characters or was too long. Please correct the text and submit again.")
return
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO [format_table_name("poll_textreply")] (id ,datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (null, Now(), [pollid], '[ckey]', '[usr.client.address]', '[replytext]', '[adminrank]')")
var/DBQuery/insert_query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_textreply")] (id ,datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (null, Now(), [pollid], '[ckey]', '[usr.client.address]', '[replytext]', '[adminrank]')")
insert_query.Execute()
to_chat(usr, "<span class='notice'>Feedback logging successful.</span>")
@@ -606,9 +606,9 @@
if(!isnum(pollid) || !isnum(optionid))
return
establish_db_connection()
if(dbcon.IsConnected())
if(GLOB.dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime [holder ? "AND adminonly = 0" : ""]")
select_query.Execute()
var/validpoll = 0
@@ -623,7 +623,7 @@
to_chat(usr, "<span class='warning'>Poll is not valid.</span>")
return
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE id = [optionid] AND pollid = [pollid]")
var/DBQuery/select_query2 = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE id = [optionid] AND pollid = [pollid]")
select_query2.Execute()
var/validoption = 0
@@ -638,7 +638,7 @@
var/alreadyvoted = 0
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND ckey = '[ckey]'")
var/DBQuery/voted_query = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND ckey = '[ckey]'")
voted_query.Execute()
while(voted_query.NextRow())
@@ -654,7 +654,7 @@
adminrank = usr.client.holder.rank
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
var/DBQuery/insert_query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
insert_query.Execute()
to_chat(usr, "<span class='notice'>Vote successful.</span>")
@@ -9,7 +9,7 @@
if(S.bodyflags & ALL_RPARTS)
var/head_model = "[!rlimb_data["head"] ? "Morpheus Cyberkinetics" : rlimb_data["head"]]"
robohead = all_robolimbs[head_model]
robohead = GLOB.all_robolimbs[head_model]
if(gender_override)
gender = gender_override
else
@@ -17,7 +17,7 @@
underwear = random_underwear(gender, species)
undershirt = random_undershirt(gender, species)
socks = random_socks(gender, species)
if(body_accessory_by_species[species])
if(GLOB.body_accessory_by_species[species])
body_accessory = random_body_accessory(species)
if(body_accessory == "None") //Required to prevent a bug where the information/icons in the character preferences screen wouldn't update despite the data being changed.
body_accessory = null
@@ -253,8 +253,8 @@
if(organ_data[name] == "amputated") continue
if(organ_data[name] == "cyborg")
var/datum/robolimb/R
if(rlimb_data[name]) R = all_robolimbs[rlimb_data[name]]
if(!R) R = basic_robolimb
if(rlimb_data[name]) R = GLOB.all_robolimbs[rlimb_data[name]]
if(!R) R = GLOB.basic_robolimb
if(name == "chest")
name = "torso"
preview_icon.Blend(icon(R.icon, "[name]"), ICON_OVERLAY) // This doesn't check gendered_icon. Not an issue while only limbs can be robotic.
@@ -281,7 +281,7 @@
var/blend_mode = ICON_ADD
if(body_accessory)
var/datum/body_accessory/accessory = body_accessory_by_name[body_accessory]
var/datum/body_accessory/accessory = GLOB.body_accessory_by_name[body_accessory]
tail_icon = accessory.icon
tail_icon_state = accessory.icon_state
if(accessory.blend_mode)