From 0e53dd49e24cfaf5d0d51d0ff3041387737f7535 Mon Sep 17 00:00:00 2001 From: Joker66613 Date: Tue, 27 Feb 2024 23:40:51 +0100 Subject: [PATCH 1/2] break shit --- aquila/aquila.dm | 1 + aquila/code/game/gamemodes/objective.dm | 99 +++++++++++++++++++ .../machinery/telecomms/telecomunications.dm | 3 +- .../antagonists/traitor/datum_traitor.dm | 9 +- 4 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 aquila/code/game/gamemodes/objective.dm diff --git a/aquila/aquila.dm b/aquila/aquila.dm index 637e33bc638..ccb32842885 100644 --- a/aquila/aquila.dm +++ b/aquila/aquila.dm @@ -36,6 +36,7 @@ #include "code\game\dynamic\dynamic_rulesets_roundstart.dm" #include "code\game\effects\decals\turfdecal\markings.dm" #include "code\game\gamemodes\monkey\monkey.dm" +#include "code\game\gamemodes\objective.dm" #include "code\game\machinery\battery.dm" #include "code\game\machinery\computer\_computer.dm" #include "code\game\machinery\doors\airlock_types.dm" diff --git a/aquila/code/game/gamemodes/objective.dm b/aquila/code/game/gamemodes/objective.dm new file mode 100644 index 00000000000..39ff1e189fa --- /dev/null +++ b/aquila/code/game/gamemodes/objective.dm @@ -0,0 +1,99 @@ + +/** + * Break shit - the objective + * + * Areas are stored, not references to the machines and not checking the machines globally + * This solves the following issues: + * * Problem 1 - Engineers rebuild and then the sabotage is immediately undone, the traitor having no reason to stop them + * * Problem 2 - Engineers build a random machine in maint where no one would look to fuck over the traitor + * The idea is that the traitor must commit to breaking the machines + */ +/datum/objective/break_machinery + name = "Destroy some machines" + explanation_text = "Destroy all of something in the areas it spawns in." + var/obj/machinery/target_obj_type + var/list/potential_target_types + var/list/area/target_areas + +/datum/objective/break_machinery/finalize() + target_areas = list() + var/station_z = SSmapping.levels_by_trait(ZTRAIT_STATION)[1] + if(!target_obj_type) // Select our target machine if there is none pre-set + potential_target_types = list( + // SCIENCE + /obj/machinery/rnd/server, + // ENGINEERING + /obj/machinery/power/smes, + /obj/machinery/power/supermatter_crystal, + /obj/machinery/telecomms, // hard-mode + // MEDICAL + /obj/machinery/stasis, + /obj/machinery/sleeper, + /obj/machinery/clonepod, + // OTHER + /obj/machinery/autolathe, + /obj/machinery/ore_silo, + /obj/machinery/teleport/hub, + /obj/machinery/rnd/production/protolathe, // hard-mode 2.0 + ) + potential_target_types = shuffle(potential_target_types) + var/targets_len = potential_target_types.len + var/iteration = 1 + while(!target_obj_type && targets_len >= iteration) + for(var/obj/machinery/machine as anything in GLOB.machines) + if(machine.z == station_z && istype(machine, potential_target_types[iteration])) + target_obj_type = potential_target_types[iteration] + break + iteration++ + + if(!target_obj_type) + return FALSE + + var/machine_name = initial(target_obj_type.name) + name = "Destroy [machine_name][machine_name[length(machine_name)] == "s" ? "es" : "s"]" + // Find and shuffle machines for random area selection + var/list/eligible_machines = list() + for(var/obj/machinery/machine as anything in GLOB.machines) + if(!istype(machine, target_obj_type)) + continue + if(machine.z != station_z) + continue + if(!istype(get_area(machine), /area)) + continue + eligible_machines |= machine + + eligible_machines = shuffle(eligible_machines) + // Store areas + for(var/obj/machinery/machine as anything in eligible_machines) + target_areas |= get_area(machine) + if(target_areas.len >= 4) + break + + // Format explanation text + explanation_text = "Ensure no functioning [machine_name][machine_name[length(machine_name)] == "s" ? "es" : "s"] exist in " + switch(target_areas.len) + if(0) + return FALSE + if(1) + explanation_text += "[target_areas[1].name]." + if(2) + explanation_text += "[target_areas[1].name] and [target_areas[2].name]." + else + var/iteration = 1 + for(var/area/target_area in target_areas) + if(iteration == target_areas.len) + explanation_text += "and [target_area.name]." + break + explanation_text += "[target_area.name], " + iteration++ + return TRUE + +/datum/objective/break_machinery/check_completion() + if(!target_obj_type) + return TRUE + if(target_areas.len == 0) + return TRUE + for(var/area/target_area in target_areas) + if(locate(target_obj_type) in target_area) + return FALSE + return TRUE diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 0ca05c554c7..8d9cf47464e 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -14,7 +14,8 @@ GLOBAL_LIST_EMPTY(telecomms_list) -/obj/machinery/telecomms +/obj/machinery/telecomms//AQ edit dodano name + name = "telecommunications machine" icon = 'icons/obj/machines/telecomms.dmi' critical_machine = TRUE light_color = LIGHT_COLOR_CYAN diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 02396b7388b..afe8f77d298 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -177,11 +177,18 @@ download_objective.owner = owner download_objective.gen_amount_goal() add_objective(download_objective) - else + else if(prob(50)) var/datum/objective/steal/steal_objective = new steal_objective.owner = owner steal_objective.find_target() add_objective(steal_objective) + else + var/datum/objective/break_machinery/break_objective = new + break_objective.owner = owner + if(break_objective.finalize()) + add_objective(break_objective) + else + forge_single_human_objective() /datum/antagonist/traitor/proc/forge_single_AI_objective() .=1 From f4f5ea0ffeee963f871cb27e7b91c644dd6eef97 Mon Sep 17 00:00:00 2001 From: smorgli Date: Tue, 27 Feb 2024 23:54:04 +0100 Subject: [PATCH 2/2] =?UTF-8?q?czy=20kto=C5=9B=20powiedzia=C5=82=20shit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aquila/code/game/gamemodes/objective.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aquila/code/game/gamemodes/objective.dm b/aquila/code/game/gamemodes/objective.dm index 39ff1e189fa..0c01b4c12cb 100644 --- a/aquila/code/game/gamemodes/objective.dm +++ b/aquila/code/game/gamemodes/objective.dm @@ -31,7 +31,7 @@ /obj/machinery/sleeper, /obj/machinery/clonepod, // OTHER - /obj/machinery/autolathe, + /obj/machinery/modular_fabricator/autolathe, /obj/machinery/ore_silo, /obj/machinery/teleport/hub, /obj/machinery/rnd/production/protolathe, // hard-mode 2.0