From 4a78b144514b99dd49564ee5b8da8e91c89415b6 Mon Sep 17 00:00:00 2001 From: Rykka Date: Wed, 15 Jan 2020 16:42:41 -0700 Subject: [PATCH 1/2] Port over Roundstats System --- code/_global_vars/roundstats.dm | 55 +++++++++++++++++++ code/game/machinery/lightswitch.dm | 1 + code/game/machinery/vending.dm | 1 + code/game/mecha/mecha.dm | 2 + code/modules/food/food/drinks.dm | 1 + code/modules/hydroponics/grown.dm | 1 + code/modules/mining/mine_turfs.dm | 2 + .../mob/living/carbon/human/human_movement.dm | 1 + code/modules/organs/organ_external.dm | 2 + code/modules/recycling/disposal.dm | 1 + code/modules/turbolift/turbolift.dm | 2 + vorestation.dme | 1 + 12 files changed, 70 insertions(+) create mode 100644 code/_global_vars/roundstats.dm diff --git a/code/_global_vars/roundstats.dm b/code/_global_vars/roundstats.dm new file mode 100644 index 0000000000..271d2ab571 --- /dev/null +++ b/code/_global_vars/roundstats.dm @@ -0,0 +1,55 @@ + +//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/RoundEnd()//bazinga + + var/stats_printed_roundstat = 0 //Placeholder used as a counter. + var/list/valid_stats_list = list() //This is to be populated with the good shit + + if(GLOB.cans_opened_roundstat > 0) + valid_stats_list.Add("[GLOB.cans_opened_roundstat] cans were drank today!") + if(GLOB.lights_switched_on_roundstat > 0) + valid_stats_list.Add("[GLOB.lights_switched_on_roundstat] light switches were flipped today!") + if(GLOB.turbo_lift_floors_moved_roundstat > 20) + valid_stats_list.Add("The elevator moved up [GLOB.turbo_lift_floors_moved_roundstat] floors today!") + 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!") + 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.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.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!") + if(GLOB.items_sold_shift_roundstat > 15) + valid_stats_list.Add("The vending machines sold [GLOB.items_sold_shift_roundstat] items today.") + 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(GLOB.rocks_drilled_roundstat > 80) + valid_stats_list.Add("Our strong miners pulverized a whole [GLOB.rocks_drilled_roundstat] into piles of pathetic rubble.") + if(GLOB.mech_destroyed_roundstat > 1) + valid_stats_list.Add("How did you guys manage to break a mech? Those are expensive!") + + + to_world("Shift trivia!") + + while(stats_printed_roundstat < 6) + var/body = pick(valid_stats_list) + stats_printed_roundstat++ + to_world("[body]")//line that deletes the thing you just posted. + valid_stats_list -= body \ No newline at end of file diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 2a1a7f6e89..bd4e435ea0 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -61,6 +61,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 28eb7f16ba..2266366d36 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -507,6 +507,7 @@ visible_message("\The [src] clunks as it vends an additional item.") playsound(src, 'sound/items/vending.ogg', 50, 1, 1) + GLOB.items_sold_shift_roundstat++ status_message = "" status_error = 0 diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 74cdb2d368..abdbc2dd3f 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -185,6 +185,8 @@ cell = null internal_tank = null + mech_destroyed_roundstat++ //This is for the roundtrivia system + 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 e86539c427..60c128b349 100644 --- a/code/modules/food/food/drinks.dm +++ b/code/modules/food/food/drinks.dm @@ -25,6 +25,7 @@ /obj/item/weapon/reagent_containers/food/drinks/proc/open(mob/user) playsound(loc,"canopen", rand(10,50), 1) + GLOB.cans_opened_roundstat++ 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 428f50e696..91aacb5954 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -305,6 +305,7 @@ if(seed.get_trait(TRAIT_SPREAD) > 0) 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/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 68d3157593..12480881df 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -567,6 +567,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 9f57be114b..a91386b72a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -236,6 +236,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 bd4317787a..86cccfddb3 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -852,6 +852,8 @@ Note that amputating the affected organ does in fact remove the infection from t else if(disintegrate == DROPLIMB_EDGE && nonsolid) //VOREStation Add End 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 8a2e9796cd..e4a581935e 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -425,6 +425,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 ea9c9e13ab..fb96ca78f5 100644 --- a/code/modules/turbolift/turbolift.dm +++ b/code/modules/turbolift/turbolift.dm @@ -127,6 +127,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/vorestation.dme b/vorestation.dme index d46f28fac9..5d9c1aafa9 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -94,6 +94,7 @@ #include "code\_global_vars\bitfields.dm" #include "code\_global_vars\misc.dm" #include "code\_global_vars\mobs.dm" +#include "code\_global_vars\roundstats.dm" #include "code\_global_vars\sensitive.dm" #include "code\_global_vars\lists\mapping.dm" #include "code\_global_vars\lists\misc.dm" From 2214003ff257c1216181d51e7caee4bc1ced33c5 Mon Sep 17 00:00:00 2001 From: Rykka Date: Wed, 15 Jan 2020 16:49:05 -0700 Subject: [PATCH 2/2] Forgot the GLOB. --- code/game/mecha/mecha.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index abdbc2dd3f..4fbeaf60a9 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -185,7 +185,7 @@ cell = null internal_tank = null - mech_destroyed_roundstat++ //This is for the roundtrivia system + GLOB.mech_destroyed_roundstat++ //This is for the roundtrivia system QDEL_NULL(pr_int_temp_processor) QDEL_NULL(pr_inertial_movement)