Skip to content

Commit

Permalink
Adjusts BS Miner with a new updated overlay, slightly better code, an…
Browse files Browse the repository at this point in the history
…d 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 <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 226c328 commit aae2b26
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 34 deletions.
113 changes: 79 additions & 34 deletions modular_skyrat/modules/bluespace_miner/code/bluespace_miner.dm
Original file line number Diff line number Diff line change
@@ -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."
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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))
Expand Down Expand Up @@ -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
Binary file modified modular_skyrat/modules/bluespace_miner/icons/bluespace_miner.dmi
Binary file not shown.

0 comments on commit aae2b26

Please sign in to comment.