Meteor Events Rework (#538)

This commit is contained in:
NanakoAC
2016-07-11 16:54:05 +03:00
committed by skull132
parent b5b1f7abad
commit 29b3203ebf
4 changed files with 265 additions and 93 deletions
+81 -29
View File
@@ -1,44 +1,96 @@
//meteor storms are much heavier
/datum/event/meteor_wave
startWhen = 6
endWhen = 33
startWhen = 86
endWhen = 9999//safety value, will be set during ticks
var/wave_delay = 13//Note, wave delay is in procs. actual time is equal to wave_delay * 2.1
var/min_waves = 11
var/max_waves = 16
var/min_meteors = 1
var/max_meteors = 2
var/duration = 420//Total duration in seconds that the storm will last after it starts
var/waves = 8
var/next_wave = 86
/datum/event/meteor_wave/setup()
endWhen = rand(15,30) * 3
startWhen += rand(-15,15)//slightly randomised start time
waves = rand(min_waves,max_waves)
next_wave = startWhen
wave_delay = round(((duration - 10)/waves)/2.1, 1)
/datum/event/meteor_wave/announce()
command_announcement.Announce("Meteors have been detected on collision course with the station.", "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
command_announcement.Announce("A heavy meteor storm has been detected on collision course with the station. Estimated three minutes until impact, please activate station shields, and seek shelter in the central ring.", "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/event/meteor_wave/start()
command_announcement.Announce("Contact with meteor wave imminent, all hands brace for impact.", "Meteor Alert")
/datum/event/meteor_wave/tick()
if(IsMultiple(activeFor, 3))
meteor_wave(rand(2,5))
if(activeFor >= next_wave)
var/amount = rand(min_meteors,max_meteors)
/datum/event/meteor_wave/end()
command_announcement.Announce("The station has cleared the meteor storm.", "Meteor Alert")
//
/datum/event/meteor_shower
startWhen = 5
endWhen = 7
var/next_meteor = 6
var/waves = 1
/datum/event/meteor_shower/setup()
waves = rand(2,5)
/datum/event/meteor_shower/announce()
command_announcement.Announce("The station is now in a meteor shower.", "Meteor Alert")
//meteor showers are lighter and more common,
/datum/event/meteor_shower/tick()
if(activeFor >= next_meteor)
meteor_wave(rand(1,4))
next_meteor += rand(20,100)
event_meteor_wave(amount)
next_wave += wave_delay
waves--
if(waves <= 0)
endWhen = activeFor + 1
else
endWhen = next_meteor + 1
endWhen = next_wave + wave_delay
/datum/event/meteor_wave/end()
spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station
command_announcement.Announce("The station has survived the meteor storm, it is now safe to commence repairs.", "Meteor Alert")
//
/datum/event/meteor_shower
startWhen = 86
endWhen = 9999
var/wave_delay = 6
var/min_waves = 7
var/max_waves = 9
var/min_meteors = 0
var/max_meteors = 1
var/duration = 180//Total duration in seconds that the storm will last after it starts
var/waves = 4//this is randomised
var/next_wave = 86
/datum/event/meteor_shower/setup()
startWhen += rand(-15,15)//slightly randomised start time
waves = rand(min_waves,max_waves)
next_wave = startWhen
wave_delay = round(((duration - 10)/waves)/2.1, 1)
/datum/event/meteor_shower/announce()
command_announcement.Announce("A meteor shower is approaching the station, estimated contact in three minutes. Crew are recommended to stay away from the outer areas of the station.", "Meteor Alert")
//meteor showers are lighter and more common,
/datum/event/meteor_shower/tick()
if(activeFor >= next_wave)
var/amount = rand(min_meteors,max_meteors)
event_meteor_wave(amount)
next_wave += wave_delay
waves--
if(waves <= 0)
endWhen = activeFor + 1
else
endWhen = next_wave + wave_delay
/datum/event/meteor_wave/start()
command_announcement.Announce("Meteors have reached the station. Please stay away from outer areas until the shower has passed.", "Meteor Alert")
/datum/event/meteor_shower/end()
command_announcement.Announce("The station has cleared the meteor shower", "Meteor Alert")
spawn(100)
command_announcement.Announce("The station has cleared the meteor shower, please return to your stations.", "Meteor Alert")
//An event specific version of the meteor wave proc, to bypass the delays
/proc/event_meteor_wave(var/number = meteors_in_wave)
for(var/i = 0 to number)
spawn(rand(10,80))
spawn_meteor()