diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql
index d3594d87fa6..b0e03f68efa 100644
--- a/SQL/paradise_schema.sql
+++ b/SQL/paradise_schema.sql
@@ -66,7 +66,6 @@ CREATE TABLE `characters` (
`med_record` mediumtext NOT NULL,
`sec_record` mediumtext NOT NULL,
`gen_record` mediumtext NOT NULL,
- `be_special` mediumint(8) NOT NULL,
`disabilities` mediumint(8) NOT NULL,
`player_alt_titles` mediumtext NOT NULL,
`organ_data` mediumtext NOT NULL,
@@ -233,7 +232,7 @@ CREATE TABLE `player` (
`UI_style` varchar(10) DEFAULT 'Midnight',
`UI_style_color` varchar(7) DEFAULT '#ffffff',
`UI_style_alpha` smallint(4) DEFAULT '255',
- `be_special` mediumint(8) DEFAULT '0',
+ `be_role` mediumtext NOT NULL,
`default_slot` smallint(4) DEFAULT '1',
`toggles` mediumint(8) DEFAULT '383',
`sound` mediumint(8) DEFAULT '31',
diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql
index 4a61245cf83..567da99c300 100644
--- a/SQL/paradise_schema_prefixed.sql
+++ b/SQL/paradise_schema_prefixed.sql
@@ -66,7 +66,6 @@ CREATE TABLE `SS13_characters` (
`med_record` mediumtext NOT NULL,
`sec_record` mediumtext NOT NULL,
`gen_record` mediumtext NOT NULL,
- `be_special` mediumint(8) NOT NULL,
`disabilities` mediumint(8) NOT NULL,
`player_alt_titles` mediumtext NOT NULL,
`organ_data` mediumtext NOT NULL,
@@ -233,7 +232,7 @@ CREATE TABLE `SS13_player` (
`UI_style` varchar(10) DEFAULT 'Midnight',
`UI_style_color` varchar(7) DEFAULT '#ffffff',
`UI_style_alpha` smallint(4) DEFAULT '255',
- `be_special` mediumint(8) DEFAULT '0',
+ `be_role` mediumtext NOT NULL,
`default_slot` smallint(4) DEFAULT '1',
`toggles` mediumint(8) DEFAULT '383',
`sound` mediumint(8) DEFAULT '31',
diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm
index 1f170276c8f..1753045cb8c 100644
--- a/code/__DEFINES/preferences.dm
+++ b/code/__DEFINES/preferences.dm
@@ -26,20 +26,3 @@
#define MEMBER_PUBLIC 8192
#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC|MEMBER_PUBLIC)
-
-#define BE_TRAITOR 1
-#define BE_OPERATIVE 2
-#define BE_CHANGELING 4
-#define BE_WIZARD 8
-#define BE_MALF 16
-#define BE_REV 32
-#define BE_ALIEN 64
-#define BE_PAI 128
-#define BE_CULTIST 256
-#define BE_NINJA 512
-#define BE_RAIDER 1024
-#define BE_VAMPIRE 2048
-#define BE_MUTINEER 4096
-#define BE_BLOB 8192
-#define BE_SHADOWLING 16384
-#define BE_REVENANT 32768
\ No newline at end of file
diff --git a/code/__DEFINES/role_preferences.dm b/code/__DEFINES/role_preferences.dm
new file mode 100644
index 00000000000..0c5a2d820c2
--- /dev/null
+++ b/code/__DEFINES/role_preferences.dm
@@ -0,0 +1,68 @@
+
+
+//Values for antag preferences, event roles, etc. unified here
+
+
+
+//These are synced with the Database, if you change the values of the defines
+//then you MUST update the database!
+// If you're adding a new role, remember to update modules/admin/topic.dm, so admins can dish out
+// justice if someone's abusing your role
+#define ROLE_TRAITOR "traitor"
+#define ROLE_OPERATIVE "operative"
+#define ROLE_CHANGELING "changeling"
+#define ROLE_WIZARD "wizard"
+#define ROLE_MALF "malf AI"
+#define ROLE_REV "revolutionary"
+#define ROLE_ALIEN "xenomorph"
+#define ROLE_PAI "pAI"
+#define ROLE_CULTIST "cultist"
+#define ROLE_BLOB "blob"
+#define ROLE_NINJA "space ninja"
+#define ROLE_MONKEY "monkey"
+#define ROLE_GANG "gangster"
+#define ROLE_SHADOWLING "shadowling"
+#define ROLE_ABDUCTOR "abductor"
+#define ROLE_REVENANT "revenant"
+#define ROLE_HOG_GOD "hand of god: god" // We're prolly gonna port this one day or another
+#define ROLE_HOG_CULTIST "hand of god: cultist"
+#define ROLE_RAIDER "vox raider"
+#define ROLE_VAMPIRE "vampire"
+#define ROLE_MUTINEER "mutineer"
+// Role tags for EVERYONE!
+#define ROLE_BORER "cortical borer"
+#define ROLE_DEMON "slaughter demon"
+#define ROLE_SENTIENT "sentient animal"
+#define ROLE_POSIBRAIN "positronic brain"
+#define ROLE_GUARDIAN "guardian"
+
+
+//Missing assignment means it's not a gamemode specific role, IT'S NOT A BUG OR ERROR.
+//The gamemode specific ones are just so the gamemodes can query whether a player is old enough
+//(in game days played) to play that role
+var/global/list/special_roles = list(
+ ROLE_TRAITOR = /datum/game_mode/traitor,
+ ROLE_OPERATIVE = /datum/game_mode/nuclear,
+ ROLE_CHANGELING = /datum/game_mode/changeling,
+ ROLE_WIZARD = /datum/game_mode/wizard,
+ ROLE_MALF = /datum/game_mode/malfunction,
+ ROLE_REV = /datum/game_mode/revolution,
+ ROLE_ALIEN,
+ ROLE_PAI,
+ ROLE_CULTIST = /datum/game_mode/cult,
+ ROLE_BLOB = /datum/game_mode/blob,
+ ROLE_NINJA,
+// ROLE_MONKEY = /datum/game_mode/monkey, Sooner or later these are going to get ported
+// ROLE_GANG = /datum/game_mode/gang,
+ ROLE_SHADOWLING = /datum/game_mode/shadowling,
+// ROLE_ABDUCTOR = /datum/game_mode/abduction,
+// ROLE_HOG_GOD = /datum/game_mode/hand_of_god,
+// ROLE_HOG_CULTIST = /datum/game_mode/hand_of_god,
+ ROLE_RAIDER = /datum/game_mode/heist,
+ ROLE_VAMPIRE = /datum/game_mode/vampire,
+ ROLE_MUTINEER = /datum/game_mode/mutiny,
+ ROLE_BORER,
+ ROLE_DEMON,
+ ROLE_SENTIENT,
+ ROLE_POSIBRAIN,
+)
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index 0d51ed39ec1..f821b19e665 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -290,17 +290,17 @@ proc/isInSight(var/atom/A, var/atom/B)
return M
return null
-/proc/get_candidates(be_special_flag=0, afk_bracket=3000, override_age=0, override_jobban=0)
- var/roletext = get_roletext(be_special_flag)
+/proc/get_candidates(be_special_type, afk_bracket=3000, override_age=0, override_jobban=0)
+ var/roletext = get_roletext(be_special_type)
var/list/candidates = list()
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
while(!candidates.len && afk_bracket < 6000)
for(var/mob/dead/observer/G in player_list)
if(G.client != null)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
- if(!G.client.is_afk(afk_bracket) && (G.client.prefs.be_special & be_special_flag))
+ if(!G.client.is_afk(afk_bracket) && (be_special_type in G.client.prefs.be_special))
if(!override_jobban || (!jobban_isbanned(G, roletext) && !jobban_isbanned(G,"Syndicate")))
- if(override_age || player_old_enough_antag(G.client,be_special_flag))
+ if(override_age || player_old_enough_antag(G.client,be_special_type))
candidates += G.client
afk_bracket += 600 // Add a minute to the bracket, for every attempt
diff --git a/code/__HELPERS/sanitize_values.dm b/code/__HELPERS/sanitize_values.dm
index 70c63dfc789..f490f71df43 100644
--- a/code/__HELPERS/sanitize_values.dm
+++ b/code/__HELPERS/sanitize_values.dm
@@ -44,10 +44,24 @@
if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase
else return default
return .
-
+
/proc/sanitize_ooccolor(color)
var/list/HSL = rgb2hsl(hex2num(copytext(color,2,4)),hex2num(copytext(color,4,6)),hex2num(copytext(color,6,8)))
HSL[3] = min(HSL[3],0.4)
var/list/RGB = hsl2rgb(arglist(HSL))
return "#[num2hex(RGB[1],2)][num2hex(RGB[2],2)][num2hex(RGB[3],2)]"
-
+
+
+// Sanitize inputs to avoid SQL injection attacks
+/proc/sql_sanitize_text(var/text)
+ text = replacetext(text, "'", "''")
+ text = replacetext(text, ";", "")
+ text = replacetext(text, "&", "")
+ return text
+
+// Calls the above proc on each entry of a list to ensure its entries are clean
+/proc/sql_sanitize_text_list(var/list/l)
+ var/list/new_list = l.Copy()
+ for (var/text in new_list)
+ sql_sanitize_text(text)
+ return new_list
\ No newline at end of file
diff --git a/code/_globalvars/configuration.dm b/code/_globalvars/configuration.dm
index 61bfd723241..4cfa038cd1e 100644
--- a/code/_globalvars/configuration.dm
+++ b/code/_globalvars/configuration.dm
@@ -31,25 +31,6 @@ var/MAX_EX_LIGHT_RANGE = 14
var/MAX_EX_FLASH_RANGE = 14
var/MAX_EX_FLAME_RANGE = 14
-var/list/be_special_flags = list(
- "traitor" = BE_TRAITOR,
- "operative" = BE_OPERATIVE,
- "changeling" = BE_CHANGELING,
- "wizard" = BE_WIZARD,
- "malf AI" = BE_MALF,
- "revolutionary" = BE_REV,
- "alien" = BE_ALIEN,
- "pAI" = BE_PAI,
- "cultist" = BE_CULTIST,
- "ninja" = BE_NINJA,
- "raider" = BE_RAIDER,
- "vampire" = BE_VAMPIRE,
- "mutineer" = BE_MUTINEER,
- "blob" = BE_BLOB,
- "shadowling" = BE_SHADOWLING,
- "revenant" = BE_REVENANT
-)
-
//Random event stuff, apparently used
var/eventchance = 10 //% per 5 mins
var/event = 0
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 712c1b41e1c..860ebdd01b9 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -180,7 +180,7 @@
else
text += "EMPLOYEE|headrev|rev"
- if(current && current.client && current.client.prefs.be_special & BE_REV)
+ if(current && current.client && (ROLE_REV in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -205,7 +205,7 @@
text += "EMPLOYEE|cultist"
- if(current && current.client && current.client.prefs.be_special & BE_CULTIST)
+ if(current && current.client && (ROLE_CULTIST in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -225,7 +225,7 @@
else
text += "yes|NO"
- if(current && current.client && current.client.prefs.be_special & BE_WIZARD)
+ if(current && current.client && (ROLE_WIZARD in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -246,7 +246,7 @@
else
text += "yes|NO"
- if(current && current.client && current.client.prefs.be_special & BE_CHANGELING)
+ if(current && current.client && (ROLE_CHANGELING in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -294,7 +294,7 @@
else
text += "operative|NANOTRASEN"
- if(current && current.client && current.client.prefs.be_special & BE_OPERATIVE)
+ if(current && current.client && (ROLE_OPERATIVE in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -316,7 +316,7 @@
else
text += "traitor|EMPLOYEE"
- if(current && current.client && current.client.prefs.be_special & BE_TRAITOR)
+ if(current && current.client && (ROLE_TRAITOR in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
@@ -335,7 +335,7 @@
else
text += "shadowling|thrall|HUMAN"
- if(current && current.client && current.client.prefs.be_special & BE_SHADOWLING)
+ if(current && current.client && (ROLE_SHADOWLING in current.client.prefs.be_special))
text += "|Enabled in Prefs"
else
text += "|Disabled in Prefs"
diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm
index cd09b5d7a9a..608d0d4061d 100644
--- a/code/game/gamemodes/antag_spawner.dm
+++ b/code/game/gamemodes/antag_spawner.dm
@@ -36,7 +36,7 @@
return
checking = 1
user << "The device is now checking for possible borgs."
- var/list/mob/dead/observer/borg_candidates = pollCandidates("Do you want to play as a Syndicate [borg_to_spawn] borg?", "operative", 1, BE_OPERATIVE, 300)
+ var/list/mob/dead/observer/borg_candidates = pollCandidates("Do you want to play as a Syndicate [borg_to_spawn] borg?", "operative", 1, ROLE_OPERATIVE, 300)
if(borg_candidates.len > 0 && !used)
checking = 0
used = 1
@@ -74,7 +74,7 @@
icon_state = "vial"
/obj/item/weapon/antag_spawner/slaughter_demon/attack_self(mob/user as mob)
- var/list/demon_candidates = get_candidates(BE_ALIEN)
+ var/list/demon_candidates = get_candidates(ROLE_DEMON)
if(user.z == ZLEVEL_CENTCOMM)//this is to make sure the wizard does NOT summon a demon from the Den..
user << "You should probably wait until you reach the station."
return
diff --git a/code/game/gamemodes/autotraitor/autotraitor.dm b/code/game/gamemodes/autotraitor/autotraitor.dm
index 8a9e9cc54b2..06b09867e6e 100644
--- a/code/game/gamemodes/autotraitor/autotraitor.dm
+++ b/code/game/gamemodes/autotraitor/autotraitor.dm
@@ -18,7 +18,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- possible_traitors = get_players_for_role(BE_TRAITOR)
+ possible_traitors = get_players_for_role(ROLE_TRAITOR)
for(var/mob/new_player/P in world)
if(P.client && P.ready)
@@ -76,13 +76,13 @@
var/traitorcount = 0
var/possible_traitors[0]
for(var/mob/living/player in mob_list)
- if (player.client && player.stat != 2)
+ if (player.client && player.stat != DEAD)
playercount += 1
- if (player.client && player.mind && player.mind.special_role && player.stat != 2)
+ if (player.client && player.mind && player.mind.special_role && player.stat != DEAD)
traitorcount += 1
- if (player.client && player.mind && !player.mind.special_role && player.stat != 2)
+ if (player.client && player.mind && !player.mind.special_role && player.stat != DEAD)
if (ishuman(player) || isrobot(player) || isAI(player))
- if (player.client && player.client.prefs.be_special & BE_TRAITOR && !jobban_isbanned(player, "traitor") && !jobban_isbanned(player, "Syndicate"))
+ if (player.client && (ROLE_TRAITOR in player.client.prefs.be_special) && !jobban_isbanned(player, "traitor") && !jobban_isbanned(player, "Syndicate"))
possible_traitors += player.mind
for(var/datum/mind/player in possible_traitors)
for(var/job in restricted_jobs)
@@ -160,15 +160,15 @@
if(shuttle_master.emergency.mode >= SHUTTLE_ESCAPE)
return
//message_admins("Late Join Check")
- if((character.client && character.client.prefs.be_special & BE_TRAITOR) && !jobban_isbanned(character, "traitor") && !jobban_isbanned(character, "Syndicate"))
+ if(character.client && (ROLE_TRAITOR in character.client.prefs.be_special) && !jobban_isbanned(character, "traitor") && !jobban_isbanned(character, "Syndicate"))
//message_admins("Late Joiner has Be Syndicate")
//message_admins("Checking number of players")
var/playercount = 0
var/traitorcount = 0
for(var/mob/living/player in mob_list)
- if (player.client && player.stat != 2)
+ if (player.client && player.stat != DEAD)
playercount += 1
- if (player.client && player.mind && player.mind.special_role && player.stat != 2)
+ if (player.client && player.mind && player.mind.special_role && player.stat != DEAD)
traitorcount += 1
//message_admins("Live Players: [playercount]")
//message_admins("Live Traitors: [traitorcount]")
diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm
index 1cbd8dd7a1e..4c8914b9131 100644
--- a/code/game/gamemodes/blob/blob.dm
+++ b/code/game/gamemodes/blob/blob.dm
@@ -29,7 +29,7 @@ var/list/blob_nodes = list()
/datum/game_mode/blob/pre_setup()
- var/list/possible_blobs = get_players_for_role(BE_BLOB)
+ var/list/possible_blobs = get_players_for_role(ROLE_BLOB)
// stop setup if no possible traitors
if(!possible_blobs.len)
@@ -58,7 +58,7 @@ var/list/blob_nodes = list()
/datum/game_mode/blob/proc/get_blob_candidates()
var/list/candidates = list()
for(var/mob/living/carbon/human/player in player_list)
- if(!player.stat && player.mind && !player.mind.special_role && !jobban_isbanned(player, "Syndicate") && (player.client.prefs.be_special & BE_BLOB))
+ if(!player.stat && player.mind && !player.mind.special_role && !jobban_isbanned(player, "Syndicate") && (ROLE_BLOB in player.client.prefs.be_special))
candidates += player
return candidates
diff --git a/code/game/gamemodes/blob/blobs/core.dm b/code/game/gamemodes/blob/blobs/core.dm
index 4ccaa08d7be..5954a5b1dba 100644
--- a/code/game/gamemodes/blob/blobs/core.dm
+++ b/code/game/gamemodes/blob/blobs/core.dm
@@ -101,7 +101,7 @@
var/list/candidates = list()
if(!new_overmind)
- candidates = get_candidates(BE_BLOB)
+ candidates = get_candidates(ROLE_BLOB)
if(candidates.len)
C = pick(candidates)
else
diff --git a/code/game/gamemodes/borer/borer.dm b/code/game/gamemodes/borer/borer.dm
index 3a491c769df..bf381ef763d 100644
--- a/code/game/gamemodes/borer/borer.dm
+++ b/code/game/gamemodes/borer/borer.dm
@@ -29,7 +29,7 @@
// also make sure that there's at least one borer and one host
recommended_enemies = max(src.num_players() / 20 * 2, 2)
- var/list/datum/mind/possible_borers = get_players_for_role(BE_ALIEN)
+ var/list/datum/mind/possible_borers = get_players_for_role(ROLE_BORER)
if(possible_borers.len < 2)
log_admin("MODE FAILURE: BORER. NOT ENOUGH BORER CANDIDATES.")
diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm
index d40402f0ae2..bc323d14c3c 100644
--- a/code/game/gamemodes/changeling/changeling.dm
+++ b/code/game/gamemodes/changeling/changeling.dm
@@ -46,7 +46,7 @@ var/list/possible_changeling_IDs = list("Alpha","Beta","Gamma","Delta","Epsilon"
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING)
+ var/list/datum/mind/possible_changelings = get_players_for_role(ROLE_CHANGELING)
changeling_amount = 1 + round(num_players() / 10)
diff --git a/code/game/gamemodes/changeling/traitor_chan.dm b/code/game/gamemodes/changeling/traitor_chan.dm
index 48ea01b1a29..8cb86e6cc3c 100644
--- a/code/game/gamemodes/changeling/traitor_chan.dm
+++ b/code/game/gamemodes/changeling/traitor_chan.dm
@@ -18,7 +18,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING)
+ var/list/datum/mind/possible_changelings = get_players_for_role(ROLE_CHANGELING)
for(var/mob/new_player/player in player_list)
if((player.mind in possible_changelings) && (player.client.prefs.species in protected_species_changeling))
diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm
index 457a9d85995..0ec4d72b5de 100644
--- a/code/game/gamemodes/cult/cult.dm
+++ b/code/game/gamemodes/cult/cult.dm
@@ -71,7 +71,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/cultists_possible = get_players_for_role(BE_CULTIST)
+ var/list/cultists_possible = get_players_for_role(ROLE_CULTIST)
for(var/cultists_number = 1 to max_cultists_to_start)
if(!cultists_possible.len)
diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm
index 3f1cd777310..8c1d97fef07 100644
--- a/code/game/gamemodes/events.dm
+++ b/code/game/gamemodes/events.dm
@@ -6,7 +6,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)
if(prob(40)) spawncount++ //sometimes, have two larvae spawn instead of one
while((spawncount >= 1) && vents.len && candidates.len)
@@ -25,7 +25,7 @@
command_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg')
for(var/mob/M in player_list)
M << sound('sound/AI/aliens.ogg')
-
+
/proc/lightsout(isEvent = 0, lightsoutAmount = 1,lightsoutRange = 25) //leave lightsoutAmount as 0 to break ALL lights
if(isEvent)
command_announcement.Announce("An Electrical storm has been detected in your area, please repair potential electronic overloads.","Electrical Storm Alert")
diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm
index 244ae984ac8..f2de8d413fd 100644
--- a/code/game/gamemodes/game_mode.dm
+++ b/code/game/gamemodes/game_mode.dm
@@ -254,7 +254,7 @@
// Get a list of all the people who want to be the antagonist for this round, except those with incompatible species
for(var/mob/new_player/player in players)
- if(player.client.prefs.be_special & role && !(player.client.prefs.species in protected_species))
+ if((role in player.client.prefs.be_special) && !(player.client.prefs.species in protected_species))
log_debug("[player.key] had [roletext] enabled, so we are drafting them.")
candidates += player.mind
players -= player
@@ -276,57 +276,6 @@
if(player.assigned_role == job)
candidates -= player
- /*if(candidates.len < recommended_enemies)
- for(var/mob/new_player/player in players)
- if(player.client && player.ready)
- if(!(player.client.prefs.be_special & role)) // We don't have enough people who want to be antagonist, make a seperate list of people who don't want to be one
- if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, roletext)) //Nodrak/Carn: Antag Job-bans
- drafted += player.mind
-
- if(restricted_jobs)
- for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist
- for(var/job in restricted_jobs)
- if(player.assigned_role == job)
- drafted -= player
-
- drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie
-
- while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates
- if(drafted.len > 0)
- applicant = pick(drafted)
- if(applicant)
- candidates += applicant
- log_debug("[applicant.key] was force-drafted as [roletext], because there aren't enough candidates.")
- drafted.Remove(applicant)
-
- else // Not enough scrubs, ABORT ABORT ABORT
- break
-
- if(candidates.len < recommended_enemies && override_jobbans) //If we still don't have enough people, we're going to start drafting banned people.
- for(var/mob/new_player/player in players)
- if (player.client && player.ready)
- if(jobban_isbanned(player, "Syndicate") || jobban_isbanned(player, roletext)) //Nodrak/Carn: Antag Job-bans
- drafted += player.mind
-
- if(restricted_jobs)
- for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist
- for(var/job in restricted_jobs)
- if(player.assigned_role == job)
- drafted -= player
-
- drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie
-
- while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates
- if(drafted.len > 0)
- applicant = pick(drafted)
- if(applicant)
- candidates += applicant
- drafted.Remove(applicant)
- log_debug("[applicant.key] was force-drafted as [roletext], because there aren't enough candidates.")
-
- else // Not enough scrubs, ABORT ABORT ABORT
- break
- */
return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than recommended_enemies
// recommended_enemies if the number of people with that role set to yes is less than recomended_enemies,
@@ -336,7 +285,7 @@
/datum/game_mode/proc/latespawn(var/mob)
/*
-/datum/game_mode/proc/check_player_role_pref(var/role, var/mob/new_player/player)
+/datum/game_mode/proc/check_player_role_pref(var/role, var/mob/player)
if(player.preferences.be_special & role)
return 1
return 0
@@ -489,22 +438,7 @@ proc/get_nt_opposed()
obj_count++
/proc/get_roletext(var/role)
- var/roletext
- switch(role)
- if(BE_CHANGELING) roletext="changeling"
- if(BE_TRAITOR) roletext="traitor"
- if(BE_OPERATIVE) roletext="operative"
- if(BE_WIZARD) roletext="wizard"
- if(BE_MALF) roletext="malf AI"
- if(BE_REV) roletext="revolutionary"
- if(BE_CULTIST) roletext="cultist"
- if(BE_NINJA) roletext="ninja"
- if(BE_RAIDER) roletext="raider"
- if(BE_VAMPIRE) roletext="vampire"
- if(BE_ALIEN) roletext="alien"
- if(BE_MUTINEER) roletext="mutineer"
- if(BE_BLOB) roletext="blob"
- return roletext
+ return role
/proc/get_nuke_code()
var/nukecode = "ERROR"
diff --git a/code/game/gamemodes/heist/heist.dm b/code/game/gamemodes/heist/heist.dm
index e6d4914ad3a..229993ee50c 100644
--- a/code/game/gamemodes/heist/heist.dm
+++ b/code/game/gamemodes/heist/heist.dm
@@ -33,7 +33,7 @@ var/global/list/obj/cortical_stacks = list() //Stacks for 'leave nobody behind'
if(!..())
return 0
- var/list/candidates = get_players_for_role(BE_RAIDER)
+ var/list/candidates = get_players_for_role(ROLE_RAIDER)
var/raider_num = 0
//Check that we have enough vox.
diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm
index f206fee3591..4d436e29ca9 100644
--- a/code/game/gamemodes/malfunction/malfunction.dm
+++ b/code/game/gamemodes/malfunction/malfunction.dm
@@ -25,13 +25,13 @@
The AI on the satellite has malfunctioned and must be destroyed.
The AI satellite is deep in space and can only be accessed with the use of a teleporter! You have [AI_win_timeleft/60] minutes to disable it."}
-/datum/game_mode/malfunction/get_players_for_role(var/role = BE_MALF)
+/datum/game_mode/malfunction/get_players_for_role(var/role = ROLE_MALF)
var/roletext = get_roletext(role)
var/datum/job/ai/DummyAIjob = new
for(var/mob/new_player/player in player_list)
if(player.client && player.ready)
- if(player.client.prefs.be_special & BE_MALF)
+ if(ROLE_MALF in player.client.prefs.be_special)
if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, "AI") && !jobban_isbanned(player, roletext) && DummyAIjob.player_old_enough(player.client))
if(player_old_enough_antag(player.client,role))
antag_candidates += player.mind
@@ -39,7 +39,7 @@
return antag_candidates
/datum/game_mode/malfunction/pre_setup()
- get_players_for_role(BE_MALF)
+ get_players_for_role(ROLE_MALF)
var/datum/mind/chosen_ai
if(!antag_candidates.len)
diff --git a/code/game/gamemodes/mutiny/mutiny.dm b/code/game/gamemodes/mutiny/mutiny.dm
index a198fb21eac..1d2faebe5ff 100644
--- a/code/game/gamemodes/mutiny/mutiny.dm
+++ b/code/game/gamemodes/mutiny/mutiny.dm
@@ -80,7 +80,7 @@ datum/game_mode/mutiny
proc/get_head_mutineer_candidates()
var/list/candidates[0]
for(var/mob/mutineer in player_list)
- if(mutineer.client.prefs.be_special & BE_MUTINEER)
+ if(ROLE_MUTINEER in mutineer.client.prefs.be_special)
if(!jobban_isbanned(mutineer, "mutineer") && !jobban_isbanned(mutineer,"Syndicate"))
for(var/job in command_positions - "Captain")
if(mutineer.mind && mutineer.mind.assigned_role == job)
diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm
index 007e1c1da04..bfcb53db43c 100644
--- a/code/game/gamemodes/nuclear/nuclear.dm
+++ b/code/game/gamemodes/nuclear/nuclear.dm
@@ -31,7 +31,7 @@ proc/issyndicate(mob/living/M as mob)
if(!..())
return 0
- var/list/possible_syndicates = get_players_for_role(BE_OPERATIVE)
+ var/list/possible_syndicates = get_players_for_role(ROLE_OPERATIVE)
var/agent_number = 0
if(possible_syndicates.len < 1)
diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm
index 714ad3d5870..345114a4088 100644
--- a/code/game/gamemodes/revolution/revolution.dm
+++ b/code/game/gamemodes/revolution/revolution.dm
@@ -45,7 +45,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV)
+ var/list/datum/mind/possible_headrevs = get_players_for_role(ROLE_REV)
for (var/i=1 to max_headrevs)
if(possible_headrevs.len==0)
diff --git a/code/game/gamemodes/revolution/rp_revolution.dm b/code/game/gamemodes/revolution/rp_revolution.dm
index 3e9c18bca12..ef2ec130047 100644
--- a/code/game/gamemodes/revolution/rp_revolution.dm
+++ b/code/game/gamemodes/revolution/rp_revolution.dm
@@ -1,4 +1,5 @@
// BS12's less violent revolution mode
+// Isn't this basically mutiny but without any real reason
/datum/game_mode/revolution/rp_revolution
name = "rp-revolution"
@@ -29,7 +30,7 @@
max_headrevs = max(num_players / 4, 3)
recommended_enemies = max_headrevs
- var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV)
+ var/list/datum/mind/possible_headrevs = get_players_for_role(ROLE_REV)
var/head_check = 0
for(var/mob/new_player/player in player_list)
diff --git a/code/game/gamemodes/shadowling/shadowling.dm b/code/game/gamemodes/shadowling/shadowling.dm
index fd1ac61ef80..551fb869839 100644
--- a/code/game/gamemodes/shadowling/shadowling.dm
+++ b/code/game/gamemodes/shadowling/shadowling.dm
@@ -78,7 +78,7 @@ Made by Xhuis
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/datum/mind/possible_shadowlings = get_players_for_role(BE_SHADOWLING)
+ var/list/datum/mind/possible_shadowlings = get_players_for_role(ROLE_SHADOWLING)
if(!possible_shadowlings.len)
return 0
diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm
index a94cda0f3cf..df18240e7bf 100644
--- a/code/game/gamemodes/traitor/traitor.dm
+++ b/code/game/gamemodes/traitor/traitor.dm
@@ -34,7 +34,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/possible_traitors = get_players_for_role(BE_TRAITOR)
+ var/list/possible_traitors = get_players_for_role(ROLE_TRAITOR)
// stop setup if no possible traitors
if(!possible_traitors.len)
diff --git a/code/game/gamemodes/vampire/vampire.dm b/code/game/gamemodes/vampire/vampire.dm
index 14266ef9f15..0931adfe4ef 100644
--- a/code/game/gamemodes/vampire/vampire.dm
+++ b/code/game/gamemodes/vampire/vampire.dm
@@ -47,7 +47,7 @@
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
- var/list/datum/mind/possible_vampires = get_players_for_role(BE_VAMPIRE)
+ var/list/datum/mind/possible_vampires = get_players_for_role(ROLE_VAMPIRE)
vampire_amount = 1 + round(num_players() / 10)
diff --git a/code/game/gamemodes/wizard/artefact.dm b/code/game/gamemodes/wizard/artefact.dm
index 17e60881cc5..587b9ad1af5 100644
--- a/code/game/gamemodes/wizard/artefact.dm
+++ b/code/game/gamemodes/wizard/artefact.dm
@@ -49,7 +49,7 @@
if (used)
H << "You already used this contract!"
return
- var/list/candidates = get_candidates(BE_WIZARD)
+ var/list/candidates = get_candidates(ROLE_WIZARD)
if(candidates.len)
src.used = 1
var/client/C = pick(candidates)
@@ -294,7 +294,7 @@ var/global/list/multiverse = list()
usr.mind.special_role = "[usr.real_name] Prime"
evil = FALSE
else
- var/list/candidates = get_candidates(BE_WIZARD)
+ var/list/candidates = get_candidates(ROLE_WIZARD)
if(candidates.len)
var/client/C = pick(candidates)
spawn_copy(C, get_turf(user.loc), user)
diff --git a/code/game/gamemodes/wizard/raginmages.dm b/code/game/gamemodes/wizard/raginmages.dm
index 81684f83e37..30af14862cd 100644
--- a/code/game/gamemodes/wizard/raginmages.dm
+++ b/code/game/gamemodes/wizard/raginmages.dm
@@ -17,7 +17,7 @@
..()
if(!max_mages)
for(var/mob/living/player in mob_list)
- if (player.client && player.stat != 2)
+ if (player.client && player.stat != DEAD)
playercount += 1
max_mages = round(playercount / 5)
@@ -40,12 +40,12 @@
continue
if(istype(wizard.current,/mob/living/carbon/brain))
continue
- if(wizard.current.stat==2)
+ if(wizard.current.stat==DEAD)
continue
- if(wizard.current.stat==1)
+ if(wizard.current.stat==UNCONSCIOUS)
if(wizard.current.health < 0)
wizard.current << "\red The Space Wizard Federation is upset with your performance and have terminated your employment."
- wizard.current.stat = 2
+ wizard.current.death()
continue
wizards_alive++
@@ -73,7 +73,7 @@
var/mob/dead/observer/theghost = null
spawn(rand(200, 600))
message_admins("SWF is still pissed, sending another wizard - [max_mages - mages_made] left.")
- candidates = get_candidates(BE_WIZARD)
+ candidates = get_candidates(ROLE_WIZARD)
if(!candidates.len)
message_admins("No applicable ghosts for the next ragin' mage, asking ghosts instead.")
var/time_passed = world.time
diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm
index 8b7267408b9..45beb619642 100644
--- a/code/game/gamemodes/wizard/wizard.dm
+++ b/code/game/gamemodes/wizard/wizard.dm
@@ -23,7 +23,7 @@
/datum/game_mode/wizard/can_start()//This could be better, will likely have to recode it later
if(!..())
return 0
- var/list/datum/mind/possible_wizards = get_players_for_role(BE_WIZARD)
+ var/list/datum/mind/possible_wizards = get_players_for_role(ROLE_WIZARD)
if(possible_wizards.len==0)
return 0
var/datum/mind/wizard = pick(possible_wizards)
@@ -211,7 +211,7 @@
for(var/datum/mind/wizard in wizards)
if(!istype(wizard.current,/mob/living/carbon))
continue
- if(wizard.current.stat==2)
+ if(wizard.current.stat==DEAD)
continue
wizards_alive++
@@ -219,7 +219,7 @@
for(var/datum/mind/traitor in traitors)
if(!istype(traitor.current,/mob/living/carbon))
continue
- if(traitor.current.stat==2)
+ if(traitor.current.stat==DEAD)
continue
traitors_alive++
@@ -269,7 +269,7 @@
wizardwin = 0
count++
- if(wizard.current && wizard.current.stat!=2 && wizardwin)
+ if(wizard.current && wizard.current.stat!=DEAD && wizardwin)
text += "
The wizard was successful!"
feedback_add_details("wizard_success","SUCCESS")
else
diff --git a/code/game/gamemodes/xenos/xenos.dm b/code/game/gamemodes/xenos/xenos.dm
index f73b398c20d..f30debb7e98 100644
--- a/code/game/gamemodes/xenos/xenos.dm
+++ b/code/game/gamemodes/xenos/xenos.dm
@@ -25,7 +25,7 @@
if(!..())
return 0
- var/list/candidates = get_players_for_role(BE_ALIEN)
+ var/list/candidates = get_players_for_role(ROLE_ALIEN)
var/playersready = 0
var/xenos_num
for(var/mob/new_player/player in player_list)
diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm
index 9a34e2e1524..f5dc80dcae7 100644
--- a/code/game/jobs/job_controller.dm
+++ b/code/game/jobs/job_controller.dm
@@ -94,7 +94,7 @@ var/global/datum/controller/occupations/job_master
if(!job.player_old_enough(player.client))
Debug("FOC player not old enough, Player: [player]")
continue
- if(flag && (!player.client.prefs.be_special & flag))
+ if(flag && !(flag in player.client.prefs.be_special))
Debug("FOC flag failed, Player: [player], Flag: [flag], ")
continue
if(player.mind && job.title in player.mind.restricted_roles)
diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm
index b8a90698e2a..eb0cb3abf63 100644
--- a/code/game/objects/effects/spiders.dm
+++ b/code/game/objects/effects/spiders.dm
@@ -198,7 +198,7 @@
S.faction = faction
S.master_commander = master_commander
if(player_spiders)
- var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET)
+ var/list/candidates = get_candidates(ROLE_ALIEN, ALIEN_AFK_BRACKET)
var/client/C = null
if(candidates.len)
diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm
index ad25fab49ce..798dd02b85f 100644
--- a/code/modules/admin/verbs/one_click_antag.dm
+++ b/code/modules/admin/verbs/one_click_antag.dm
@@ -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)
diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm
index 40d8bc80671..e428f25fc39 100644
--- a/code/modules/admin/verbs/randomverbs.dm
+++ b/code/modules/admin/verbs/randomverbs.dm
@@ -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
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index e7987280d48..bc28c88ee2f 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -2,42 +2,29 @@
var/list/preferences_datums = list()
-var/global/list/special_roles = list( //keep synced with the defines BE_* in setup.dm. THE ORDER MATTERS
-//some autodetection here.
- "traitor" = IS_MODE_COMPILED("traitor"), // 1 / 1
- "operative" = IS_MODE_COMPILED("nuclear"), // 2 / 2
- "changeling" = IS_MODE_COMPILED("changeling"), // 4 / 3
- "wizard" = IS_MODE_COMPILED("wizard"), // 8 / 4
- "malf AI" = IS_MODE_COMPILED("malfunction"), // 16 / 5
- "revolutionary" = IS_MODE_COMPILED("revolution"), // 32 / 6
- "alien" = 1, // 62 / 7
- "pAI" = 1, // 128 / 8
- "cultist" = IS_MODE_COMPILED("cult"), // 256 / 9
- "ninja" = 1, // 512 / 10
- "raider" = IS_MODE_COMPILED("heist"), // 1024 / 11
- "vampire" = IS_MODE_COMPILED("vampire"), // 2048 / 12
- "mutineer" = IS_MODE_COMPILED("mutiny"), // 4096 / 13
- "blob" = IS_MODE_COMPILED("blob"), // 8192 / 14
- "shadowling" = IS_MODE_COMPILED("shadowling"), //16384 / 15
- "revenant" = 1 //32768 / 16
-)
var/global/list/special_role_times = list( //minimum age (in days) for accounts to play these roles
- num2text(BE_PAI) = 0,
- num2text(BE_TRAITOR) = 7,
- num2text(BE_CHANGELING) = 14,
- num2text(BE_SHADOWLING) = 14,
- num2text(BE_WIZARD) = 14,
- num2text(BE_REV) = 14,
- num2text(BE_VAMPIRE) = 14,
- num2text(BE_BLOB) = 14,
- num2text(BE_REVENANT) = 14,
- num2text(BE_OPERATIVE) = 21,
- num2text(BE_CULTIST) = 21,
- num2text(BE_RAIDER) = 21,
- num2text(BE_ALIEN) = 21,
- num2text(BE_NINJA) = 21,
- num2text(BE_MUTINEER) = 21,
- num2text(BE_MALF) = 30,
+ ROLE_PAI = 0,
+ ROLE_POSIBRAIN = 0,
+ ROLE_GUARDIAN = 0,
+ ROLE_TRAITOR = 7,
+ ROLE_CHANGELING = 14,
+ ROLE_SHADOWLING = 14,
+ ROLE_WIZARD = 14,
+ ROLE_REV = 14,
+ ROLE_VAMPIRE = 14,
+ ROLE_BLOB = 14,
+ ROLE_REVENANT = 14,
+ ROLE_OPERATIVE = 21,
+ ROLE_CULTIST = 21,
+ ROLE_RAIDER = 21,
+ ROLE_ALIEN = 21,
+ ROLE_DEMON = 21,
+ ROLE_SENTIENT = 21,
+// ROLE_GANG = 21,
+ ROLE_BORER = 21,
+ ROLE_NINJA = 21,
+ ROLE_MUTINEER = 21,
+ ROLE_MALF = 30,
)
/proc/player_old_enough_antag(client/C, role)
@@ -75,7 +62,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
#define MAX_SAVE_SLOTS 10 // Save slots for regular players
#define MAX_SAVE_SLOTS_MEMBER 10 // Save slots for BYOND members
-datum/preferences
+/datum/preferences
//doohickeys for savefiles
// var/path
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
@@ -91,7 +78,7 @@ datum/preferences
//game-preferences
// var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
var/ooccolor = "#b82e00"
- var/be_special = 0 //Special role selection
+ var/be_special = list() //Special role selection
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
var/sound = SOUND_DEFAULT
@@ -209,1010 +196,884 @@ datum/preferences
save_preferences(C)
save_character(C) //let's save this new random character so it doesn't keep generating new ones.
-/datum/preferences
- proc/ShowChoices(mob/user)
- if(!user || !user.client) return
- update_preview_icon()
- user << browse_rsc(preview_icon_front, "previewicon.png")
- user << browse_rsc(preview_icon_side, "previewicon2.png")
- var/dat = "
"
- dat += "Character Settings"
- dat += "Game Preferences"
- dat += ""
- dat += "
"
+// Hello I am a proc full of snowflake species checks how are you
+/datum/preferences/proc/ShowChoices(mob/user)
+ if(!user || !user.client) return
+ update_preview_icon()
+ user << browse_rsc(preview_icon_front, "previewicon.png")
+ user << browse_rsc(preview_icon_side, "previewicon2.png")
+ var/dat = ""
- switch(current_tab)
- if (0) // Character Settings#
- dat += ""
- dat += "Slot [slot_name] - "
- dat += "Load slot - "
- dat += "Save slot - "
- dat += "Reload slot"
- dat += ""
- dat += "Occupation Choices
"
- dat += "Set Occupation Preferences
"
- dat += "Identity
"
- dat += ""
- if(appearance_isbanned(user))
- dat += "You are banned from using custom names and appearances. You can continue to adjust your characters, but you will be randomised once you join the game. "
- dat += "Name: "
- dat += "[real_name] "
- dat += "(Random Name) "
- dat += "(Always Random Name: [be_random_name ? "Yes" : "No"])"
- dat += " "
- dat += "Gender: [gender == MALE ? "Male" : "Female"] "
- dat += "Age: [age]"
- //dat += "Spawn Point: [spawnpoint]"
- dat += "
Body "
- dat += "(®)"
- dat += " "
- dat += "Species: [species] "
- if(species == "Vox")//oldvox code, sucks I know
- dat += "N2 Tank: [speciesprefs ? "Large N2 Tank" : "Specialized N2 Tank"] "
- dat += "Secondary Language: [language] "
- dat += "Blood Type: [b_type] "
- if(species == "Human")
- dat += "Skin Tone: [-s_tone + 35]/220 "
+ dat += "Character Settings"
+ dat += "Game Preferences"
+ dat += ""
+ dat += " "
- // dat += "Skin pattern: Adjust "
- dat += " Handicaps "
- dat += "\t\[Set Disabilities\] "
- dat += "Limbs: Adjust "
- if(species != "Slime People" && species != "Machine")
- dat += "Internal Organs: Adjust "
+ switch(current_tab)
+ if (0) // Character Settings#
+ dat += ""
+ dat += "Slot [slot_name] - "
+ dat += "Load slot - "
+ dat += "Save slot - "
+ dat += "Reload slot"
+ dat += ""
+ dat += "Occupation Choices"
+ dat += "Set Occupation Preferences "
+ dat += "Identity"
+ dat += ""
+ if(appearance_isbanned(user))
+ dat += "You are banned from using custom names and appearances. You can continue to adjust your characters, but you will be randomised once you join the game. "
+ dat += "Name: "
+ dat += "[real_name] "
+ dat += "(Random Name) "
+ dat += "(Always Random Name: [be_random_name ? "Yes" : "No"])"
+ dat += " "
+ dat += "Gender: [gender == MALE ? "Male" : "Female"] "
+ dat += "Age: [age]"
+ //dat += "Spawn Point: [spawnpoint]"
+ dat += "
Body "
+ dat += "(®)"
+ dat += " "
+ dat += "Species: [species] "
+ if(species == "Vox")//oldvox code, sucks I know
+ dat += "N2 Tank: [speciesprefs ? "Large N2 Tank" : "Specialized N2 Tank"] "
+ dat += "Secondary Language: [language] "
+ dat += "Blood Type: [b_type] "
+ if(species == "Human")
+ dat += "Skin Tone: [-s_tone + 35]/220 "
- //display limbs below
- var/ind = 0
- for(var/name in organ_data)
- //world << "[ind] \ [organ_data.len]"
- var/status = organ_data[name]
- var/organ_name = null
- switch(name)
- if("l_arm")
- organ_name = "left arm"
- if("r_arm")
- organ_name = "right arm"
- if("l_leg")
- organ_name = "left leg"
- if("r_leg")
- organ_name = "right leg"
- if("l_foot")
- organ_name = "left foot"
- if("r_foot")
- organ_name = "right foot"
- if("l_hand")
- organ_name = "left hand"
- if("r_hand")
- organ_name = "right hand"
- if("heart")
- organ_name = "heart"
- if("eyes")
- organ_name = "eyes"
+ // dat += "Skin pattern: Adjust "
+ dat += " Handicaps "
+ dat += "\t\[Set Disabilities\] "
+ dat += "Limbs: Adjust "
+ if(species != "Slime People" && species != "Machine")
+ dat += "Internal Organs: Adjust "
- if(status == "cyborg")
- ++ind
- if(ind > 1)
- dat += ", "
- var/datum/robolimb/R
- if(rlimb_data[name] && all_robolimbs[rlimb_data[name]])
- R = all_robolimbs[rlimb_data[name]]
- else
- R = basic_robolimb
- dat += "\t[R.company] [organ_name] prothesis"
+ //display limbs below
+ var/ind = 0
+ for(var/name in organ_data)
+ //world << "[ind] \ [organ_data.len]"
+ var/status = organ_data[name]
+ var/organ_name = null
+ switch(name)
+ if("l_arm")
+ organ_name = "left arm"
+ if("r_arm")
+ organ_name = "right arm"
+ if("l_leg")
+ organ_name = "left leg"
+ if("r_leg")
+ organ_name = "right leg"
+ if("l_foot")
+ organ_name = "left foot"
+ if("r_foot")
+ organ_name = "right foot"
+ if("l_hand")
+ organ_name = "left hand"
+ if("r_hand")
+ organ_name = "right hand"
+ if("heart")
+ organ_name = "heart"
+ if("eyes")
+ organ_name = "eyes"
-
- else if(status == "amputated")
- ++ind
- if(ind > 1)
- dat += ", "
- dat += "\tAmputated [organ_name]"
-
- else if(status == "mechanical")
- ++ind
- if(ind > 1)
- dat += ", "
- dat += "\tMechanical [organ_name]"
-
- else if(status == "assisted")
- ++ind
- if(ind > 1)
- dat += ", "
- switch(organ_name)
- if("heart")
- dat += "\tPacemaker-assisted [organ_name]"
- if("voicebox") //on adding voiceboxes for speaking skrell/similar replacements
- dat += "\tSurgically altered [organ_name]"
- if("eyes")
- dat += "\tRetinal overlayed [organ_name]"
- else
- dat += "\tMechanically assisted [organ_name]"
- if(!ind)
- dat += "\[...\]
"
- else
- dat += "
"
- dat += "Underwear: [underwear] "
- dat += "Undershirt: [undershirt] "
- dat += "Socks: [socks] "
- dat += "Backpack Type: [backbaglist[backbag]] "
- dat += "Nanotrasen Relation: [nanotrasen_relation] "
- dat += " | Preview
  | "
- dat += " | "
-
- if(jobban_isbanned(user, "Records"))
- dat += "You are banned from using character records. "
- else
- dat += "Character Records "
- dat += "Set Flavor Text "
- if(lentext(flavor_text) <= 40)
- if(!lentext(flavor_text))
- dat += "\[...\]"
+ if(status == "cyborg")
+ ++ind
+ if(ind > 1)
+ dat += ", "
+ var/datum/robolimb/R
+ if(rlimb_data[name] && all_robolimbs[rlimb_data[name]])
+ R = all_robolimbs[rlimb_data[name]]
else
- dat += "[flavor_text]"
+ R = basic_robolimb
+ dat += "\t[R.company] [organ_name] prothesis"
+
+
+ else if(status == "amputated")
+ ++ind
+ if(ind > 1)
+ dat += ", "
+ dat += "\tAmputated [organ_name]"
+
+ else if(status == "mechanical")
+ ++ind
+ if(ind > 1)
+ dat += ", "
+ dat += "\tMechanical [organ_name]"
+
+ else if(status == "assisted")
+ ++ind
+ if(ind > 1)
+ dat += ", "
+ switch(organ_name)
+ if("heart")
+ dat += "\tPacemaker-assisted [organ_name]"
+ if("voicebox") //on adding voiceboxes for speaking skrell/similar replacements
+ dat += "\tSurgically altered [organ_name]"
+ if("eyes")
+ dat += "\tRetinal overlayed [organ_name]"
+ else
+ dat += "\tMechanically assisted [organ_name]"
+ if(!ind)
+ dat += "\[...\]
"
+ else
+ dat += "
"
+ dat += "Underwear: [underwear] "
+ dat += "Undershirt: [undershirt] "
+ dat += "Socks: [socks] "
+ dat += "Backpack Type: [backbaglist[backbag]] "
+ dat += "Nanotrasen Relation: [nanotrasen_relation] "
+ dat += " | Preview
  | "
+ dat += " | "
+
+ if(jobban_isbanned(user, "Records"))
+ dat += "You are banned from using character records. "
+ else
+ dat += "Character Records "
+ dat += "Set Flavor Text "
+ if(lentext(flavor_text) <= 40)
+ if(!lentext(flavor_text))
+ dat += "\[...\]"
else
- dat += "[TextPreview(flavor_text)]... "
- dat += " "
+ dat += "[flavor_text]"
+ else
+ dat += "[TextPreview(flavor_text)]... "
+ dat += " "
- var/hairname = "Hair"
- if(species == "Machine")
- hairname = "Frame Color"
- dat += " [hairname] "
- dat += "Change Color "
- dat += " Style: [h_style] "
+ var/hairname = "Hair"
+ if(species == "Machine")
+ hairname = "Frame Color"
+ dat += " [hairname] "
+ dat += "Change Color "
+ dat += " Style: [h_style] "
- dat += " Facial "
- dat += "Change Color "
- dat += " Style: [f_style] "
+ dat += " Facial "
+ dat += "Change Color "
+ dat += " Style: [f_style] "
- dat += " Eyes "
- dat += "Change Color "
+ dat += " Eyes "
+ dat += "Change Color "
- if((species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Vulpkanin", "Machine")) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) //admins can always fuck with this, because they are admins
- dat += " Body Color "
- dat += "Change Color "
+ if((species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Vulpkanin", "Machine")) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) //admins can always fuck with this, because they are admins
+ dat += " Body Color "
+ dat += "Change Color "
- if(body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
- dat += " Body Accessory "
- dat += "Accessory: [body_accessory ? "[body_accessory]" : "None"] "
+ if(body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
+ dat += " Body Accessory "
+ dat += "Accessory: [body_accessory ? "[body_accessory]" : "None"] "
- dat += " |
"
+ dat += " |
"
- if (1) // General Preferences
- dat += "
"
- if(!IsGuestKey(user.key))
- dat += "Undo - "
- dat += "Save Setup - "
+ if(!IsGuestKey(user.key))
+ dat += "Undo - "
+ dat += "Save Setup - "
- dat += "Reset Setup"
- dat += ""
+ dat += "Reset Setup"
+ dat += ""
// user << browse(dat, "window=preferences;size=560x580")
- var/datum/browser/popup = new(user, "preferences", "Character Setup
", 640, 810)
- popup.set_content(dat)
- popup.open(0)
+ var/datum/browser/popup = new(user, "preferences", "Character Setup
", 640, 810)
+ popup.set_content(dat)
+ popup.open(0)
- proc/SetChoices(mob/user, limit = 12, list/splitJobs = list("Civilian","Research Director","AI","Bartender"), width = 760, height = 790)
- if(!job_master)
- return
+/datum/preferences/proc/SetChoices(mob/user, limit = 12, list/splitJobs = list("Civilian","Research Director","AI","Bartender"), width = 760, height = 790)
+ if(!job_master)
+ return
- //limit - The amount of jobs allowed per column. Defaults to 17 to make it look nice.
- //splitJobs - Allows you split the table by job. You can make different tables for each department by including their heads. Defaults to CE to make it look nice.
- //width - Screen' width. Defaults to 550 to make it look nice.
- //height - Screen's height. Defaults to 500 to make it look nice.
+ //limit - The amount of jobs allowed per column. Defaults to 17 to make it look nice.
+ //splitJobs - Allows you split the table by job. You can make different tables for each department by including their heads. Defaults to CE to make it look nice.
+ //width - Screen' width. Defaults to 550 to make it look nice.
+ //height - Screen's height. Defaults to 500 to make it look nice.
- var/HTML = ""
- HTML += ""
- HTML += "Choose occupation chances
Unavailable occupations are crossed out.
"
- HTML += "\[Done\]
" // Easier to press up here.
- HTML += "Left-click to raise an occupation preference, right-click to lower it.
"
- HTML += ""
- HTML += "" // Table within a table for alignment, also allows you to easily add more colomns.
- HTML += ""
- var/index = -1
+ var/HTML = ""
+ HTML += ""
+ HTML += "Choose occupation chances Unavailable occupations are crossed out.
"
+ HTML += "\[Done\] " // Easier to press up here.
+ HTML += "Left-click to raise an occupation preference, right-click to lower it.
"
+ HTML += ""
+ HTML += "" // Table within a table for alignment, also allows you to easily add more colomns.
+ HTML += ""
+ var/index = -1
- //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
- var/datum/job/lastJob
- if (!job_master) return
- for(var/datum/job/job in job_master.occupations)
+ //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
+ var/datum/job/lastJob
+ if (!job_master) return
+ for(var/datum/job/job in job_master.occupations)
- index += 1
- if((index >= limit) || (job.title in splitJobs))
- if((index < limit) && (lastJob != null))
- //If the cells were broken up by a job in the splitJob list then it will fill in the rest of the cells with
- //the last job's selection color. Creating a rather nice effect.
- for(var/i = 0, i < (limit - index), i += 1)
- HTML += "|   |   | "
- HTML += " | "
- index = 0
+ index += 1
+ if((index >= limit) || (job.title in splitJobs))
+ if((index < limit) && (lastJob != null))
+ //If the cells were broken up by a job in the splitJob list then it will fill in the rest of the cells with
+ //the last job's selection color. Creating a rather nice effect.
+ for(var/i = 0, i < (limit - index), i += 1)
+ HTML += "|   |   | "
+ HTML += " | "
+ index = 0
- HTML += "| "
- var/rank = job.title
- lastJob = job
- if(!is_job_whitelisted(user, rank))
- HTML += "[rank] | \[KARMA] | "
- continue
- if(jobban_isbanned(user, rank))
- HTML += "[rank] \[BANNED] | "
- continue
- if(!job.player_old_enough(user.client))
- var/available_in_days = job.available_in_days(user.client)
- HTML += "[rank] \[IN [(available_in_days)] DAYS] | "
- continue
- if((job_support_low & CIVILIAN) && (rank != "Civilian"))
- HTML += "[rank] | "
- continue
- if((rank in command_positions) || (rank == "AI"))//Bold head jobs
- HTML += "[rank]"
- else
- HTML += "[rank]"
+ HTML += "| "
+ var/rank = job.title
+ lastJob = job
+ if(!is_job_whitelisted(user, rank))
+ HTML += "[rank] | \[KARMA] | "
+ continue
+ if(jobban_isbanned(user, rank))
+ HTML += "[rank] \[BANNED] | "
+ continue
+ if(!job.player_old_enough(user.client))
+ var/available_in_days = job.available_in_days(user.client)
+ HTML += "[rank] \[IN [(available_in_days)] DAYS] | "
+ continue
+ if((job_support_low & CIVILIAN) && (rank != "Civilian"))
+ HTML += "[rank] | "
+ continue
+ if((rank in command_positions) || (rank == "AI"))//Bold head jobs
+ HTML += "[rank]"
+ else
+ HTML += "[rank]"
- HTML += ""
+ HTML += " | "
- var/prefLevelLabel = "ERROR"
- var/prefLevelColor = "pink"
- var/prefUpperLevel = -1 // level to assign on left click
- var/prefLowerLevel = -1 // level to assign on right click
+ var/prefLevelLabel = "ERROR"
+ var/prefLevelColor = "pink"
+ var/prefUpperLevel = -1 // level to assign on left click
+ var/prefLowerLevel = -1 // level to assign on right click
- if(GetJobDepartment(job, 1) & job.flag)
- prefLevelLabel = "High"
- prefLevelColor = "slateblue"
- prefUpperLevel = 4
- prefLowerLevel = 2
- else if(GetJobDepartment(job, 2) & job.flag)
- prefLevelLabel = "Medium"
- prefLevelColor = "green"
- prefUpperLevel = 1
- prefLowerLevel = 3
- else if(GetJobDepartment(job, 3) & job.flag)
- prefLevelLabel = "Low"
- prefLevelColor = "orange"
- prefUpperLevel = 2
- prefLowerLevel = 4
- else
- prefLevelLabel = "NEVER"
- prefLevelColor = "red"
- prefUpperLevel = 3
- prefLowerLevel = 1
+ if(GetJobDepartment(job, 1) & job.flag)
+ prefLevelLabel = "High"
+ prefLevelColor = "slateblue"
+ prefUpperLevel = 4
+ prefLowerLevel = 2
+ else if(GetJobDepartment(job, 2) & job.flag)
+ prefLevelLabel = "Medium"
+ prefLevelColor = "green"
+ prefUpperLevel = 1
+ prefLowerLevel = 3
+ else if(GetJobDepartment(job, 3) & job.flag)
+ prefLevelLabel = "Low"
+ prefLevelColor = "orange"
+ prefUpperLevel = 2
+ prefLowerLevel = 4
+ else
+ prefLevelLabel = "NEVER"
+ prefLevelColor = "red"
+ prefUpperLevel = 3
+ prefLowerLevel = 1
- HTML += ""
+ HTML += ""
// HTML += ""
- if(rank == "Civilian")//Civilian is special
- if(job_support_low & CIVILIAN)
- HTML += " \[Yes]"
- else
- HTML += " \[No]"
- if(job.alt_titles)
- HTML += " \[[GetPlayerAltTitle(job)]\] | "
- HTML += ""
- continue
-/*
- if(GetJobDepartment(job, 1) & job.flag)
- HTML += " \[High]"
- else if(GetJobDepartment(job, 2) & job.flag)
- HTML += " \[Medium]"
- else if(GetJobDepartment(job, 3) & job.flag)
- HTML += " \[Low]"
+ if(rank == "Civilian")//Civilian is special
+ if(job_support_low & CIVILIAN)
+ HTML += " \[Yes]"
else
- HTML += " \[NEVER]"
- */
- HTML += "[prefLevelLabel]"
-
+ HTML += " \[No]"
if(job.alt_titles)
HTML += " \[[GetPlayerAltTitle(job)]\]"
-
-
HTML += ""
+ continue
+/*
+ if(GetJobDepartment(job, 1) & job.flag)
+ HTML += " \[High]"
+ else if(GetJobDepartment(job, 2) & job.flag)
+ HTML += " \[Medium]"
+ else if(GetJobDepartment(job, 3) & job.flag)
+ HTML += " \[Low]"
+ else
+ HTML += " \[NEVER]"
+ */
+ HTML += "[prefLevelLabel]"
- for(var/i = 1, i < (limit - index), i += 1) // Finish the column so it is even
- HTML += "|   |   | "
+ if(job.alt_titles)
+ HTML += " \[[GetPlayerAltTitle(job)]\]"
- HTML += " "
- HTML += " | "
+ HTML += ""
- switch(alternate_option)
- if(GET_RANDOM_JOB)
- HTML += " Get random job if preferences unavailable "
- if(BE_CIVILIAN)
- HTML += " Be a civilian if preferences unavailable "
- if(RETURN_TO_LOBBY)
- HTML += " Return to lobby if preferences unavailable "
+ for(var/i = 1, i < (limit - index), i += 1) // Finish the column so it is even
+ HTML += "|   |   | "
- HTML += "\[Reset\]"
- HTML += ""
+ HTML += " "
- user << browse(null, "window=preferences")
+ HTML += " |
"
+
+ switch(alternate_option)
+ if(GET_RANDOM_JOB)
+ HTML += "
Get random job if preferences unavailable
"
+ if(BE_CIVILIAN)
+ HTML += "
Be a civilian if preferences unavailable
"
+ if(RETURN_TO_LOBBY)
+ HTML += "
Return to lobby if preferences unavailable
"
+
+ HTML += "\[Reset\]"
+ HTML += ""
+
+ user << browse(null, "window=preferences")
// user << browse(HTML, "window=mob_occupation;size=[width]x[height]")
- var/datum/browser/popup = new(user, "mob_occupation", "Occupation Preferences
", width, height)
- popup.set_window_options("can_close=0")
- popup.set_content(HTML)
- popup.open(0)
+ var/datum/browser/popup = new(user, "mob_occupation", "Occupation Preferences
", width, height)
+ popup.set_window_options("can_close=0")
+ popup.set_content(HTML)
+ popup.open(0)
+ return
+
+/datum/preferences/proc/SetJobPreferenceLevel(var/datum/job/job, var/level)
+ if (!job)
+ return 0
+
+ if (level == 1) // to high
+ // remove any other job(s) set to high
+ job_support_med |= job_support_high
+ job_engsec_med |= job_engsec_high
+ job_medsci_med |= job_medsci_high
+ job_karma_med |= job_karma_high
+ job_support_high = 0
+ job_engsec_high = 0
+ job_medsci_high = 0
+ job_karma_high = 0
+
+ if (job.department_flag == SUPPORT)
+ job_support_low &= ~job.flag
+ job_support_med &= ~job.flag
+ job_support_high &= ~job.flag
+
+ switch(level)
+ if (1)
+ job_support_high |= job.flag
+ if (2)
+ job_support_med |= job.flag
+ if (3)
+ job_support_low |= job.flag
+
+ return 1
+ else if (job.department_flag == ENGSEC)
+ job_engsec_low &= ~job.flag
+ job_engsec_med &= ~job.flag
+ job_engsec_high &= ~job.flag
+
+ switch(level)
+ if (1)
+ job_engsec_high |= job.flag
+ if (2)
+ job_engsec_med |= job.flag
+ if (3)
+ job_engsec_low |= job.flag
+
+ return 1
+ else if (job.department_flag == MEDSCI)
+ job_medsci_low &= ~job.flag
+ job_medsci_med &= ~job.flag
+ job_medsci_high &= ~job.flag
+
+ switch(level)
+ if (1)
+ job_medsci_high |= job.flag
+ if (2)
+ job_medsci_med |= job.flag
+ if (3)
+ job_medsci_low |= job.flag
+
+ return 1
+ else if (job.department_flag == KARMA)
+ job_karma_low &= ~job.flag
+ job_karma_med &= ~job.flag
+ job_karma_high &= ~job.flag
+
+ switch(level)
+ if (1)
+ job_karma_high |= job.flag
+ if (2)
+ job_karma_med |= job.flag
+ if (3)
+ job_karma_low |= job.flag
+
+ return 1
+
+ return 0
+
+/datum/preferences/proc/UpdateJobPreference(mob/user, role, desiredLvl)
+ var/datum/job/job = job_master.GetJob(role)
+
+ if(!job)
+ user << browse(null, "window=mob_occupation")
+ ShowChoices(user)
return
- proc/SetJobPreferenceLevel(var/datum/job/job, var/level)
- if (!job)
- return 0
+ if (!isnum(desiredLvl))
+ user << "\red UpdateJobPreference - desired level was not a number. Please notify coders!"
+ ShowChoices(user)
+ return
- if (level == 1) // to high
- // remove any other job(s) set to high
+ if(role == "Civilian")
+ if(job_support_low & job.flag)
+ job_support_low &= ~job.flag
+ else
+ job_support_low |= job.flag
+ SetChoices(user)
+ return 1
+
+ SetJobPreferenceLevel(job, desiredLvl)
+ SetChoices(user)
+
+ return 1
+
+/datum/preferences/proc/ShowDisabilityState(mob/user,flag,label)
+ if(flag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey"))
+ return "[species] cannot be fat."
+ return "[label]: [disabilities & flag ? "Yes" : "No"]"
+
+/datum/preferences/proc/SetDisabilities(mob/user)
+ var/HTML = ""
+
+ // AUTOFIXED BY fix_string_idiocy.py
+ // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:474: HTML += ""
+ HTML += {"
+ Choose disabilities"}
+ // END AUTOFIX
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_NEARSIGHTED,"Needs Glasses")
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_FAT,"Obese")
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_EPILEPTIC,"Seizures")
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_DEAF,"Deaf")
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_BLIND,"Blind")
+ HTML += ShowDisabilityState(user,DISABILITY_FLAG_MUTE,"Mute")
+
+
+ // AUTOFIXED BY fix_string_idiocy.py
+ // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:481: HTML += "
"
+ HTML += {"
+ \[Done\]
+ \[Reset\]
+ "}
+ // END AUTOFIX
+ user << browse(null, "window=preferences")
+ user << browse(HTML, "window=disabil;size=350x300")
+ return
+
+/datum/preferences/proc/SetRecords(mob/user)
+ var/HTML = ""
+ HTML += ""
+ HTML += "Set Character Records
"
+
+ HTML += "Medical Records
"
+
+ if(lentext(med_record) <= 40)
+ HTML += "[med_record]"
+ else
+ HTML += "[copytext(med_record, 1, 37)]..."
+
+ HTML += "
Employment Records
"
+
+ if(lentext(gen_record) <= 40)
+ HTML += "[gen_record]"
+ else
+ HTML += "[copytext(gen_record, 1, 37)]..."
+
+ HTML += "
Security Records
"
+
+ if(lentext(sec_record) <= 40)
+ HTML += "[sec_record]
"
+ else
+ HTML += "[copytext(sec_record, 1, 37)]...
"
+
+ HTML += "
"
+ HTML += "\[Done\]"
+ HTML += ""
+
+ user << browse(null, "window=preferences")
+ user << browse(HTML, "window=records;size=350x300")
+ return
+
+/datum/preferences/proc/GetPlayerAltTitle(datum/job/job)
+ return player_alt_titles.Find(job.title) > 0 \
+ ? player_alt_titles[job.title] \
+ : job.title
+
+/datum/preferences/proc/SetPlayerAltTitle(datum/job/job, new_title)
+ // remove existing entry
+ if(player_alt_titles.Find(job.title))
+ player_alt_titles -= job.title
+ // add one if it's not default
+ if(job.title != new_title)
+ player_alt_titles[job.title] = new_title
+
+/datum/preferences/proc/SetJob(mob/user, role)
+ var/datum/job/job = job_master.GetJob(role)
+ if(!job)
+ user << browse(null, "window=mob_occupation")
+ ShowChoices(user)
+ return
+
+ if(role == "Civilian")
+ if(job_support_low & job.flag)
+ job_support_low &= ~job.flag
+ else
+ job_support_low |= job.flag
+ SetChoices(user)
+ return 1
+
+ if(GetJobDepartment(job, 1) & job.flag)
+ SetJobDepartment(job, 1)
+ else if(GetJobDepartment(job, 2) & job.flag)
+ SetJobDepartment(job, 2)
+ else if(GetJobDepartment(job, 3) & job.flag)
+ SetJobDepartment(job, 3)
+ else//job = Never
+ SetJobDepartment(job, 4)
+
+ SetChoices(user)
+ return 1
+
+/datum/preferences/proc/ResetJobs()
+ job_support_high = 0
+ job_support_med = 0
+ job_support_low = 0
+
+ job_medsci_high = 0
+ job_medsci_med = 0
+ job_medsci_low = 0
+
+ job_engsec_high = 0
+ job_engsec_med = 0
+ job_engsec_low = 0
+
+ job_karma_high = 0
+ job_karma_med = 0
+ job_karma_low = 0
+
+
+/datum/preferences/proc/GetJobDepartment(var/datum/job/job, var/level)
+ if(!job || !level) return 0
+ switch(job.department_flag)
+ if(SUPPORT)
+ switch(level)
+ if(1)
+ return job_support_high
+ if(2)
+ return job_support_med
+ if(3)
+ return job_support_low
+ if(MEDSCI)
+ switch(level)
+ if(1)
+ return job_medsci_high
+ if(2)
+ return job_medsci_med
+ if(3)
+ return job_medsci_low
+ if(ENGSEC)
+ switch(level)
+ if(1)
+ return job_engsec_high
+ if(2)
+ return job_engsec_med
+ if(3)
+ return job_engsec_low
+ if(KARMA)
+ switch(level)
+ if(1)
+ return job_karma_high
+ if(2)
+ return job_karma_med
+ if(3)
+ return job_karma_low
+ return 0
+
+/datum/preferences/proc/SetJobDepartment(var/datum/job/job, var/level)
+ if(!job || !level) return 0
+ switch(level)
+ if(1)//Only one of these should ever be active at once so clear them all here
+ job_support_high = 0
+ job_medsci_high = 0
+ job_engsec_high = 0
+ job_karma_high = 0
+ return 1
+ if(2)//Set current highs to med, then reset them
job_support_med |= job_support_high
- job_engsec_med |= job_engsec_high
job_medsci_med |= job_medsci_high
+ job_engsec_med |= job_engsec_high
job_karma_med |= job_karma_high
job_support_high = 0
- job_engsec_high = 0
job_medsci_high = 0
+ job_engsec_high = 0
job_karma_high = 0
- if (job.department_flag == SUPPORT)
- job_support_low &= ~job.flag
- job_support_med &= ~job.flag
- job_support_high &= ~job.flag
-
+ switch(job.department_flag)
+ if(SUPPORT)
switch(level)
- if (1)
- job_support_high |= job.flag
- if (2)
+ if(2)
+ job_support_high = job.flag
+ job_support_med &= ~job.flag
+ if(3)
job_support_med |= job.flag
- if (3)
+ job_support_low &= ~job.flag
+ else
job_support_low |= job.flag
-
- return 1
- else if (job.department_flag == ENGSEC)
- job_engsec_low &= ~job.flag
- job_engsec_med &= ~job.flag
- job_engsec_high &= ~job.flag
-
+ if(MEDSCI)
switch(level)
- if (1)
- job_engsec_high |= job.flag
- if (2)
- job_engsec_med |= job.flag
- if (3)
- job_engsec_low |= job.flag
-
- return 1
- else if (job.department_flag == MEDSCI)
- job_medsci_low &= ~job.flag
- job_medsci_med &= ~job.flag
- job_medsci_high &= ~job.flag
-
- switch(level)
- if (1)
- job_medsci_high |= job.flag
- if (2)
+ if(2)
+ job_medsci_high = job.flag
+ job_medsci_med &= ~job.flag
+ if(3)
job_medsci_med |= job.flag
- if (3)
+ job_medsci_low &= ~job.flag
+ else
job_medsci_low |= job.flag
-
- return 1
- else if (job.department_flag == KARMA)
- job_karma_low &= ~job.flag
- job_karma_med &= ~job.flag
- job_karma_high &= ~job.flag
-
+ if(ENGSEC)
switch(level)
- if (1)
- job_karma_high |= job.flag
- if (2)
+ if(2)
+ job_engsec_high = job.flag
+ job_engsec_med &= ~job.flag
+ if(3)
+ job_engsec_med |= job.flag
+ job_engsec_low &= ~job.flag
+ else
+ job_engsec_low |= job.flag
+ if(KARMA)
+ switch(level)
+ if(2)
+ job_karma_high = job.flag
+ job_karma_med &= ~job.flag
+ if(3)
job_karma_med |= job.flag
- if (3)
+ job_karma_low &= ~job.flag
+ else
job_karma_low |= job.flag
+ return 1
- return 1
+/datum/preferences/proc/process_link(mob/user, list/href_list)
+ if(!user) return
- return 0
-
- proc/UpdateJobPreference(mob/user, role, desiredLvl)
- var/datum/job/job = job_master.GetJob(role)
-
- if(!job)
- user << browse(null, "window=mob_occupation")
- ShowChoices(user)
- return
-
- if (!isnum(desiredLvl))
- user << "\red UpdateJobPreference - desired level was not a number. Please notify coders!"
- ShowChoices(user)
- return
-
- if(role == "Civilian")
- if(job_support_low & job.flag)
- job_support_low &= ~job.flag
- else
- job_support_low |= job.flag
- SetChoices(user)
- return 1
-
- SetJobPreferenceLevel(job, desiredLvl)
- SetChoices(user)
-
- return 1
-
- proc/ShowDisabilityState(mob/user,flag,label)
- if(flag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey"))
- return "[species] cannot be fat."
- return "[label]: [disabilities & flag ? "Yes" : "No"]"
-
- proc/SetDisabilities(mob/user)
- var/HTML = ""
-
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:474: HTML += ""
- HTML += {"
- Choose disabilities"}
- // END AUTOFIX
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_NEARSIGHTED,"Needs Glasses")
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_FAT,"Obese")
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_EPILEPTIC,"Seizures")
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_DEAF,"Deaf")
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_BLIND,"Blind")
- HTML += ShowDisabilityState(user,DISABILITY_FLAG_MUTE,"Mute")
-
-
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:481: HTML += "
"
- HTML += {"
- \[Done\]
- \[Reset\]
- "}
- // END AUTOFIX
- user << browse(null, "window=preferences")
- user << browse(HTML, "window=disabil;size=350x300")
- return
-
- proc/SetRecords(mob/user)
- var/HTML = ""
- HTML += ""
- HTML += "Set Character Records
"
-
- HTML += "Medical Records
"
-
- if(lentext(med_record) <= 40)
- HTML += "[med_record]"
- else
- HTML += "[copytext(med_record, 1, 37)]..."
-
- HTML += "
Employment Records
"
-
- if(lentext(gen_record) <= 40)
- HTML += "[gen_record]"
- else
- HTML += "[copytext(gen_record, 1, 37)]..."
-
- HTML += "
Security Records
"
-
- if(lentext(sec_record) <= 40)
- HTML += "[sec_record]
"
- else
- HTML += "[copytext(sec_record, 1, 37)]...
"
-
- HTML += "
"
- HTML += "\[Done\]"
- HTML += ""
-
- user << browse(null, "window=preferences")
- user << browse(HTML, "window=records;size=350x300")
- return
-
- proc/GetPlayerAltTitle(datum/job/job)
- return player_alt_titles.Find(job.title) > 0 \
- ? player_alt_titles[job.title] \
- : job.title
-
- proc/SetPlayerAltTitle(datum/job/job, new_title)
- // remove existing entry
- if(player_alt_titles.Find(job.title))
- player_alt_titles -= job.title
- // add one if it's not default
- if(job.title != new_title)
- player_alt_titles[job.title] = new_title
-
- proc/SetJob(mob/user, role)
- var/datum/job/job = job_master.GetJob(role)
- if(!job)
- user << browse(null, "window=mob_occupation")
- ShowChoices(user)
- return
-
- if(role == "Civilian")
- if(job_support_low & job.flag)
- job_support_low &= ~job.flag
- else
- job_support_low |= job.flag
- SetChoices(user)
- return 1
-
- if(GetJobDepartment(job, 1) & job.flag)
- SetJobDepartment(job, 1)
- else if(GetJobDepartment(job, 2) & job.flag)
- SetJobDepartment(job, 2)
- else if(GetJobDepartment(job, 3) & job.flag)
- SetJobDepartment(job, 3)
- else//job = Never
- SetJobDepartment(job, 4)
-
- SetChoices(user)
- return 1
-
- proc/ResetJobs()
- job_support_high = 0
- job_support_med = 0
- job_support_low = 0
-
- job_medsci_high = 0
- job_medsci_med = 0
- job_medsci_low = 0
-
- job_engsec_high = 0
- job_engsec_med = 0
- job_engsec_low = 0
-
- job_karma_high = 0
- job_karma_med = 0
- job_karma_low = 0
-
-
- proc/GetJobDepartment(var/datum/job/job, var/level)
- if(!job || !level) return 0
- switch(job.department_flag)
- if(SUPPORT)
- switch(level)
- if(1)
- return job_support_high
- if(2)
- return job_support_med
- if(3)
- return job_support_low
- if(MEDSCI)
- switch(level)
- if(1)
- return job_medsci_high
- if(2)
- return job_medsci_med
- if(3)
- return job_medsci_low
- if(ENGSEC)
- switch(level)
- if(1)
- return job_engsec_high
- if(2)
- return job_engsec_med
- if(3)
- return job_engsec_low
- if(KARMA)
- switch(level)
- if(1)
- return job_karma_high
- if(2)
- return job_karma_med
- if(3)
- return job_karma_low
- return 0
-
- proc/SetJobDepartment(var/datum/job/job, var/level)
- if(!job || !level) return 0
- switch(level)
- if(1)//Only one of these should ever be active at once so clear them all here
- job_support_high = 0
- job_medsci_high = 0
- job_engsec_high = 0
- job_karma_high = 0
- return 1
- if(2)//Set current highs to med, then reset them
- job_support_med |= job_support_high
- job_medsci_med |= job_medsci_high
- job_engsec_med |= job_engsec_high
- job_karma_med |= job_karma_high
- job_support_high = 0
- job_medsci_high = 0
- job_engsec_high = 0
- job_karma_high = 0
-
- switch(job.department_flag)
- if(SUPPORT)
- switch(level)
- if(2)
- job_support_high = job.flag
- job_support_med &= ~job.flag
- if(3)
- job_support_med |= job.flag
- job_support_low &= ~job.flag
- else
- job_support_low |= job.flag
- if(MEDSCI)
- switch(level)
- if(2)
- job_medsci_high = job.flag
- job_medsci_med &= ~job.flag
- if(3)
- job_medsci_med |= job.flag
- job_medsci_low &= ~job.flag
- else
- job_medsci_low |= job.flag
- if(ENGSEC)
- switch(level)
- if(2)
- job_engsec_high = job.flag
- job_engsec_med &= ~job.flag
- if(3)
- job_engsec_med |= job.flag
- job_engsec_low &= ~job.flag
- else
- job_engsec_low |= job.flag
- if(KARMA)
- switch(level)
- if(2)
- job_karma_high = job.flag
- job_karma_med &= ~job.flag
- if(3)
- job_karma_med |= job.flag
- job_karma_low &= ~job.flag
- else
- job_karma_low |= job.flag
- return 1
-
- proc/process_link(mob/user, list/href_list)
- if(!user) return
-
- if(href_list["preference"] == "job")
- switch(href_list["task"])
- if("close")
- user << browse(null, "window=mob_occupation")
- ShowChoices(user)
- if("reset")
- ResetJobs()
- SetChoices(user)
- if("random")
- if(alternate_option == GET_RANDOM_JOB || alternate_option == BE_CIVILIAN)
- alternate_option += 1
- else if(alternate_option == RETURN_TO_LOBBY)
- alternate_option = 0
- else
- return 0
- SetChoices(user)
- if ("alt_title")
- var/datum/job/job = locate(href_list["job"])
- if (job)
- var/choices = list(job.title) + job.alt_titles
- var/choice = input("Pick a title for [job.title].", "Character Generation", GetPlayerAltTitle(job)) as anything in choices | null
- if(choice)
- SetPlayerAltTitle(job, choice)
- SetChoices(user)
- if("input")
- SetJob(user, href_list["text"])
- if("setJobLevel")
- UpdateJobPreference(user, href_list["text"], text2num(href_list["level"]))
+ if(href_list["preference"] == "job")
+ switch(href_list["task"])
+ if("close")
+ user << browse(null, "window=mob_occupation")
+ ShowChoices(user)
+ if("reset")
+ ResetJobs()
+ SetChoices(user)
+ if("random")
+ if(alternate_option == GET_RANDOM_JOB || alternate_option == BE_CIVILIAN)
+ alternate_option += 1
+ else if(alternate_option == RETURN_TO_LOBBY)
+ alternate_option = 0
else
- SetChoices(user)
- return 1
- else if(href_list["preference"] == "disabilities")
-
- switch(href_list["task"])
- if("close")
- user << browse(null, "window=disabil")
- ShowChoices(user)
- if("reset")
- disabilities=0
- SetDisabilities(user)
- if("input")
- var/dflag=text2num(href_list["disability"])
- if(dflag >= 0)
- if(!(dflag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey")))
- disabilities ^= text2num(href_list["disability"]) //MAGIC
- SetDisabilities(user)
- else
- SetDisabilities(user)
- return 1
-
- else if(href_list["preference"] == "records")
- if(text2num(href_list["record"]) >= 1)
- SetRecords(user)
- return
+ return 0
+ SetChoices(user)
+ if ("alt_title")
+ var/datum/job/job = locate(href_list["job"])
+ if (job)
+ var/choices = list(job.title) + job.alt_titles
+ var/choice = input("Pick a title for [job.title].", "Character Generation", GetPlayerAltTitle(job)) as anything in choices | null
+ if(choice)
+ SetPlayerAltTitle(job, choice)
+ SetChoices(user)
+ if("input")
+ SetJob(user, href_list["text"])
+ if("setJobLevel")
+ UpdateJobPreference(user, href_list["text"], text2num(href_list["level"]))
else
- user << browse(null, "window=records")
- if(href_list["task"] == "med_record")
- var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message
-
- if(medmsg != null)
- medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN)
- medmsg = html_encode(medmsg)
-
- med_record = medmsg
- SetRecords(user)
-
- if(href_list["task"] == "sec_record")
- var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message
-
- if(secmsg != null)
- secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN)
- secmsg = html_encode(secmsg)
-
- sec_record = secmsg
- SetRecords(user)
- if(href_list["task"] == "gen_record")
- var/genmsg = input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message
-
- if(genmsg != null)
- genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN)
- genmsg = html_encode(genmsg)
-
- gen_record = genmsg
- SetRecords(user)
+ SetChoices(user)
+ return 1
+ else if(href_list["preference"] == "disabilities")
switch(href_list["task"])
- if("random")
- switch(href_list["preference"])
- if("name")
- real_name = random_name(gender,species)
- if("age")
- age = rand(AGE_MIN, AGE_MAX)
- if("hair")
- if(species == "Human" || species == "Unathi" || species == "Tajaran" || species == "Skrell" || species == "Machine" || species == "Wryn" || species == "Vulpkanin")
- r_hair = rand(0,255)
- g_hair = rand(0,255)
- b_hair = rand(0,255)
- if("h_style")
- h_style = random_hair_style(gender, species)
- if("facial")
- r_facial = rand(0,255)
- g_facial = rand(0,255)
- b_facial = rand(0,255)
- if("f_style")
- f_style = random_facial_hair_style(gender, species)
- if("underwear")
- underwear = random_underwear(gender)
- ShowChoices(user)
- if("undershirt")
- undershirt = random_undershirt(gender)
- ShowChoices(user)
- if("socks")
- socks = random_socks(gender)
- ShowChoices(user)
- if("eyes")
- r_eyes = rand(0,255)
- g_eyes = rand(0,255)
- b_eyes = rand(0,255)
- if("s_tone")
- if(species == "Human")
- s_tone = random_skin_tone()
- if("s_color")
- if(species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Wyrn", "Vulpkanin", "Machine"))
- r_skin = rand(0,255)
- g_skin = rand(0,255)
- b_skin = rand(0,255)
- if("bag")
- backbag = rand(1,4)
- /*if("skin_style")
- h_style = random_skin_style(gender)*/
- if("all")
- random_character()
+ if("close")
+ user << browse(null, "window=disabil")
+ ShowChoices(user)
+ if("reset")
+ disabilities=0
+ SetDisabilities(user)
if("input")
- switch(href_list["preference"])
- if("name")
- var/raw_name = input(user, "Choose your character's name:", "Character Preference") as text|null
- if (!isnull(raw_name)) // Check to ensure that the user entered text (rather than cancel.)
- var/new_name = reject_bad_name(raw_name)
- if(new_name)
- real_name = new_name
- else
- user << "Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and ."
+ var/dflag=text2num(href_list["disability"])
+ if(dflag >= 0)
+ if(!(dflag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey")))
+ disabilities ^= text2num(href_list["disability"]) //MAGIC
+ SetDisabilities(user)
+ else
+ SetDisabilities(user)
+ return 1
- if("age")
- var/new_age = input(user, "Choose your character's age:\n([AGE_MIN]-[AGE_MAX])", "Character Preference") as num|null
- if(new_age)
- age = max(min( round(text2num(new_age)), AGE_MAX),AGE_MIN)
- if("species")
+ else if(href_list["preference"] == "records")
+ if(text2num(href_list["record"]) >= 1)
+ SetRecords(user)
+ return
+ else
+ user << browse(null, "window=records")
+ if(href_list["task"] == "med_record")
+ var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message
- var/list/new_species = list("Human","Tajaran","Skrell","Unathi","Diona", "Vulpkanin")
- var/prev_species = species
+ if(medmsg != null)
+ medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN)
+ medmsg = html_encode(medmsg)
+
+ med_record = medmsg
+ SetRecords(user)
+
+ if(href_list["task"] == "sec_record")
+ var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message
+
+ if(secmsg != null)
+ secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN)
+ secmsg = html_encode(secmsg)
+
+ sec_record = secmsg
+ SetRecords(user)
+ if(href_list["task"] == "gen_record")
+ var/genmsg = input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message
+
+ if(genmsg != null)
+ genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN)
+ genmsg = html_encode(genmsg)
+
+ gen_record = genmsg
+ SetRecords(user)
+
+ switch(href_list["task"])
+ if("random")
+ switch(href_list["preference"])
+ if("name")
+ real_name = random_name(gender,species)
+ if("age")
+ age = rand(AGE_MIN, AGE_MAX)
+ if("hair")
+ if(species == "Human" || species == "Unathi" || species == "Tajaran" || species == "Skrell" || species == "Machine" || species == "Wryn" || species == "Vulpkanin")
+ r_hair = rand(0,255)
+ g_hair = rand(0,255)
+ b_hair = rand(0,255)
+ if("h_style")
+ h_style = random_hair_style(gender, species)
+ if("facial")
+ r_facial = rand(0,255)
+ g_facial = rand(0,255)
+ b_facial = rand(0,255)
+ if("f_style")
+ f_style = random_facial_hair_style(gender, species)
+ if("underwear")
+ underwear = random_underwear(gender)
+ ShowChoices(user)
+ if("undershirt")
+ undershirt = random_undershirt(gender)
+ ShowChoices(user)
+ if("socks")
+ socks = random_socks(gender)
+ ShowChoices(user)
+ if("eyes")
+ r_eyes = rand(0,255)
+ g_eyes = rand(0,255)
+ b_eyes = rand(0,255)
+ if("s_tone")
+ if(species == "Human")
+ s_tone = random_skin_tone()
+ if("s_color")
+ if(species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Wyrn", "Vulpkanin", "Machine"))
+ r_skin = rand(0,255)
+ g_skin = rand(0,255)
+ b_skin = rand(0,255)
+ if("bag")
+ backbag = rand(1,4)
+ /*if("skin_style")
+ h_style = random_skin_style(gender)*/
+ if("all")
+ random_character()
+ if("input")
+ switch(href_list["preference"])
+ if("name")
+ var/raw_name = input(user, "Choose your character's name:", "Character Preference") as text|null
+ if (!isnull(raw_name)) // Check to ensure that the user entered text (rather than cancel.)
+ var/new_name = reject_bad_name(raw_name)
+ if(new_name)
+ real_name = new_name
+ else
+ user << "Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and ."
+
+ if("age")
+ var/new_age = input(user, "Choose your character's age:\n([AGE_MIN]-[AGE_MAX])", "Character Preference") as num|null
+ if(new_age)
+ age = max(min( round(text2num(new_age)), AGE_MAX),AGE_MIN)
+ if("species")
+
+ var/list/new_species = list("Human","Tajaran","Skrell","Unathi","Diona", "Vulpkanin")
+ var/prev_species = species
// var/whitelisted = 0
- if(config.usealienwhitelist) //If we're using the whitelist, make sure to check it!
- for(var/S in whitelisted_species)
- if(is_alien_whitelisted(user,S))
- new_species += S
+ if(config.usealienwhitelist) //If we're using the whitelist, make sure to check it!
+ for(var/S in whitelisted_species)
+ if(is_alien_whitelisted(user,S))
+ new_species += S
// whitelisted = 1
// if(!whitelisted)
// alert(user, "You cannot change your species as you need to be whitelisted. If you wish to be whitelisted contact an admin in-game, on the forums, or on IRC.")
- else //Not using the whitelist? Aliens for everyone!
- new_species += whitelisted_species
+ else //Not using the whitelist? Aliens for everyone!
+ new_species += whitelisted_species
- species = input("Please select a species", "Character Generation", null) in new_species
+ species = input("Please select a species", "Character Generation", null) in new_species
- if(prev_species != species)
- //grab one of the valid hair styles for the newly chosen species
- var/list/valid_hairstyles = list()
- for(var/hairstyle in hair_styles_list)
- var/datum/sprite_accessory/S = hair_styles_list[hairstyle]
- if(gender == MALE && S.gender == FEMALE)
- continue
- if(gender == FEMALE && S.gender == MALE)
- continue
- if( !(species in S.species_allowed))
- continue
- valid_hairstyles[hairstyle] = hair_styles_list[hairstyle]
-
- if(valid_hairstyles.len)
- h_style = pick(valid_hairstyles)
- else
- //this shouldn't happen
- h_style = hair_styles_list["Bald"]
-
- //grab one of the valid facial hair styles for the newly chosen species
- var/list/valid_facialhairstyles = list()
- for(var/facialhairstyle in facial_hair_styles_list)
- var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle]
- if(gender == MALE && S.gender == FEMALE)
- continue
- if(gender == FEMALE && S.gender == MALE)
- continue
- if( !(species in S.species_allowed))
- continue
-
- valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle]
-
- if(valid_facialhairstyles.len)
- f_style = pick(valid_facialhairstyles)
- else
- //this shouldn't happen
- f_style = facial_hair_styles_list["Shaved"]
-
- // Don't wear another species' underwear!
- var/datum/sprite_accessory/S = underwear_list[underwear]
- if(!(species in S.species_allowed))
- underwear = random_underwear(gender, species)
-
- S = undershirt_list[undershirt]
- if(!(species in S.species_allowed))
- undershirt = random_undershirt(gender, species)
-
- S = socks_list[socks]
- if(!(species in S.species_allowed))
- socks = random_socks(gender, species)
-
- //reset hair colour and skin colour
- r_hair = 0//hex2num(copytext(new_hair, 2, 4))
- g_hair = 0//hex2num(copytext(new_hair, 4, 6))
- b_hair = 0//hex2num(copytext(new_hair, 6, 8))
-
- s_tone = 0
-
- body_accessory = null //no vulpatail on humans damnit
- if("speciesprefs")//oldvox code
- speciesprefs = !speciesprefs
-
- if("language")
-// var/languages_available
- var/list/new_languages = list("None")
-/*
- if(config.usealienwhitelist)
- for(var/L in all_languages)
- var/datum/language/lang = all_languages[L]
- if((!(lang.flags & RESTRICTED)) && (is_alien_whitelisted(user, L)||(!( lang.flags & WHITELISTED ))))
- new_languages += lang
- languages_available = 1
-
- if(!(languages_available))
- alert(user, "There are not currently any available secondary languages.")
- else
-*/
- for(var/L in all_languages)
- var/datum/language/lang = all_languages[L]
- if(!(lang.flags & RESTRICTED))
- new_languages += lang.name
-
- language = input("Please select a secondary language", "Character Generation", null) in new_languages
-
- if("metadata")
- var/new_metadata = input(user, "Enter any information you'd like others to see, such as Roleplay-preferences:", "Game Preference" , metadata) as message|null
- if(new_metadata)
- metadata = sanitize(copytext(new_metadata,1,MAX_MESSAGE_LEN))
-
- if("b_type")
- var/new_b_type = input(user, "Choose your character's blood-type:", "Character Preference") as null|anything in list( "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-" )
- if(new_b_type)
- b_type = new_b_type
-
- if("hair")
- if(species == "Human" || species == "Unathi" || species == "Tajaran" || species == "Skrell" || species == "Machine" || species == "Vulpkanin")
- var/input = "Choose your character's hair colour:"
- if(species == "Machine")
- input = "Choose your character's frame colour:"
- var/new_hair = input(user, input, "Character Preference", rgb(r_hair, g_hair, b_hair)) as color|null
- if(new_hair)
- r_hair = hex2num(copytext(new_hair, 2, 4))
- g_hair = hex2num(copytext(new_hair, 4, 6))
- b_hair = hex2num(copytext(new_hair, 6, 8))
-
- if("h_style")
+ if(prev_species != species)
+ //grab one of the valid hair styles for the newly chosen species
var/list/valid_hairstyles = list()
for(var/hairstyle in hair_styles_list)
var/datum/sprite_accessory/S = hair_styles_list[hairstyle]
+ if(gender == MALE && S.gender == FEMALE)
+ continue
+ if(gender == FEMALE && S.gender == MALE)
+ continue
if( !(species in S.species_allowed))
continue
-
valid_hairstyles[hairstyle] = hair_styles_list[hairstyle]
- var/new_h_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in valid_hairstyles
- if(new_h_style)
- h_style = new_h_style
-
- if("body_accessory")
- var/list/possible_body_accessories = list()
- if(check_rights(R_ADMIN, 1, user))
- possible_body_accessories = body_accessory_by_name.Copy()
+ if(valid_hairstyles.len)
+ h_style = pick(valid_hairstyles)
else
- for(var/B in body_accessory_by_name)
- var/datum/body_accessory/accessory = body_accessory_by_name[B]
- if(!istype(accessory))
- possible_body_accessories += "None" //the only null entry should be the "None" option
- continue
- if(species in accessory.allowed_species)
- possible_body_accessories += B
+ //this shouldn't happen
+ h_style = hair_styles_list["Bald"]
- var/new_body_accessory = input(user, "Choose your body accessory:", "Character Preference") as null|anything in possible_body_accessories
- if(new_body_accessory)
- body_accessory = (new_body_accessory == "None") ? null : new_body_accessory
-
- if("facial")
- var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", rgb(r_facial, g_facial, b_facial)) as color|null
- if(new_facial)
- r_facial = hex2num(copytext(new_facial, 2, 4))
- g_facial = hex2num(copytext(new_facial, 4, 6))
- b_facial = hex2num(copytext(new_facial, 6, 8))
-
- if("f_style")
+ //grab one of the valid facial hair styles for the newly chosen species
var/list/valid_facialhairstyles = list()
for(var/facialhairstyle in facial_hair_styles_list)
var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle]
@@ -1225,431 +1086,561 @@ datum/preferences
valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle]
- var/new_f_style = input(user, "Choose your character's facial-hair style:", "Character Preference") as null|anything in valid_facialhairstyles
- if(new_f_style)
- f_style = new_f_style
-
- if("underwear")
- var/list/underwear_options
- if(gender == MALE)
- underwear_options = underwear_m
+ if(valid_facialhairstyles.len)
+ f_style = pick(valid_facialhairstyles)
else
- underwear_options = underwear_f
+ //this shouldn't happen
+ f_style = facial_hair_styles_list["Shaved"]
- var/new_underwear = input(user, "Choose your character's underwear:", "Character Preference") as null|anything in underwear_options
- if(new_underwear)
- underwear = new_underwear
- ShowChoices(user)
+ // Don't wear another species' underwear!
+ var/datum/sprite_accessory/S = underwear_list[underwear]
+ if(!(species in S.species_allowed))
+ underwear = random_underwear(gender, species)
- if("undershirt")
- var/new_undershirt
- if(gender == MALE)
- new_undershirt = input(user, "Choose your character's undershirt:", "Character Preference") as null|anything in undershirt_m
- else
- new_undershirt = input(user, "Choose your character's undershirt:", "Character Preference") as null|anything in undershirt_f
- if(new_undershirt)
- undershirt = new_undershirt
- ShowChoices(user)
+ S = undershirt_list[undershirt]
+ if(!(species in S.species_allowed))
+ undershirt = random_undershirt(gender, species)
- if("socks")
- var/list/valid_sockstyles = list()
- for(var/sockstyle in socks_list)
- var/datum/sprite_accessory/S = socks_list[sockstyle]
- if(gender == MALE && S.gender == FEMALE)
+ S = socks_list[socks]
+ if(!(species in S.species_allowed))
+ socks = random_socks(gender, species)
+
+ //reset hair colour and skin colour
+ r_hair = 0//hex2num(copytext(new_hair, 2, 4))
+ g_hair = 0//hex2num(copytext(new_hair, 4, 6))
+ b_hair = 0//hex2num(copytext(new_hair, 6, 8))
+
+ s_tone = 0
+
+ body_accessory = null //no vulpatail on humans damnit
+ if("speciesprefs")//oldvox code
+ speciesprefs = !speciesprefs
+
+ if("language")
+// var/languages_available
+ var/list/new_languages = list("None")
+/*
+ if(config.usealienwhitelist)
+ for(var/L in all_languages)
+ var/datum/language/lang = all_languages[L]
+ if((!(lang.flags & RESTRICTED)) && (is_alien_whitelisted(user, L)||(!( lang.flags & WHITELISTED ))))
+ new_languages += lang
+ languages_available = 1
+
+ if(!(languages_available))
+ alert(user, "There are not currently any available secondary languages.")
+ else
+*/
+ for(var/L in all_languages)
+ var/datum/language/lang = all_languages[L]
+ if(!(lang.flags & RESTRICTED))
+ new_languages += lang.name
+
+ language = input("Please select a secondary language", "Character Generation", null) in new_languages
+
+ if("metadata")
+ var/new_metadata = input(user, "Enter any information you'd like others to see, such as Roleplay-preferences:", "Game Preference" , metadata) as message|null
+ if(new_metadata)
+ metadata = sanitize(copytext(new_metadata,1,MAX_MESSAGE_LEN))
+
+ if("b_type")
+ var/new_b_type = input(user, "Choose your character's blood-type:", "Character Preference") as null|anything in list( "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-" )
+ if(new_b_type)
+ b_type = new_b_type
+
+ if("hair")
+ if(species == "Human" || species == "Unathi" || species == "Tajaran" || species == "Skrell" || species == "Machine" || species == "Vulpkanin")
+ var/input = "Choose your character's hair colour:"
+ if(species == "Machine")
+ input = "Choose your character's frame colour:"
+ var/new_hair = input(user, input, "Character Preference", rgb(r_hair, g_hair, b_hair)) as color|null
+ if(new_hair)
+ r_hair = hex2num(copytext(new_hair, 2, 4))
+ g_hair = hex2num(copytext(new_hair, 4, 6))
+ b_hair = hex2num(copytext(new_hair, 6, 8))
+
+ if("h_style")
+ var/list/valid_hairstyles = list()
+ for(var/hairstyle in hair_styles_list)
+ var/datum/sprite_accessory/S = hair_styles_list[hairstyle]
+ if( !(species in S.species_allowed))
+ continue
+
+ valid_hairstyles[hairstyle] = hair_styles_list[hairstyle]
+
+ var/new_h_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in valid_hairstyles
+ if(new_h_style)
+ h_style = new_h_style
+
+ if("body_accessory")
+ var/list/possible_body_accessories = list()
+ if(check_rights(R_ADMIN, 1, user))
+ possible_body_accessories = body_accessory_by_name.Copy()
+ else
+ for(var/B in body_accessory_by_name)
+ var/datum/body_accessory/accessory = body_accessory_by_name[B]
+ if(!istype(accessory))
+ possible_body_accessories += "None" //the only null entry should be the "None" option
continue
- if(gender == FEMALE && S.gender == MALE)
- continue
- if(!(species in S.species_allowed))
- continue
- valid_sockstyles[sockstyle] = socks_list[sockstyle]
- var/new_socks = input(user, "Choose your character's socks:", "Character Preference") as null|anything in valid_sockstyles
- ShowChoices(user)
- if(new_socks)
- socks = new_socks
+ if(species in accessory.allowed_species)
+ possible_body_accessories += B
- if("eyes")
- var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", rgb(r_eyes, g_eyes, b_eyes)) as color|null
- if(new_eyes)
- r_eyes = hex2num(copytext(new_eyes, 2, 4))
- g_eyes = hex2num(copytext(new_eyes, 4, 6))
- b_eyes = hex2num(copytext(new_eyes, 6, 8))
+ var/new_body_accessory = input(user, "Choose your body accessory:", "Character Preference") as null|anything in possible_body_accessories
+ if(new_body_accessory)
+ body_accessory = (new_body_accessory == "None") ? null : new_body_accessory
- if("s_tone")
- if(species != "Human")
- return
- var/new_s_tone = input(user, "Choose your character's skin-tone:\n(Light 1 - 220 Dark)", "Character Preference") as num|null
- if(new_s_tone)
- s_tone = 35 - max(min( round(new_s_tone), 220),1)
+ if("facial")
+ var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", rgb(r_facial, g_facial, b_facial)) as color|null
+ if(new_facial)
+ r_facial = hex2num(copytext(new_facial, 2, 4))
+ g_facial = hex2num(copytext(new_facial, 4, 6))
+ b_facial = hex2num(copytext(new_facial, 6, 8))
- if("skin")
- if((species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Vulpkanin", "Machine")) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
- var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", rgb(r_skin, g_skin, b_skin)) as color|null
- if(new_skin)
- r_skin = hex2num(copytext(new_skin, 2, 4))
- g_skin = hex2num(copytext(new_skin, 4, 6))
- b_skin = hex2num(copytext(new_skin, 6, 8))
+ if("f_style")
+ var/list/valid_facialhairstyles = list()
+ for(var/facialhairstyle in facial_hair_styles_list)
+ var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle]
+ if(gender == MALE && S.gender == FEMALE)
+ continue
+ if(gender == FEMALE && S.gender == MALE)
+ continue
+ if( !(species in S.species_allowed))
+ continue
+
+ valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle]
+
+ var/new_f_style = input(user, "Choose your character's facial-hair style:", "Character Preference") as null|anything in valid_facialhairstyles
+ if(new_f_style)
+ f_style = new_f_style
+
+ if("underwear")
+ var/list/underwear_options
+ if(gender == MALE)
+ underwear_options = underwear_m
+ else
+ underwear_options = underwear_f
+
+ var/new_underwear = input(user, "Choose your character's underwear:", "Character Preference") as null|anything in underwear_options
+ if(new_underwear)
+ underwear = new_underwear
+ ShowChoices(user)
+
+ if("undershirt")
+ var/new_undershirt
+ if(gender == MALE)
+ new_undershirt = input(user, "Choose your character's undershirt:", "Character Preference") as null|anything in undershirt_m
+ else
+ new_undershirt = input(user, "Choose your character's undershirt:", "Character Preference") as null|anything in undershirt_f
+ if(new_undershirt)
+ undershirt = new_undershirt
+ ShowChoices(user)
+
+ if("socks")
+ var/list/valid_sockstyles = list()
+ for(var/sockstyle in socks_list)
+ var/datum/sprite_accessory/S = socks_list[sockstyle]
+ if(gender == MALE && S.gender == FEMALE)
+ continue
+ if(gender == FEMALE && S.gender == MALE)
+ continue
+ if(!(species in S.species_allowed))
+ continue
+ valid_sockstyles[sockstyle] = socks_list[sockstyle]
+ var/new_socks = input(user, "Choose your character's socks:", "Character Preference") as null|anything in valid_sockstyles
+ ShowChoices(user)
+ if(new_socks)
+ socks = new_socks
+
+ if("eyes")
+ var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", rgb(r_eyes, g_eyes, b_eyes)) as color|null
+ if(new_eyes)
+ r_eyes = hex2num(copytext(new_eyes, 2, 4))
+ g_eyes = hex2num(copytext(new_eyes, 4, 6))
+ b_eyes = hex2num(copytext(new_eyes, 6, 8))
+
+ if("s_tone")
+ if(species != "Human")
+ return
+ var/new_s_tone = input(user, "Choose your character's skin-tone:\n(Light 1 - 220 Dark)", "Character Preference") as num|null
+ if(new_s_tone)
+ s_tone = 35 - max(min( round(new_s_tone), 220),1)
+
+ if("skin")
+ if((species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Vulpkanin", "Machine")) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
+ var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", rgb(r_skin, g_skin, b_skin)) as color|null
+ if(new_skin)
+ r_skin = hex2num(copytext(new_skin, 2, 4))
+ g_skin = hex2num(copytext(new_skin, 4, 6))
+ b_skin = hex2num(copytext(new_skin, 6, 8))
- if("ooccolor")
- var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference", ooccolor) as color|null
- if(new_ooccolor)
- ooccolor = new_ooccolor
+ if("ooccolor")
+ var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference", ooccolor) as color|null
+ if(new_ooccolor)
+ ooccolor = new_ooccolor
- if("bag")
- var/new_backbag = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in backbaglist
- if(new_backbag)
- backbag = backbaglist.Find(new_backbag)
+ if("bag")
+ var/new_backbag = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in backbaglist
+ if(new_backbag)
+ backbag = backbaglist.Find(new_backbag)
- if("nt_relation")
- var/new_relation = input(user, "Choose your relation to NT. Note that this represents what others can find out about your character by researching your background, not what your character actually thinks.", "Character Preference") as null|anything in list("Loyal", "Supportive", "Neutral", "Skeptical", "Opposed")
- if(new_relation)
- nanotrasen_relation = new_relation
+ if("nt_relation")
+ var/new_relation = input(user, "Choose your relation to NT. Note that this represents what others can find out about your character by researching your background, not what your character actually thinks.", "Character Preference") as null|anything in list("Loyal", "Supportive", "Neutral", "Skeptical", "Opposed")
+ if(new_relation)
+ nanotrasen_relation = new_relation
- if("flavor_text")
- var/msg = input(usr,"Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!","Flavor Text",html_decode(flavor_text)) as message
+ if("flavor_text")
+ var/msg = input(usr,"Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!","Flavor Text",html_decode(flavor_text)) as message
- if(msg != null)
- msg = copytext(msg, 1, MAX_MESSAGE_LEN)
- msg = html_encode(msg)
+ if(msg != null)
+ msg = copytext(msg, 1, MAX_MESSAGE_LEN)
+ msg = html_encode(msg)
- flavor_text = msg
+ flavor_text = msg
- if("limbs")
- var/limb_name = input(user, "Which limb do you want to change?") as null|anything in list("Left Leg","Right Leg","Left Arm","Right Arm","Left Foot","Right Foot","Left Hand","Right Hand")
- if(!limb_name) return
+ if("limbs")
+ var/limb_name = input(user, "Which limb do you want to change?") as null|anything in list("Left Leg","Right Leg","Left Arm","Right Arm","Left Foot","Right Foot","Left Hand","Right Hand")
+ if(!limb_name) return
- var/limb = null
- var/second_limb = null // if you try to change the arm, the hand should also change
- var/third_limb = null // if you try to unchange the hand, the arm should also change
- var/valid_limb_states=list("Normal","Amputated","Prothesis")
- switch(limb_name)
- if("Left Leg")
- limb = "l_leg"
- second_limb = "l_foot"
- if("Right Leg")
- limb = "r_leg"
- second_limb = "r_foot"
- if("Left Arm")
- limb = "l_arm"
- second_limb = "l_hand"
- if("Right Arm")
- limb = "r_arm"
- second_limb = "r_hand"
- if("Left Foot")
- limb = "l_foot"
- third_limb = "l_leg"
- if("Right Foot")
- limb = "r_foot"
- third_limb = "r_leg"
- if("Left Hand")
- limb = "l_hand"
- third_limb = "l_arm"
- if("Right Hand")
- limb = "r_hand"
- third_limb = "r_arm"
+ var/limb = null
+ var/second_limb = null // if you try to change the arm, the hand should also change
+ var/third_limb = null // if you try to unchange the hand, the arm should also change
+ var/valid_limb_states=list("Normal","Amputated","Prothesis")
+ switch(limb_name)
+ if("Left Leg")
+ limb = "l_leg"
+ second_limb = "l_foot"
+ if("Right Leg")
+ limb = "r_leg"
+ second_limb = "r_foot"
+ if("Left Arm")
+ limb = "l_arm"
+ second_limb = "l_hand"
+ if("Right Arm")
+ limb = "r_arm"
+ second_limb = "r_hand"
+ if("Left Foot")
+ limb = "l_foot"
+ third_limb = "l_leg"
+ if("Right Foot")
+ limb = "r_foot"
+ third_limb = "r_leg"
+ if("Left Hand")
+ limb = "l_hand"
+ third_limb = "l_arm"
+ if("Right Hand")
+ limb = "r_hand"
+ third_limb = "r_arm"
- var/new_state = input(user, "What state do you wish the limb to be in?") as null|anything in valid_limb_states
- if(!new_state) return
+ var/new_state = input(user, "What state do you wish the limb to be in?") as null|anything in valid_limb_states
+ if(!new_state) return
- switch(new_state)
- if("Normal")
- organ_data[limb] = null
- rlimb_data[limb] = null
- if(third_limb)
- organ_data[third_limb] = null
- rlimb_data[third_limb] = null
- if("Amputated")
- organ_data[limb] = "amputated"
- rlimb_data[limb] = null
- if(second_limb)
- organ_data[second_limb] = "amputated"
- rlimb_data[second_limb] = null
- if("Prothesis")
- var/choice = input(user, "Which manufacturer do you wish to use for this limb?") as null|anything in chargen_robolimbs
- if(!choice)
- return
- rlimb_data[limb] = choice
- organ_data[limb] = "cyborg"
- if(second_limb)
- rlimb_data[second_limb] = choice
- organ_data[second_limb] = "cyborg"
+ switch(new_state)
+ if("Normal")
+ organ_data[limb] = null
+ rlimb_data[limb] = null
+ if(third_limb)
+ organ_data[third_limb] = null
+ rlimb_data[third_limb] = null
+ if("Amputated")
+ organ_data[limb] = "amputated"
+ rlimb_data[limb] = null
+ if(second_limb)
+ organ_data[second_limb] = "amputated"
+ rlimb_data[second_limb] = null
+ if("Prothesis")
+ var/choice = input(user, "Which manufacturer do you wish to use for this limb?") as null|anything in chargen_robolimbs
+ if(!choice)
+ return
+ rlimb_data[limb] = choice
+ organ_data[limb] = "cyborg"
+ if(second_limb)
+ rlimb_data[second_limb] = choice
+ organ_data[second_limb] = "cyborg"
- if("organs")
- var/organ_name = input(user, "Which internal function do you want to change?") as null|anything in list("Heart", "Eyes")
- if(!organ_name) return
+ if("organs")
+ var/organ_name = input(user, "Which internal function do you want to change?") as null|anything in list("Heart", "Eyes")
+ if(!organ_name) return
- var/organ = null
- switch(organ_name)
- if("Heart")
- organ = "heart"
- if("Eyes")
- organ = "eyes"
+ var/organ = null
+ switch(organ_name)
+ if("Heart")
+ organ = "heart"
+ if("Eyes")
+ organ = "eyes"
- var/new_state = input(user, "What state do you wish the organ to be in?") as null|anything in list("Normal","Assisted","Mechanical")
- if(!new_state) return
+ var/new_state = input(user, "What state do you wish the organ to be in?") as null|anything in list("Normal","Assisted","Mechanical")
+ if(!new_state) return
- switch(new_state)
- if("Normal")
- organ_data[organ] = null
- if("Assisted")
- organ_data[organ] = "assisted"
- if("Mechanical")
- organ_data[organ] = "mechanical"
+ switch(new_state)
+ if("Normal")
+ organ_data[organ] = null
+ if("Assisted")
+ organ_data[organ] = "assisted"
+ if("Mechanical")
+ organ_data[organ] = "mechanical"
/*
- if("skin_style")
- var/skin_style_name = input(user, "Select a new skin style") as null|anything in list("default1", "default2", "default3")
- if(!skin_style_name) return
+ if("skin_style")
+ var/skin_style_name = input(user, "Select a new skin style") as null|anything in list("default1", "default2", "default3")
+ if(!skin_style_name) return
*/
/* if("spawnpoint")
- var/list/spawnkeys = list()
- for(var/S in spawntypes)
- spawnkeys += S
- var/choice = input(user, "Where would you like to spawn when latejoining?") as null|anything in spawnkeys
- if(!choice || !spawntypes[choice])
- spawnpoint = "Arrivals Shuttle"
- return
- spawnpoint = choice */
+ var/list/spawnkeys = list()
+ for(var/S in spawntypes)
+ spawnkeys += S
+ var/choice = input(user, "Where would you like to spawn when latejoining?") as null|anything in spawnkeys
+ if(!choice || !spawntypes[choice])
+ spawnpoint = "Arrivals Shuttle"
+ return
+ spawnpoint = choice */
- else
- switch(href_list["preference"])
- if("publicity")
- if(unlock_content)
- toggles ^= MEMBER_PUBLIC
+ else
+ switch(href_list["preference"])
+ if("publicity")
+ if(unlock_content)
+ toggles ^= MEMBER_PUBLIC
- if("gender")
- if(gender == MALE)
- gender = FEMALE
- else
- gender = MALE
- underwear = random_underwear(gender)
-
- if("hear_adminhelps")
- sound ^= SOUND_ADMINHELP
-
- if("ui")
- switch(UI_style)
- if("Midnight")
- UI_style = "White"
- else
- UI_style = "Midnight"
-
- if("UIcolor")
- var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!", UI_style_color) as color|null
- if(!UI_style_color_new) return
- UI_style_color = UI_style_color_new
-
- if("UIalpha")
- var/UI_style_alpha_new = input(user, "Select a new alpha(transparence) parametr for UI, between 50 and 255") as num
- if(!UI_style_alpha_new | !(UI_style_alpha_new <= 255 && UI_style_alpha_new >= 50)) return
- UI_style_alpha = UI_style_alpha_new
-
- if("be_special")
- var/num = text2num(href_list["num"])
- be_special ^= (1<= 50)) return
+ UI_style_alpha = UI_style_alpha_new
- if(backbag > 4 || backbag < 1)
- backbag = 1 //Same as above
- character.backbag = backbag
+ if("be_special")
+ var/r = href_list["role"]
+ if(!(r in special_roles))
+ var/cleaned_r = sql_sanitize_text(r)
+ if(r != cleaned_r) // up to no good
+ message_admins("[user] attempted an href exploit! (This could have possibly lead to a \"Bobby Tables\" exploit, so they're probably up to no good). String: [r] ID: [last_id] IP: [last_ip]")
+ user << "Stop right there, criminal scum"
+ else
+ be_special ^= r
- //Debugging report to track down a bug, which randomly assigned the plural gender to people.
- if(character.gender in list(PLURAL, NEUTER))
- if(isliving(src)) //Ghosts get neuter by default
- message_admins("[key_name_admin(character)] has spawned with their gender as plural or neuter. Please notify coders.")
- character.gender = MALE
+ if("name")
+ be_random_name = !be_random_name
- proc/open_load_dialog(mob/user)
+ if("randomslot")
+ randomslot = !randomslot
- var/DBQuery/query = dbcon.NewQuery("SELECT slot,real_name FROM [format_table_name("characters")] WHERE ckey='[user.ckey]' ORDER BY slot")
+ if("hear_midis")
+ sound ^= SOUND_MIDI
- var/dat = ""
- dat += ""
- dat += "Select a character slot to load
"
- var/name
+ if("lobby_music")
+ sound ^= SOUND_LOBBY
+ if(sound & SOUND_LOBBY)
+ user << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1)
+ else
+ user << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1)
- for(var/i=1, i<=max_save_slots, i++)
- if(!query.Execute())
- var/err = query.ErrorMsg()
- log_game("SQL ERROR during character slot loading. Error : \[[err]\]\n")
- message_admins("SQL ERROR during character slot loading. Error : \[[err]\]\n")
- return
- while(query.NextRow())
- if(i==text2num(query.item[1]))
- name = query.item[2]
- if(!name) name = "Character[i]"
- if(i==default_slot)
- name = "[name]"
- dat += "[name]
"
- name = null
+ if("ghost_ears")
+ toggles ^= CHAT_GHOSTEARS
- dat += "
"
- dat += "Close
"
- dat += ""
+ if("ghost_sight")
+ toggles ^= CHAT_GHOSTSIGHT
+
+ if("ghost_radio")
+ toggles ^= CHAT_GHOSTRADIO
+
+ if("ghost_radio")
+ toggles ^= CHAT_GHOSTRADIO
+
+ if("save")
+ save_preferences(user)
+ save_character(user)
+
+ if("reload")
+ load_preferences(user)
+ load_character(user)
+
+ if("open_load_dialog")
+ if(!IsGuestKey(user.key))
+ open_load_dialog(user)
+
+ if("close_load_dialog")
+ close_load_dialog(user)
+
+ if("changeslot")
+ if(!load_character(user,text2num(href_list["num"])))
+ random_character()
+ real_name = random_name(gender)
+ save_character(user)
+ close_load_dialog(user)
+
+ if("tab")
+ if (href_list["tab"])
+ current_tab = text2num(href_list["tab"])
+
+ ShowChoices(user)
+ return 1
+
+/datum/preferences/proc/copy_to(mob/living/carbon/human/character)
+ if(be_random_name)
+ real_name = random_name(gender,species)
+
+ if(config.humans_need_surnames)
+ var/firstspace = findtext(real_name, " ")
+ var/name_length = length(real_name)
+ if(!firstspace) //we need a surname
+ real_name += " [pick(last_names)]"
+ else if(firstspace == name_length)
+ real_name += "[pick(last_names)]"
+
+ character.real_name = real_name
+ character.name = character.real_name
+ if(character.dna)
+ character.dna.real_name = character.real_name
+
+ character.flavor_text = flavor_text
+ character.med_record = med_record
+ character.sec_record = sec_record
+ character.gen_record = gen_record
+
+ character.gender = gender
+ character.age = age
+ character.b_type = b_type
+
+ character.r_eyes = r_eyes
+ character.g_eyes = g_eyes
+ character.b_eyes = b_eyes
+
+ character.r_hair = r_hair
+ character.g_hair = g_hair
+ character.b_hair = b_hair
+
+ character.r_facial = r_facial
+ character.g_facial = g_facial
+ character.b_facial = b_facial
+
+ character.r_skin = r_skin
+ character.g_skin = g_skin
+ character.b_skin = b_skin
+
+ character.s_tone = s_tone
+
+ character.h_style = h_style
+ character.f_style = f_style
+
+
+ // Destroy/cyborgize organs
+
+ for(var/name in organ_data)
+
+ var/status = organ_data[name]
+ var/obj/item/organ/external/O = character.organs_by_name[name]
+ if(O)
+ if(status == "amputated")
+ character.organs_by_name[O.limb_name] = null
+ character.organs -= O
+ if(O.children) // This might need to become recursive.
+ for(var/obj/item/organ/external/child in O.children)
+ character.organs_by_name[child.limb_name] = null
+ character.organs -= child
+
+ else if(status == "cyborg")
+ if(rlimb_data[name])
+ O.robotize(rlimb_data[name])
+ else
+ O.robotize()
+ else
+ var/obj/item/organ/I = character.internal_organs_by_name[name]
+ if(I)
+ if(status == "assisted")
+ I.mechassist()
+ else if(status == "mechanical")
+ I.robotize()
+
+ if(disabilities & DISABILITY_FLAG_FAT && character.species.flags & CAN_BE_FAT)//character.species.flags & CAN_BE_FAT)
+ character.mutations += FAT
+ character.mutations += OBESITY
+ if(disabilities & DISABILITY_FLAG_NEARSIGHTED)
+ character.disabilities|=NEARSIGHTED
+ if(disabilities & DISABILITY_FLAG_EPILEPTIC)
+ character.disabilities|=EPILEPSY
+ if(disabilities & DISABILITY_FLAG_DEAF)
+ character.sdisabilities|=DEAF
+
+ // Wheelchair necessary?
+ var/obj/item/organ/external/l_foot = character.get_organ("l_foot")
+ var/obj/item/organ/external/r_foot = character.get_organ("r_foot")
+ if((!l_foot || l_foot.status & ORGAN_DESTROYED) && (!r_foot || r_foot.status & ORGAN_DESTROYED))
+ var/obj/structure/stool/bed/chair/wheelchair/W = new /obj/structure/stool/bed/chair/wheelchair (character.loc)
+ character.buckled = W
+ character.update_canmove()
+ W.dir = character.dir
+ W.buckled_mob = character
+ W.add_fingerprint(character)
+
+ character.underwear = underwear
+ character.undershirt = undershirt
+ character.socks = socks
+
+ if(body_accessory)
+ character.body_accessory = body_accessory_by_name["[body_accessory]"]
+
+ if(backbag > 4 || backbag < 1)
+ backbag = 1 //Same as above
+ character.backbag = backbag
+
+ //Debugging report to track down a bug, which randomly assigned the plural gender to people.
+ if(character.gender in list(PLURAL, NEUTER))
+ if(isliving(src)) //Ghosts get neuter by default
+ message_admins("[key_name_admin(character)] has spawned with their gender as plural or neuter. Please notify coders.")
+ character.gender = MALE
+
+/datum/preferences/proc/open_load_dialog(mob/user)
+
+ var/DBQuery/query = dbcon.NewQuery("SELECT slot,real_name FROM [format_table_name("characters")] WHERE ckey='[user.ckey]' ORDER BY slot")
+
+ var/dat = ""
+ dat += ""
+ dat += "Select a character slot to load
"
+ var/name
+
+ for(var/i=1, i<=max_save_slots, i++)
+ if(!query.Execute())
+ var/err = query.ErrorMsg()
+ log_game("SQL ERROR during character slot loading. Error : \[[err]\]\n")
+ message_admins("SQL ERROR during character slot loading. Error : \[[err]\]\n")
+ return
+ while(query.NextRow())
+ if(i==text2num(query.item[1]))
+ name = query.item[2]
+ if(!name) name = "Character[i]"
+ if(i==default_slot)
+ name = "[name]"
+ dat += "[name]
"
+ name = null
+
+ dat += "
"
+ dat += "Close
"
+ dat += ""
// user << browse(dat, "window=saves;size=300x390")
- var/datum/browser/popup = new(user, "saves", "Character Saves
", 300, 390)
- popup.set_content(dat)
- popup.open(0)
- proc/close_load_dialog(mob/user)
- user << browse(null, "window=saves")
+ var/datum/browser/popup = new(user, "saves", "Character Saves
", 300, 390)
+ popup.set_content(dat)
+ popup.open(0)
+
+/datum/preferences/proc/close_load_dialog(mob/user)
+ user << browse(null, "window=saves")
diff --git a/code/modules/client/preferences_mysql.dm b/code/modules/client/preferences_mysql.dm
index 98c26df8ec8..84d36fa9ea2 100644
--- a/code/modules/client/preferences_mysql.dm
+++ b/code/modules/client/preferences_mysql.dm
@@ -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")
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
deleted file mode 100644
index f1dd7b307f3..00000000000
--- a/code/modules/client/preferences_savefile.dm
+++ /dev/null
@@ -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
diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm
index a59f4eeac42..ccc0ef94191 100644
--- a/code/modules/events/alien_infestation.dm
+++ b/code/modules/events/alien_infestation.dm
@@ -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
-
+
diff --git a/code/modules/events/borers.dm b/code/modules/events/borers.dm
index d1620e45be7..d716b1df6c5 100644
--- a/code/modules/events/borers.dm
+++ b/code/modules/events/borers.dm
@@ -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
-
+
diff --git a/code/modules/events/slaughterevent.dm b/code/modules/events/slaughterevent.dm
index c0f1ae75184..0889f8d8136 100644
--- a/code/modules/events/slaughterevent.dm
+++ b/code/modules/events/slaughterevent.dm
@@ -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()
-
\ No newline at end of file
diff --git a/code/modules/hydroponics/seed_mobs.dm b/code/modules/hydroponics/seed_mobs.dm
index b7fd3b4fdfd..57579a3a797 100644
--- a/code/modules/hydroponics/seed_mobs.dm
+++ b/code/modules/hydroponics/seed_mobs.dm
@@ -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("[host] is malformed and unable to survive. It expires pitifully, leaving behind some seeds.")
-
- 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 You awaken slowly, stirring into sluggish motion as the air caresses you."
-
- // This is a hack, replace with some kind of species blurb proc.
- if(istype(host,/mob/living/simple_animal/diona))
- host << "You are [host], one of a race of drifting interstellar plantlike creatures that sometimes share their seeds with human traders."
- host << "Too much darkness will send you into shock and starve you, but light will help you heal."
-
- 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
-*/
\ No newline at end of file
+/datum/seed/proc/handle_living_product(var/mob/living/host)
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm
index 5494b199a87..5ffe45a8123 100644
--- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm
+++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm
@@ -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
diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm
index 67caeb2788c..d76b7dea569 100644
--- a/code/modules/mob/living/carbon/brain/posibrain.dm
+++ b/code/modules/mob/living/carbon/brain/posibrain.dm
@@ -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 \A [src] has been activated. (Teleport | Sign Up)"
- //question(O.client)
+ O << "\A [src] has been activated. (Teleport | Sign Up)"
+// 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)
diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm
index 4abae727c73..96680de98b8 100644
--- a/code/modules/mob/living/carbon/metroid/metroid.dm
+++ b/code/modules/mob/living/carbon/metroid/metroid.dm
@@ -789,7 +789,7 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75
user << "You offer the sentience potion to [M]..."
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)
diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm
index 768b46c2283..fe785adf929 100644
--- a/code/modules/mob/living/silicon/pai/recruit.dm
+++ b/code/modules/mob/living/silicon/pai/recruit.dm
@@ -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 A pAI card is looking for personalities. (Teleport | Sign Up)"
//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
diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm
index 4b38f79c2cc..005b1194821 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone.dm
@@ -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)
diff --git a/code/modules/mob/living/simple_animal/borer.dm b/code/modules/mob/living/simple_animal/borer.dm
index ab593967725..34ec44a4245 100644
--- a/code/modules/mob/living/simple_animal/borer.dm
+++ b/code/modules/mob/living/simple_animal/borer.dm
@@ -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
diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm
index fefd94092b0..b202fd9bf81 100644
--- a/code/modules/mob/living/simple_animal/guardian/guardian.dm
+++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm
@@ -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)
diff --git a/code/modules/mob/living/simple_animal/revenant/revenant.dm b/code/modules/mob/living/simple_animal/revenant/revenant.dm
index 70edbc27dd3..dfe8d1838e0 100644
--- a/code/modules/mob/living/simple_animal/revenant/revenant.dm
+++ b/code/modules/mob/living/simple_animal/revenant/revenant.dm
@@ -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!")
diff --git a/code/modules/mob/living/simple_animal/revenant/revenant_spawn_event.dm b/code/modules/mob/living/simple_animal/revenant/revenant_spawn_event.dm
index 0f1b3545391..57ebb983e72 100644
--- a/code/modules/mob/living/simple_animal/revenant/revenant_spawn_event.dm
+++ b/code/modules/mob/living/simple_animal/revenant/revenant_spawn_event.dm
@@ -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
diff --git a/code/modules/research/message_server.dm b/code/modules/research/message_server.dm
index 34a10b97f1d..7159f83ab0d 100644
--- a/code/modules/research/message_server.dm
+++ b/code/modules/research/message_server.dm
@@ -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
diff --git a/paradise.dme b/paradise.dme
index d3a4fd5c68b..56a61d6fa1a 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -34,6 +34,7 @@
#include "code\__DEFINES\preferences.dm"
#include "code\__DEFINES\process_scheduler.dm"
#include "code\__DEFINES\qdel.dm"
+#include "code\__DEFINES\role_preferences.dm"
#include "code\__DEFINES\sight.dm"
#include "code\__DEFINES\stat.dm"
#include "code\__HELPERS\_string_lists.dm"