Fixed a bug from 1607. Observing and the like should work properly now regardless of config. May need more testing but looks solid on my end.

DONT_DEL_NEWMOB in config.txt is no longer necessary and you can remove it entirely.
Respawn character now uses ckey() matching so it doesn't matter what case you type in a person's key. It also takes into account space ninjas and death commandos if you want to respawn them. Also fixed a few bugs dealing with special roles.
Revised code for checking security records and added missing ranks as per bug report by Magicbones.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1614 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
noisomehollow@lycos.com
2011-05-23 23:35:31 +00:00
parent f7dabfae1e
commit fd0133d920
8 changed files with 525 additions and 514 deletions
+33 -13
View File
@@ -335,13 +335,13 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!authenticated || !holder)
src << "Only administrators may use this command."
return
var/input = input(src, "Please specify which key will be respawned. Make sure their key is properly capitalized (if that doesn't work, try all lower case).", "Key", "")
var/input = input(src, "Please specify which key will be respawned.", "Key", "")
if(!input)
return
var/mob/dead/observer/G_found
for(var/mob/dead/observer/G in world)
if(G.client&&G.key==input)
if(G.client&&ckey(G.key)==ckey(input))
G_found = G
break
@@ -355,7 +355,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
/*Second, we 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.*/
var/datum/data/record/record_found//Referenced to later to either randomize or not randomize the character.
if(G_found.mind)
if(G_found.mind)//They must have a mind to reference the record.
var/id = md5("[G_found.real_name][G_found.mind.assigned_role]")
for(var/datum/data/record/t in data_core.locked)
if(t.fields["id"]==id)
@@ -369,20 +369,23 @@ Traitors and the like can also be revived with the previous role mostly intact.
else
new_character.mind = new()
if(!record_found)//We have to pick their role if they have no record.
var/assigned_role = input("Please specify which job the character will be respawned as.", "Assigned role") as null|anything in get_all_jobs()
if(!assigned_role) new_character.mind.assigned_role = "Assistant"//Defaults to assistant.
else new_character.mind.assigned_role = assigned_role
if(G_found.mind&&G_found.mind.assigned_role)//But they may have an assigned role already.
new_character.mind.assigned_role = G_found.mind.assigned_role//Also makes sure our MODE people are equipped right later on.
else
var/assigned_role = input("Please specify which job the character will be respawned as.", "Assigned role") as null|anything in get_all_jobs()
if(!assigned_role) new_character.mind.assigned_role = "Assistant"//Defaults to assistant.
else new_character.mind.assigned_role = assigned_role
if(!new_character.mind.assigned_role) new_character.mind.assigned_role = "Assistant"//If they somehow got a null assigned role.
new_character.mind.key = G_found.key//In case it's someone else playing as that character.
new_character.mind.current = new_character//So that it can properly reference later if needed.
new_character.mind.memory = ""//Memory erased so it doesn't get clunkered up with useless info.
new_character.mind.memory = ""//Memory erased so it doesn't get clunkered up with useless info. This means they may forget their previous mission--this is usually handled through objective code and recalling memory.
//Here we either load their saved appearance or randomize it.
var/datum/preferences/A = new()
if(A.savefile_load(G_found))//If they have a save file. This will automatically load their parameters.
//Note: savefile appearances are overwritten later on if the character has a data_core entry. By appearance, I mean the physical appearance.
var/name_safety = G_found.real_name//Their saved parameters may include a random name.
var/name_safety = G_found.real_name//Their saved parameters may include a random name. Also a safety in case they are playing a character that got their name after round start.
A.copy_to(new_character)
new_character.real_name = name_safety
new_character.name = name_safety
@@ -407,8 +410,8 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(record_found)//Pull up their name from database records if they did have a mind.
new_character.dna = new()//Let's first give them a new DNA.
new_character.dna.unique_enzymes = record_found.fields["b_dna"]//Enzymes are based on real name but we'll use the record for conformity.
new_character.dna.struc_enzymes = record_found.fields["enzymes"]//This is the default of enzymes so I think it's safe to go with.
new_character.dna.uni_identity = record_found.fields["identity"]//DNA identity is carried over.
new_character.dna.struc_enzymes = "2013E85C944C19A4B00185144725785DC6406A4508"//This is the default of enzymes so I think it's safe to go with.
updateappearance(new_character,new_character.dna.uni_identity)//Now we configure their appearance based on their unique identity, same as with a DNA machine or somesuch.
else//If they have no records, we just do a random DNA for them, based on their random appearance/savefile.
new_character.dna.ready_dna(new_character)
@@ -416,6 +419,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
//Here we need to find where to spawn them.
var/spawn_here = pick(latejoin)//"JoinLate" is a landmark which is deleted on round start. So, latejoin has to be used instead.
new_character.loc = spawn_here
//If they need to spawn elsewhere, they will be transferred there momentarily.
/*
The code below functions with the assumption that the mob is already a traitor if they have a special role.
@@ -445,6 +449,21 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(synd_spawn)
new_character.loc = get_turf(synd_spawn)
call(/datum/game_mode/nuclear/proc/equip_syndicate)(new_character)
if("Space Ninja")
var/ninja_spawn[] = list()
for(var/obj/landmark/L in world)
if(L.name=="carpspawn")
ninja_spawn += L
new_character.equip_space_ninja()
new_character.internal = new_character.s_store
new_character.internals.icon_state = "internal1"
if(ninja_spawn.len)
var/obj/landmark/ninja_spawn_here = pick(ninja_spawn)
new_character.loc = ninja_spawn_here.loc
if("Death Commando")//Leaves them at late-join spawn.
new_character.equip_death_commando()
new_character.internal = new_character.s_store
new_character.internals.icon_state = "internal1"
else//They may also be a cyborg or AI.
switch(new_character.mind.assigned_role)
if("Cyborg")//More rigging to make em' work and check if they're traitor.
@@ -460,11 +479,12 @@ Traitors and the like can also be revived with the previous role mostly intact.
//Announces the character on all the systems, based on the record.
if(!issilicon(new_character))//If they are not a cyborg/AI.
if(!record_found)//If there are no records for them. If they have a record, this info is already in there.
if(alert("Warning: No data core entry detected. Would you like to announce the arrival of this character by addeding them to various databases, such as medical records? Wizards and nuke operatives will not be added.",,"No","Yes")=="Yes")
if(!record_found&&new_character.mind.assigned_role!="MODE")//If there are no records for them. If they have a record, this info is already in there. MODE people are not announced anyway.
//Power to the user!
if(alert(new_character,"Warning: No data core entry detected. Would you like to announce the arrival of this character by adding them to various databases, such as medical records?",,"No","Yes")=="Yes")
call(/mob/new_player/proc/ManifestLateSpawn)(new_character)
if(alert("Would you like an active AI to announce this character? Wizards and nuke operatives won't be announced.",,"No","Yes")=="Yes")
if(alert(new_character,"Would you like an active AI to announce this character?",,"No","Yes")=="Yes")
call(/mob/new_player/proc/AnnounceArrival)(new_character)
message_admins("\blue [admin] has respawned [player_key] as [new_character.real_name].", 1)
@@ -472,7 +492,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
new_character << "You have been fully respawned. Enjoy the game."
del(G_found)//Don't want to leave ghosts around.
return
return new_character
/client/proc/cmd_admin_add_freeform_ai_law()
set category = "Fun"
+93 -83
View File
@@ -35,7 +35,6 @@ var/global/sent_strike_team = 0
var/commando_number = 6 //for selecting a leader
var/leader_selected = 0 //when the leader is chosen. The last person spawned.
var/commando_leader_rank = pick("Lieutenant", "Captain", "Major")
//Code for spawning a nuke auth code.
var/nuke_code = "[rand(10000, 99999.0)]"
@@ -58,89 +57,15 @@ var/global/sent_strike_team = 0
//Spawns commandos and equips them.
for (var/obj/landmark/STARTLOC in world)
if (STARTLOC.name == "Commando")
var/mob/living/carbon/human/new_commando = new(STARTLOC.loc)
var/commando_rank = pick("Corporal", "Sergeant", "Staff Sergeant", "Sergeant 1st Class", "Master Sergeant", "Sergeant Major")
var/commando_name = pick(last_names)
new_commando.gender = pick(MALE, FEMALE)
if (commando_number == 1)
if (commando_number == 1)//Leader is always the last guy spawned.
leader_selected = 1
var/datum/preferences/A = new()//Randomize appearance for the commando.
A.randomize_appearance_for(new_commando)
if (leader_selected == 0)
new_commando.real_name = "[commando_rank] [commando_name]"
else
new_commando.real_name = "[commando_leader_rank] [commando_name]"
if (leader_selected == 0)
new_commando.age = rand(23,35)
else
new_commando.age = rand(35,45)
new_commando.dna.ready_dna(new_commando) //Creates DNA
//Creates mind stuff.
new_commando.mind = new
new_commando.mind.current = new_commando
new_commando.mind.assigned_role = "Centcom Contractor"
new_commando.mind.special_role = "Death Commando"
new_commando.mind.store_memory("<B>Nuke Code:</B> \red [nuke_code].")//So they don't forget their code or mission.
new_commando.mind.store_memory("<B>Mission:</B> \red [input].")
new_commando.resistances += "alien_embryo"
del(STARTLOC)
var/obj/machinery/camera/camera = new /obj/machinery/camera(new_commando) //Gives all the commandos internals cameras.
camera.network = "CREED"
camera.c_tag = new_commando.real_name
var/obj/item/device/radio/R = new /obj/item/device/radio/headset(new_commando)
R.set_frequency(1441)
new_commando.equip_if_possible(R, new_commando.slot_ears)
if (leader_selected == 0)
new_commando.equip_if_possible(new /obj/item/clothing/under/color/green(new_commando), new_commando.slot_w_uniform)
else
new_commando.equip_if_possible(new /obj/item/clothing/under/rank/centcom_officer(new_commando), new_commando.slot_w_uniform)
new_commando.equip_if_possible(new /obj/item/clothing/shoes/swat(new_commando), new_commando.slot_shoes)
new_commando.equip_if_possible(new /obj/item/clothing/suit/armor/swat(new_commando), new_commando.slot_wear_suit)
new_commando.equip_if_possible(new /obj/item/clothing/gloves/swat(new_commando), new_commando.slot_gloves)
new_commando.equip_if_possible(new /obj/item/clothing/head/helmet/swat(new_commando), new_commando.slot_head)
new_commando.equip_if_possible(new /obj/item/clothing/mask/gas/swat(new_commando), new_commando.slot_wear_mask)
new_commando.equip_if_possible(new /obj/item/clothing/glasses/thermal(new_commando), new_commando.slot_glasses)
new_commando.equip_if_possible(new /obj/item/weapon/storage/backpack(new_commando), new_commando.slot_back)
new_commando.equip_if_possible(new /obj/item/weapon/ammo/a357(new_commando), new_commando.slot_in_backpack)
new_commando.equip_if_possible(new /obj/item/weapon/storage/firstaid/regular(new_commando), new_commando.slot_in_backpack)
new_commando.equip_if_possible(new /obj/item/weapon/storage/flashbang_kit(new_commando), new_commando.slot_in_backpack)
new_commando.equip_if_possible(new /obj/item/device/flashlight(new_commando), new_commando.slot_in_backpack)
if (leader_selected == 0)
new_commando.equip_if_possible(new /obj/item/weapon/plastique(new_commando), new_commando.slot_in_backpack)
else
new_commando.equip_if_possible(new /obj/item/weapon/pinpointer(new_commando), new_commando.slot_in_backpack)
if (leader_selected == 1)
new_commando.equip_if_possible(new /obj/item/weapon/disk/nuclear(new_commando), new_commando.slot_in_backpack)
new_commando.equip_if_possible(new /obj/item/weapon/sword(new_commando), new_commando.slot_l_store)
new_commando.equip_if_possible(new /obj/item/weapon/flashbang(new_commando), new_commando.slot_r_store)
new_commando.equip_if_possible(new /obj/item/weapon/tank/emergency_oxygen(new_commando), new_commando.slot_s_store)
var/obj/item/weapon/gun/revolver/GUN = new /obj/item/weapon/gun/revolver/mateba(new_commando)
GUN.bullets = 7
new_commando.equip_if_possible(GUN, new_commando.slot_belt)
// new_commando.equip_if_possible(new /obj/item/weapon/gun/energy/pulse_rifle(new_commando), new_commando.slot_l_hand)
/*Commented out because Commandos now have their rifles spawn in front of them, along with operation manuals.
Useful for copy pasta since I'm lazy.*/
var/obj/item/weapon/card/id/W = new(new_commando)
W.name = "[new_commando.real_name]'s ID Card"
W.access = get_all_accesses()
W.assignment = "Death Commando"
W.registered = new_commando.real_name
new_commando.equip_if_possible(W, new_commando.slot_wear_id)
var/mob/living/carbon/human/new_commando = create_death_commando(STARTLOC, leader_selected)
if(commandos.len)
G = pick(commandos)
new_commando.mind.key = G.key//For mind stuff.
new_commando.client = G.client
new_commando.key = G.key
new_commando.internal = new_commando.s_store
new_commando.internals.icon_state = "internal1"
del(G)
@@ -148,12 +73,15 @@ Useful for copy pasta since I'm lazy.*/
new_commando.key = "null"
new_commando.mind.key = new_commando.key
commando_number--
new_commando.mind.store_memory("<B>Nuke Code:</B> \red [nuke_code].")//So they don't forget their code or mission.
new_commando.mind.store_memory("<B>Mission:</B> \red [input].")
if (leader_selected == 0)
new_commando << "\blue \nYou are a Special Ops. commando in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: \red<B>[input]</B>"
if (!leader_selected)
new_commando << "\blue You are a Special Ops. commando in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: \red<B>[input]</B>"
else
new_commando << "\blue \nYou are a Special Ops. <B>LEADER</B> in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: \red<B>[input]</B>"
new_commando << "\blue You are a Special Ops. <B>LEADER</B> in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: \red<B>[input]</B>"
commando_number--
//Targets any nukes in the world and changes their auth code as needed.
//Bad news for Nuke operatives--or great news.
@@ -174,4 +102,86 @@ Useful for copy pasta since I'm lazy.*/
del(BOMB)
message_admins("\blue [key_name_admin(usr)] has spawned a CentCom strike squad.", 1)
log_admin("[key_name(usr)] used Spawn Death Squad.")
log_admin("[key_name(usr)] used Spawn Death Squad.")
/client/proc/create_death_commando(obj/spawn_location, leader_selected = 0)
var/mob/living/carbon/human/new_commando = new(spawn_location.loc)
var/commando_leader_rank = pick("Lieutenant", "Captain", "Major")
var/commando_rank = pick("Corporal", "Sergeant", "Staff Sergeant", "Sergeant 1st Class", "Master Sergeant", "Sergeant Major")
var/commando_name = pick(last_names)
new_commando.gender = pick(MALE, FEMALE)
var/datum/preferences/A = new()//Randomize appearance for the commando.
A.randomize_appearance_for(new_commando)
if (!leader_selected)
new_commando.real_name = "[commando_rank] [commando_name]"
else
new_commando.real_name = "[commando_leader_rank] [commando_name]"
if (!leader_selected)
new_commando.age = rand(23,35)
else
new_commando.age = rand(35,45)
new_commando.dna.ready_dna(new_commando)//Creates DNA.
//Creates mind stuff.
new_commando.mind = new
new_commando.mind.current = new_commando
new_commando.mind.assigned_role = "MODE"
new_commando.mind.special_role = "Death Commando"
new_commando.equip_death_commando(leader_selected)
del(spawn_location)
return new_commando
/mob/living/carbon/human/proc/equip_death_commando(leader_selected = 0)
var/obj/machinery/camera/camera = new /obj/machinery/camera(src) //Gives all the commandos internals cameras.
camera.network = "CREED"
camera.c_tag = real_name
var/obj/item/device/radio/R = new /obj/item/device/radio/headset(src)
R.set_frequency(1441)
equip_if_possible(R, slot_ears)
if (leader_selected == 0)
equip_if_possible(new /obj/item/clothing/under/color/green(src), slot_w_uniform)
else
equip_if_possible(new /obj/item/clothing/under/rank/centcom_officer(src), slot_w_uniform)
equip_if_possible(new /obj/item/clothing/shoes/swat(src), slot_shoes)
equip_if_possible(new /obj/item/clothing/suit/armor/swat(src), slot_wear_suit)
equip_if_possible(new /obj/item/clothing/gloves/swat(src), slot_gloves)
equip_if_possible(new /obj/item/clothing/head/helmet/swat(src), slot_head)
equip_if_possible(new /obj/item/clothing/mask/gas/swat(src), slot_wear_mask)
equip_if_possible(new /obj/item/clothing/glasses/thermal(src), slot_glasses)
equip_if_possible(new /obj/item/weapon/storage/backpack(src), slot_back)
equip_if_possible(new /obj/item/weapon/ammo/a357(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/storage/firstaid/regular(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/storage/flashbang_kit(src), slot_in_backpack)
equip_if_possible(new /obj/item/device/flashlight(src), slot_in_backpack)
if (!leader_selected)
equip_if_possible(new /obj/item/weapon/plastique(src), slot_in_backpack)
else
equip_if_possible(new /obj/item/weapon/pinpointer(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/disk/nuclear(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/sword(src), slot_l_store)
equip_if_possible(new /obj/item/weapon/flashbang(src), slot_r_store)
equip_if_possible(new /obj/item/weapon/tank/emergency_oxygen(src), slot_s_store)
var/obj/item/weapon/gun/revolver/GUN = new /obj/item/weapon/gun/revolver/mateba(src)
GUN.bullets = 7
equip_if_possible(GUN, slot_belt)
//equip_if_possible(new /obj/item/weapon/gun/energy/pulse_rifle(src), slot_l_hand)
/*Commented out because Commandos now have their rifles spawn in front of them, along with operation manuals.
Useful for copy pasta since I'm lazy.*/
var/obj/item/weapon/card/id/W = new(src)
W.name = "[real_name]'s ID Card"
W.access = get_all_accesses()
W.assignment = "Death Commando"
W.registered = real_name
equip_if_possible(W, slot_wear_id)
resistances += "alien_embryo"
return 1