Implement powersink surge (#2452)

Implements suggestion https://forums.aurorastation.org/viewtopic.php?f=21&p=78011 in the following fashion:

Powersinks explode ~18 minutes after being placed on normal SMES setup. Obviously more input from engineering will make this process go faster.
Upon reaching their capacity, they will now cause a larger area power surge. The surge will smash all lights belonging to APCs within close to moderate proximity, and call EMP act on all connected powernet items that are within range (severity depending on distance). All of those items have a small chance to cause a minor explosion as well, primarily because EMP act is fucking whimpy.
This commit is contained in:
skull132
2017-05-27 12:25:47 +03:00
committed by GitHub
parent ad5c986093
commit 547e78d93c
5 changed files with 105 additions and 43 deletions

View File

@@ -25,4 +25,21 @@
#define INFINITY 1.#INF
#define TICKS_IN_DAY 24*60*60*10
#define TICKS_IN_SECOND 10
#define TICKS_IN_SECOND 10
// A neat little helper to convert the value X, that's between imin and imax, into a value
// that's proportionally scaled and in range of omin and omax.
#define MAP(x, imin, imax, omin, omax) ((x - imin) * (omax - omin) / (imax - imin) + omin)
#define RAND_F(LOW, HIGH) (rand()*(HIGH-LOW) + LOW)
//"fancy" math for calculating time in ms from tick_usage percentage and the length of ticks
//percent_of_tick_used * (ticklag * 100(to convert to ms)) / 100(percent ratio)
//collapsed to percent_of_tick_used * tick_lag
#define TICK_DELTA_TO_MS(percent_of_tick_used) ((percent_of_tick_used) * world.tick_lag)
#define TICK_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(world.tick_usage-starting_tickusage))
//time of day but automatically adjusts to the server going into the next day within the same round.
//for when you need a reliable time number that doesn't depend on byond time.
#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK))
#define MIDNIGHT_ROLLOVER_CHECK ( rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : midnight_rollovers )