Added features, cancel buttons.

Added job selection, adding to manifest optionally by early-check if they were on it before.
This commit is contained in:
Arokha Sieyes
2016-07-05 12:04:38 -04:00
parent 34c6ba4604
commit 71d29b0320
2 changed files with 73 additions and 44 deletions

View File

@@ -5,7 +5,7 @@ sudo: false
env: env:
BYOND_MAJOR="510" BYOND_MAJOR="510"
BYOND_MINOR="1346" BYOND_MINOR="1346"
MACRO_COUNT=987 MACRO_COUNT=986
cache: cache:
directories: directories:

View File

@@ -356,15 +356,15 @@ Traitors and the like can also be revived with the previous role mostly intact.
return return
//I frontload all the questions so we don't have a half-done process while you're reading. //I frontload all the questions so we don't have a half-done process while you're reading.
var/client/picked_client = input(src, "Please specify which client's character to spawn.", "Client", "") in clients var/client/picked_client = input(src, "Please specify which client's character to spawn.", "Client", "") as null|anything in clients
if(!picked_client) if(!picked_client)
return return
var/location = input(src,"Please specify where to spawn them.", "Location", "Right Here") in list("Right Here","Arrivals","Cancel") var/location = alert(src,"Please specify where to spawn them.", "Location", "Right Here", "Arrivals", "Cancel")
if(!location || location == "Cancel") if(!location)
return return
var/announce = alert(src,"Do an announcement as if they had just arrived?", "Announce", "Yes", "No", "Cancel") var/announce = alert(src,"Announce as if they had just arrived?", "Announce", "Yes", "No", "Cancel")
if(announce == "Cancel") if(announce == "Cancel")
return return
else if(announce == "Yes") //Too bad buttons can't just have 1/0 values and different display strings else if(announce == "Yes") //Too bad buttons can't just have 1/0 values and different display strings
@@ -380,38 +380,78 @@ Traitors and the like can also be revived with the previous role mostly intact.
else else
inhabit = 0 inhabit = 0
var/equipment = alert(src,"Give equipment? Last job's equipment, or assistant if none.", "Equipment", "Yes", "No", "Cancel") //Name matching is ugly but mind doesn't persist to look at.
if(equipment == "Cancel") var/charjob
return var/records
else if(equipment == "Yes") var/datum/data/record/record_found
equipment = 1 record_found = find_general_record("name",picked_client.prefs.real_name)
//Found their record, they were spawned previously
if(record_found)
var/samejob = alert(src,"Found [picked_client.prefs.real_name] in data core. They were [record_found.fields["real_rank"]] this round. Assign same job? They will not be re-added to the manifest/records, either way.","Previously spawned","Yes","Assistant","No")
if(samejob == "Yes")
charjob = record_found.fields["real_rank"]
else if(samejob == "Assistant")
charjob = "Assistant"
else else
equipment = 0 records = alert(src,"No data core entry detected. Would you like add them to the manifest, and sec/med/HR records?","Records","Yes","No","Cancel")
if(records == "Cancel")
return
if(records == "Yes")
records = 1
else
records = 0
//Well you're not reloading their job or they never had one.
if(!charjob)
var/pickjob = input(src,"Pick a job to assign them (or none).","Job Select","-No Job-") as null|anything in joblist + "-No Job-"
if(!pickjob)
return
if(pickjob != "-No Job-")
charjob = pickjob
//If you've picked a job by now, you can equip them.
var/equipment
if(charjob)
equipment = alert(src,"Spawn them with equipment?", "Equipment", "Yes", "No", "Cancel")
if(equipment == "Cancel")
return
else if(equipment == "Yes")
equipment = 1
else
equipment = 0
//For logging later //For logging later
var/admin = key_name_admin(src) var/admin = key_name_admin(src)
var/player_key = picked_client.key var/player_key = picked_client.key
var/mob/living/carbon/human/new_character var/mob/living/carbon/human/new_character
var/spawnloc
if(location == "Right Here") //Spawn them on your turf //Where did you want to spawn them?
if(!src.mob) switch(location)
src << "You can't use 'Right Here' when you are not 'Right Anywhere'!" if("Right Here") //Spawn them on your turf
if(!src.mob)
src << "You can't use 'Right Here' when you are not 'Right Anywhere'!"
return
spawnloc = get_turf(src.mob)
if("Arrivals") //Spawn them at a latejoin spawnpoint
spawnloc = pick(latejoin)
else //I have no idea how you're here
src << "Invalid spawn location choice."
return return
var/turf/srcturf = get_turf(src.mob) //Did we actually get a loc to spawn them?
if(!srcturf) if(!spawnloc)
src << "Unsure where to spawn the mob. Try using Arrivals?" src << "Couldn't get valid spawn location."
return
new_character = new(srcturf)
else if(location == "Arrivals") //Spawn them at a latejoin spawnpoint
new_character = new(pick(latejoin))
else //I have no idea how you're here
return return
new_character = new(spawnloc)
//We were able to spawn them, right?
if(!new_character) if(!new_character)
src << "Something went wrong and spawning failed." src << "Something went wrong and spawning failed."
return return
@@ -427,20 +467,13 @@ Traitors and the like can also be revived with the previous role mostly intact.
antag_data.add_antagonist(new_character.mind) antag_data.add_antagonist(new_character.mind)
antag_data.place_mob(new_character) antag_data.place_mob(new_character)
//Referenced to later to apply previous settings (role, antag) if any //If desired, apply equipment.
var/datum/data/record/record_found if(equipment && charjob)
var/formerjob = "Assistant" job_master.EquipRank(new_character, charjob, 1)
if(new_character.mind)
/*Try and locate a record for the person being respawned through data_core.
This isn't an exact science but it does the trick more often than not.*/
record_found = find_general_record("name",new_character.real_name)
if(record_found)
formerjob = record_found.fields["real_rank"]
new_character.mind.assigned_role = formerjob
//If they had a job before, re-equip them for their job. //If desired, add records.
if(equipment) if(records)
job_master.EquipRank(new_character, formerjob, 1) data_core.manifest_inject(new_character)
//A redraw for good measure //A redraw for good measure
new_character.update_icons() new_character.update_icons()
@@ -449,12 +482,8 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(announce) if(announce)
AnnounceArrival(new_character, new_character.mind.assigned_role) AnnounceArrival(new_character, new_character.mind.assigned_role)
//Announces the character on all the systems, based on the record. log_admin("[admin] has spawned [player_key]'s character [new_character.real_name].")
if(!record_found) message_admins("[admin] has spawned [player_key]'s character [new_character.real_name].", 1)
if(alert(new_character,"Warning: No data core entry detected. Would you like add them to various databases, such as medical records?","Records","Yes","No")=="Yes")
data_core.manifest_inject(new_character)
message_admins("\blue [admin] has spawned [player_key]'s character [new_character.real_name].", 1)
new_character << "You have been fully spawned. Enjoy the game." new_character << "You have been fully spawned. Enjoy the game."