Files
VOREStation/code/modules/gamemaster/actions/meteor_defense.dm
T
Neerti 9b9de138e6 Continues work on new Event System
Ports and adds some more events, including dust, meteors, carp, etc.
Tweaks meteors, now has a 10 minute warning beforehand and meteors only approach from one direction now.
2017-01-29 19:32:20 -05:00

51 lines
2.1 KiB
Plaintext

// This event gives the station an advance warning about meteors, so that they can prepare in various ways.
/datum/gm_action/meteor_defense
name = "meteor defense"
departments = list(ROLE_ENGINEERING)
chaotic = 50
var/direction = null
var/dir_text = null
var/waves = 0
/datum/gm_action/meteor_defense/get_weight()
var/engineers = metric.count_people_in_department(ROLE_ENGINEERING)
var/weight = (max(engineers - 1, 0) * 25) // If only one engineer exists, no meteors for now.
return weight
/datum/gm_action/meteor_defense/set_up()
direction = pick(cardinal) // alldirs doesn't work with current meteor code unfortunately.
waves = rand(5, 8)
switch(direction)
if(NORTH)
dir_text = "aft" // For some reason this is needed.
if(SOUTH)
dir_text = "fore"
if(EAST)
dir_text = "port"
if(WEST)
dir_text = "starboard"
/datum/gm_action/meteor_defense/announce()
var/announcement = "Alert! Two other asteroids have collided near [station_name()]. Chunks of it are expected to approach from the [dir_text] side. ETA to arrival is \
approximately 10 minutes."
command_announcement.Announce(announcement, "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/gm_action/meteor_defense/start()
..()
spawn(0)
// sleep(5 MINUTES)
var/announcement = "The incoming debris are expected to approach from the [dir_text] side. ETA to arrival is approximately 5 minutes."
command_announcement.Announce(announcement, "Meteor Alert - Update")
// sleep(5 MINUTES)
announcement = "Incoming debris approaches from the [dir_text] side!"
command_announcement.Announce(announcement, "Meteor Alert - Update")
while(waves)
message_admins("[waves] more wave\s of meteors remain.")
spawn(1) // Dir is reversed because the direction describes where meteors are going, not what side it's gonna hit.
spawn_meteors(rand(8, 12), meteors_threatening, reverse_dir[direction])
waves--
sleep(30 SECONDS)
announcement = "The colony has cleared the incoming debris."
command_announcement.Announce(announcement, "Meteor Alert - Update")
message_admins("Meteor defense event has ended.")