Merge remote-tracking branch 'citadel/master' into auxtools-atmos
This commit is contained in:
@@ -66,7 +66,10 @@
|
||||
var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity)
|
||||
|
||||
var/heat = energy_transfer*(1-efficiency)
|
||||
lastgen += LOGISTIC_FUNCTION(500000,0.0009,delta_temperature,10000)
|
||||
if(delta_temperature < 16800) // second point where derivative of below function = 1
|
||||
lastgen += LOGISTIC_FUNCTION(500000,0.0009,delta_temperature,10000)
|
||||
else
|
||||
lastgen += delta_temperature + 482102 // value of above function at 16800, or very nearly so
|
||||
|
||||
hot_air.set_temperature(hot_air.return_temperature() - energy_transfer/hot_air_heat_capacity)
|
||||
cold_air.set_temperature(cold_air.return_temperature() + heat/cold_air_heat_capacity)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/area/engine/engineering/poweralert(state, source)
|
||||
/area/engineering/main/poweralert(state, source)
|
||||
if (state != poweralm)
|
||||
investigate_log("has a power alarm!", INVESTIGATE_SINGULO)
|
||||
..()
|
||||
|
||||
@@ -80,6 +80,9 @@
|
||||
SSshuttle.lockdown = TRUE
|
||||
SSpersistence.station_was_destroyed = TRUE
|
||||
sleep(600)
|
||||
if(QDELETED(src))
|
||||
priority_announce("Accausal event alert rescinded. Eldritch presence no longer reading on sensors. Solution package disarmed. Reccomend immediate evacuation","Central Command Higher Dimensional Affairs")
|
||||
return
|
||||
if(resolved == FALSE)
|
||||
resolved = TRUE
|
||||
sound_to_playing_players('sound/machines/alarm.ogg')
|
||||
|
||||
+23
-37
@@ -1,5 +1,4 @@
|
||||
#define SOLAR_GEN_RATE 1500
|
||||
#define OCCLUSION_DISTANCE 20
|
||||
|
||||
/obj/machinery/power/solar
|
||||
name = "solar panel"
|
||||
@@ -14,8 +13,8 @@
|
||||
integrity_failure = 0.33
|
||||
|
||||
var/id
|
||||
var/obscured = FALSE
|
||||
var/sunfrac = 0 //[0-1] measure of obscuration -- multipllier against power generation
|
||||
var/list/obscured = list()
|
||||
var/total_flux = 0 // multipllier against power generation -- measured by obscuration of all suns
|
||||
var/azimuth_current = 0 //[0-360) degrees, which direction are we facing?
|
||||
var/azimuth_target = 0 //same but what way we're going to face next time we turn
|
||||
var/obj/machinery/power/solar_control/control
|
||||
@@ -133,40 +132,28 @@
|
||||
|
||||
///trace towards sun to see if we're in shadow
|
||||
/obj/machinery/power/solar/proc/occlusion_setup()
|
||||
obscured = TRUE
|
||||
|
||||
var/distance = OCCLUSION_DISTANCE
|
||||
var/target_x = round(sin(SSsun.azimuth), 0.01)
|
||||
var/target_y = round(cos(SSsun.azimuth), 0.01)
|
||||
var/x_hit = x
|
||||
var/y_hit = y
|
||||
var/turf/hit
|
||||
|
||||
for(var/run in 1 to distance)
|
||||
x_hit += target_x
|
||||
y_hit += target_y
|
||||
hit = locate(round(x_hit, 1), round(y_hit, 1), z)
|
||||
if(hit.opacity)
|
||||
return
|
||||
if(hit.x == 1 || hit.x == world.maxx || hit.y == 1 || hit.y == world.maxy) //edge of the map
|
||||
break
|
||||
obscured = FALSE
|
||||
obscured = list()
|
||||
for(var/S in SSsun.suns)
|
||||
if(check_obscured(S))
|
||||
obscured |= S
|
||||
|
||||
///calculates the fraction of the sunlight that the panel receives
|
||||
/obj/machinery/power/solar/proc/update_solar_exposure()
|
||||
needs_to_update_solar_exposure = FALSE
|
||||
sunfrac = 0
|
||||
if(obscured)
|
||||
return 0
|
||||
|
||||
var/sun_azimuth = SSsun.azimuth
|
||||
if(azimuth_current == sun_azimuth) //just a quick optimization for the most frequent case
|
||||
. = 1
|
||||
else
|
||||
//dot product of sun and panel -- Lambert's Cosine Law
|
||||
. = cos(azimuth_current - sun_azimuth)
|
||||
. = clamp(round(., 0.01), 0, 1)
|
||||
sunfrac = .
|
||||
total_flux = 0
|
||||
for(var/S in SSsun.suns)
|
||||
if(S in obscured)
|
||||
continue
|
||||
var/datum/sun/sun = S
|
||||
var/sun_azimuth = sun.azimuth
|
||||
var/cur_pow = 0
|
||||
if(azimuth_current == sun_azimuth) //just a quick optimization for the most frequent case
|
||||
cur_pow = sun.power_mod
|
||||
else
|
||||
//dot product of sun and panel -- Lambert's Cosine Law
|
||||
cur_pow = cos(azimuth_current - sun_azimuth) * sun.power_mod
|
||||
cur_pow = clamp(round(cur_pow, 0.01), 0, 1)
|
||||
total_flux += cur_pow
|
||||
|
||||
/obj/machinery/power/solar/process()
|
||||
if(stat & BROKEN)
|
||||
@@ -177,10 +164,10 @@
|
||||
update_turn()
|
||||
if(needs_to_update_solar_exposure)
|
||||
update_solar_exposure()
|
||||
if(sunfrac <= 0)
|
||||
if(total_flux <= 0)
|
||||
return
|
||||
|
||||
var/sgen = SOLAR_GEN_RATE * sunfrac * efficiency
|
||||
var/sgen = SOLAR_GEN_RATE * total_flux * efficiency
|
||||
add_avail(sgen)
|
||||
if(control)
|
||||
control.gen += sgen
|
||||
@@ -385,7 +372,7 @@
|
||||
track = mode
|
||||
if(mode == SOLAR_TRACK_AUTO)
|
||||
if(connected_tracker)
|
||||
connected_tracker.sun_update(SSsun, SSsun.azimuth)
|
||||
connected_tracker.sun_update(SSsun, SSsun.primary_sun, SSsun.suns)
|
||||
else
|
||||
track = SOLAR_TRACK_OFF
|
||||
return TRUE
|
||||
@@ -483,4 +470,3 @@ Congratulations, you should have a working solar array. If you are having troubl
|
||||
"}
|
||||
|
||||
#undef SOLAR_GEN_RATE
|
||||
#undef OCCLUSION_DISTANCE
|
||||
|
||||
@@ -390,7 +390,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
speaking = "[DisplayTimeText(i, TRUE)] remain before causality stabilization."
|
||||
else
|
||||
speaking = "[i*0.1]..."
|
||||
radio.talk_into(src, speaking, common_channel)
|
||||
radio.talk_into(src, speaking, common_channel, list(SPAN_COMMAND)) // IT GOT WORSE, LOUD TIME
|
||||
sleep(10)
|
||||
|
||||
explode()
|
||||
@@ -715,7 +715,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
//Oh shit it's bad, time to freak out
|
||||
if(damage > emergency_point)
|
||||
radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity()]%", common_channel)
|
||||
// it's bad, LETS YELL
|
||||
radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity()]%", common_channel, list(SPAN_YELL))
|
||||
lastwarning = REALTIMEOFDAY
|
||||
if(!has_reached_emergency)
|
||||
investigate_log("has reached the emergency point for the first time.", INVESTIGATE_SUPERMATTER)
|
||||
|
||||
@@ -41,10 +41,10 @@
|
||||
control = null
|
||||
|
||||
///Tell the controller to turn the solar panels
|
||||
/obj/machinery/power/tracker/proc/sun_update(datum/source, azimuth)
|
||||
setDir(angle2dir(azimuth))
|
||||
/obj/machinery/power/tracker/proc/sun_update(datum/source, datum/sun/primary_sun, list/datum/sun/suns)
|
||||
setDir(angle2dir(primary_sun.azimuth))
|
||||
if(control && control.track == SOLAR_TRACK_AUTO)
|
||||
control.set_panels(azimuth)
|
||||
control.set_panels(primary_sun.azimuth)
|
||||
|
||||
/obj/machinery/power/tracker/proc/Make(obj/item/solar_assembly/S)
|
||||
if(!S)
|
||||
|
||||
Reference in New Issue
Block a user