mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-21 12:17:40 +01:00
[MIRROR] Department Goals Subsystem (#12816)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Guti <guti23400@gmail.com>
This commit is contained in:
co-authored by
Will
Guti
parent
2bdf48b78d
commit
2d09ccfdc7
@@ -1,7 +0,0 @@
|
||||
|
||||
#define GOAL_GENERAL "Common Goal"
|
||||
#define GOAL_MEDICAL "Medical Goal"
|
||||
#define GOAL_SECURITY "Security Goal"
|
||||
#define GOAL_ENGINEERING "Engineering Goal"
|
||||
#define GOAL_CARGO "Cargo Goal"
|
||||
#define GOAL_RESEARCH "Research Goal"
|
||||
@@ -1,101 +0,0 @@
|
||||
|
||||
GLOBAL_LIST(department_goals)
|
||||
GLOBAL_LIST(active_department_goals)
|
||||
|
||||
/hook/startup/proc/initializeDepartmentGoals()
|
||||
GLOB.department_goals = list(GOAL_GENERAL, GOAL_MEDICAL, GOAL_SECURITY, GOAL_ENGINEERING, GOAL_CARGO, GOAL_RESEARCH)
|
||||
GLOB.active_department_goals = list(GOAL_GENERAL, GOAL_MEDICAL, GOAL_SECURITY, GOAL_ENGINEERING, GOAL_CARGO, GOAL_RESEARCH)
|
||||
|
||||
for(var/category in GLOB.department_goals)
|
||||
GLOB.department_goals[category] = list()
|
||||
|
||||
for(var/subtype in subtypesof(/datum/goal))
|
||||
var/datum/goal/SG = new subtype()
|
||||
|
||||
if(SG.name == "goal")
|
||||
continue
|
||||
|
||||
if(SG.category == category)
|
||||
GLOB.department_goals[category] |= SG
|
||||
|
||||
for(var/category in GLOB.active_department_goals)
|
||||
GLOB.active_department_goals[category] = list()
|
||||
var/list/cat_goals = GLOB.department_goals[category]
|
||||
|
||||
var/goal_count = rand(2,4)
|
||||
|
||||
for(var/count = 1 to goal_count)
|
||||
var/datum/goal/G
|
||||
|
||||
if(LAZYLEN(cat_goals))
|
||||
G = pick(cat_goals)
|
||||
|
||||
if(G)
|
||||
G.active_goal = TRUE
|
||||
cat_goals -= G
|
||||
|
||||
GLOB.active_department_goals[category] |= G
|
||||
return 1
|
||||
|
||||
/hook/roundend/proc/checkDepartmentGoals()
|
||||
for(var/category in GLOB.active_department_goals)
|
||||
var/list/cat_goals = GLOB.active_department_goals[category]
|
||||
|
||||
to_world(span_world("[category]"))
|
||||
|
||||
if(!LAZYLEN(cat_goals))
|
||||
to_world(span_filter_system("There were no assigned goals!"))
|
||||
|
||||
else
|
||||
for(var/datum/goal/G in cat_goals)
|
||||
var/success = G.check_completion()
|
||||
to_world(span_filter_system("[success ? span_notice("[G.name]") : span_warning("[G.name]")]"))
|
||||
to_world(span_filter_system("[G.goal_text]"))
|
||||
return 1
|
||||
|
||||
/datum/goal
|
||||
var/name = "goal"
|
||||
|
||||
var/goal_text = "Do nothing! Congratulations."
|
||||
|
||||
var/active_goal = FALSE
|
||||
|
||||
var/category = GOAL_GENERAL
|
||||
|
||||
/datum/goal/proc/check_completion()
|
||||
return FALSE
|
||||
|
||||
/datum/goal/common
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
|
||||
/datum/goal/medical
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
category = GOAL_MEDICAL
|
||||
|
||||
/datum/goal/security
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
category = GOAL_SECURITY
|
||||
|
||||
/datum/goal/engineering
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
category = GOAL_ENGINEERING
|
||||
|
||||
/datum/goal/cargo
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
category = GOAL_CARGO
|
||||
|
||||
/datum/goal/research
|
||||
name = "goal"
|
||||
|
||||
goal_text = "Congratulations, you still do nothing."
|
||||
category = GOAL_RESEARCH
|
||||
Reference in New Issue
Block a user