Solar Flares (#14400)

* Solar Flares

* fixup

* SSsun

* convert solar flare to a /datum/weather

* AA request

* shock chance for APCs = 5% per 2.5M of power in grid

* refactor

* farie suggestions

* farie suggestions 2

* reduced maximum length from 15m to 10m

Co-authored-by: Kyep <Kyep@users.noreply.github.com>
This commit is contained in:
Kyep
2020-10-17 18:04:29 +00:00
committed by GitHub
parent 20a8424fff
commit 3fbe5d46ac
8 changed files with 78 additions and 9 deletions
+7 -2
View File
@@ -1195,8 +1195,13 @@
charging = 0
chargecount = 0
if(excess >= 5000000 && !shock_proof) //If there's more than 5,000,000 watts in the grid, start arcing and shocking people.
if(prob(5))
if(excess >= 2500000 && !shock_proof)
var/shock_chance = 5 // 5%
if(excess >= 7500000)
shock_chance = 15
else if(excess >= 5000000)
shock_chance = 10
if(prob(shock_chance))
var/list/shock_mobs = list()
for(var/C in view(get_turf(src), 5)) //We only want to shock a single random mob in range, not every one.
if(isliving(C))
+2 -3
View File
@@ -1,5 +1,4 @@
#define SOLAR_MAX_DIST 40
#define SOLARGENRATE 1500
/obj/machinery/power/solar
name = "solar panel"
@@ -131,7 +130,7 @@
if(powernet == control.powernet)//check if the panel is still connected to the computer
if(obscured) //get no light from the sun, so don't generate power
return
var/sgen = SOLARGENRATE * sunfrac
var/sgen = SSsun.solar_gen_rate * sunfrac
add_avail(sgen)
control.gen += sgen
else //if we're no longer on the same powernet, remove from control computer
@@ -379,7 +378,7 @@
/obj/machinery/power/solar_control/tgui_data(mob/user)
var/list/data = list()
data["generated"] = round(lastgen) //generated power by all connected panels
data["generated_ratio"] = data["generated"] / round(max(connected_panels.len, 1) * SOLARGENRATE) //power generation ratio. Used for the power bar
data["generated_ratio"] = data["generated"] / round(max(connected_panels.len, 1) * SSsun.solar_gen_rate) //power generation ratio. Used for the power bar
data["direction"] = angle2text(cdir) //current orientation of the panels
data["cdir"] = cdir //current orientation of the of the panels in degrees
data["tracking_state"] = track //tracker status: TRACKER_OFF, TRACKER_TIMED, TRACKER_AUTO