From cb5c2f7bad14ff33dfd7a1897aea299cd4e4e0bb Mon Sep 17 00:00:00 2001 From: Dimitar Dihanov Date: Sun, 5 May 2019 16:54:29 +0300 Subject: [PATCH] fixed stuff, added alert when no new objects are generated --- code/datums/gamemode/objectives/objective.dm | 4 ++-- code/datums/mind.dm | 22 ++++++++++++++------ code/modules/admin/topic.dm | 15 +++++++++---- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/code/datums/gamemode/objectives/objective.dm b/code/datums/gamemode/objectives/objective.dm index 41c3048e2a9..e5db7677097 100644 --- a/code/datums/gamemode/objectives/objective.dm +++ b/code/datums/gamemode/objectives/objective.dm @@ -75,6 +75,6 @@ else if (faction) dat += " Manage faction:
" dat += "(add faction objective)
" - dat += "(generate objectives)
" - dat += "(annouce objectives)
" + dat += "(generate objectives)
" + dat += "(annouce objectives)
" return dat diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 8b0d80fa84a..51cd8b524fa 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -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"]) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 15d21ea817f..69e4c518ade 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -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"])