diff --git a/code/datums/roundstats/_defines_local.dm b/code/datums/roundstats/_defines_local.dm new file mode 100644 index 0000000000..951d7118ff --- /dev/null +++ b/code/datums/roundstats/_defines_local.dm @@ -0,0 +1,7 @@ + +#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" diff --git a/code/datums/roundstats/departmentgoal.dm b/code/datums/roundstats/departmentgoal.dm new file mode 100644 index 0000000000..b0aa69784c --- /dev/null +++ b/code/datums/roundstats/departmentgoal.dm @@ -0,0 +1,99 @@ + +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 + +/hook/roundend/proc/checkDepartmentGoals() + for(var/category in GLOB.active_department_goals) + var/list/cat_goals = GLOB.active_department_goals[category] + + to_world("[category]") + + if(!LAZYLEN(cat_goals)) + to_world("There were no assigned goals!") + + else + for(var/datum/goal/G in cat_goals) + var/success = G.check_completion() + to_world("[success ? "[G.name]" : "[G.name]"]") + to_world("[G.goal_text]") + +/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 diff --git a/code/datums/roundstats/roundstats.dm b/code/datums/roundstats/roundstats.dm new file mode 100644 index 0000000000..c5ceb686a7 --- /dev/null +++ b/code/datums/roundstats/roundstats.dm @@ -0,0 +1,57 @@ + +/* + * lbnesquik - Github + * Provided massive components of this. Polaris PR #5720. + */ + +//This is for the round end stats system. + +//roundstat is used for easy finding of the variables, if you ever want to delete all of this, +//just search roundstat and you'll find everywhere this thing reaches into. +//It used to be bazinga but it only fly with microwaves. + +GLOBAL_VAR_INIT(cans_opened_roundstat, 0) +GLOBAL_VAR_INIT(lights_switched_on_roundstat, 0) +GLOBAL_VAR_INIT(turbo_lift_floors_moved_roundstat, 0) +GLOBAL_VAR_INIT(lost_limbs_shift_roundstat, 0) +GLOBAL_VAR_INIT(seed_planted_shift_roundstat, 0) +GLOBAL_VAR_INIT(step_taken_shift_roundstat, 0) +GLOBAL_VAR_INIT(destroyed_research_items_roundstat, 0) +GLOBAL_VAR_INIT(items_sold_shift_roundstat, 0) +GLOBAL_VAR_INIT(disposals_flush_shift_roundstat, 0) +GLOBAL_VAR_INIT(rocks_drilled_roundstat, 0) +GLOBAL_VAR_INIT(mech_destroyed_roundstat, 0) + +/hook/roundend/proc/RoundTrivia()//bazinga + var/list/valid_stats_list = list() //This is to be populated with the good shit + + if(GLOB.lost_limbs_shift_roundstat > 1) + valid_stats_list.Add("[GLOB.lost_limbs_shift_roundstat] limbs left their owners bodies this shift, oh no!") + else if(GLOB.destroyed_research_items_roundstat > 13) + valid_stats_list.Add("[GLOB.destroyed_research_items_roundstat] objects were destroyed in the name of Science! Keep it up!") + else if(GLOB.mech_destroyed_roundstat > 1) + valid_stats_list.Add("[GLOB.mech_destroyed_roundstat] mechs were destroyed this shift. What did you do?") + else if(GLOB.seed_planted_shift_roundstat > 20) + valid_stats_list.Add("[GLOB.seed_planted_shift_roundstat] were planted according to our sensors this shift.") + + if(GLOB.rocks_drilled_roundstat > 80) + valid_stats_list.Add("Our strong miners pulverized a whole [GLOB.rocks_drilled_roundstat] piles of pathetic rubble.") + else if(GLOB.items_sold_shift_roundstat > 15) + valid_stats_list.Add("The vending machines sold [GLOB.items_sold_shift_roundstat] items today.") + else if(GLOB.step_taken_shift_roundstat > 900) + valid_stats_list.Add("The employees walked a total of [GLOB.step_taken_shift_roundstat] steps for this shift! It should put them on the road to fitness!") + + if(GLOB.cans_opened_roundstat > 0) + valid_stats_list.Add("[GLOB.cans_opened_roundstat] cans were drank today!") + else if(GLOB.lights_switched_on_roundstat > 0) + valid_stats_list.Add("[GLOB.lights_switched_on_roundstat] light switches were flipped today!") + else if(GLOB.turbo_lift_floors_moved_roundstat > 20) + valid_stats_list.Add("The elevator moved up [GLOB.turbo_lift_floors_moved_roundstat] floors today!") + else if(GLOB.disposals_flush_shift_roundstat > 40) + valid_stats_list.Add("The disposal system flushed a whole [GLOB.disposals_flush_shift_roundstat] times for this shift. We should really invest in waste treatement.") + + if(LAZYLEN(valid_stats_list)) + to_world("Shift trivia!") + + for(var/body in valid_stats_list) + to_world("[body]") diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index bbd865502f..5a1e31b2a2 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -67,6 +67,7 @@ L.updateicon() area.power_change() + GLOB.lights_switched_on_roundstat++ /obj/machinery/light_switch/power_change() diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 5ff60979d0..dea82aa46a 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -513,6 +513,8 @@ visible_message("\The [src] clunks as it vends an additional item.") playsound(src, "sound/[vending_sound]", 100, 1, 1) + GLOB.items_sold_shift_roundstat++ + status_message = "" status_error = 0 vend_ready = 1 diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index a255174a61..43616b332a 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -324,6 +324,8 @@ if(smoke_possible) //Just making sure nothing is running. qdel(smoke_system) + GLOB.mech_destroyed_roundstat++ + QDEL_NULL(pr_int_temp_processor) QDEL_NULL(pr_inertial_movement) QDEL_NULL(pr_give_air) diff --git a/code/modules/food/food/drinks.dm b/code/modules/food/food/drinks.dm index 2723df7fe2..6f2462aae2 100644 --- a/code/modules/food/food/drinks.dm +++ b/code/modules/food/food/drinks.dm @@ -43,6 +43,7 @@ /obj/item/weapon/reagent_containers/food/drinks/proc/open(mob/user) playsound(src,"canopen", rand(10,50), 1) + GLOB.cans_opened_roundstat++ to_chat(user, "You open [src] with an audible pop!") flags |= OPENCONTAINER diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index fddd10cb23..dd91e78a07 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -16,10 +16,10 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/Initialize(var/mapload, var/planttype) . = ..() - + if(!dried_type) dried_type = type - + pixel_x = rand(-5.0, 5) pixel_y = rand(-5.0, 5) @@ -293,6 +293,7 @@ if(seed.get_trait(TRAIT_SPREAD) > 0) to_chat(user, "You plant the [src.name].") new /obj/machinery/portable_atmospherics/hydroponics/soil/invisible(get_turf(user),src.seed) + GLOB.seed_planted_shift_roundstat++ qdel(src) return diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 236fbb1a0d..76b31d4659 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -196,6 +196,8 @@ qdel(S) + GLOB.seed_planted_shift_roundstat++ + check_health() update_icon() diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index d7b9bad320..117d5cf5d5 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -554,6 +554,8 @@ turf/simulated/mineral/floor/light_corner for (var/i = 1 to mineral.result_amount - mined_ore) DropMineral() + GLOB.rocks_drilled_roundstat++ + //destroyed artifacts have weird, unpleasant effects //make sure to destroy them before changing the turf though if(artifact_find && artifact_fail) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 2e5ed99369..9a591694c4 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -227,6 +227,7 @@ return var/S = pick(footstep_sounds) + GLOB.step_taken_shift_roundstat++ if(!S) return // Play every 20 steps while walking, for the sneak diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index bc4510c82a..696154f661 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -840,6 +840,8 @@ Note that amputating the affected organ does in fact remove the infection from t if(disintegrate == DROPLIMB_EDGE && nonsolid) disintegrate = DROPLIMB_BLUNT //splut + GLOB.lost_limbs_shift_roundstat++ + switch(disintegrate) if(DROPLIMB_EDGE) if(!clean) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index fa19b46e1f..ae40a91a3b 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -31,7 +31,7 @@ // find the attached trunk (if present) and init gas resvr. /obj/machinery/disposal/Initialize() . = ..() - + trunk = locate() in loc if(!trunk) mode = 0 @@ -481,6 +481,7 @@ playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) last_sound = world.time sleep(5) // wait for animation to finish + GLOB.disposals_flush_shift_roundstat++ H.init(src, air_contents) // copy the contents of disposer to holder diff --git a/code/modules/turbolift/turbolift.dm b/code/modules/turbolift/turbolift.dm index 1ca46cb77d..1caa898374 100644 --- a/code/modules/turbolift/turbolift.dm +++ b/code/modules/turbolift/turbolift.dm @@ -103,6 +103,8 @@ doors_closing = 0 // The doors weren't open, so they are done closing + GLOB.turbo_lift_floors_moved_roundstat++ + var/area/turbolift/origin = locate(current_floor.area_ref) if(target_floor == current_floor) diff --git a/polaris.dme b/polaris.dme index ceb4bbfd83..3ee8aa6480 100644 --- a/polaris.dme +++ b/polaris.dme @@ -359,6 +359,9 @@ #include "code\datums\repositories\decls.dm" #include "code\datums\repositories\repository.dm" #include "code\datums\repositories\unique.dm" +#include "code\datums\roundstats\_defines_local.dm" +#include "code\datums\roundstats\departmentgoal.dm" +#include "code\datums\roundstats\roundstats.dm" #include "code\datums\supplypacks\atmospherics.dm" #include "code\datums\supplypacks\contraband.dm" #include "code\datums\supplypacks\costumes.dm"