Check ambition, port updates.

This commit is contained in:
Alffd
2018-06-21 19:04:55 -04:00
parent 495b1b17f3
commit acf2375980
+97 -61
View File
@@ -1,27 +1,33 @@
//Ported from /vg/station13, which was in turn forked from baystation12;
//Please do not bother them with bugs from this port, however, as it has been modified quite a bit.
//Modifications include removing the world-ending full supermatter variation, and leaving only the shard.
#define NITROGEN_RETARDATION_FACTOR 0.15 //Higher == N2 slows reaction more
#define THERMAL_RELEASE_MODIFIER 10000 //Higher == more heat released during reaction
#define PLASMA_RELEASE_MODIFIER 1500 //Higher == less phor.. plasma released by reaction
#define OXYGEN_RELEASE_MODIFIER 15000 //Higher == less oxygen released at high temperature/power
#define REACTION_POWER_MODIFIER 1.1 //Higher == more overall power
#define NITROGEN_RETARDATION_FACTOR 2 //Higher == N2 slows reaction more
#define THERMAL_RELEASE_MODIFIER 5 //Higher == less heat released during reaction
#define PLASMA_RELEASE_MODIFIER 750 //Higher == less plasma released by reaction
#define OXYGEN_RELEASE_MODIFIER 325 //Higher == less oxygen released at high temperature/power
#define REACTION_POWER_MODIFIER 0.55 //Higher == more overall power
/*
How to tweak the SM
POWER_FACTOR directly controls how much power the SM puts out at a given level of excitation (power var). Making this lower means you have to work the SM harder to get the same amount of power.
CRITICAL_TEMPERATURE The temperature at which the SM starts taking damage.
CHARGING_FACTOR Controls how much emitter shots excite the SM.
DAMAGE_RATE_LIMIT Controls the maximum rate at which the SM will take damage due to high temperatures.
*/
//Controls how much power is produced by each collector in range - this is the main parameter for tweaking SM balance, as it basically controls how the power variable relates to the rest of the game.
#define POWER_FACTOR 1.0
#define DECAY_FACTOR 700 //Affects how fast the supermatter power decays
#define CRITICAL_TEMPERATURE 5000 //K
#define CHARGING_FACTOR 0.05
#define DAMAGE_RATE_LIMIT 4.5 //damage rate cap at power = 300, scales linearly with power
//These would be what you would get at point blank, decreases with distance
// Base variants are applied to everyone on the same Z level
// Range variants are applied on per-range basis: numbers here are on point blank, it scales with the map size (assumes square shaped Z levels)
#define DETONATION_RADS 200
#define DETONATION_HALLUCINATION 600
#define WARNING_DELAY 30 //seconds between warnings.
//If integrity percent remaining is less than these values, the monitor sets off the relevant alarm.
#define SUPERMATTER_DELAM_PERCENT 5
#define SUPERMATTER_EMERGENCY_PERCENT 25
#define SUPERMATTER_DANGER_PERCENT 50
#define SUPERMATTER_WARNING_PERCENT 100
#define WARNING_DELAY 20 //seconds between warnings.
/obj/machinery/power/supermatter_shard
name = "supermatter shard"
desc = "A strangely translucent and iridescent crystal that looks like it used to be part of a larger structure. <span class='danger'>You get headaches just from looking at it.</span>"
@@ -41,9 +47,9 @@
var/safe_alert = "Crystalline hyperstructure returning to safe operating levels."
var/warning_point = 50
var/warning_alert = "Danger! Crystal hyperstructure instability!"
var/emergency_point = 500
var/emergency_point = 400
var/emergency_alert = "CRYSTAL DELAMINATION IMMINENT."
var/explosion_point = 900
var/explosion_point = 600
var/emergency_issued = 0
@@ -57,11 +63,20 @@
//Temporary values so that we can optimize this
//How much the bullets damage should be multiplied by when it is added to the internal variables
var/config_bullet_energy = 2
//How much of the power is left after processing is finished?
// var/config_power_reduction_per_tick = 0.5
//How much hallucination should it produce per unit of power?
var/config_hallucination_power = 0.1
var/debug = 0
var/disable_adminwarn = FALSE
var/aw_normal = FALSE
var/aw_notify = FALSE
var/aw_warning = FALSE
var/aw_danger = FALSE
var/aw_emerg = FALSE
var/aw_delam = FALSE
var/obj/item/radio/radio
//for logging
@@ -77,8 +92,8 @@
warning_point = 200
emergency_point = 2000
explosion_point = 3600
gasefficency = 0.15
explosion_power = 35
gasefficency = 0.25
explosion_power = 24
/obj/machinery/power/supermatter_shard/New()
@@ -89,6 +104,29 @@
radio.listening = 0
investigate_log("has been created.", "supermatter")
/obj/machinery/power/supermatter_shard/proc/handle_admin_warnings()
if(disable_adminwarn)
return
// Generic checks, similar to checks done by supermatter monitor program.
aw_normal = status_adminwarn_check(SUPERMATTER_NORMAL, aw_normal, "INFO: Supermatter crystal has been energised.", FALSE)
aw_notify = status_adminwarn_check(SUPERMATTER_NOTIFY, aw_notify, "INFO: Supermatter crystal is approaching unsafe operating temperature.", FALSE)
aw_warning = status_adminwarn_check(SUPERMATTER_WARNING, aw_warning, "WARN: Supermatter crystal is taking integrity damage!", FALSE)
aw_danger = status_adminwarn_check(SUPERMATTER_DANGER, aw_danger, "WARN: Supermatter integrity is below 50%!", TRUE)
aw_emerg = status_adminwarn_check(SUPERMATTER_EMERGENCY, aw_emerg, "CRIT: Supermatter integrity is below 25%!", FALSE)
aw_delam = status_adminwarn_check(SUPERMATTER_DELAMINATING, aw_delam, "CRIT: Supermatter is delaminating!", TRUE)
/obj/machinery/power/supermatter_shard/proc/status_adminwarn_check(var/min_status, var/current_state, var/message, var/send_to_irc = FALSE)
var/status = get_status()
if(status >= min_status)
if(!current_state)
log_and_message_admins(message)
if(send_to_irc)
send2adminirc(message)
return TRUE
else
return FALSE
/obj/machinery/power/supermatter_shard/Destroy()
investigate_log("has been destroyed.", "supermatter")
@@ -112,9 +150,6 @@
if(!istype(L)) //We are in a crate or somewhere that isn't turf, if we return to turf resume processing but for now.
return //Yeah just stop.
if(istype(L, /turf/space)) // Stop processing this stuff if we've been ejected.
return
if(damage > warning_point) // while the core is still damaged and it's still worth noting its status
if((world.timeofday - lastwarning) / 10 >= WARNING_DELAY)
alarm()
@@ -157,53 +192,56 @@
//Remove gas from surrounding area
var/datum/gas_mixture/removed = env.remove(gasefficency * env.total_moles())
if(!removed || !removed.total_moles())
damage += max((power-1600)/2, 0)
power = min(power, 1600)
return 1
//ensure that damage doesn't increase too quickly due to super high temperatures resulting from no coolant, for example. We dont want the SM exploding before anyone can react.
//We want the cap to scale linearly with power (and explosion_point). Let's aim for a cap of 5 at power = 300 (based on testing, equals roughly 5% per SM alert announcement).
var/damage_inc_limit = (power/300)*(explosion_point/1000)*DAMAGE_RATE_LIMIT
if(!env || !removed || !removed.total_moles())
damage += max((power - 15*POWER_FACTOR)/10, 0)
else
damage_archived = damage
damage = max(0, damage + between(-DAMAGE_RATE_LIMIT, (removed.temperature - CRITICAL_TEMPERATURE) / 150, damage_inc_limit))
damage_archived = damage
damage = max( damage + ( (removed.temperature - 800) / 50 ) , 0 )
//Ok, 100% oxygen atmosphere = best reaction
//Maxes out at 100% oxygen pressure
oxygen = max(min((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 1), 0)
oxygen = Clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1)
var/temp_factor = 50
if(oxygen > 0.8)
// with a perfect gas mix, make the power less based on heat
var/temp_factor
var/equilibrium_power
if (oxygen > 0.8)
//If chain reacting at oxygen == 1, we want the power at 800 K to stabilize at a power level of 400
equilibrium_power = 400
icon_state = "[base_icon_state]_glow"
else
// in normal mode, base the produced energy around the heat
temp_factor = 30
//If chain reacting at oxygen == 1, we want the power at 800 K to stabilize at a power level of 250
equilibrium_power = 250
icon_state = base_icon_state
power = max( (removed.temperature * temp_factor / T0C) * oxygen + power, 0) //Total laser power plus an overload
//We've generated power, now let's transfer it to the collectors for storing/usage
transfer_energy()
temp_factor = ( (equilibrium_power/DECAY_FACTOR)**3 )/800
power = max( (removed.temperature * temp_factor) * oxygen + power, 0)
var/device_energy = power * REACTION_POWER_MODIFIER
//To figure out how much temperature to add each tick, consider that at one atmosphere's worth
//of pure oxygen, with all four lasers firing at standard energy and no N2 present, at room temperature
//that the device energy is around 2140. At that stage, we don't want too much heat to be put out
//Since the core is effectively "cold"
var/heat_capacity = removed.heat_capacity()
//Also keep in mind we are only adding this temperature to (efficiency)% of the one tile the rock
//is on. An increase of 4*C @ 25% efficiency here results in an increase of 1*C / (#tilesincore) overall.
removed.temperature += (device_energy / THERMAL_RELEASE_MODIFIER)
removed.temperature = max(0, min(removed.temperature, 2500))
//Calculate how much gas to release
removed.toxins += max(device_energy / PLASMA_RELEASE_MODIFIER, 0)
removed.oxygen += max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
var/thermal_power = THERMAL_RELEASE_MODIFIER * device_energy
if (debug)
var/heat_capacity_new = removed.heat_capacity()
visible_message("[src]: Releasing [round(thermal_power)] W.")
visible_message("[src]: Releasing additional [round((heat_capacity_new - heat_capacity)*removed.temperature)] W with exhaust gasses.")
removed.temperature += (device_energy)
removed.temperature = max(0, min(removed.temperature, 10000))
env.merge(removed)
air_update_turf()
transfer_energy()
for(var/mob/living/carbon/human/l in view(src, min(7, round(sqrt(power/6)))))
// If they can see it without mesons on. Bad on them.
@@ -220,7 +258,8 @@
var/rads = (power / 10) * sqrt( 1 / max(get_dist(l, src),1) )
l.apply_effect(rads, IRRADIATE)
power -= (power/500)**3
power -= (power/DECAY_FACTOR)**3
handle_admin_warnings()
return 1
@@ -380,16 +419,13 @@
if(!air)
return SUPERMATTER_ERROR
if(get_integrity() < SUPERMATTER_DELAM_PERCENT)
return SUPERMATTER_DELAMINATING
if(get_integrity() < SUPERMATTER_EMERGENCY_PERCENT)
if(get_integrity() < 25)
return SUPERMATTER_EMERGENCY
if(get_integrity() < SUPERMATTER_DANGER_PERCENT)
if(get_integrity() < 50)
return SUPERMATTER_DANGER
if((get_integrity() < SUPERMATTER_WARNING_PERCENT) || (air.temperature > CRITICAL_TEMPERATURE))
if((get_integrity() < 100) || (air.temperature > CRITICAL_TEMPERATURE))
return SUPERMATTER_WARNING
if(air.temperature > (CRITICAL_TEMPERATURE * 0.8))