TG: Integrated BS12's improved uplink code, courtesy of SkyMarshal.

This means items now spawn in your hand if possible, items are sorted into
categories, and only items you have enough telecrystals to purchase will be
displayed.  Also, the same basic code is now used for PDA, headset and nuke-
round uplinks, and it should be easier to add new items.
Revision: r3216
Author: 	 musketstgstation
This commit is contained in:
Ren Erthilo
2012-04-25 00:35:54 +01:00
parent 43a4020990
commit 707b6caa1e
9 changed files with 113 additions and 41 deletions
+36 -19
View File
@@ -9,10 +9,10 @@
/proc/is_convertable_to_cult(datum/mind/mind)
if(!istype(mind)) return 0
//This makes security unconvertable. *comments out*
/* for(var/obj/item/weapon/implant/loyalty/L in mind.current)
/* if(istype(mind.current, /mob/living/carbon/human) && (mind.assigned_role in list("Captain", "Head of Security", "Security Officer", "Detective", "Chaplain", "Warden"))) return 0
for(var/obj/item/weapon/implant/loyalty/L in mind.current)
if(L && L.implanted)
return 0 */
return 0*/
return 1
@@ -20,10 +20,14 @@
name = "cult"
config_tag = "cult"
restricted_jobs = list("AI", "Cyborg")
// protected_jobs = list("Security Officer", "Warden", "Detective", "Captain", "Head of Security")
required_players = 3
required_enemies = 3
recommended_enemies = 4
uplink_welcome = "Nar-Sie Uplink Console:"
uplink_uses = 10
var/datum/mind/sacrifice_target = null
var/finished = 0
var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
@@ -40,9 +44,6 @@
var/const/max_cultists_to_start = 4
var/acolytes_survived = 0
uplink_welcome = "Nar-Sie Uplink Console:"
uplink_uses = 10
/datum/game_mode/cult/announce()
world << "<B>The current game mode is - Cult!</B>"
@@ -50,6 +51,15 @@
/datum/game_mode/cult/pre_setup()
if(prob(50) || num_players() < 10) // don't give summon nar-sie if less than 10 people, it's literally impossible in that case!
objectives += "survive"
objectives += "sacrifice"
else
objectives += "eldergod"
objectives += "sacrifice"
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
var/list/cultists_possible = get_players_for_role(BE_CULTIST)
for(var/datum/mind/player in cultists_possible)
@@ -64,26 +74,18 @@
cultists_possible -= cultist
cult += cultist
// don't give summon nar-sie if less than 10 people,
// it's literally impossible in that case!
if(prob(50) || num_players() < 10)
objectives += "survive"
objectives += "sacrifice"
else
objectives += "eldergod"
objectives += "sacrifice"
return (cult.len>0)
/datum/game_mode/cult/post_setup()
modePlayer += cult
if("sacrifice" in objectives)
var/list/possible_targets = list()
var/list/possible_targets = get_unconvertables()
for(var/mob/living/carbon/human/player in world)
if(player.mind && !(player.mind in cult))
possible_targets += player.mind
if(!possible_targets.len)
for(var/mob/living/carbon/human/player in world)
if(player.mind && !(player.mind in cult))
possible_targets += player.mind
if(possible_targets.len > 0)
sacrifice_target = pick(possible_targets)
@@ -254,6 +256,14 @@
del(I)
/datum/game_mode/cult/proc/get_unconvertables()
var/list/ucs = list()
for(var/mob/living/carbon/human/player in world)
if(!is_convertable_to_cult(player.mind))
ucs += player.mind
return ucs
/datum/game_mode/cult/proc/check_cult_victory()
var/cult_fail = 0
if(objectives.Find("survive"))
@@ -301,23 +311,30 @@
if("survive")
if(!check_survive())
explanation = "Make sure at least [acolytes_needed] acolytes escape on the shuttle. \green <b>Success!</b>"
//feedback_add_details("cult_objective","cult_survive|SUCCESS|[acolytes_needed]")
else
explanation = "Make sure at least [acolytes_needed] acolytes escape on the shuttle. \red Failed."
//feedback_add_details("cult_objective","cult_survive|FAIL|[acolytes_needed]")
if("sacrifice")
if(!sacrifice_target)
explanation = "Free objective"
else
if(sacrificed.Find(sacrifice_target))
explanation = "Sacrifice [sacrifice_target.current.real_name], the [sacrifice_target.role_alt_title ? sacrifice_target.role_alt_title : sacrifice_target.assigned_role]. \green <b>Success!</b>"
//feedback_add_details("cult_objective","cult_sacrifice|SUCCESS")
else if(sacrifice_target && sacrifice_target.current)
explanation = "Sacrifice [sacrifice_target.current.real_name], the [sacrifice_target.role_alt_title ? sacrifice_target.role_alt_title : sacrifice_target.assigned_role]. \red Failed."
//feedback_add_details("cult_objective","cult_sacrifice|FAIL")
else
explanation = "Sacrifice Unknown, the Unknown whos body was likely gibbed. \red Failed."
//feedback_add_details("cult_objective","cult_sacrifice|FAIL|GIBBED")
if("eldergod")
if(!eldergod)
explanation = "Summon Nar-Sie. \green <b>Success!</b>"
//feedback_add_details("cult_objective","cult_narsie|SUCCESS")
else
explanation = "Summon Nar-Sie. \red Failed."
//feedback_add_details("cult_objective","cult_narsie|FAIL")
world << "<B>Objective #[obj_count]</B>: [explanation]"
..()
+2 -2
View File
@@ -52,8 +52,8 @@
else
survivors[player.real_name] = "alive"
feedback_set_details("round_end_result","end - evacuation")
feedback_set("round_end_result",survivors.len)
//feedback_set_details("round_end_result","end - evacuation")
//feedback_set("round_end_result",survivors.len)
if (survivors.len)
world << "\blue <B>The following survived the meteor attack!</B>"
+7 -7
View File
@@ -132,9 +132,9 @@
if(!leader_selected)
prepare_syndicate_leader(synd_mind, nuke_code)
leader_selected = 1
//else
//synd_mind.current.real_name = "[syndicate_name()] Operative #[agent_number]"
//agent_number++
/* else
synd_mind.current.real_name = "[syndicate_name()] Operative #[agent_number]"
agent_number++*/
equip_syndicate(synd_mind.current,freq)
update_synd_icons_added(synd_mind)
@@ -166,10 +166,10 @@
/datum/game_mode/proc/prepare_syndicate_leader(var/datum/mind/synd_mind, var/nuke_code)
// var/leader_title = pick("Czar", "Boss", "Commander", "Chief", "Kingpin", "Director", "Overlord")
// spawn(1) // don't change names anymore!
// NukeNameAssign(nukelastname(synd_mind.current),syndicates) //allows time for the rest of the syndies to be chosen
//synd_mind.current.real_name = "[syndicate_name()] [leader_title]"
/* var/leader_title = pick("Czar", "Boss", "Commander", "Chief", "Kingpin", "Director", "Overlord")
spawn(1)
NukeNameAssign(nukelastname(synd_mind.current),syndicates) //allows time for the rest of the syndies to be chosen
synd_mind.current.real_name = "[syndicate_name()] [leader_title]"*/
if (nuke_code)
synd_mind.store_memory("<B>Syndicate Nuclear Bomb Code</B>: [nuke_code]", 0, 0)
synd_mind.current << "The nuclear authorization code is: <B>[nuke_code]</B>"
@@ -40,6 +40,10 @@
//Gets the round setup, cancelling if there's not enough players at the start//
///////////////////////////////////////////////////////////////////////////////
/datum/game_mode/revolution/pre_setup()
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV)
var/head_check = 0
-3
View File
@@ -15,9 +15,6 @@
for(var/mob/M in world)
if(M.client)
M.CanBuild()
// setup_sectors()
// spawn_exporation_packs()
return 1
/datum/game_mode/sandbox/check_finished()
+10
View File
@@ -6,6 +6,7 @@
name = "traitor"
config_tag = "traitor"
restricted_jobs = list("Cyborg", "AI")//Approved by headmins for a week test, if you see this it would be nice if you didn't spread it everywhere
// protected_jobs = list("Security Officer", "Warden", "Detective", "Head of Security", "Captain")
required_players = 0
required_enemies = 1
recommended_enemies = 4
@@ -29,6 +30,10 @@
/datum/game_mode/traitor/pre_setup()
if(config.protect_roles_from_antagonist)
restricted_jobs += protected_jobs
var/list/possible_traitors = get_players_for_role(BE_TRAITOR)
// stop setup if no possible traitors
@@ -118,6 +123,7 @@
/datum/game_mode/traitor/declare_completion()
..()
return//Traitors will be checked as part of check_extra_completion. Leaving this here as a reminder.
@@ -166,15 +172,19 @@
for(var/datum/objective/objective in traitor.objectives)
if(objective.check_completion())
world << "<B>Objective #[count]</B>: [objective.explanation_text] \green <B>Success</B>"
//feedback_add_details("traitor_objective","[objective.type]|SUCCESS")
else
world << "<B>Objective #[count]</B>: [objective.explanation_text] \red Failed"
//feedback_add_details("traitor_objective","[objective.type]|FAIL")
traitorwin = 0
count++
if(traitorwin)
world << "<B>The [special_role_text] was successful!<B>"
//feedback_add_details("traitor_success","SUCCESS")
else
world << "<B>The [special_role_text] has failed!<B>"
//feedback_add_details("traitor_success","FAIL")
return 1
+4
View File
@@ -183,15 +183,19 @@
for(var/datum/objective/objective in wizard.objectives)
if(objective.check_completion())
world << "<B>Objective #[count]</B>: [objective.explanation_text] \green <B>Success</B>"
//feedback_add_details("wizard_objective","[objective.type]|SUCCESS")
else
world << "<B>Objective #[count]</B>: [objective.explanation_text] \red Failed"
//feedback_add_details("wizard_objective","[objective.type]|FAIL")
wizardwin = 0
count++
if(wizard.current && wizard.current.stat!=2 && wizardwin)
world << "<B>The wizard was successful!<B>"
//feedback_add_details("wizard_success","SUCCESS")
else
world << "<B>The wizard has failed!<B>"
//feedback_add_details("wizard_success","FAIL")
return 1
//OTHER PROCS
+43 -8
View File
@@ -4,7 +4,6 @@ var/global/datum/controller/occupations/job_master
var
//List of all jobs
list/occupations = list()
list/occupations2 = list()
//Players who need jobs
list/unassigned = list()
//Debug info
@@ -28,6 +27,8 @@ var/global/datum/controller/occupations/job_master
if(!job) continue
if(job.faction != faction) continue
occupations += job
return 1
@@ -151,6 +152,8 @@ var/global/datum/controller/occupations/job_master
Debug("Running DO")
SetupOccupations()
occupations = shuffle(occupations) //Shuffles job-list at round start so that people don't have their job picks randomized
//Get the players who are ready
for(var/mob/new_player/player in world)
if((player) && (player.client) && (player.ready) && (player.mind) && (!player.mind.assigned_role))
@@ -160,7 +163,8 @@ var/global/datum/controller/occupations/job_master
if(unassigned.len == 0) return 0
//Shuffle players and jobs
unassigned = shuffle(unassigned)
occupations2 = shuffle(occupations)
//HandleFeedbackGathering()
//Assistants are checked first
Debug("DO, Running Assistant Check 1")
@@ -186,11 +190,14 @@ var/global/datum/controller/occupations/job_master
//Other jobs are now checked
Debug("DO, Running Standard Check")
for(var/level = 1 to 3)
for(var/datum/job/job in occupations2)
for(var/datum/job/job in occupations)
Debug("Checking job: [job]")
if(!job) continue
if(!unassigned.len) break
if((job.current_positions >= job.spawn_positions) && job.spawn_positions != -1) continue
if(!job)
continue
if(!unassigned.len)
break
if((job.current_positions >= job.spawn_positions) && job.spawn_positions != -1)
continue
var/list/candidates = FindOccupationCandidates(job, level)
while(candidates.len && ((job.current_positions < job.spawn_positions) || job.spawn_positions == -1))
var/mob/new_player/candidate = pick(candidates)
@@ -294,7 +301,7 @@ var/global/datum/controller/occupations/job_master
if(!H.equip_if_possible(new /obj/item/weapon/pen(H), H.slot_r_store))
H.equip_if_possible(new /obj/item/weapon/pen(H), H.slot_ears)
H.equip_if_possible(new /obj/item/device/pda(H), H.slot_belt)
if(locate(/obj/item/device/pda,H))//I bet this could just use locate
if(locate(/obj/item/device/pda,H))//I bet this could just use locate. It can --SkyMarshal
var/obj/item/device/pda/pda = locate(/obj/item/device/pda,H)
pda.owner = H.real_name
pda.ownjob = H.wear_id.assignment
@@ -344,4 +351,32 @@ var/global/datum/controller/occupations/job_master
if(name == "AI" || name == "Cyborg")//I dont like this here but it will do for now
J.total_positions = 0
return 1
return 1
/*
proc/HandleFeedbackGathering()
for(var/datum/job/job in occupations)
var/tmp_str = "|[job.title]|"
var/level1 = 0 //high
var/level2 = 0 //medium
var/level3 = 0 //low
var/level4 = 0 //never
var/level5 = 0 //banned
for(var/mob/new_player/player in world)
if(!((player) && (player.client) && (player.ready) && (player.mind) && (!player.mind.assigned_role)))
continue //This player is not ready
if(jobban_isbanned(player, job.title))
level5++
continue
if(player.preferences.GetJobDepartment(job, 1) & job.flag)
level1++
else if(player.preferences.GetJobDepartment(job, 2) & job.flag)
level2++
else if(player.preferences.GetJobDepartment(job, 3) & job.flag)
level3++
else level4++ //not selected
tmp_str += "HIGH=[level1]|MEDIUM=[level2]|LOW=[level3]|NEVER=[level4]|BANNED=[level5]|-"
feedback_add_details("job_preferences",tmp_str)
*/
+7 -2
View File
@@ -319,8 +319,6 @@
for (var/O in listening)
world << O
var/list/V = view(message_range, T)
var/list/W = V
//find mobs in lockers, cryo, intellicards, brains, MMIs, and so on.
for (var/mob/M in world)
if (!M.client)
@@ -378,6 +376,13 @@
if(O && !istype(O.loc, /obj/item/weapon/storage))
O.hear_talk(src, message)
/* Commented out as replaced by code above from BS12
for (var/obj/O in ((V | contents)-used_radios)) //radio in pocket could work, radio in backpack wouldn't --rastaf0
spawn (0)
if (O)
O.hear_talk(src, message)
*/
if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
for(var/obj/O in loc)//Kinda ugly but whatever.
if(O)