extreme optimization project to maybe fix game

This commit is contained in:
Putnam
2021-06-06 21:58:24 -07:00
parent 6e83289d36
commit d03bf641dd
38 changed files with 220 additions and 241 deletions
+2 -16
View File
@@ -362,14 +362,7 @@
else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff))
visible_message("<span class='warning'>[src] malfunctions, melting [exp_on] and leaking hot air!</span>")
var/datum/gas_mixture/env = loc.return_air()
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.set_temperature(min((removed.return_temperature()*heat_capacity + 100000)/heat_capacity, 1000))
env.merge(removed)
env.adjust_heat(100000)
air_update_turf()
investigate_log("Experimentor has released hot air.", INVESTIGATE_EXPERIMENTOR)
ejectItem(TRUE)
@@ -408,14 +401,7 @@
else if(prob(EFFECT_PROB_LOW-badThingCoeff))
visible_message("<span class='warning'>[src] malfunctions, shattering [exp_on] and leaking cold air!</span>")
var/datum/gas_mixture/env = loc.return_air()
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.set_temperature((removed.return_temperature()*heat_capacity - 75000)/heat_capacity)
env.merge(removed)
env.adjust_heat(-75000)
air_update_turf()
investigate_log("Experimentor has released cold air.", INVESTIGATE_EXPERIMENTOR)
ejectItem(TRUE)
+6 -19
View File
@@ -7,12 +7,11 @@
circuit = /obj/item/circuitboard/machine/rdserver
var/datum/techweb/stored_research
var/heat_health = 100
//Code for point mining here.
var/working = TRUE //temperature should break it.
var/server_id = 0
var/base_mining_income = 2
var/heat_gen = 100
var/heat_gen = 1
var/heating_power = 40000
var/delay = 5
var/temp_tolerance_low = 0
@@ -32,7 +31,7 @@
var/tot_rating = 0
for(var/obj/item/stock_parts/SP in src)
tot_rating += SP.rating
heat_gen /= max(1, tot_rating)
heat_gen = initial(src.heat_gen) / max(1, tot_rating)
/obj/machinery/rnd/server/proc/refresh_working()
if(stat & EMPED)
@@ -56,31 +55,19 @@
. = base_mining_income
var/penalty = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient
. = max(. - penalty, 0)
produce_heat(. / base_mining_income)
/obj/machinery/rnd/server/proc/get_env_temp()
var/datum/gas_mixture/environment = loc.return_air()
return environment.return_temperature()
/obj/machinery/rnd/server/proc/produce_heat(heat_amt)
/obj/machinery/rnd/server/proc/produce_heat(perc)
if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater.
var/turf/L = loc
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
if(env.return_temperature() < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.set_temperature(min((removed.return_temperature()*heat_capacity + heating_power)/heat_capacity, 1000))
env.merge(removed)
air_update_turf()
env.adjust_heat(heating_power * perc * heat_gen)
air_update_turf()
/proc/fix_noid_research_servers()
var/list/no_id_servers = list()