new_player: absolute pathing

This commit is contained in:
Kelenius
2016-03-17 16:35:09 +03:00
parent e8d65eb901
commit bc1bbafaad
3 changed files with 1209 additions and 1209 deletions

View File

@@ -15,468 +15,468 @@
anchored = 1 // don't get pushed around
New()
mob_list += src
/mob/new_player/New()
mob_list += src
verb/new_player_panel()
set src = usr
new_player_panel_proc()
/mob/new_player/verb/new_player_panel()
set src = usr
new_player_panel_proc()
proc/new_player_panel_proc()
var/output = "<div align='center'><B>New Player Options</B>"
output +="<hr>"
output += "<p><a href='byond://?src=\ref[src];show_preferences=1'>Setup Character</A></p>"
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME)
if(ready)
output += "<p>\[ <b>Ready</b> | <a href='byond://?src=\ref[src];ready=0'>Not Ready</a> \]</p>"
else
output += "<p>\[ <a href='byond://?src=\ref[src];ready=1'>Ready</a> | <b>Not Ready</b> \]</p>"
/mob/new_player/proc/new_player_panel_proc()
var/output = "<div align='center'><B>New Player Options</B>"
output +="<hr>"
output += "<p><a href='byond://?src=\ref[src];show_preferences=1'>Setup Character</A></p>"
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME)
if(ready)
output += "<p>\[ <b>Ready</b> | <a href='byond://?src=\ref[src];ready=0'>Not Ready</a> \]</p>"
else
output += "<a href='byond://?src=\ref[src];manifest=1'>View the Crew Manifest</A><br><br>"
output += "<p><a href='byond://?src=\ref[src];late_join=1'>Join Game!</A></p>"
output += "<p>\[ <a href='byond://?src=\ref[src];ready=1'>Ready</a> | <b>Not Ready</b> \]</p>"
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
else
output += "<a href='byond://?src=\ref[src];manifest=1'>View the Crew Manifest</A><br><br>"
output += "<p><a href='byond://?src=\ref[src];late_join=1'>Join Game!</A></p>"
if(!IsGuestKey(src.key))
establish_db_connection()
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
if(dbcon.IsConnected())
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
newpoll = 1
break
if(!IsGuestKey(src.key))
establish_db_connection()
if(newpoll)
output += "<p><b><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A> (NEW!)</b></p>"
else
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A></p>"
output += "</div>"
src << browse(output,"window=playersetup;size=210x280;can_close=0")
return
Stat()
..()
if(statpanel("Lobby") && ticker)
if(ticker.hide_mode)
stat("Game Mode:", "Secret")
else
if(ticker.hide_mode == 0)
stat("Game Mode:", "[master_mode]") // Old setting for showing the game mode
if(ticker.current_state == GAME_STATE_PREGAME)
stat("Time To Start:", "[ticker.pregame_timeleft][round_progressing ? "" : " (DELAYED)"]")
stat("Players: [totalPlayers]", "Players Ready: [totalPlayersReady]")
totalPlayers = 0
totalPlayersReady = 0
for(var/mob/new_player/player in player_list)
stat("[player.key]", (player.ready)?("(Playing)"):(null))
totalPlayers++
if(player.ready)totalPlayersReady++
Topic(href, href_list[])
if(!client) return 0
if(href_list["show_preferences"])
client.prefs.ShowChoices(src)
return 1
if(href_list["ready"])
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME) // Make sure we don't ready up after the round has started
ready = text2num(href_list["ready"])
else
ready = 0
if(href_list["refresh"])
src << browse(null, "window=playersetup") //closes the player setup window
new_player_panel_proc()
if(href_list["observe"])
if(alert(src,"Are you sure you wish to observe? You will have to wait 15 minutes before being able to respawn!","Player Setup","Yes","No") == "Yes")
if(!client) return 1
var/mob/dead/observer/observer = new()
spawning = 1
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
src << "<span class='notice'>Now teleporting.</span>"
observer.loc = O.loc
else
src << "<span class='danger'>Could not locate an observer spawn point. Use the Teleport verb to jump to the station map.</span>"
observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly.
announce_ghost_joinleave(src)
client.prefs.update_preview_icon()
observer.icon = client.prefs.preview_icon
observer.alpha = 127
if(client.prefs.be_random_name)
client.prefs.real_name = random_name(client.prefs.gender)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed.
observer.verbs -= /mob/dead/observer/verb/toggle_antagHUD // Poor guys, don't know what they are missing!
observer.key = key
qdel(src)
return 1
if(href_list["late_join"])
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
usr << "\red The round is either not ready, or has already finished..."
return
if(client.prefs.species != "Human" && !check_rights(R_ADMIN, 0))
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
src << alert("You are currently not whitelisted to play [client.prefs.species].")
return 0
var/datum/species/S = all_species[client.prefs.species]
if(!(S.spawn_flags & IS_WHITELISTED))
src << alert("Your current species,[client.prefs.species], is not available for play on the station.")
return 0
LateChoices()
if(href_list["manifest"])
ViewManifest()
if(href_list["SelectedJob"])
if(!config.enter_allowed)
usr << "<span class='notice'>There is an administrative lock on entering the game!</span>"
return
else if(ticker && ticker.mode && ticker.mode.explosion_in_progress)
usr << "<span class='danger'>The station is currently exploding. Joining would go poorly.</span>"
return
if(client.prefs.species != "Human")
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
src << alert("You are currently not whitelisted to play [client.prefs.species].")
return 0
var/datum/species/S = all_species[client.prefs.species]
if(!(S.spawn_flags & CAN_JOIN))
src << alert("Your current species, [client.prefs.species], is not available for play on the station.")
return 0
AttemptLateSpawn(href_list["SelectedJob"],client.prefs.spawnpoint)
return
if(href_list["privacy_poll"])
establish_db_connection()
if(!dbcon.IsConnected())
return
var/voted = 0
//First check if the person has not voted yet.
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_privacy WHERE ckey='[src.ckey]'")
if(dbcon.IsConnected())
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
voted = 1
newpoll = 1
break
//This is a safety switch, so only valid options pass through
var/option = "UNKNOWN"
switch(href_list["privacy_poll"])
if("signed")
option = "SIGNED"
if("anonymous")
option = "ANONYMOUS"
if("nostats")
option = "NOSTATS"
if("later")
usr << browse(null,"window=privacypoll")
return
if("abstain")
option = "ABSTAIN"
if(newpoll)
output += "<p><b><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A> (NEW!)</b></p>"
else
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A></p>"
if(option == "UNKNOWN")
return
output += "</div>"
if(!voted)
var/sql = "INSERT INTO erro_privacy VALUES (null, Now(), '[src.ckey]', '[option]')"
var/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
usr << "<b>Thank you for your vote!</b>"
usr << browse(null,"window=privacypoll")
src << browse(output,"window=playersetup;size=210x280;can_close=0")
return
if(!ready && href_list["preference"])
if(client)
client.prefs.process_link(src, href_list)
else if(!href_list["late_join"])
new_player_panel()
/mob/new_player/Stat()
..()
if(href_list["showpoll"])
if(statpanel("Lobby") && ticker)
if(ticker.hide_mode)
stat("Game Mode:", "Secret")
else
if(ticker.hide_mode == 0)
stat("Game Mode:", "[master_mode]") // Old setting for showing the game mode
handle_player_polling()
return
if(ticker.current_state == GAME_STATE_PREGAME)
stat("Time To Start:", "[ticker.pregame_timeleft][round_progressing ? "" : " (DELAYED)"]")
stat("Players: [totalPlayers]", "Players Ready: [totalPlayersReady]")
totalPlayers = 0
totalPlayersReady = 0
for(var/mob/new_player/player in player_list)
stat("[player.key]", (player.ready)?("(Playing)"):(null))
totalPlayers++
if(player.ready)totalPlayersReady++
if(href_list["pollid"])
/mob/new_player/Topic(href, href_list[])
if(!client) return 0
var/pollid = href_list["pollid"]
if(istext(pollid))
pollid = text2num(pollid)
if(isnum(pollid))
src.poll_player(pollid)
return
if(href_list["votepollid"] && href_list["votetype"])
var/pollid = text2num(href_list["votepollid"])
var/votetype = href_list["votetype"]
switch(votetype)
if("OPTION")
var/optionid = text2num(href_list["voteoptionid"])
vote_on_poll(pollid, optionid)
if("TEXT")
var/replytext = href_list["replytext"]
log_text_poll_reply(pollid, replytext)
if("NUMVAL")
var/id_min = text2num(href_list["minid"])
var/id_max = text2num(href_list["maxid"])
if( (id_max - id_min) > 100 ) //Basic exploit prevention
usr << "The option ID difference is too big. Please contact administration or the database admin."
return
for(var/optionid = id_min; optionid <= id_max; optionid++)
if(!isnull(href_list["o[optionid]"])) //Test if this optionid was replied to
var/rating
if(href_list["o[optionid]"] == "abstain")
rating = null
else
rating = text2num(href_list["o[optionid]"])
if(!isnum(rating))
return
vote_on_numval_poll(pollid, optionid, rating)
if("MULTICHOICE")
var/id_min = text2num(href_list["minoptionid"])
var/id_max = text2num(href_list["maxoptionid"])
if( (id_max - id_min) > 100 ) //Basic exploit prevention
usr << "The option ID difference is too big. Please contact administration or the database admin."
return
for(var/optionid = id_min; optionid <= id_max; optionid++)
if(!isnull(href_list["option_[optionid]"])) //Test if this optionid was selected
vote_on_poll(pollid, optionid, 1)
proc/IsJobAvailable(rank)
var/datum/job/job = job_master.GetJob(rank)
if(!job) return 0
if(!job.is_position_available()) return 0
if(jobban_isbanned(src,rank)) return 0
if(!job.player_old_enough(src.client)) return 0
if(href_list["show_preferences"])
client.prefs.ShowChoices(src)
return 1
if(href_list["ready"])
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME) // Make sure we don't ready up after the round has started
ready = text2num(href_list["ready"])
else
ready = 0
if(href_list["refresh"])
src << browse(null, "window=playersetup") //closes the player setup window
new_player_panel_proc()
if(href_list["observe"])
if(alert(src,"Are you sure you wish to observe? You will have to wait 15 minutes before being able to respawn!","Player Setup","Yes","No") == "Yes")
if(!client) return 1
var/mob/dead/observer/observer = new()
spawning = 1
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
src << "<span class='notice'>Now teleporting.</span>"
observer.loc = O.loc
else
src << "<span class='danger'>Could not locate an observer spawn point. Use the Teleport verb to jump to the station map.</span>"
observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly.
announce_ghost_joinleave(src)
client.prefs.update_preview_icon()
observer.icon = client.prefs.preview_icon
observer.alpha = 127
if(client.prefs.be_random_name)
client.prefs.real_name = random_name(client.prefs.gender)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed.
observer.verbs -= /mob/dead/observer/verb/toggle_antagHUD // Poor guys, don't know what they are missing!
observer.key = key
qdel(src)
return 1
if(href_list["late_join"])
proc/AttemptLateSpawn(rank,var/spawning_at)
if (src != usr)
return 0
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
usr << "\red The round is either not ready, or has already finished..."
return 0
if(!config.enter_allowed)
usr << "<span class='notice'>There is an administrative lock on entering the game!</span>"
return 0
if(!IsJobAvailable(rank))
src << alert("[rank] is not available. Please try another.")
return 0
spawning = 1
close_spawn_windows()
job_master.AssignRole(src, rank, 1)
var/mob/living/character = create_character() //creates the human and transfers vars and mind
character = job_master.EquipRank(character, rank, 1) //equips the human
UpdateFactionList(character)
equip_custom_items(character)
// AIs don't need a spawnpoint, they must spawn at an empty core
if(character.mind.assigned_role == "AI")
character = character.AIize(move=0) // AIize the character, but don't move them yet
// IsJobAvailable for AI checks that there is an empty core available in this list
var/obj/structure/AIcore/deactivated/C = empty_playable_ai_cores[1]
empty_playable_ai_cores -= C
character.loc = C.loc
AnnounceCyborg(character, rank, "has been downloaded to the empty core in \the [character.loc.loc]")
ticker.mode.latespawn(character)
qdel(C)
qdel(src)
return
//Find our spawning point.
var/join_message = job_master.LateSpawn(character, rank)
if(client.prefs.species != "Human" && !check_rights(R_ADMIN, 0))
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
src << alert("You are currently not whitelisted to play [client.prefs.species].")
return 0
character.lastarea = get_area(loc)
// Moving wheelchair if they have one
if(character.buckled && istype(character.buckled, /obj/structure/bed/chair/wheelchair))
character.buckled.loc = character.loc
character.buckled.set_dir(character.dir)
var/datum/species/S = all_species[client.prefs.species]
if(!(S.spawn_flags & IS_WHITELISTED))
src << alert("Your current species,[client.prefs.species], is not available for play on the station.")
return 0
ticker.mode.latespawn(character)
LateChoices()
if(character.mind.assigned_role != "Cyborg")
data_core.manifest_inject(character)
ticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. //TODO!!!!! ~Carn
if(href_list["manifest"])
ViewManifest()
//Grab some data from the character prefs for use in random news procs.
if(href_list["SelectedJob"])
AnnounceArrival(character, rank, join_message)
else
AnnounceCyborg(character, rank, join_message)
if(!config.enter_allowed)
usr << "<span class='notice'>There is an administrative lock on entering the game!</span>"
return
else if(ticker && ticker.mode && ticker.mode.explosion_in_progress)
usr << "<span class='danger'>The station is currently exploding. Joining would go poorly.</span>"
return
qdel(src)
if(client.prefs.species != "Human")
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
src << alert("You are currently not whitelisted to play [client.prefs.species].")
return 0
proc/AnnounceCyborg(var/mob/living/character, var/rank, var/join_message)
if (ticker.current_state == GAME_STATE_PLAYING)
if(character.mind.role_alt_title)
rank = character.mind.role_alt_title
// can't use their name here, since cyborg namepicking is done post-spawn, so we'll just say "A new Cyborg has arrived"/"A new Android has arrived"/etc.
global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
var/datum/species/S = all_species[client.prefs.species]
if(!(S.spawn_flags & CAN_JOIN))
src << alert("Your current species, [client.prefs.species], is not available for play on the station.")
return 0
proc/LateChoices()
var/name = client.prefs.be_random_name ? "friend" : client.prefs.real_name
AttemptLateSpawn(href_list["SelectedJob"],client.prefs.spawnpoint)
return
var/dat = "<html><body><center>"
dat += "<b>Welcome, [name].<br></b>"
dat += "Round Duration: [round_duration()]<br>"
if(href_list["privacy_poll"])
establish_db_connection()
if(!dbcon.IsConnected())
return
var/voted = 0
if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles.
if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled
dat += "<font color='red'><b>The station has been evacuated.</b></font><br>"
if(emergency_shuttle.online())
if (emergency_shuttle.evac) // Emergency shuttle is past the point of no recall
dat += "<font color='red'>The station is currently undergoing evacuation procedures.</font><br>"
else // Crew transfer initiated
dat += "<font color='red'>The station is currently undergoing crew transfer procedures.</font><br>"
//First check if the person has not voted yet.
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_privacy WHERE ckey='[src.ckey]'")
query.Execute()
while(query.NextRow())
voted = 1
break
dat += "Choose from the following open/valid positions:<br>"
for(var/datum/job/job in job_master.occupations)
if(job && IsJobAvailable(job.title))
if(job.minimum_character_age && (client.prefs.age < job.minimum_character_age))
continue
var/active = 0
// Only players with the job assigned and AFK for less than 10 minutes count as active
for(var/mob/M in player_list) if(M.mind && M.client && M.mind.assigned_role == job.title && M.client.inactivity <= 10 * 60 * 10)
active++
dat += "<a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title] ([job.current_positions]) (Active: [active])</a><br>"
//This is a safety switch, so only valid options pass through
var/option = "UNKNOWN"
switch(href_list["privacy_poll"])
if("signed")
option = "SIGNED"
if("anonymous")
option = "ANONYMOUS"
if("nostats")
option = "NOSTATS"
if("later")
usr << browse(null,"window=privacypoll")
return
if("abstain")
option = "ABSTAIN"
dat += "</center>"
src << browse(dat, "window=latechoices;size=300x640;can_close=1")
if(option == "UNKNOWN")
return
if(!voted)
var/sql = "INSERT INTO erro_privacy VALUES (null, Now(), '[src.ckey]', '[option]')"
var/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
usr << "<b>Thank you for your vote!</b>"
usr << browse(null,"window=privacypoll")
if(!ready && href_list["preference"])
if(client)
client.prefs.process_link(src, href_list)
else if(!href_list["late_join"])
new_player_panel()
if(href_list["showpoll"])
handle_player_polling()
return
if(href_list["pollid"])
var/pollid = href_list["pollid"]
if(istext(pollid))
pollid = text2num(pollid)
if(isnum(pollid))
src.poll_player(pollid)
return
if(href_list["votepollid"] && href_list["votetype"])
var/pollid = text2num(href_list["votepollid"])
var/votetype = href_list["votetype"]
switch(votetype)
if("OPTION")
var/optionid = text2num(href_list["voteoptionid"])
vote_on_poll(pollid, optionid)
if("TEXT")
var/replytext = href_list["replytext"]
log_text_poll_reply(pollid, replytext)
if("NUMVAL")
var/id_min = text2num(href_list["minid"])
var/id_max = text2num(href_list["maxid"])
if( (id_max - id_min) > 100 ) //Basic exploit prevention
usr << "The option ID difference is too big. Please contact administration or the database admin."
return
for(var/optionid = id_min; optionid <= id_max; optionid++)
if(!isnull(href_list["o[optionid]"])) //Test if this optionid was replied to
var/rating
if(href_list["o[optionid]"] == "abstain")
rating = null
else
rating = text2num(href_list["o[optionid]"])
if(!isnum(rating))
return
vote_on_numval_poll(pollid, optionid, rating)
if("MULTICHOICE")
var/id_min = text2num(href_list["minoptionid"])
var/id_max = text2num(href_list["maxoptionid"])
if( (id_max - id_min) > 100 ) //Basic exploit prevention
usr << "The option ID difference is too big. Please contact administration or the database admin."
return
for(var/optionid = id_min; optionid <= id_max; optionid++)
if(!isnull(href_list["option_[optionid]"])) //Test if this optionid was selected
vote_on_poll(pollid, optionid, 1)
/mob/new_player/proc/IsJobAvailable(rank)
var/datum/job/job = job_master.GetJob(rank)
if(!job) return 0
if(!job.is_position_available()) return 0
if(jobban_isbanned(src,rank)) return 0
if(!job.player_old_enough(src.client)) return 0
return 1
proc/create_character()
spawning = 1
close_spawn_windows()
var/mob/living/carbon/human/new_character
var/use_species_name
var/datum/species/chosen_species
if(client.prefs.species)
chosen_species = all_species[client.prefs.species]
use_species_name = chosen_species.get_station_variant() //Only used by pariahs atm.
if(chosen_species && use_species_name)
// Have to recheck admin due to no usr at roundstart. Latejoins are fine though.
if(is_species_whitelisted(chosen_species) || has_admin_rights())
new_character = new(loc, use_species_name)
if(!new_character)
new_character = new(loc)
new_character.lastarea = get_area(loc)
for(var/lang in client.prefs.alternate_languages)
var/datum/language/chosen_language = all_languages[lang]
if(chosen_language)
if(!config.usealienwhitelist || !(chosen_language.flags & WHITELISTED) || is_alien_whitelisted(src, lang) || has_admin_rights() \
|| (new_character.species && (chosen_language.name in new_character.species.secondary_langs)))
new_character.add_language(lang)
if(ticker.random_players)
new_character.gender = pick(MALE, FEMALE)
client.prefs.real_name = random_name(new_character.gender)
client.prefs.randomize_appearance_for(new_character)
else
client.prefs.copy_to(new_character)
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
if(mind)
mind.active = 0 //we wish to transfer the key manually
if(mind.assigned_role == "Clown") //give them a clownname if they are a clown
new_character.real_name = pick(clown_names) //I hate this being here of all places but unfortunately dna is based on real_name!
new_character.rename_self("clown")
mind.original = new_character
mind.transfer_to(new_character) //won't transfer key since the mind is not active
new_character.name = real_name
new_character.dna.ready_dna(new_character)
new_character.dna.b_type = client.prefs.b_type
new_character.sync_organ_dna()
if(client.prefs.disabilities)
// Set defer to 1 if you add more crap here so it only recalculates struc_enzymes once. - N3X
new_character.dna.SetSEState(GLASSESBLOCK,1,0)
new_character.disabilities |= NEARSIGHTED
// And uncomment this, too.
//new_character.dna.UpdateSE()
// Do the initial caching of the player's body icons.
new_character.force_update_limbs()
new_character.update_eyes()
new_character.regenerate_icons()
new_character.key = key //Manually transfer the key to log them in
return new_character
proc/ViewManifest()
var/dat = "<html><body>"
dat += "<h4>Show Crew Manifest</h4>"
dat += data_core.get_manifest(OOC = 1)
src << browse(dat, "window=manifest;size=370x420;can_close=1")
Move()
/mob/new_player/proc/AttemptLateSpawn(rank,var/spawning_at)
if (src != usr)
return 0
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
usr << "\red The round is either not ready, or has already finished..."
return 0
if(!config.enter_allowed)
usr << "<span class='notice'>There is an administrative lock on entering the game!</span>"
return 0
if(!IsJobAvailable(rank))
src << alert("[rank] is not available. Please try another.")
return 0
proc/close_spawn_windows()
src << browse(null, "window=latechoices") //closes late choices window
src << browse(null, "window=playersetup") //closes the player setup window
spawning = 1
close_spawn_windows()
proc/has_admin_rights()
return check_rights(R_ADMIN, 0, src)
job_master.AssignRole(src, rank, 1)
proc/is_species_whitelisted(datum/species/S)
if(!S) return 1
return is_alien_whitelisted(src, S.name) || !config.usealienwhitelist || !(S.spawn_flags & IS_WHITELISTED)
var/mob/living/character = create_character() //creates the human and transfers vars and mind
character = job_master.EquipRank(character, rank, 1) //equips the human
UpdateFactionList(character)
equip_custom_items(character)
// AIs don't need a spawnpoint, they must spawn at an empty core
if(character.mind.assigned_role == "AI")
character = character.AIize(move=0) // AIize the character, but don't move them yet
// IsJobAvailable for AI checks that there is an empty core available in this list
var/obj/structure/AIcore/deactivated/C = empty_playable_ai_cores[1]
empty_playable_ai_cores -= C
character.loc = C.loc
AnnounceCyborg(character, rank, "has been downloaded to the empty core in \the [character.loc.loc]")
ticker.mode.latespawn(character)
qdel(C)
qdel(src)
return
//Find our spawning point.
var/join_message = job_master.LateSpawn(character, rank)
character.lastarea = get_area(loc)
// Moving wheelchair if they have one
if(character.buckled && istype(character.buckled, /obj/structure/bed/chair/wheelchair))
character.buckled.loc = character.loc
character.buckled.set_dir(character.dir)
ticker.mode.latespawn(character)
if(character.mind.assigned_role != "Cyborg")
data_core.manifest_inject(character)
ticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. //TODO!!!!! ~Carn
//Grab some data from the character prefs for use in random news procs.
AnnounceArrival(character, rank, join_message)
else
AnnounceCyborg(character, rank, join_message)
qdel(src)
/mob/new_player/proc/AnnounceCyborg(var/mob/living/character, var/rank, var/join_message)
if (ticker.current_state == GAME_STATE_PLAYING)
if(character.mind.role_alt_title)
rank = character.mind.role_alt_title
// can't use their name here, since cyborg namepicking is done post-spawn, so we'll just say "A new Cyborg has arrived"/"A new Android has arrived"/etc.
global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
/mob/new_player/proc/LateChoices()
var/name = client.prefs.be_random_name ? "friend" : client.prefs.real_name
var/dat = "<html><body><center>"
dat += "<b>Welcome, [name].<br></b>"
dat += "Round Duration: [round_duration()]<br>"
if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles.
if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled
dat += "<font color='red'><b>The station has been evacuated.</b></font><br>"
if(emergency_shuttle.online())
if (emergency_shuttle.evac) // Emergency shuttle is past the point of no recall
dat += "<font color='red'>The station is currently undergoing evacuation procedures.</font><br>"
else // Crew transfer initiated
dat += "<font color='red'>The station is currently undergoing crew transfer procedures.</font><br>"
dat += "Choose from the following open/valid positions:<br>"
for(var/datum/job/job in job_master.occupations)
if(job && IsJobAvailable(job.title))
if(job.minimum_character_age && (client.prefs.age < job.minimum_character_age))
continue
var/active = 0
// Only players with the job assigned and AFK for less than 10 minutes count as active
for(var/mob/M in player_list) if(M.mind && M.client && M.mind.assigned_role == job.title && M.client.inactivity <= 10 * 60 * 10)
active++
dat += "<a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title] ([job.current_positions]) (Active: [active])</a><br>"
dat += "</center>"
src << browse(dat, "window=latechoices;size=300x640;can_close=1")
/mob/new_player/proc/create_character()
spawning = 1
close_spawn_windows()
var/mob/living/carbon/human/new_character
var/use_species_name
var/datum/species/chosen_species
if(client.prefs.species)
chosen_species = all_species[client.prefs.species]
use_species_name = chosen_species.get_station_variant() //Only used by pariahs atm.
if(chosen_species && use_species_name)
// Have to recheck admin due to no usr at roundstart. Latejoins are fine though.
if(is_species_whitelisted(chosen_species) || has_admin_rights())
new_character = new(loc, use_species_name)
if(!new_character)
new_character = new(loc)
new_character.lastarea = get_area(loc)
for(var/lang in client.prefs.alternate_languages)
var/datum/language/chosen_language = all_languages[lang]
if(chosen_language)
if(!config.usealienwhitelist || !(chosen_language.flags & WHITELISTED) || is_alien_whitelisted(src, lang) || has_admin_rights() \
|| (new_character.species && (chosen_language.name in new_character.species.secondary_langs)))
new_character.add_language(lang)
if(ticker.random_players)
new_character.gender = pick(MALE, FEMALE)
client.prefs.real_name = random_name(new_character.gender)
client.prefs.randomize_appearance_for(new_character)
else
client.prefs.copy_to(new_character)
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
if(mind)
mind.active = 0 //we wish to transfer the key manually
if(mind.assigned_role == "Clown") //give them a clownname if they are a clown
new_character.real_name = pick(clown_names) //I hate this being here of all places but unfortunately dna is based on real_name!
new_character.rename_self("clown")
mind.original = new_character
mind.transfer_to(new_character) //won't transfer key since the mind is not active
new_character.name = real_name
new_character.dna.ready_dna(new_character)
new_character.dna.b_type = client.prefs.b_type
new_character.sync_organ_dna()
if(client.prefs.disabilities)
// Set defer to 1 if you add more crap here so it only recalculates struc_enzymes once. - N3X
new_character.dna.SetSEState(GLASSESBLOCK,1,0)
new_character.disabilities |= NEARSIGHTED
// And uncomment this, too.
//new_character.dna.UpdateSE()
// Do the initial caching of the player's body icons.
new_character.force_update_limbs()
new_character.update_eyes()
new_character.regenerate_icons()
new_character.key = key //Manually transfer the key to log them in
return new_character
/mob/new_player/proc/ViewManifest()
var/dat = "<html><body>"
dat += "<h4>Show Crew Manifest</h4>"
dat += data_core.get_manifest(OOC = 1)
src << browse(dat, "window=manifest;size=370x420;can_close=1")
/mob/new_player/Move()
return 0
/mob/new_player/proc/close_spawn_windows()
src << browse(null, "window=latechoices") //closes late choices window
src << browse(null, "window=playersetup") //closes the player setup window
/mob/new_player/proc/has_admin_rights()
return check_rights(R_ADMIN, 0, src)
/mob/new_player/proc/is_species_whitelisted(datum/species/S)
if(!S) return 1
return is_alien_whitelisted(src, S.name) || !config.usealienwhitelist || !(S.spawn_flags & IS_WHITELISTED)
/mob/new_player/get_species()
var/datum/species/chosen_species
@@ -504,5 +504,5 @@
/mob/new_player/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null, var/hard_to_hear = 0)
return
mob/new_player/MayRespawn()
/mob/new_player/MayRespawn()
return 1

