fixed stuff, added alert when no new objects are generated

This commit is contained in:
Dimitar Dihanov
2019-05-05 16:54:29 +03:00
parent 71da67123e
commit cb5c2f7bad
3 changed files with 29 additions and 12 deletions

View File

@@ -75,6 +75,6 @@
else if (faction)
dat += "<b> Manage faction: </b> <br/>"
dat += "<a href='?src=\ref[M];obj_add=1;obj_holder=\ref[src]'>(add faction objective)</a> <br/>"
dat += "<a href='?src=\ref[M];obj_gen=1;obj_holder=\ref[src];[faction?"obj_owner=\ref[faction]":"obj_owner=\ref[R]"]'>(generate objectives)</a> <br/>"
dat += "<a href='?src=\ref[M];obj_announce=1;[faction?"obj_owner=\ref[faction]":"obj_owner=\ref[R]"]'>(annouce objectives)</a><br/>"
dat += "<a href='?src=\ref[M];obj_gen=1;obj_holder=\ref[src];obj_owner=[faction?"\ref[faction]":"\ref[R]"]'>(generate objectives)</a> <br/>"
dat += "<a href='?src=\ref[M];obj_announce=1;obj_owner=[faction?"\ref[faction]":"\ref[R]"]'>(annouce objectives)</a><br/>"
return dat

View File

@@ -331,7 +331,11 @@
obj_holder.AddObjective(new_objective, src)
message_admins("[usr.key]/([usr.name]) gave [key]/([name]) the objective: [new_objective.explanation_text]")
log_admin("[usr.key]/([usr.name]) gave [key]/([name]) the objective: [new_objective.explanation_text]")
else if (obj_holder.faction || (istype(new_objective, /datum/objective/custom) && new_objective.faction)) //if its an explicit faction obj OR a custom objective with a faction modifier
else if (new_objective.faction && istype(new_objective, /datum/objective/custom)) //is it a custom objective with a faction modifier?
new_objective.faction.AppendObjective(new_objective)
message_admins("[usr.key]/([usr.name]) gave \the [new_objective.faction.ID] the objective: [new_objective.explanation_text]")
log_admin("[usr.key]/([usr.name]) gave \the [new_objective.faction.ID] the objective: [new_objective.explanation_text]")
else if (obj_holder.faction) //or is it just an explicit faction obj?
obj_holder.faction.AppendObjective(new_objective)
message_admins("[usr.key]/([usr.name]) gave \the [obj_holder.faction.ID] the objective: [new_objective.explanation_text]")
log_admin("[usr.key]/([usr.name]) gave \the [obj_holder.faction.ID] the objective: [new_objective.explanation_text]")
@@ -370,16 +374,22 @@
var/list/prev_objectives = R.objectives.objectives.Copy()
R.ForgeObjectives()
var/list/unique_objectives_role = find_unique_objectives(R.objectives.objectives, prev_objectives)
for (var/datum/objective/objective in unique_objectives_role)
log_admin("[usr.key]/([usr.name]) gave [key]/([name]) the objective: [objective.explanation_text]")
if (!unique_objectives_role.len)
alert(usr, "No new objectives generated.", "Alert", "OK")
else
for (var/datum/objective/objective in unique_objectives_role)
log_admin("[usr.key]/([usr.name]) gave [key]/([name]) the objective: [objective.explanation_text]")
else if(istype(owner, /datum/faction))
var/datum/faction/F = owner
var/list/prev_objectives = F.GetObjectives().Copy()
F.forgeObjectives()
var/list/unique_objectives_faction = find_unique_objectives(F.GetObjectives(), prev_objectives)
for (var/datum/objective/objective in unique_objectives_faction)
message_admins("[usr.key]/([usr.name]) gave \the [F.ID] the objective: [objective.explanation_text]")
log_admin("[usr.key]/([usr.name]) gave \the [F.ID] the objective: [objective.explanation_text]")
if (!unique_objectives_faction.len)
alert(usr, "No new objectives generated.", "Alert", "OK")
else
for (var/datum/objective/objective in unique_objectives_faction)
message_admins("[usr.key]/([usr.name]) gave \the [F.ID] the objective: [objective.explanation_text]")
log_admin("[usr.key]/([usr.name]) gave \the [F.ID] the objective: [objective.explanation_text]")
else if(href_list["role"]) //Something role specific
var/datum/role/R = locate(href_list["role"])

View File

@@ -4968,7 +4968,11 @@
alert("Couldn't set-up a proper target.", "New Objective")
return
if (obj_holder.faction || (istype(new_objective, /datum/objective/custom) && new_objective.faction)) //if its an explicit faction obj OR a custom objective with a faction modifier
if (new_objective.faction && istype(new_objective, /datum/objective/custom)) //is it a custom objective with a faction modifier?
new_objective.faction.AppendObjective(new_objective)
message_admins("[key_name_admin(usr)] gave \the [new_objective.faction.ID] the objective: [new_objective.explanation_text]")
log_admin("[key_name(usr)] gave \the [new_objective.faction.ID] the objective: [new_objective.explanation_text]")
else if (obj_holder.faction) //or is it just an explicit faction obj?
obj_holder.faction.AppendObjective(new_objective)
message_admins("[key_name_admin(usr)] gave \the [obj_holder.faction.ID] the objective: [new_objective.explanation_text]")
log_admin("[key_name(usr)] gave \the [obj_holder.faction.ID] the objective: [new_objective.explanation_text]")
@@ -5021,9 +5025,12 @@
var/list/prev_objectives = F.GetObjectives().Copy()
F.forgeObjectives()
var/list/unique_objectives = find_unique_objectives(F.GetObjectives(), prev_objectives)
for (var/datum/objective/objective in unique_objectives)
message_admins("[key_name_admin(usr)] gave \the [F.ID] the objective: [objective.explanation_text]")
log_admin("[key_name(usr)] gave \the [F.ID] the objective: [objective.explanation_text]")
if (!unique_objectives.len)
alert(usr, "No new objectives generated.", "", "OK")
else
for (var/datum/objective/objective in unique_objectives)
message_admins("[key_name_admin(usr)] gave \the [F.ID] the objective: [objective.explanation_text]")
log_admin("[key_name(usr)] gave \the [F.ID] the objective: [objective.explanation_text]")
check_antagonists()
if(href_list["wages_enabled"])