Add crew manifest world/Topic

Returns JSON data in the format
{ department: [{ name: title }, { name: title }] }
This commit is contained in:
Tigercat2000
2016-07-26 06:27:12 -07:00
parent 4a7a0aa81f
commit f01f33bcec
2 changed files with 42 additions and 8 deletions
+9 -8
View File
@@ -158,6 +158,7 @@ var/global/list/PDA_Manifest = list()
var/name = sanitize(t.fields["name"])
var/rank = sanitize(t.fields["rank"])
var/real_rank = t.fields["real_rank"]
var/isactive = t.fields["p_stat"]
var/department = 0
var/depthead = 0 // Department Heads will be placed at the top of their lists.
@@ -165,44 +166,44 @@ var/global/list/PDA_Manifest = list()
heads[++heads.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
depthead = 1
if(rank=="Captain" && heads.len != 1)
heads.Swap(1,heads.len)
if(rank == "Captain" && heads.len != 1)
heads.Swap(1, heads.len)
if(real_rank in security_positions)
sec[++sec.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sec.len != 1)
sec.Swap(1,sec.len)
sec.Swap(1, sec.len)
if(real_rank in engineering_positions)
eng[++eng.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && eng.len != 1)
eng.Swap(1,eng.len)
eng.Swap(1, eng.len)
if(real_rank in medical_positions)
med[++med.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && med.len != 1)
med.Swap(1,med.len)
med.Swap(1, med.len)
if(real_rank in science_positions)
sci[++sci.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sci.len != 1)
sci.Swap(1,sci.len)
sci.Swap(1, sci.len)
if(real_rank in service_positions)
ser[++ser.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && ser.len != 1)
ser.Swap(1,ser.len)
ser.Swap(1, ser.len)
if(real_rank in supply_positions)
sup[++sup.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sup.len != 1)
sup.Swap(1,sup.len)
sup.Swap(1, sup.len)
if(real_rank in nonhuman_positions)
bot[++bot.len] = list("name" = name, "rank" = rank, "active" = isactive)
+33
View File
@@ -154,6 +154,39 @@ var/world_topic_spam_protect_time = world.timeofday
return list2params(s)
else if("manifest" in input)
var/list/positions = list()
var/list/set_names = list(
"heads" = command_positions,
"sec" = security_positions,
"eng" = engineering_positions,
"med" = medical_positions,
"sci" = science_positions,
"car" = supply_positions,
"srv" = service_positions,
"civ" = civilian_positions,
"bot" = nonhuman_positions
)
for(var/datum/data/record/t in data_core.general)
var/name = t.fields["name"]
var/rank = t.fields["rank"]
var/real_rank = t.fields["real_rank"]
var/department = 0
for(var/k in set_names)
if(real_rank in set_names[k])
if(!positions[k])
positions[k] = list()
positions[k][name] = rank
department = 1
if(!department)
if(!positions["misc"])
positions["misc"] = list()
positions["misc"][name] = rank
return json_encode(positions)
else if("adminmsg" in input)
/*
We got an adminmsg from IRC bot lets split the input then validate the input.