File diff suppressed because it is too large Load Diff

View File

@@ -4,12 +4,12 @@ var/global/const
SKILL_ADEPT = 2
SKILL_EXPERT = 3
datum/skill/var
ID = "none" // ID of the skill, used in code
name = "None" // name of the skill
desc = "Placeholder skill" // detailed description of the skill
field = "Misc" // the field under which the skill will be listed
secondary = 0 // secondary skills only have two levels and cost significantly less
/datum/skill/var
ID = "none" // ID of the skill, used in code
name = "None" // name of the skill
desc = "Placeholder skill" // detailed description of the skill
field = "Misc" // the field under which the skill will be listed
secondary = 0 // secondary skills only have two levels and cost significantly less
var/global/list/SKILLS = null
var/list/SKILL_ENGINEER = list("field" = "Engineering", "EVA" = SKILL_BASIC, "construction" = SKILL_ADEPT, "electrical" = SKILL_BASIC, "engines" = SKILL_ADEPT)
@@ -18,144 +18,144 @@ var/list/SKILL_SECURITY_OFFICER = list("field" = "Security", "combat" = SKILL_BA
var/list/SKILL_CHEMIST = list("field" = "Science", "chemistry" = SKILL_ADEPT, "science" = SKILL_ADEPT, "medical" = SKILL_BASIC, "devices" = SKILL_BASIC)
var/global/list/SKILL_PRE = list("Engineer" = SKILL_ENGINEER, "Roboticist" = SKILL_ORGAN_ROBOTICIST, "Security Officer" = SKILL_SECURITY_OFFICER, "Chemist" = SKILL_CHEMIST)
datum/skill/management
ID = "management"
name = "Command"
desc = "Your ability to manage and commandeer other crew members."
/datum/skill/management
ID = "management"
name = "Command"
desc = "Your ability to manage and commandeer other crew members."
datum/skill/combat
/datum/skill/combat
ID = "combat"
name = "Close Combat"
desc = "This skill describes your training in hand-to-hand combat or melee weapon usage. While expertise in this area is rare in the era of firearms, experts still exist among athletes."
field = "Security"
datum/skill/weapons
/datum/skill/weapons
ID = "weapons"
name = "Weapons Expertise"
desc = "This skill describes your expertise with and knowledge of weapons. A low level in this skill implies knowledge of simple weapons, for example tazers and flashes. A high level in this skill implies knowledge of complex weapons, such as grenades, riot shields, pulse rifles or bombs. A low level in this skill is typical for security officers, a high level of this skill is typical for special agents and soldiers."
field = "Security"
datum/skill/EVA
ID = "EVA"
name = "Extra-vehicular activity"
desc = "This skill describes your skill and knowledge of space-suits and working in vacuum."
field = "Engineering"
secondary = 1
/datum/skill/EVA
ID = "EVA"
name = "Extra-vehicular activity"
desc = "This skill describes your skill and knowledge of space-suits and working in vacuum."
field = "Engineering"
secondary = 1
datum/skill/forensics
/datum/skill/forensics
ID = "forensics"
name = "Forensics"
desc = "Describes your skill at performing forensic examinations and identifying vital evidence. Does not cover analytical abilities, and as such isn't the only indicator for your investigation skill. Note that in order to perform autopsy, the surgery skill is also required."
field = "Security"
datum/skill/construction
ID = "construction"
name = "Construction"
desc = "Your ability to construct various buildings, such as walls, floors, tables and so on. Note that constructing devices such as APCs additionally requires the Electronics skill. A low level of this skill is typical for janitors, a high level of this skill is typical for engineers."
field = "Engineering"
/datum/skill/construction
ID = "construction"
name = "Construction"
desc = "Your ability to construct various buildings, such as walls, floors, tables and so on. Note that constructing devices such as APCs additionally requires the Electronics skill. A low level of this skill is typical for janitors, a high level of this skill is typical for engineers."
field = "Engineering"
datum/skill/management
ID = "management"
name = "Command"
desc = "Your ability to manage and commandeer other crew members."
/datum/skill/management
ID = "management"
name = "Command"
desc = "Your ability to manage and commandeer other crew members."
datum/skill/knowledge/law
ID = "law"
name = "Corporate Law"
desc = "Your knowledge of corporate law and procedures. This includes Corporate Regulations, as well as general station rulings and procedures. A low level in this skill is typical for security officers, a high level in this skill is typical for captains."
field = "Security"
secondary = 1
/datum/skill/knowledge/law
ID = "law"
name = "Corporate Law"
desc = "Your knowledge of corporate law and procedures. This includes Corporate Regulations, as well as general station rulings and procedures. A low level in this skill is typical for security officers, a high level in this skill is typical for captains."
field = "Security"
secondary = 1
datum/skill/devices
ID = "devices"
name = "Complex Devices"
desc = "Describes the ability to assemble complex devices, such as computers, circuits, printers, robots or gas tank assemblies(bombs). Note that if a device requires electronics or programming, those skills are also required in addition to this skill."
field = "Science"
/datum/skill/devices
ID = "devices"
name = "Complex Devices"
desc = "Describes the ability to assemble complex devices, such as computers, circuits, printers, robots or gas tank assemblies(bombs). Note that if a device requires electronics or programming, those skills are also required in addition to this skill."
field = "Science"
datum/skill/electrical
ID = "electrical"
name = "Electrical Engineering"
desc = "This skill describes your knowledge of electronics and the underlying physics. A low level of this skill implies you know how to lay out wiring and configure powernets, a high level of this skill is required for working complex electronic devices such as circuits or bots."
field = "Engineering"
/datum/skill/electrical
ID = "electrical"
name = "Electrical Engineering"
desc = "This skill describes your knowledge of electronics and the underlying physics. A low level of this skill implies you know how to lay out wiring and configure powernets, a high level of this skill is required for working complex electronic devices such as circuits or bots."
field = "Engineering"
datum/skill/atmos
ID = "atmos"
name = "Atmospherics"
desc = "Describes your knowledge of piping, air distribution and gas dynamics."
field = "Engineering"
/datum/skill/atmos
ID = "atmos"
name = "Atmospherics"
desc = "Describes your knowledge of piping, air distribution and gas dynamics."
field = "Engineering"
datum/skill/engines
/datum/skill/engines
ID = "engines"
name = "Engines"
desc = "Describes your knowledge of the various engine types common on space stations, such as the singularity or anti-matter engine."
field = "Engineering"
secondary = 1
datum/skill/computer
ID = "computer"
name = "Information Technology"
desc = "Describes your understanding of computers, software and communication. Not a requirement for using computers, but definitely helps. Used in telecommunications and programming of computers and AIs."
field = "Science"
/datum/skill/computer
ID = "computer"
name = "Information Technology"
desc = "Describes your understanding of computers, software and communication. Not a requirement for using computers, but definitely helps. Used in telecommunications and programming of computers and AIs."
field = "Science"
datum/skill/pilot
ID = "pilot"
name = "Heavy Machinery Operation"
desc = "Describes your experience and understanding of operating heavy machinery, which includes mechs and other large exosuits. Used in piloting mechs."
field = "Engineering"
/datum/skill/pilot
ID = "pilot"
name = "Heavy Machinery Operation"
desc = "Describes your experience and understanding of operating heavy machinery, which includes mechs and other large exosuits. Used in piloting mechs."
field = "Engineering"
datum/skill/medical
ID = "medical"
name = "Medicine"
desc = "Covers an understanding of the human body and medicine. At a low level, this skill gives a basic understanding of applying common types of medicine, and a rough understanding of medical devices like the health analyzer. At a high level, this skill grants exact knowledge of all the medicine available on the station, as well as the ability to use complex medical devices like the body scanner or mass spectrometer."
field = "Medical"
/datum/skill/medical
ID = "medical"
name = "Medicine"
desc = "Covers an understanding of the human body and medicine. At a low level, this skill gives a basic understanding of applying common types of medicine, and a rough understanding of medical devices like the health analyzer. At a high level, this skill grants exact knowledge of all the medicine available on the station, as well as the ability to use complex medical devices like the body scanner or mass spectrometer."
field = "Medical"
datum/skill/anatomy
ID = "anatomy"
name = "Anatomy"
desc = "Gives you a detailed insight of the human body. A high skill in this is required to perform surgery.This skill may also help in examining alien biology."
field = "Medical"
/datum/skill/anatomy
ID = "anatomy"
name = "Anatomy"
desc = "Gives you a detailed insight of the human body. A high skill in this is required to perform surgery.This skill may also help in examining alien biology."
field = "Medical"
datum/skill/virology
ID = "virology"
name = "Virology"
desc = "This skill implies an understanding of microorganisms and their effects on humans."
field = "Medical"
/datum/skill/virology
ID = "virology"
name = "Virology"
desc = "This skill implies an understanding of microorganisms and their effects on humans."
field = "Medical"
datum/skill/genetics
ID = "genetics"
name = "Genetics"
desc = "Implies an understanding of how DNA works and the structure of the human DNA."
field = "Science"
/datum/skill/genetics
ID = "genetics"
name = "Genetics"
desc = "Implies an understanding of how DNA works and the structure of the human DNA."
field = "Science"
datum/skill/chemistry
/datum/skill/chemistry
ID = "chemistry"
name = "Chemistry"
desc = "Experience with mixing chemicals, and an understanding of what the effect will be. This doesn't cover an understanding of the effect of chemicals on the human body, as such the medical skill is also required for medical chemists."
field = "Science"
datum/skill/botany
/datum/skill/botany
ID = "botany"
name = "Botany"
desc = "Describes how good a character is at growing and maintaining plants."
datum/skill/cooking
/datum/skill/cooking
ID = "cooking"
name = "Cooking"
desc = "Describes a character's skill at preparing meals and other consumable goods. This includes mixing alcoholic beverages."
datum/skill/science
/datum/skill/science
ID = "science"
name = "Science"
desc = "Your experience and knowledge with scientific methods and processes."
field = "Science"
datum/attribute/var
/datum/attribute/var
ID = "none"
name = "None"
desc = "This is a placeholder"
proc/setup_skills()
/proc/setup_skills()
if(SKILLS == null)
SKILLS = list()
for(var/T in (typesof(/datum/skill)-/datum/skill))
@@ -167,10 +167,10 @@ proc/setup_skills()
L += S
mob/living/carbon/human/proc/GetSkillClass(points)
/mob/living/carbon/human/proc/GetSkillClass(points)
return CalculateSkillClass(points, age)
proc/show_skill_window(var/mob/user, var/mob/living/carbon/human/M)
/proc/show_skill_window(var/mob/user, var/mob/living/carbon/human/M)
if(!istype(M)) return
if(SKILLS == null)
setup_skills()
@@ -205,7 +205,7 @@ proc/show_skill_window(var/mob/user, var/mob/living/carbon/human/M)
user << browse(HTML, "window=show_skills;size=600x800")
return
mob/living/carbon/human/verb/show_skills()
/mob/living/carbon/human/verb/show_skills()
set category = "IC"
set name = "Show Own Skills"