mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Merge pull request #3025 from Crazylemon64/infinite_antags
Infinite antag tags
This commit is contained in:
@@ -33,7 +33,7 @@ client/proc/one_click_antag()
|
||||
var/datum/mind/themind = null
|
||||
|
||||
for(var/mob/living/silicon/ai/ai in player_list)
|
||||
if(ai.client && ai.client.prefs.be_special & BE_MALF)
|
||||
if(ai.client && (ROLE_MALF in ai.client.prefs.be_special))
|
||||
AIs += ai
|
||||
|
||||
if(AIs.len)
|
||||
@@ -57,8 +57,8 @@ client/proc/one_click_antag()
|
||||
var/mob/living/carbon/human/H = null
|
||||
|
||||
for(var/mob/living/carbon/human/applicant in player_list)
|
||||
if(applicant.client.prefs.be_special & BE_TRAITOR)
|
||||
if(player_old_enough_antag(applicant.client,BE_TRAITOR))
|
||||
if(ROLE_TRAITOR in applicant.client.prefs.be_special)
|
||||
if(player_old_enough_antag(applicant.client,ROLE_TRAITOR))
|
||||
if(!applicant.stat)
|
||||
if(applicant.mind)
|
||||
if (!applicant.mind.special_role)
|
||||
@@ -91,8 +91,8 @@ client/proc/one_click_antag()
|
||||
var/mob/living/carbon/human/H = null
|
||||
|
||||
for(var/mob/living/carbon/human/applicant in player_list)
|
||||
if(applicant.client.prefs.be_special & BE_CHANGELING)
|
||||
if(player_old_enough_antag(applicant.client,BE_CHANGELING))
|
||||
if(ROLE_CHANGELING in applicant.client.prefs.be_special)
|
||||
if(player_old_enough_antag(applicant.client,ROLE_CHANGELING))
|
||||
if(!applicant.stat)
|
||||
if(applicant.mind)
|
||||
if (!applicant.mind.special_role)
|
||||
@@ -123,8 +123,8 @@ client/proc/one_click_antag()
|
||||
var/mob/living/carbon/human/H = null
|
||||
|
||||
for(var/mob/living/carbon/human/applicant in player_list)
|
||||
if(applicant.client.prefs.be_special & BE_REV)
|
||||
if(player_old_enough_antag(applicant.client,BE_REV))
|
||||
if(ROLE_REV in applicant.client.prefs.be_special)
|
||||
if(player_old_enough_antag(applicant.client,ROLE_REV))
|
||||
if(applicant.stat == CONSCIOUS)
|
||||
if(applicant.mind)
|
||||
if(!applicant.mind.special_role)
|
||||
@@ -150,9 +150,9 @@ client/proc/one_click_antag()
|
||||
var/time_passed = world.time
|
||||
|
||||
for(var/mob/G in respawnable_list)
|
||||
if(istype(G) && G.client && G.client.prefs.be_special & BE_WIZARD)
|
||||
if(istype(G) && G.client && (ROLE_WIZARD in G.client.prefs.be_special))
|
||||
if(!jobban_isbanned(G, "wizard") && !jobban_isbanned(G, "Syndicate"))
|
||||
if(player_old_enough_antag(G.client,BE_WIZARD))
|
||||
if(player_old_enough_antag(G.client,ROLE_WIZARD))
|
||||
spawn(0)
|
||||
switch(G.timed_alert("Do you wish to be considered for the position of Space Wizard Foundation 'diplomat'?","Please answer in 30 seconds!","No",300,"Yes","No"))//alert(G, "Do you wish to be considered for the position of Space Wizard Foundation 'diplomat'?","Please answer in 30 seconds!","Yes","No"))
|
||||
if("Yes")
|
||||
@@ -192,8 +192,8 @@ client/proc/one_click_antag()
|
||||
var/mob/living/carbon/human/H = null
|
||||
|
||||
for(var/mob/living/carbon/human/applicant in player_list)
|
||||
if(applicant.client.prefs.be_special & BE_CULTIST)
|
||||
if(player_old_enough_antag(applicant.client,BE_CULTIST))
|
||||
if(ROLE_CULTIST in applicant.client.prefs.be_special)
|
||||
if(player_old_enough_antag(applicant.client,ROLE_CULTIST))
|
||||
if(applicant.stat == CONSCIOUS)
|
||||
if(applicant.mind)
|
||||
if(!applicant.mind.special_role)
|
||||
@@ -224,9 +224,9 @@ client/proc/one_click_antag()
|
||||
var/time_passed = world.time
|
||||
|
||||
for(var/mob/G in respawnable_list)
|
||||
if(istype(G) && G.client && G.client.prefs.be_special & BE_OPERATIVE)
|
||||
if(istype(G) && G.client && (ROLE_OPERATIVE in G.client.prefs.be_special))
|
||||
if(!jobban_isbanned(G, "operative") && !jobban_isbanned(G, "Syndicate"))
|
||||
if(player_old_enough_antag(G.client,BE_OPERATIVE))
|
||||
if(player_old_enough_antag(G.client,ROLE_OPERATIVE))
|
||||
spawn(0)
|
||||
switch(alert(G,"Do you wish to be considered for a nuke team being sent in?","Please answer in 30 seconds!","Yes","No"))
|
||||
if("Yes")
|
||||
@@ -442,8 +442,8 @@ client/proc/one_click_antag()
|
||||
|
||||
//Generates a list of candidates from active ghosts.
|
||||
for(var/mob/G in respawnable_list)
|
||||
if(istype(G) && G.client && G.client.prefs.be_special & BE_RAIDER)
|
||||
if(player_old_enough_antag(G.client,BE_RAIDER))
|
||||
if(istype(G) && G.client && (ROLE_RAIDER in G.client.prefs.be_special))
|
||||
if(player_old_enough_antag(G.client,ROLE_RAIDER))
|
||||
if(!jobban_isbanned(G, "raider") && !jobban_isbanned(G, "Syndicate"))
|
||||
spawn(0)
|
||||
switch(alert(G,"Do you wish to be considered for a vox raiding party arriving on the station?","Please answer in 30 seconds!","Yes","No"))
|
||||
@@ -543,8 +543,8 @@ client/proc/one_click_antag()
|
||||
var/mob/living/carbon/human/H = null
|
||||
|
||||
for(var/mob/living/carbon/human/applicant in player_list)
|
||||
if(applicant.client.prefs.be_special & BE_VAMPIRE)
|
||||
if(player_old_enough_antag(applicant.client,BE_VAMPIRE))
|
||||
if(ROLE_VAMPIRE in applicant.client.prefs.be_special)
|
||||
if(player_old_enough_antag(applicant.client,ROLE_VAMPIRE))
|
||||
if(!applicant.stat)
|
||||
if(applicant.mind)
|
||||
if (!applicant.mind.special_role)
|
||||
|
||||
@@ -444,7 +444,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
var/list/candidates = list()
|
||||
for(var/mob/M in player_list)
|
||||
if(M.stat != DEAD) continue //we are not dead!
|
||||
if(!M.client.prefs.be_special & BE_ALIEN) continue //we don't want to be an alium
|
||||
if(!(ROLE_ALIEN in M.client.prefs.be_special)) continue //we don't want to be an alium
|
||||
if(jobban_isbanned(M, "alien") || jobban_isbanned(M, "Syndicate")) continue //we are jobbanned
|
||||
if(M.client.is_afk()) continue //we are afk
|
||||
if(M.mind && M.mind.current && M.mind.current.stat != DEAD) continue //we have a live body we are tied to
|
||||
|
||||
+1323
-1332
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
UI_style,
|
||||
UI_style_color,
|
||||
UI_style_alpha,
|
||||
be_special,
|
||||
be_role,
|
||||
default_slot,
|
||||
toggles,
|
||||
sound,
|
||||
@@ -28,18 +28,19 @@
|
||||
UI_style = query.item[2]
|
||||
UI_style_color = query.item[3]
|
||||
UI_style_alpha = text2num(query.item[4])
|
||||
be_special = text2num(query.item[5])
|
||||
be_special = params2list(query.item[5])
|
||||
default_slot = text2num(query.item[6])
|
||||
toggles = text2num(query.item[7])
|
||||
sound = text2num(query.item[8])
|
||||
randomslot = text2num(query.item[9])
|
||||
volume = text2num(query.item[10])
|
||||
|
||||
old_roles_to_new(C)
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
// lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
|
||||
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
|
||||
sound = sanitize_integer(sound, 0, 65535, initial(sound))
|
||||
@@ -51,13 +52,19 @@
|
||||
|
||||
/datum/preferences/proc/save_preferences(client/C)
|
||||
|
||||
// Might as well scrub out any malformed be_special list entries while we're here
|
||||
for (var/role in be_special)
|
||||
if(!(role in special_roles))
|
||||
log_to_dd("[C.key] had a malformed role entry: '[role]'. Removing!")
|
||||
be_special -= role
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery({"UPDATE [format_table_name("player")]
|
||||
SET
|
||||
ooccolor='[ooccolor]',
|
||||
UI_style='[UI_style]',
|
||||
UI_style_color='[UI_style_color]',
|
||||
UI_style_alpha='[UI_style_alpha]',
|
||||
be_special='[be_special]',
|
||||
be_role='[list2params(sql_sanitize_text_list(be_special))]',
|
||||
default_slot='[default_slot]',
|
||||
toggles='[toggles]',
|
||||
sound='[sound]',
|
||||
@@ -82,7 +89,60 @@
|
||||
var/DBQuery/firstquery = dbcon.NewQuery("UPDATE [format_table_name("player")] SET default_slot=[slot] WHERE ckey='[C.ckey]'")
|
||||
firstquery.Execute()
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM [format_table_name("characters")] WHERE ckey='[C.ckey]' AND slot='[slot]'")
|
||||
// Let's not have this explode if you sneeze on the DB
|
||||
var/DBQuery/query = dbcon.NewQuery({"SELECT
|
||||
OOC_Notes,
|
||||
real_name,
|
||||
name_is_always_random,
|
||||
gender,
|
||||
age,
|
||||
species,
|
||||
language,
|
||||
hair_red,
|
||||
hair_green,
|
||||
hair_blue,
|
||||
facial_red,
|
||||
facial_green,
|
||||
facial_blue,
|
||||
skin_tone,
|
||||
skin_red,
|
||||
skin_green,
|
||||
skin_blue,
|
||||
hair_style_name,
|
||||
facial_style_name,
|
||||
eyes_red,
|
||||
eyes_green,
|
||||
eyes_blue,
|
||||
underwear,
|
||||
undershirt,
|
||||
backbag,
|
||||
b_type,
|
||||
alternate_option,
|
||||
job_support_high,
|
||||
job_support_med,
|
||||
job_support_low,
|
||||
job_medsci_high,
|
||||
job_medsci_med,
|
||||
job_medsci_low,
|
||||
job_engsec_high,
|
||||
job_engsec_med,
|
||||
job_engsec_low,
|
||||
job_karma_high,
|
||||
job_karma_med,
|
||||
job_karma_low,
|
||||
flavor_text,
|
||||
med_record,
|
||||
sec_record,
|
||||
gen_record,
|
||||
disabilities,
|
||||
player_alt_titles,
|
||||
organ_data,
|
||||
rlimb_data,
|
||||
nanotrasen_relation,
|
||||
speciesprefs,
|
||||
socks,
|
||||
body_accessory
|
||||
FROM [format_table_name("characters")] WHERE ckey='[C.ckey]' AND slot='[slot]'"})
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during character slot loading. Error : \[[err]\]\n")
|
||||
@@ -91,68 +151,67 @@
|
||||
|
||||
while(query.NextRow())
|
||||
//Character
|
||||
metadata = query.item[4]
|
||||
real_name = query.item[5]
|
||||
be_random_name = text2num(query.item[6])
|
||||
gender = query.item[7]
|
||||
age = text2num(query.item[8])
|
||||
species = query.item[9]
|
||||
language = query.item[10]
|
||||
metadata = query.item[1]
|
||||
real_name = query.item[2]
|
||||
be_random_name = text2num(query.item[3])
|
||||
gender = query.item[4]
|
||||
age = text2num(query.item[5])
|
||||
species = query.item[6]
|
||||
language = query.item[7]
|
||||
|
||||
//colors to be consolidated into hex strings (requires some work with dna code)
|
||||
r_hair = text2num(query.item[11])
|
||||
g_hair = text2num(query.item[12])
|
||||
b_hair = text2num(query.item[13])
|
||||
r_facial = text2num(query.item[14])
|
||||
g_facial = text2num(query.item[15])
|
||||
b_facial = text2num(query.item[16])
|
||||
s_tone = text2num(query.item[17])
|
||||
r_skin = text2num(query.item[18])
|
||||
g_skin = text2num(query.item[19])
|
||||
b_skin = text2num(query.item[20])
|
||||
h_style = query.item[21]
|
||||
f_style = query.item[22]
|
||||
r_eyes = text2num(query.item[23])
|
||||
g_eyes = text2num(query.item[24])
|
||||
b_eyes = text2num(query.item[25])
|
||||
underwear = query.item[26]
|
||||
undershirt = query.item[27]
|
||||
backbag = text2num(query.item[28])
|
||||
b_type = query.item[29]
|
||||
r_hair = text2num(query.item[8])
|
||||
g_hair = text2num(query.item[9])
|
||||
b_hair = text2num(query.item[10])
|
||||
r_facial = text2num(query.item[11])
|
||||
g_facial = text2num(query.item[12])
|
||||
b_facial = text2num(query.item[13])
|
||||
s_tone = text2num(query.item[14])
|
||||
r_skin = text2num(query.item[15])
|
||||
g_skin = text2num(query.item[16])
|
||||
b_skin = text2num(query.item[17])
|
||||
h_style = query.item[18]
|
||||
f_style = query.item[19]
|
||||
r_eyes = text2num(query.item[20])
|
||||
g_eyes = text2num(query.item[21])
|
||||
b_eyes = text2num(query.item[22])
|
||||
underwear = query.item[23]
|
||||
undershirt = query.item[24]
|
||||
backbag = text2num(query.item[25])
|
||||
b_type = query.item[26]
|
||||
|
||||
|
||||
//Jobs
|
||||
alternate_option = text2num(query.item[30])
|
||||
job_support_high = text2num(query.item[31])
|
||||
job_support_med = text2num(query.item[32])
|
||||
job_support_low = text2num(query.item[33])
|
||||
job_medsci_high = text2num(query.item[34])
|
||||
job_medsci_med = text2num(query.item[35])
|
||||
job_medsci_low = text2num(query.item[36])
|
||||
job_engsec_high = text2num(query.item[37])
|
||||
job_engsec_med = text2num(query.item[38])
|
||||
job_engsec_low = text2num(query.item[39])
|
||||
job_karma_high = text2num(query.item[40])
|
||||
job_karma_med = text2num(query.item[41])
|
||||
job_karma_low = text2num(query.item[42])
|
||||
alternate_option = text2num(query.item[27])
|
||||
job_support_high = text2num(query.item[28])
|
||||
job_support_med = text2num(query.item[29])
|
||||
job_support_low = text2num(query.item[30])
|
||||
job_medsci_high = text2num(query.item[31])
|
||||
job_medsci_med = text2num(query.item[32])
|
||||
job_medsci_low = text2num(query.item[33])
|
||||
job_engsec_high = text2num(query.item[34])
|
||||
job_engsec_med = text2num(query.item[35])
|
||||
job_engsec_low = text2num(query.item[36])
|
||||
job_karma_high = text2num(query.item[37])
|
||||
job_karma_med = text2num(query.item[38])
|
||||
job_karma_low = text2num(query.item[39])
|
||||
|
||||
//Miscellaneous
|
||||
flavor_text = query.item[43]
|
||||
med_record = query.item[44]
|
||||
sec_record = query.item[45]
|
||||
gen_record = query.item[46]
|
||||
be_special = text2num(query.item[47])
|
||||
disabilities = text2num(query.item[48])
|
||||
player_alt_titles = params2list(query.item[49])
|
||||
organ_data = params2list(query.item[50])
|
||||
rlimb_data = params2list(query.item[51])
|
||||
nanotrasen_relation = query.item[52]
|
||||
speciesprefs = text2num(query.item[53])
|
||||
flavor_text = query.item[40]
|
||||
med_record = query.item[41]
|
||||
sec_record = query.item[42]
|
||||
gen_record = query.item[43]
|
||||
disabilities = text2num(query.item[44])
|
||||
player_alt_titles = params2list(query.item[45])
|
||||
organ_data = params2list(query.item[46])
|
||||
rlimb_data = params2list(query.item[47])
|
||||
nanotrasen_relation = query.item[48]
|
||||
speciesprefs = text2num(query.item[49])
|
||||
|
||||
//socks
|
||||
socks = query.item[54]
|
||||
body_accessory = query.item[55]
|
||||
|
||||
socks = query.item[50]
|
||||
body_accessory = query.item[51]
|
||||
|
||||
//Sanitize
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = reject_bad_name(real_name)
|
||||
@@ -198,7 +257,6 @@
|
||||
job_karma_med = sanitize_integer(job_karma_med, 0, 65535, initial(job_karma_med))
|
||||
job_karma_low = sanitize_integer(job_karma_low, 0, 65535, initial(job_karma_low))
|
||||
disabilities = sanitize_integer(disabilities, 0, 65535, initial(disabilities))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
|
||||
socks = sanitize_text(socks, initial(socks))
|
||||
body_accessory = sanitize_text(body_accessory, initial(body_accessory))
|
||||
@@ -269,7 +327,6 @@
|
||||
sec_record='[sql_sanitize_text(html_decode(sec_record))]',
|
||||
gen_record='[sql_sanitize_text(html_decode(gen_record))]',
|
||||
player_alt_titles='[playertitlelist]',
|
||||
be_special='[be_special]',
|
||||
disabilities='[disabilities]',
|
||||
organ_data='[organlist]',
|
||||
rlimb_data='[rlimblist]',
|
||||
@@ -303,7 +360,7 @@
|
||||
job_engsec_high, job_engsec_med, job_engsec_low,
|
||||
job_karma_high, job_karma_med, job_karma_low,
|
||||
flavor_text, med_record, sec_record, gen_record,
|
||||
player_alt_titles, be_special,
|
||||
player_alt_titles,
|
||||
disabilities, organ_data, rlimb_data, nanotrasen_relation, speciesprefs,
|
||||
socks, body_accessory)
|
||||
|
||||
@@ -322,7 +379,7 @@
|
||||
'[job_engsec_high]', '[job_engsec_med]', '[job_engsec_low]',
|
||||
'[job_karma_high]', '[job_karma_med]', '[job_karma_low]',
|
||||
'[sql_sanitize_text(html_encode(flavor_text))]', '[sql_sanitize_text(html_encode(med_record))]', '[sql_sanitize_text(html_encode(sec_record))]', '[sql_sanitize_text(html_encode(gen_record))]',
|
||||
'[playertitlelist]', '[be_special]',
|
||||
'[playertitlelist]',
|
||||
'[disabilities]', '[organlist]', '[rlimblist]', '[nanotrasen_relation]', '[speciesprefs]',
|
||||
'[socks]', '[body_accessory]')
|
||||
|
||||
@@ -335,6 +392,99 @@
|
||||
message_admins("SQL ERROR during character slot saving. Error : \[[err]\]\n")
|
||||
return
|
||||
return 1
|
||||
|
||||
// If you see this proc lying around and don't know why it's there, expunge it, as this is for a short-term DB update, starting 27/12/2015
|
||||
// 0 on failed update, 1 on success
|
||||
/datum/preferences/proc/old_roles_to_new(var/client/C)
|
||||
var/DBQuery/query = dbcon.NewQuery({"
|
||||
SELECT be_special
|
||||
FROM [format_table_name("player")]
|
||||
WHERE ckey='[C.ckey]'"})
|
||||
if(!query.Execute())
|
||||
return 0
|
||||
var/old_be_special
|
||||
while(query.NextRow())
|
||||
old_be_special = text2num(query.item[1])
|
||||
if(isnull(old_be_special))
|
||||
message_admins("SQL NOTICE: be_special has been purged from the database, bug the coders.\n")
|
||||
return 0
|
||||
|
||||
old_be_special = sanitize_integer(old_be_special, 0, 65535)
|
||||
var/B_traitor = 1
|
||||
var/B_operative = 2
|
||||
var/B_changeling = 4
|
||||
var/B_wizard = 8
|
||||
var/B_malf = 16
|
||||
var/B_rev = 32
|
||||
var/B_alien = 64
|
||||
var/B_pai = 128
|
||||
var/B_cultist = 256
|
||||
var/B_ninja = 512
|
||||
var/B_raider = 1024
|
||||
var/B_vampire = 2048
|
||||
var/B_mutineer = 4096
|
||||
var/B_blob = 8192
|
||||
var/B_shadowling = 16384
|
||||
var/B_revenant = 32768
|
||||
|
||||
var/list/archived = list(B_traitor,B_operative,B_changeling,B_wizard,B_malf,B_rev,B_alien,B_pai,B_cultist,B_ninja,B_raider,B_vampire,B_mutineer,B_blob,B_shadowling,B_revenant)
|
||||
|
||||
// meow meow I am the copy cat
|
||||
for(var/flag in archived)
|
||||
if(old_be_special & flag)
|
||||
switch(flag)
|
||||
// hello i am byond i think constant variables r dumm
|
||||
if(1)
|
||||
be_special |= ROLE_TRAITOR
|
||||
if(2)
|
||||
be_special |= ROLE_OPERATIVE
|
||||
if(4)
|
||||
be_special |= ROLE_CHANGELING
|
||||
if(8)
|
||||
be_special |= ROLE_WIZARD
|
||||
if(16)
|
||||
be_special |= ROLE_MALF
|
||||
if(32)
|
||||
be_special |= ROLE_REV
|
||||
if(64)
|
||||
be_special |= ROLE_ALIEN
|
||||
be_special |= ROLE_SENTIENT
|
||||
be_special |= ROLE_DEMON
|
||||
be_special |= ROLE_BORER
|
||||
if(128)
|
||||
be_special |= ROLE_PAI
|
||||
be_special |= ROLE_POSIBRAIN
|
||||
be_special |= ROLE_GUARDIAN
|
||||
if(256)
|
||||
be_special |= ROLE_CULTIST
|
||||
if(512)
|
||||
be_special |= ROLE_NINJA
|
||||
if(1024)
|
||||
be_special |= ROLE_RAIDER
|
||||
if(2048)
|
||||
be_special |= ROLE_VAMPIRE
|
||||
if(4096)
|
||||
be_special |= ROLE_MUTINEER
|
||||
if(8192)
|
||||
be_special |= ROLE_BLOB
|
||||
if(16384)
|
||||
be_special |= ROLE_SHADOWLING
|
||||
if(32768)
|
||||
be_special |= ROLE_REVENANT
|
||||
|
||||
var/DBQuery/query2 = dbcon.NewQuery({"UPDATE [format_table_name("player")]
|
||||
SET
|
||||
be_role='[list2params(sql_sanitize_text_list(be_special))]'
|
||||
WHERE ckey='[C.ckey]'"}
|
||||
)
|
||||
|
||||
if(!query2.Execute())
|
||||
var/err = query2.ErrorMsg()
|
||||
log_game("SQL ERROR during saving player preferences. Error : \[[err]\]\n")
|
||||
message_admins("SQL ERROR during saving player preferences. Error : \[[err]\]\n")
|
||||
return
|
||||
return 1
|
||||
|
||||
/*
|
||||
/datum/preferences/proc/random_character(client/C)
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT slot FROM [format_table_name("characters")] WHERE ckey='[C.ckey]' ORDER BY slot")
|
||||
|
||||
@@ -1,443 +0,0 @@
|
||||
#define SAVEFILE_VERSION_MIN 8
|
||||
#define SAVEFILE_VERSION_MAX 12
|
||||
|
||||
//handles converting savefiles to new formats
|
||||
//MAKE SURE YOU KEEP THIS UP TO DATE!
|
||||
//If the sanity checks are capable of handling any issues. Only increase SAVEFILE_VERSION_MAX,
|
||||
//this will mean that savefile_version will still be over SAVEFILE_VERSION_MIN, meaning
|
||||
//this savefile update doesn't run everytime we load from the savefile.
|
||||
//This is mainly for format changes, such as the bitflags in toggles changing order or something.
|
||||
//if a file can't be updated, return 0 to delete it and start again
|
||||
//if a file was updated, return 1
|
||||
/datum/preferences/proc/savefile_update()
|
||||
if(savefile_version < 8) //lazily delete everything + additional files so they can be saved in the new format
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
var/delpath = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/"
|
||||
if(delpath && fexists(delpath))
|
||||
fdel(delpath)
|
||||
break
|
||||
return 0
|
||||
|
||||
if(savefile_version == SAVEFILE_VERSION_MAX) //update successful.
|
||||
save_preferences()
|
||||
save_character()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
||||
if(!ckey) return
|
||||
path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/[filename]"
|
||||
savefile_version = SAVEFILE_VERSION_MAX
|
||||
|
||||
/*
|
||||
/datum/preferences/proc/load_preferences()
|
||||
if(!path) return 0
|
||||
if(!fexists(path)) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
|
||||
S["version"] >> savefile_version
|
||||
//Conversion
|
||||
if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX)
|
||||
if(!savefile_update()) //handles updates
|
||||
savefile_version = SAVEFILE_VERSION_MAX
|
||||
save_preferences()
|
||||
save_character()
|
||||
return 0
|
||||
|
||||
//general preferences
|
||||
S["ooccolor"] >> ooccolor
|
||||
S["lastchangelog"] >> lastchangelog
|
||||
S["UI_style"] >> UI_style
|
||||
S["be_special"] >> be_special
|
||||
S["default_slot"] >> default_slot
|
||||
S["toggles"] >> toggles
|
||||
S["sound"] >> sound
|
||||
S["UI_style_color"] >> UI_style_color
|
||||
S["UI_style_alpha"] >> UI_style_alpha
|
||||
S["randomslot"] >> randomslot
|
||||
S["volume"] >> volume
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
|
||||
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
|
||||
sound = sanitize_integer(sound, 0, 65535, initial(toggles))
|
||||
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
|
||||
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
|
||||
randomslot = sanitize_integer(randomslot, 0, 1, initial(randomslot))
|
||||
volume = sanitize_integer(volume, 0, 100, initial(volume))
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_preferences()
|
||||
if(!path) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
|
||||
S["version"] << savefile_version
|
||||
|
||||
//general preferences
|
||||
S["ooccolor"] << ooccolor
|
||||
S["lastchangelog"] << lastchangelog
|
||||
S["UI_style"] << UI_style
|
||||
S["be_special"] << be_special
|
||||
S["default_slot"] << default_slot
|
||||
S["toggles"] << toggles
|
||||
S["sound"] << sound
|
||||
S["UI_style_color"] << UI_style_color
|
||||
S["UI_style_alpha"] << UI_style_alpha
|
||||
S["randomslot"] << randomslot
|
||||
S["volume"] << volume
|
||||
return 1
|
||||
|
||||
|
||||
//saving volume changes
|
||||
/datum/preferences/proc/save_volume()
|
||||
if(!path) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
|
||||
S["volume"] << volume
|
||||
return 1
|
||||
*/
|
||||
|
||||
/datum/preferences/proc/load_save(dir)
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = dir
|
||||
|
||||
//Character
|
||||
S["OOC_Notes"] >> metadata
|
||||
S["real_name"] >> real_name
|
||||
S["name_is_always_random"] >> be_random_name
|
||||
S["gender"] >> gender
|
||||
S["age"] >> age
|
||||
S["species"] >> species
|
||||
S["language"] >> language
|
||||
S["spawnpoint"] >> spawnpoint
|
||||
|
||||
//colors to be consolidated into hex strings (requires some work with dna code)
|
||||
S["hair_red"] >> r_hair
|
||||
S["hair_green"] >> g_hair
|
||||
S["hair_blue"] >> b_hair
|
||||
S["facial_red"] >> r_facial
|
||||
S["facial_green"] >> g_facial
|
||||
S["facial_blue"] >> b_facial
|
||||
S["skin_tone"] >> s_tone
|
||||
S["skin_red"] >> r_skin
|
||||
S["skin_green"] >> g_skin
|
||||
S["skin_blue"] >> b_skin
|
||||
S["hair_style_name"] >> h_style
|
||||
S["facial_style_name"] >> f_style
|
||||
S["eyes_red"] >> r_eyes
|
||||
S["eyes_green"] >> g_eyes
|
||||
S["eyes_blue"] >> b_eyes
|
||||
S["underwear"] >> underwear
|
||||
S["undershirt"] >> undershirt
|
||||
S["socks"] >> socks
|
||||
S["backbag"] >> backbag
|
||||
S["b_type"] >> b_type
|
||||
S["accent"] >> accent
|
||||
S["voice"] >> voice
|
||||
S["pitch"] >> pitch
|
||||
S["talkspeed"] >> talkspeed
|
||||
|
||||
//Jobs
|
||||
S["alternate_option"] >> alternate_option
|
||||
S["job_civilian_high"] >> job_civilian_high
|
||||
S["job_civilian_med"] >> job_civilian_med
|
||||
S["job_civilian_low"] >> job_civilian_low
|
||||
S["job_medsci_high"] >> job_medsci_high
|
||||
S["job_medsci_med"] >> job_medsci_med
|
||||
S["job_medsci_low"] >> job_medsci_low
|
||||
S["job_engsec_high"] >> job_engsec_high
|
||||
S["job_engsec_med"] >> job_engsec_med
|
||||
S["job_engsec_low"] >> job_engsec_low
|
||||
S["job_karma_high"] >> job_karma_high
|
||||
S["job_karma_med"] >> job_karma_med
|
||||
S["job_karma_low"] >> job_karma_low
|
||||
|
||||
//Miscellaneous
|
||||
S["flavor_text"] >> flavor_text
|
||||
S["med_record"] >> med_record
|
||||
S["sec_record"] >> sec_record
|
||||
S["gen_record"] >> gen_record
|
||||
S["be_special"] >> be_special
|
||||
S["disabilities"] >> disabilities
|
||||
S["player_alt_titles"] >> player_alt_titles
|
||||
S["organ_data"] >> organ_data
|
||||
|
||||
S["nanotrasen_relation"] >> nanotrasen_relation
|
||||
//S["skin_style"] >> skin_style
|
||||
|
||||
//Sanitize
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = reject_bad_name(real_name)
|
||||
if(isnull(species)) species = "Human"
|
||||
if(isnull(language)) language = "None"
|
||||
if(isnull(nanotrasen_relation)) nanotrasen_relation = initial(nanotrasen_relation)
|
||||
if(!real_name) real_name = random_name(gender,species)
|
||||
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
|
||||
gender = sanitize_gender(gender)
|
||||
age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
|
||||
r_hair = sanitize_integer(r_hair, 0, 255, initial(r_hair))
|
||||
g_hair = sanitize_integer(g_hair, 0, 255, initial(g_hair))
|
||||
b_hair = sanitize_integer(b_hair, 0, 255, initial(b_hair))
|
||||
r_facial = sanitize_integer(r_facial, 0, 255, initial(r_facial))
|
||||
g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial))
|
||||
b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial))
|
||||
s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone))
|
||||
r_skin = sanitize_integer(r_skin, 0, 255, initial(r_skin))
|
||||
g_skin = sanitize_integer(g_skin, 0, 255, initial(g_skin))
|
||||
b_skin = sanitize_integer(b_skin, 0, 255, initial(b_skin))
|
||||
h_style = sanitize_inlist(h_style, hair_styles_list, initial(h_style))
|
||||
f_style = sanitize_inlist(f_style, facial_hair_styles_list, initial(f_style))
|
||||
r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes))
|
||||
g_eyes = sanitize_integer(g_eyes, 0, 255, initial(g_eyes))
|
||||
b_eyes = sanitize_integer(b_eyes, 0, 255, initial(b_eyes))
|
||||
underwear = sanitize_integer(underwear, 1, underwear_m.len, initial(underwear))
|
||||
undershirt = sanitize_integer(undershirt, 1, undershirt_t.len, initial(undershirt))
|
||||
socks = sanitize_integer(socks,1 socks_t.len, initial(socks))
|
||||
backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag))
|
||||
b_type = sanitize_text(b_type, initial(b_type))
|
||||
accent = sanitize_text(accent, initial(accent))
|
||||
voice = sanitize_text(voice, initial(voice))
|
||||
pitch = sanitize_text(pitch, initial(pitch))
|
||||
talkspeed = sanitize_text(talkspeed, initial(talkspeed))
|
||||
|
||||
alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option))
|
||||
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
|
||||
job_civilian_med = sanitize_integer(job_civilian_med, 0, 65535, initial(job_civilian_med))
|
||||
job_civilian_low = sanitize_integer(job_civilian_low, 0, 65535, initial(job_civilian_low))
|
||||
job_medsci_high = sanitize_integer(job_medsci_high, 0, 65535, initial(job_medsci_high))
|
||||
job_medsci_med = sanitize_integer(job_medsci_med, 0, 65535, initial(job_medsci_med))
|
||||
job_medsci_low = sanitize_integer(job_medsci_low, 0, 65535, initial(job_medsci_low))
|
||||
job_engsec_high = sanitize_integer(job_engsec_high, 0, 65535, initial(job_engsec_high))
|
||||
job_engsec_med = sanitize_integer(job_engsec_med, 0, 65535, initial(job_engsec_med))
|
||||
job_engsec_low = sanitize_integer(job_engsec_low, 0, 65535, initial(job_engsec_low))
|
||||
job_karma_high = sanitize_integer(job_karma_high, 0, 65535, initial(job_karma_high))
|
||||
job_karma_med = sanitize_integer(job_karma_med, 0, 65535, initial(job_karma_med))
|
||||
job_karma_low = sanitize_integer(job_karma_low, 0, 65535, initial(job_karma_low))
|
||||
|
||||
if(isnull(disabilities)) disabilities = 0
|
||||
if(!player_alt_titles) player_alt_titles = new()
|
||||
if(!organ_data) src.organ_data = list()
|
||||
//if(!skin_style) skin_style = "Default"
|
||||
|
||||
/datum/preferences/proc/random_character()
|
||||
if(!path) return 0
|
||||
if(!fexists(path)) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
var/list/saves = list()
|
||||
var/name
|
||||
for(var/i=1, i<=MAX_SAVE_SLOTS, i++)
|
||||
S.cd = "/character[i]"
|
||||
S["real_name"] >> name
|
||||
if(!name) continue
|
||||
saves.Add(S.cd)
|
||||
|
||||
if(!saves.len)
|
||||
load_character()
|
||||
return 0
|
||||
S.cd = pick(saves)
|
||||
load_save(S.cd)
|
||||
return 1
|
||||
/*
|
||||
/datum/preferences/proc/load_character(slot)
|
||||
if(!path) return 0
|
||||
if(!fexists(path)) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
if(!slot) slot = default_slot
|
||||
slot = sanitize_integer(slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
|
||||
if(slot != default_slot)
|
||||
default_slot = slot
|
||||
S["default_slot"] << slot
|
||||
S.cd = "/character[slot]"
|
||||
load_save(S.cd)
|
||||
Now loaded by proc load_save(S.cd)
|
||||
//Character
|
||||
S["OOC_Notes"] >> metadata
|
||||
S["real_name"] >> real_name
|
||||
S["name_is_always_random"] >> be_random_name
|
||||
S["gender"] >> gender
|
||||
S["age"] >> age
|
||||
S["species"] >> species
|
||||
S["language"] >> language
|
||||
|
||||
//colors to be consolidated into hex strings (requires some work with dna code)
|
||||
S["hair_red"] >> r_hair
|
||||
S["hair_green"] >> g_hair
|
||||
S["hair_blue"] >> b_hair
|
||||
S["facial_red"] >> r_facial
|
||||
S["facial_green"] >> g_facial
|
||||
S["facial_blue"] >> b_facial
|
||||
S["skin_tone"] >> s_tone
|
||||
S["skin_red"] >> r_skin
|
||||
S["skin_green"] >> g_skin
|
||||
S["skin_blue"] >> b_skin
|
||||
S["hair_style_name"] >> h_style
|
||||
S["facial_style_name"] >> f_style
|
||||
S["eyes_red"] >> r_eyes
|
||||
S["eyes_green"] >> g_eyes
|
||||
S["eyes_blue"] >> b_eyes
|
||||
S["underwear"] >> underwear
|
||||
S["undershirt"] >> undershirt
|
||||
S["backbag"] >> backbag
|
||||
S["b_type"] >> b_type
|
||||
|
||||
//Jobs
|
||||
S["alternate_option"] >> alternate_option
|
||||
S["job_civilian_high"] >> job_civilian_high
|
||||
S["job_civilian_med"] >> job_civilian_med
|
||||
S["job_civilian_low"] >> job_civilian_low
|
||||
S["job_medsci_high"] >> job_medsci_high
|
||||
S["job_medsci_med"] >> job_medsci_med
|
||||
S["job_medsci_low"] >> job_medsci_low
|
||||
S["job_engsec_high"] >> job_engsec_high
|
||||
S["job_engsec_med"] >> job_engsec_med
|
||||
S["job_engsec_low"] >> job_engsec_low
|
||||
|
||||
//Miscellaneous
|
||||
S["flavor_text"] >> flavor_text
|
||||
S["med_record"] >> med_record
|
||||
S["sec_record"] >> sec_record
|
||||
S["gen_record"] >> gen_record
|
||||
S["be_special"] >> be_special
|
||||
S["disabilities"] >> disabilities
|
||||
S["player_alt_titles"] >> player_alt_titles
|
||||
S["organ_data"] >> organ_data
|
||||
|
||||
S["nanotrasen_relation"] >> nanotrasen_relation
|
||||
//S["skin_style"] >> skin_style
|
||||
|
||||
|
||||
//Sanitize
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = reject_bad_name(real_name)
|
||||
if(isnull(species)) species = "Human"
|
||||
if(isnull(language)) language = "None"
|
||||
if(isnull(spawnpoint)) spawnpoint = "Arrivals Shuttle"
|
||||
if(isnull(nanotrasen_relation)) nanotrasen_relation = initial(nanotrasen_relation)
|
||||
if(!real_name) real_name = random_name(gender)
|
||||
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
|
||||
gender = sanitize_gender(gender)
|
||||
age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
|
||||
r_hair = sanitize_integer(r_hair, 0, 255, initial(r_hair))
|
||||
g_hair = sanitize_integer(g_hair, 0, 255, initial(g_hair))
|
||||
b_hair = sanitize_integer(b_hair, 0, 255, initial(b_hair))
|
||||
r_facial = sanitize_integer(r_facial, 0, 255, initial(r_facial))
|
||||
g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial))
|
||||
b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial))
|
||||
s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone))
|
||||
r_skin = sanitize_integer(r_skin, 0, 255, initial(r_skin))
|
||||
g_skin = sanitize_integer(g_skin, 0, 255, initial(g_skin))
|
||||
b_skin = sanitize_integer(b_skin, 0, 255, initial(b_skin))
|
||||
h_style = sanitize_inlist(h_style, hair_styles_list, initial(h_style))
|
||||
f_style = sanitize_inlist(f_style, facial_hair_styles_list, initial(f_style))
|
||||
r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes))
|
||||
g_eyes = sanitize_integer(g_eyes, 0, 255, initial(g_eyes))
|
||||
b_eyes = sanitize_integer(b_eyes, 0, 255, initial(b_eyes))
|
||||
underwear = sanitize_integer(underwear, 1, underwear_m.len, initial(underwear))
|
||||
undershirt = sanitize_integer(undershirt, 1, undershirt_t.len, initial(undershirt))
|
||||
backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag))
|
||||
b_type = sanitize_text(b_type, initial(b_type))
|
||||
|
||||
alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option))
|
||||
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
|
||||
job_civilian_med = sanitize_integer(job_civilian_med, 0, 65535, initial(job_civilian_med))
|
||||
job_civilian_low = sanitize_integer(job_civilian_low, 0, 65535, initial(job_civilian_low))
|
||||
job_medsci_high = sanitize_integer(job_medsci_high, 0, 65535, initial(job_medsci_high))
|
||||
job_medsci_med = sanitize_integer(job_medsci_med, 0, 65535, initial(job_medsci_med))
|
||||
job_medsci_low = sanitize_integer(job_medsci_low, 0, 65535, initial(job_medsci_low))
|
||||
job_engsec_high = sanitize_integer(job_engsec_high, 0, 65535, initial(job_engsec_high))
|
||||
job_engsec_med = sanitize_integer(job_engsec_med, 0, 65535, initial(job_engsec_med))
|
||||
job_engsec_low = sanitize_integer(job_engsec_low, 0, 65535, initial(job_engsec_low))
|
||||
|
||||
if(isnull(disabilities)) disabilities = 0
|
||||
if(!player_alt_titles) player_alt_titles = new()
|
||||
if(!organ_data) src.organ_data = list()
|
||||
//if(!skin_style) skin_style = "Default"
|
||||
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_character()
|
||||
if(!path) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/character[default_slot]"
|
||||
|
||||
//Character
|
||||
S["OOC_Notes"] << metadata
|
||||
S["real_name"] << real_name
|
||||
S["name_is_always_random"] << be_random_name
|
||||
S["gender"] << gender
|
||||
S["age"] << age
|
||||
S["species"] << species
|
||||
S["language"] << language
|
||||
S["hair_red"] << r_hair
|
||||
S["hair_green"] << g_hair
|
||||
S["hair_blue"] << b_hair
|
||||
S["facial_red"] << r_facial
|
||||
S["facial_green"] << g_facial
|
||||
S["facial_blue"] << b_facial
|
||||
S["skin_tone"] << s_tone
|
||||
S["skin_red"] << r_skin
|
||||
S["skin_green"] << g_skin
|
||||
S["skin_blue"] << b_skin
|
||||
S["hair_style_name"] << h_style
|
||||
S["facial_style_name"] << f_style
|
||||
S["eyes_red"] << r_eyes
|
||||
S["eyes_green"] << g_eyes
|
||||
S["eyes_blue"] << b_eyes
|
||||
S["underwear"] << underwear
|
||||
S["undershirt"] << undershirt
|
||||
S["backbag"] << backbag
|
||||
S["b_type"] << b_type
|
||||
S["accent"] << accent
|
||||
S["voice"] << voice
|
||||
S["pitch"] << pitch
|
||||
S["talkspeed"] << talkspeed
|
||||
|
||||
//Jobs
|
||||
S["alternate_option"] << alternate_option
|
||||
S["job_civilian_high"] << job_civilian_high
|
||||
S["job_civilian_med"] << job_civilian_med
|
||||
S["job_civilian_low"] << job_civilian_low
|
||||
S["job_medsci_high"] << job_medsci_high
|
||||
S["job_medsci_med"] << job_medsci_med
|
||||
S["job_medsci_low"] << job_medsci_low
|
||||
S["job_engsec_high"] << job_engsec_high
|
||||
S["job_engsec_med"] << job_engsec_med
|
||||
S["job_engsec_low"] << job_engsec_low
|
||||
S["job_karma_high"] << job_karma_high
|
||||
S["job_karma_med"] << job_karma_med
|
||||
S["job_karma_low"] << job_karma_low
|
||||
|
||||
//Miscellaneous
|
||||
S["flavor_text"] << flavor_text
|
||||
S["med_record"] << med_record
|
||||
S["sec_record"] << sec_record
|
||||
S["gen_record"] << gen_record
|
||||
S["player_alt_titles"] << player_alt_titles
|
||||
S["be_special"] << be_special
|
||||
S["disabilities"] << disabilities
|
||||
S["organ_data"] << organ_data
|
||||
|
||||
S["nanotrasen_relation"] << nanotrasen_relation
|
||||
//S["skin_style"] << skin_style
|
||||
|
||||
return 1
|
||||
*/
|
||||
|
||||
#undef SAVEFILE_VERSION_MAX
|
||||
#undef SAVEFILE_VERSION_MIN
|
||||
@@ -21,7 +21,7 @@
|
||||
if(temp_vent.parent.other_atmosmch.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology
|
||||
vents += temp_vent
|
||||
|
||||
var/list/candidates = get_candidates(BE_ALIEN,ALIEN_AFK_BRACKET)
|
||||
var/list/candidates = get_candidates(ROLE_ALIEN,ALIEN_AFK_BRACKET)
|
||||
|
||||
while(spawncount > 0 && vents.len && candidates.len)
|
||||
var/obj/vent = pick_n_take(vents)
|
||||
@@ -33,4 +33,4 @@
|
||||
|
||||
spawncount--
|
||||
successSpawn = 1
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
if(temp_vent.parent.other_atmosmch.len > 50)
|
||||
vents += temp_vent
|
||||
|
||||
var/list/candidates = get_candidates(BE_ALIEN,ALIEN_AFK_BRACKET)
|
||||
var/list/candidates = get_candidates(ROLE_BORER,ALIEN_AFK_BRACKET)
|
||||
while(spawncount > 0 && vents.len && candidates.len)
|
||||
var/obj/vent = pick_n_take(vents)
|
||||
var/client/C = pick_n_take(candidates)
|
||||
@@ -32,4 +32,4 @@
|
||||
|
||||
spawncount--
|
||||
successSpawn = 1
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/datum/event/spawn_slaughter/proc/get_slaughter(var/end_if_fail = 0)
|
||||
key_of_slaughter = null
|
||||
if(!key_of_slaughter)
|
||||
var/list/candidates = get_candidates(BE_ALIEN)
|
||||
var/list/candidates = get_candidates(ROLE_DEMON)
|
||||
if(!candidates.len)
|
||||
if(end_if_fail)
|
||||
return 0
|
||||
@@ -55,4 +55,3 @@
|
||||
return 0
|
||||
message_admins("Unfortunately, no candidates were available for becoming a Slaugter Demon. Shutting down.")
|
||||
kill()
|
||||
|
||||
@@ -2,80 +2,4 @@
|
||||
var/list/currently_querying // Used to avoid asking the same ghost repeatedly.
|
||||
|
||||
// The following procs are used to grab players for mobs produced by a seed (mostly for dionaea).
|
||||
/datum/seed/proc/handle_living_product(var/mob/living/host)
|
||||
/*
|
||||
if(!host || !istype(host)) return
|
||||
|
||||
spawn(0)
|
||||
request_player(host)
|
||||
if(istype(host,/mob/living/simple_animal))
|
||||
return
|
||||
spawn(75)
|
||||
if(!host.ckey && !host.client)
|
||||
host.death() // This seems redundant, but a lot of mobs don't
|
||||
host.stat = DEAD // handle death() properly. Better safe than etc.
|
||||
host.visible_message("<span class='danger'>[host] is malformed and unable to survive. It expires pitifully, leaving behind some seeds.</span>")
|
||||
|
||||
var/total_yield = rand(1,3)
|
||||
for(var/j = 0;j<=total_yield;j++)
|
||||
var/obj/item/seeds/S = new(get_turf(host))
|
||||
S.seed_type = name
|
||||
S.update_seed()
|
||||
|
||||
/datum/seed/proc/request_player(var/mob/living/host)
|
||||
if(!host) return
|
||||
for(var/mob/dead/observer/O in player_list)
|
||||
if(jobban_isbanned(O, "Dionaea"))
|
||||
continue
|
||||
if(O.client)
|
||||
if(O.client.prefs.be_special & BE_PLANT && !(O.client in currently_querying))
|
||||
currently_querying |= O.client
|
||||
question(O.client,host)
|
||||
|
||||
/datum/seed/proc/question(var/client/C,var/mob/living/host)
|
||||
spawn(0)
|
||||
|
||||
if(!C || !host || !(C.mob && istype(C.mob,/mob/dead))) return // We don't want to spam them repeatedly if they're already in a mob.
|
||||
|
||||
var/response = alert(C, "Someone is harvesting [display_name]. Would you like to play as one?", "Sentient plant harvest", "Yes", "No", "Never for this round.")
|
||||
|
||||
if(!C || !host || !(C.mob && istype(C.mob,/mob/dead))) return // ...or accidentally accept an invalid argument for transfer.
|
||||
|
||||
if(response == "Yes")
|
||||
transfer_personality(C,host)
|
||||
else if (response == "Never for this round")
|
||||
C.prefs.be_special ^= BE_PLANT
|
||||
|
||||
currently_querying -= C
|
||||
|
||||
/datum/seed/proc/transfer_personality(var/client/player,var/mob/living/host)
|
||||
|
||||
//Something is wrong, abort.
|
||||
if(!player || !host) return
|
||||
|
||||
//Host already has a controller, pike off slowpoke.
|
||||
if(host.client && host.ckey) return
|
||||
|
||||
//Transfer them over.
|
||||
host.ckey = player.ckey
|
||||
if(player.mob && player.mob.mind)
|
||||
player.mob.mind.transfer_to(host)
|
||||
|
||||
if(host.dna) host.dna.real_name = host.real_name
|
||||
|
||||
// Update mode specific HUD icons.
|
||||
callHook("harvest_podman", list(host))
|
||||
|
||||
host << "\green <B>You awaken slowly, stirring into sluggish motion as the air caresses you.</B>"
|
||||
|
||||
// This is a hack, replace with some kind of species blurb proc.
|
||||
if(istype(host,/mob/living/simple_animal/diona))
|
||||
host << "<B>You are [host], one of a race of drifting interstellar plantlike creatures that sometimes share their seeds with human traders.</B>"
|
||||
host << "<B>Too much darkness will send you into shock and starve you, but light will help you heal.</B>"
|
||||
|
||||
var/newname = input(host,"Enter a name, or leave blank for the default name.", "Name change","") as text
|
||||
newname = sanitize(newname)
|
||||
if (newname != "")
|
||||
host.real_name = newname
|
||||
host.name = host.real_name
|
||||
*/
|
||||
/datum/seed/proc/handle_living_product(var/mob/living/host)
|
||||
@@ -83,7 +83,7 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds
|
||||
AttemptGrow()
|
||||
|
||||
/obj/item/alien_embryo/proc/AttemptGrow(var/gib_on_success = 1)
|
||||
var/list/candidates = get_candidates(BE_ALIEN,ALIEN_AFK_BRACKET,1)
|
||||
var/list/candidates = get_candidates(ROLE_ALIEN,ALIEN_AFK_BRACKET,1)
|
||||
var/client/C = null
|
||||
|
||||
// To stop clientless larva, we will check that our host has a client
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
/obj/item/device/mmi/posibrain/proc/request_player()
|
||||
for(var/mob/dead/observer/O in player_list)
|
||||
if(check_observer(O))
|
||||
O << "\blue <b>\A [src] has been activated. (<a href='?src=\ref[O];jump=\ref[src]'>Teleport</a> | <a href='?src=\ref[src];signup=\ref[O]'>Sign Up</a>)"
|
||||
//question(O.client)
|
||||
O << "<span class='boldnotice'>\A [src] has been activated. (<a href='?src=\ref[O];jump=\ref[src]'>Teleport</a> | <a href='?src=\ref[src];signup=\ref[O]'>Sign Up</a>)</span>"
|
||||
// if(ROLE_POSIBRAIN in O.client.prefs.be_special) The Guardian implementation looks cleaner
|
||||
// question(O.client)
|
||||
|
||||
/obj/item/device/mmi/posibrain/proc/check_observer(var/mob/dead/observer/O)
|
||||
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
|
||||
@@ -52,7 +53,7 @@
|
||||
if(response == "Yes")
|
||||
transfer_personality(C.mob)
|
||||
else if (response == "Never for this round")
|
||||
C.prefs.be_special ^= BE_PAI
|
||||
C.prefs.be_special -= ROLE_POSIBRAIN
|
||||
|
||||
// This should not ever happen, but let's be safe
|
||||
/obj/item/device/mmi/posibrain/dropbrain(var/turf/dropspot)
|
||||
|
||||
@@ -789,7 +789,7 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75
|
||||
user << "<span class='notice'>You offer the sentience potion to [M]...</span>"
|
||||
being_used = 1
|
||||
|
||||
var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET)
|
||||
var/list/candidates = get_candidates(ROLE_SENTIENT, ALIEN_AFK_BRACKET)
|
||||
|
||||
shuffle(candidates)
|
||||
|
||||
|
||||
@@ -348,15 +348,15 @@ var/datum/paiController/paiController // Global handler for pAI candidates
|
||||
|
||||
proc/requestRecruits(var/obj/item/device/paicard/P)
|
||||
for(var/mob/dead/observer/O in player_list)
|
||||
if(O.client && O.client.prefs.be_special & BE_PAI)
|
||||
if(player_old_enough_antag(O.client,BE_PAI))
|
||||
if(O.client && (ROLE_PAI in O.client.prefs.be_special))
|
||||
if(player_old_enough_antag(O.client,ROLE_PAI))
|
||||
if(check_recruit(O))
|
||||
O << "\blue <b>A pAI card is looking for personalities. (<a href='?src=\ref[O];jump=\ref[P]'>Teleport</a> | <a href='?src=\ref[src];signup=\ref[O]'>Sign Up</a>)</b>"
|
||||
//question(O.client)
|
||||
proc/check_recruit(var/mob/dead/observer/O)
|
||||
if(jobban_isbanned(O, "pAI") || jobban_isbanned(O,"nonhumandept"))
|
||||
return 0
|
||||
if(!player_old_enough_antag(O.client,BE_PAI))
|
||||
if(!player_old_enough_antag(O.client,ROLE_PAI))
|
||||
return 0
|
||||
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
|
||||
return 0
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
if(jobban_isbanned(O,"nonhumandept") || jobban_isbanned(O,"Drone"))
|
||||
continue
|
||||
if(O.client)
|
||||
if(O.client.prefs.be_special & BE_PAI)
|
||||
if(ROLE_PAI in O.client.prefs.be_special)
|
||||
question(O.client,O)
|
||||
|
||||
/mob/living/silicon/robot/drone/proc/question(var/client/C,var/mob/M)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
if (!message)
|
||||
return
|
||||
log_say("[key_name(src)] : [message]")
|
||||
if (stat == 2)
|
||||
if (stat == DEAD)
|
||||
return say_dead(message)
|
||||
var/mob/living/simple_animal/borer/B = src.loc
|
||||
src << "You whisper silently, \"[message]\""
|
||||
@@ -302,7 +302,7 @@
|
||||
detatch()
|
||||
leave_host()
|
||||
|
||||
mob/living/simple_animal/borer/proc/detatch()
|
||||
/mob/living/simple_animal/borer/proc/detatch()
|
||||
|
||||
if(!host) return
|
||||
|
||||
@@ -416,7 +416,7 @@ mob/living/simple_animal/borer/proc/detatch()
|
||||
src << "You cannot infest a target in your current state."
|
||||
return
|
||||
|
||||
if(M.stat == 2)
|
||||
if(M.stat == DEAD)
|
||||
src << "That is not an appropriate target."
|
||||
return
|
||||
|
||||
@@ -457,15 +457,15 @@ mob/living/simple_animal/borer/proc/detatch()
|
||||
return
|
||||
|
||||
//Procs for grabbing players.
|
||||
mob/living/simple_animal/borer/proc/request_player()
|
||||
/mob/living/simple_animal/borer/proc/request_player()
|
||||
for(var/mob/O in respawnable_list)
|
||||
if(jobban_isbanned(O, "Syndicate"))
|
||||
continue
|
||||
if(O.client)
|
||||
if(O.client.prefs.be_special & BE_ALIEN && !jobban_isbanned(O, "alien"))
|
||||
if((ROLE_BORER in O.client.prefs.be_special) && !jobban_isbanned(O, "alien"))
|
||||
question(O.client)
|
||||
|
||||
mob/living/simple_animal/borer/proc/question(var/client/C)
|
||||
/mob/living/simple_animal/borer/proc/question(var/client/C)
|
||||
spawn(0)
|
||||
if(!C) return
|
||||
var/response = alert(C, "A cortical borer needs a player. Are you interested?", "Cortical borer request", "Yes", "No", "Never for this round")
|
||||
@@ -474,9 +474,9 @@ mob/living/simple_animal/borer/proc/question(var/client/C)
|
||||
if(response == "Yes")
|
||||
transfer_personality(C)
|
||||
else if (response == "Never for this round")
|
||||
C.prefs.be_special ^= BE_ALIEN
|
||||
C.prefs.be_special -= ROLE_BORER
|
||||
|
||||
mob/living/simple_animal/borer/proc/transfer_personality(var/client/candidate)
|
||||
/mob/living/simple_animal/borer/proc/transfer_personality(var/client/candidate)
|
||||
|
||||
if(!candidate)
|
||||
return
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
return
|
||||
used = TRUE
|
||||
user << "[use_message]"
|
||||
var/list/mob/dead/observer/candidates = pollCandidates("Do you want to play as the [mob_name] of [user.real_name]?",BE_PAI, null, FALSE, 100)
|
||||
var/list/mob/dead/observer/candidates = pollCandidates("Do you want to play as the [mob_name] of [user.real_name]?",ROLE_GUARDIAN, null, FALSE, 100)
|
||||
var/mob/dead/observer/theghost = null
|
||||
|
||||
if(candidates.len)
|
||||
|
||||
@@ -442,7 +442,7 @@
|
||||
|
||||
if(!key_of_revenant)
|
||||
message_admins("The new revenant's old client either could not be found or is in a new, living mob - grabbing a random candidate instead...")
|
||||
var/list/candidates = get_candidates(BE_REVENANT)
|
||||
var/list/candidates = get_candidates(ROLE_REVENANT)
|
||||
if(!candidates.len)
|
||||
qdel(R)
|
||||
message_admins("No candidates were found for the new revenant. Oh well!")
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
return
|
||||
key_of_revenant = null
|
||||
if(!key_of_revenant)
|
||||
var/list/candidates = get_candidates(BE_REVENANT)
|
||||
var/list/candidates = get_candidates(ROLE_REVENANT)
|
||||
if(!candidates.len)
|
||||
if(end_if_fail)
|
||||
return 0
|
||||
|
||||
@@ -309,12 +309,6 @@ var/obj/machinery/blackbox_recorder/blackbox
|
||||
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
||||
query_insert.Execute()
|
||||
|
||||
// Sanitize inputs to avoid SQL injection attacks
|
||||
proc/sql_sanitize_text(var/text)
|
||||
text = replacetext(text, "'", "''")
|
||||
text = replacetext(text, ";", "")
|
||||
text = replacetext(text, "&", "")
|
||||
return text
|
||||
|
||||
proc/feedback_set(var/variable,var/value)
|
||||
if(!blackbox) return
|
||||
|
||||
Reference in New Issue
Block a user