From aae2b263d13b71a6a37b9cd1681c8be3ab2714ae Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+AnArgonianLizardThatStealsPRs@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:06:46 +0300 Subject: [PATCH] Adjusts BS Miner with a new updated overlay, slightly better code, and less annoying buzzing/beeping (#648) * this * oop * I do actually miss the sounds ever so slightly * Still too much, silence you fool * Moved this here * Update modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm * Update modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm * Update modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm * Update modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm * Update modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm --------- Co-authored-by: Waterpig <49160555+Majkl-J@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- .../bluespace_miner/code/bluespace_miner.dm | 113 ++++++++++++------ .../bluespace_miner/icons/bluespace_miner.dmi | Bin 627 -> 714 bytes 2 files changed, 79 insertions(+), 34 deletions(-) diff --git a/modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm b/modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm index e082ddabb42..be3f8323ec5 100644 --- a/modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm +++ b/modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm @@ -1,3 +1,8 @@ +#define BLUESPACE_MINER_TOO_HOT (1<<0) +#define BLUESPACE_MINER_LOW_PRESSURE (1<<1) +#define BLUESPACE_MINER_HIGH_PRESSURE (1<<2) +#define BLUESPACE_MINER_TOO_CLOSE (1<<3) + /obj/machinery/bluespace_miner name = "bluespace miner" desc = "Through the power of bluespace, it is capable of producing materials." @@ -12,6 +17,8 @@ var/gas_temp = 100 ///the amount of seconds process_speed goes on cooldown for var/processing_speed = 6 SECONDS + ///the current status of the enviroment. Any nonzero value means we can't work + var/mining_stat = NONE ///the chance each ore has to be picked, weighted list var/list/ore_chance = list( /obj/item/stack/sheet/iron = 20, @@ -44,23 +51,37 @@ add_overlay("miner_open") if(machine_stat & (NOPOWER|BROKEN)) return - add_overlay("miner_on") + if(mining_stat) + add_overlay("miner_error") + // This one overrides all the following overlays so we check it first + if(mining_stat & BLUESPACE_MINER_TOO_CLOSE) + add_overlay("miner_proximity") + return + if(mining_stat & BLUESPACE_MINER_TOO_HOT) + add_overlay("miner_hot") + if(mining_stat & BLUESPACE_MINER_LOW_PRESSURE) + add_overlay("miner_plow") + else if(mining_stat & BLUESPACE_MINER_HIGH_PRESSURE) + add_overlay("miner_phigh") + else + add_overlay("miner_on") /obj/machinery/bluespace_miner/examine(mob/user) . = ..() if(obj_flags & EMAGGED) . += span_warning("The safeties are turned off!") - var/turf/src_turf = get_turf(src) - var/datum/gas_mixture/environment = src_turf.return_air() - if(environment.temperature >= T20C) - . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("TEMPERATURE TOO HIGH!")) - if(environment.return_pressure() <= ONE_ATMOSPHERE) - . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("PRESSURE TOO LOW!")) - if(environment.return_pressure() >= (ONE_ATMOSPHERE * 1.5)) - . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("PRESSURE TOO HIGH!")) - for(var/obj/machinery/bluespace_miner/bs_miner in range(1, src)) - if(bs_miner != src) + // We don't need to run any more checks if this is functioning. Genuinely the old code is terrible + if(mining_stat) + if(mining_stat & BLUESPACE_MINER_TOO_CLOSE) . += span_warning("[src] is in a suboptimal environment: TOO CLOSE TO ANOTHER BLUESPACE MINER") + return . // This needs relocation to fix so we won't bother with the rest + if(mining_stat & BLUESPACE_MINER_TOO_HOT) + . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("TEMPERATURE TOO HIGH!")) + if(mining_stat & BLUESPACE_MINER_LOW_PRESSURE) + . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("PRESSURE TOO LOW!")) + else if(mining_stat & BLUESPACE_MINER_HIGH_PRESSURE) + . += span_warning("[src] is in a suboptimal environment: " + span_boldwarning("PRESSURE TOO HIGH!")) + //we need to make sure we can actually print the ores out /obj/machinery/bluespace_miner/proc/check_factors() @@ -73,33 +94,39 @@ // cant be unanchored or open panel if(!anchored || panel_open) return FALSE - for(var/obj/machinery/bluespace_miner/bs_miner in range(1, src)) - if(bs_miner != src) - return FALSE + var/previous_mining_stat = mining_stat + // Generates the mining_stat to use for overlays and checks + update_mining_stat() + // Updates the overlays, if it is needed + if(mining_stat != previous_mining_stat) + update_appearance() + // Check if it is nonzero + if(mining_stat) + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE, SILENCED_SOUND_EXTRARANGE, ignore_walls = FALSE) + return FALSE + // mining_stat = 0, we are ready to go + return TRUE + +//Checking enviroment individually +/obj/machinery/bluespace_miner/proc/update_mining_stat() + // To actually check atmos var/turf/src_turf = get_turf(src) var/datum/gas_mixture/environment = src_turf.return_air() + // Default value + mining_stat = NONE + // Proximity check, needs to be more than one tile from another miners + for(var/obj/machinery/bluespace_miner/bs_miner in range(1, src)) + if(bs_miner != src) + mining_stat = mining_stat | BLUESPACE_MINER_TOO_CLOSE + return // This is allmighty // if its hotter than (or equal to) room temp, don't work if(environment.temperature >= T20C) - playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) - return FALSE - // if its lesser than(or equal to) normal pressure, don't work + mining_stat = mining_stat | BLUESPACE_MINER_TOO_HOT + // if its lesser than(or equal to) normal pressure, don't work. Same goes for over(or equal to) 150% pressure if(environment.return_pressure() <= ONE_ATMOSPHERE) - playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) - return FALSE - // overpressurizing will cause nuclear particles... - if(environment.return_pressure() >= (ONE_ATMOSPHERE * 1.5)) - playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) - return FALSE - //add amount_produced degrees to the temperature - var/datum/gas_mixture/merger = new - merger.assert_gas(/datum/gas/carbon_dioxide) - merger.gases[/datum/gas/carbon_dioxide][MOLES] = MOLES_CELLSTANDARD - if(obj_flags & EMAGGED) - merger.assert_gas(/datum/gas/tritium) - merger.gases[/datum/gas/tritium][MOLES] = MOLES_CELLSTANDARD - merger.temperature = (T20C + gas_temp) - src_turf.assume_air(merger) - return TRUE + mining_stat = mining_stat | BLUESPACE_MINER_LOW_PRESSURE + else if(environment.return_pressure() >= (ONE_ATMOSPHERE * 1.5)) + mining_stat = mining_stat | BLUESPACE_MINER_HIGH_PRESSURE //if check_factors is good, then we spawn materials /obj/machinery/bluespace_miner/proc/spawn_mats() @@ -109,8 +136,21 @@ /obj/machinery/bluespace_miner/process() if(!check_factors()) return + // Generate all the waste gas + var/datum/gas_mixture/merger = new + merger.assert_gas(/datum/gas/carbon_dioxide) + merger.gases[/datum/gas/carbon_dioxide][MOLES] = MOLES_CELLSTANDARD + if(obj_flags & EMAGGED) + merger.assert_gas(/datum/gas/tritium) + merger.gases[/datum/gas/tritium][MOLES] = MOLES_CELLSTANDARD + merger.temperature = (T20C + gas_temp) + var/turf/src_turf = get_turf(src) + src_turf.assume_air(merger) + // Finally spawn the mats spawn_mats() - playsound(src, 'sound/machines/ping.ogg', 50, FALSE) + // Crazy? I was crazy once. They locked me in a room, an atmos room, an atmos room with bluespace miners, and the bluespace miners made me crazy. + // This sound no longer echoes through departments like before. Got that was an era. + playsound(src, 'sound/machines/ping.ogg', 50, FALSE, SILENCED_SOUND_EXTRARANGE, ignore_walls = FALSE) /obj/machinery/bluespace_miner/crowbar_act(mob/living/user, obj/item/tool) if(default_deconstruction_crowbar(tool)) @@ -184,3 +224,8 @@ research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 10000) discount_experiments = list(/datum/experiment/scanning/points/bluespace_miner = 5000) */ + +#undef BLUESPACE_MINER_TOO_HOT +#undef BLUESPACE_MINER_LOW_PRESSURE +#undef BLUESPACE_MINER_HIGH_PRESSURE +#undef BLUESPACE_MINER_TOO_CLOSE diff --git a/modular_skyrat/modules/bluespace_miner/icons/bluespace_miner.dmi b/modular_skyrat/modules/bluespace_miner/icons/bluespace_miner.dmi index ebc421da80d0f5f1e555d8d77e1c850345f21263..01b9db8ff53cd9f686a9a722eb0c52ea05dffe02 100644 GIT binary patch delta 658 zcmV;D0&V^C1j+?}iBL{Q4GJ0x0000DNk~Le0001h0001h2m=5B0QBII`2YX_IZ#Yg zMeFP9U|?`aNLVm9NRW`IczB4Yu)rW7Ff(TV%>MxY0A@2YGXTtHGc*7H00gmCKtQmu z>+9?Pf&eXU8G`@-00DGTPE!Ct=GbNc005+VR9JLGWpiVZb47nhiHkEOv#1!zH{{|> zD@x2wg|Jao#pf5K<`JtDhe9);XlhPkB}iBY4$*a|78T_a>!^aF{EE!n%#uoC)n@=h zfmpRU`Q=0^&B!morBYeJ)z1YSIRG+?dOz-#kyZcz0gp*UK~#90?U&h-gCGz^1%kN5 zrTqVo9hNcChRlD+L|bce&x4djm7KmTYEfJh5nvikMyOkW$3Wg9bm^OtOF$F&1xWq; z0_Af2@*@RS@Cyh6yFg+a26zM%-Gy2U)`KV^AhmL6b)JAU#>jUBs;b)BZ|E8n!V1^` z-V(^b2>LD(BmvsL<*8W-NT0i(bw2?#0a-UqJ5$x01Tuec0xoyI{9PL-(6&v$df&GR zK%BtcVvBEl5(gxZ5LhKpSDw}+9=aU~rI-sCamYsIb5wATZ4T0RI4HGcz*)%w|MFsN(fFDZ*Bkpc$`y_i#dNNK0i;1i!&v&s2C_@ z$iNIKY~cO|h5@@aSL* zijqKZ%EkN z?K_LS3rWTQK7FCW9E%)!cfdK6EX-@u1TGv2`p_F8b