Merge pull request #6884 from Neerti/event_system_fix

Rewrites the Rewritten Event System
This commit is contained in:
Atermonera
2020-04-05 16:20:38 -07:00
committed by Leshana
parent 351b9e8c5e
commit 5c03273ce8
130 changed files with 3927 additions and 2614 deletions

View File

@@ -73,6 +73,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
#define INIT_ORDER_CIRCUIT -21
#define INIT_ORDER_AI -22
#define INIT_ORDER_JOB -23
#define INIT_ORDER_GAME_MASTER -24
#define INIT_ORDER_CHAT -100 //Should be last to ensure chat remains smooth during init.

View File

@@ -24,4 +24,16 @@
if(A == myarea) //The loc of a turf is the area it is in.
return 1
return 0
// Returns a list of area instances, or a subtypes of them, that are mapped in somewhere.
// Avoid feeding it `/area`, as it will likely cause a lot of lag as it evaluates every single area coded in.
/proc/get_all_existing_areas_of_types(list/area_types)
. = list()
for(var/area_type in area_types)
var/list/types = typesof(area_type)
for(var/T in types)
// Test for existance.
var/area/A = locate(T)
if(!istype(A) || !A.contents.len) // Empty contents list means it's not on the map.
continue
. += A

View File

@@ -54,6 +54,20 @@
return TRUE
return FALSE
// Picks a turf that is clearance tiles away from the map edge given by dir, on z-level Z
/proc/pick_random_edge_turf(var/dir, var/Z, var/clearance = TRANSITIONEDGE + 1)
if(!dir)
return
switch(dir)
if(NORTH)
return locate(rand(clearance, world.maxx - clearance), world.maxy - clearance, Z)
if(SOUTH)
return locate(rand(clearance, world.maxx - clearance), clearance, Z)
if(EAST)
return locate(world.maxx - clearance, rand(clearance, world.maxy - clearance), Z)
if(WEST)
return locate(clearance, rand(clearance, world.maxy - clearance), Z)
/*
Turf manipulation
*/

View File

@@ -1,6 +0,0 @@
/datum/controller/process/game_master/setup()
name = "\improper GM controller"
schedule_interval = 600 // every 60 seconds
/datum/controller/process/game_master/doWork()
game_master.process()

View File

@@ -1,5 +1,5 @@
SUBSYSTEM_DEF(events)
name = "Events"
name = "Events" // VOREStation Edit - This is still the main events subsystem for us.
wait = 2 SECONDS
var/tmp/list/currentrun = null

View File

@@ -0,0 +1,37 @@
// This is a simple ticker for the new event system.
// The logic that determines what events get chosen is held inside a seperate subsystem.
SUBSYSTEM_DEF(event_ticker)
name = "Events (Ticker)"
wait = 2 SECONDS
runlevels = RUNLEVEL_GAME
// List of `/datum/event2/event`s that are currently active, and receiving process() ticks.
var/list/active_events = list()
// List of `/datum/event2/event`s that finished, and are here for showing at roundend, if that's desired.
var/list/finished_events = list()
// Process active events.
/datum/controller/subsystem/event_ticker/fire(resumed)
for(var/E in active_events)
var/datum/event2/event/event = E
event.process()
if(event.finished)
event_finished(event)
// Starts an event, independent of the GM system.
// This means it will always run, and won't affect the GM system in any way, e.g. not putting the event off limits after one use.
/datum/controller/subsystem/event_ticker/proc/start_event(event_type)
var/datum/event2/event/E = new event_type(src)
E.execute()
event_started(E)
/datum/controller/subsystem/event_ticker/proc/event_started(datum/event2/event/E)
log_debug("Event [E.type] is now being ran.")
active_events += E
/datum/controller/subsystem/event_ticker/proc/event_finished(datum/event2/event/E)
log_debug("Event [E.type] has finished.")
active_events -= E
finished_events += E

View File

@@ -0,0 +1,373 @@
// This is a sort of successor to the various event systems created over the years. It is designed to be just a tad smarter than the
// previous ones, checking various things like player count, department size and composition, individual player activity,
// individual player (IC) skill, and such, in order to try to choose the best events to take in order to add spice or variety to
// the round.
// This subsystem holds the logic that chooses events. Actual event processing is handled in a seperate subsystem.
SUBSYSTEM_DEF(game_master)
name = "Events (Game Master)"
wait = 1 MINUTE
runlevels = RUNLEVEL_GAME
// The GM object is what actually chooses events.
// It's held in a seperate object for better encapsulation, and allows for different 'flavors' of GMs to be made, that choose events differently.
var/datum/game_master/GM = null
var/game_master_type = /datum/game_master/default
var/list/available_events = list() // A list of meta event objects.
var/danger = 0 // The GM's best guess at how chaotic the round is. High danger makes it hold back.
var/staleness = -20 // Determines liklihood of the GM doing something, increases over time.
var/next_event = 0 // Minimum amount of time of nothingness until the GM can pick something again.
var/debug_messages = FALSE // If true, debug information is written to `log_debug()`.
/datum/controller/subsystem/game_master/Initialize()
var/list/subtypes = subtypesof(/datum/event2/meta)
for(var/T in subtypes)
var/datum/event2/meta/M = new T(src)
if(!M.name)
continue
available_events += M
GM = new game_master_type(src)
if(config && !config.enable_game_master)
can_fire = FALSE
return ..()
/datum/controller/subsystem/game_master/fire(resumed)
adjust_staleness(1)
adjust_danger(-1)
var/global_afk = metric.assess_all_living_mobs()
global_afk = abs(global_afk - 100)
global_afk = round(global_afk / 100, 0.1)
adjust_staleness(global_afk) // Staleness increases faster if more people are less active.
if(GM.ignore_time_restrictions || next_event < world.time)
if(prob(staleness) && pre_event_checks())
do_event_decision()
/datum/controller/subsystem/game_master/proc/do_event_decision()
log_game_master("Going to choose an event.")
var/datum/event2/meta/event_picked = GM.choose_event()
if(event_picked)
run_event(event_picked)
next_event = world.time + rand(GM.decision_cooldown_lower_bound, GM.decision_cooldown_upper_bound)
/datum/controller/subsystem/game_master/proc/debug_gm()
can_fire = TRUE
staleness = 100
debug_messages = TRUE
/datum/controller/subsystem/game_master/proc/run_event(datum/event2/meta/chosen_event)
var/datum/event2/event/E = chosen_event.make_event()
chosen_event.times_ran++
if(!chosen_event.reusable)
// Disable this event, so it only gets picked once.
chosen_event.enabled = FALSE
if(chosen_event.event_class)
// Disable similar events, too.
for(var/M in available_events)
var/datum/event2/meta/meta = M
if(meta.event_class == chosen_event.event_class)
meta.enabled = FALSE
SSevent_ticker.event_started(E)
adjust_danger(chosen_event.chaos)
adjust_staleness(-(10 + chosen_event.chaos)) // More chaotic events reduce staleness more, e.g. a 25 chaos event will reduce it by 35.
// Tell the game master that something dangerous happened, e.g. someone dying, station explosions.
/datum/controller/subsystem/game_master/proc/adjust_danger(amount)
amount *= GM.danger_modifier
danger = round(between(0, danger + amount, 1000), 0.1)
// Tell the game master that things are getting boring if positive, or something interesting if negative..
/datum/controller/subsystem/game_master/proc/adjust_staleness(amount)
amount *= GM.staleness_modifier
staleness = round( between(-20, staleness + amount, 100), 0.1)
// These are ran before committing to an event.
// Returns TRUE if the system is allowed to procede, otherwise returns FALSE.
/datum/controller/subsystem/game_master/proc/pre_event_checks(quiet = FALSE)
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
if(!quiet)
log_game_master("Unable to start event: Ticker is nonexistant, or the game is not ongoing.")
return FALSE
if(GM.ignore_time_restrictions)
return TRUE
if(next_event > world.time) // Sanity.
if(!quiet)
log_game_master("Unable to start event: Time until next event is approximately [round((next_event - world.time) / (1 MINUTE))] minute(s)")
return FALSE
// Last minute antagging is bad for humans to do, so the GM will respect the start and end of the round.
var/mills = round_duration_in_ticks
var/mins = round((mills % 36000) / 600)
var/hours = round(mills / 36000)
// if(hours < 1 && mins <= 20) // Don't do anything for the first twenty minutes of the round.
// if(!quiet)
// log_debug("Game Master unable to start event: It is too early.")
// return FALSE
if(hours >= 2 && mins >= 40) // Don't do anything in the last twenty minutes of the round, as well.
if(!quiet)
log_game_master("Unable to start event: It is too late.")
return FALSE
return TRUE
/datum/controller/subsystem/game_master/proc/choose_game_master(mob/user)
var/list/subtypes = subtypesof(/datum/game_master)
var/new_gm_path = input(user, "What kind of Game Master do you want?", "New Game Master", /datum/game_master/default) as null|anything in subtypes
if(new_gm_path)
log_and_message_admins("has swapped the current GM ([GM.type]) for a new GM ([new_gm_path]).")
GM = new new_gm_path(src)
/datum/controller/subsystem/game_master/proc/log_game_master(message)
if(debug_messages)
log_debug("GAME MASTER: [message]")
// This object makes the actual decisions.
/datum/game_master
var/datum/controller/subsystem/game_master/ticker = null
// Multiplier for how much 'danger' is accumulated. Higer generally makes it possible for more dangerous events to be picked.
var/danger_modifier = 1.0
// Ditto. Higher numbers generally result in more events occuring in a round.
var/staleness_modifier = 1.0
var/decision_cooldown_lower_bound = 5 MINUTES // Lower bound for how long to wait until -the potential- for another event being decided.
var/decision_cooldown_upper_bound = 20 MINUTES // Same, but upper bound.
var/ignore_time_restrictions = FALSE // Useful for debugging without needing to wait 20 minutes each time.
var/ignore_round_chaos = FALSE // If true, the system will happily choose back to back intense events like meteors and blobs, Dwarf Fortress style.
/datum/game_master/New(datum/controller/subsystem/game_master/new_ticker)
ticker = new_ticker
/client/proc/show_gm_status()
set category = "Debug"
set name = "Show GM Status"
set desc = "Shows you what the GM is thinking. If only that existed in real life..."
if(check_rights(R_ADMIN|R_EVENT|R_DEBUG))
SSgame_master.interact(usr)
else
to_chat(usr, span("warning", "You do not have sufficent rights to view the GM panel, sorry."))
/datum/controller/subsystem/game_master/proc/interact(var/client/user)
if(!user)
return
// Using lists for string tree conservation.
var/list/dat = list("<html><head><title>Automated Game Master Event System</title></head><body>")
// Makes the system turn on or off.
dat += href(src, list("toggle" = 1), "\[Toggle GM\]")
dat += " | "
// Makes the system not care about staleness or being near round-end.
dat += href(src, list("toggle_time_restrictions" = 1), "\[Toggle Time Restrictions\]")
dat += " | "
// Makes the system not care about how chaotic the round might be.
dat += href(src, list("toggle_chaos_throttle" = 1), "\[Toggle Chaos Throttling\]")
dat += " | "
// Makes the system immediately choose an event, while still bound to factors like danger, weights, and department staffing.
dat += href(src, list("force_choose_event" = 1), "\[Force Event Decision\]")
dat += "<br>"
// Swaps out the current GM for a new one with different ideas on what a good event might be.
dat += href(src, list("change_gm" = 1), "\[Change GM\]")
dat += "<br>"
dat += "Current GM Type: [GM.type]<br>"
dat += "State: [can_fire ? "Active": "Inactive"]<br>"
dat += "Status: [pre_event_checks(TRUE) ? "Ready" : "Suppressed"]<br><br>"
dat += "Staleness: [staleness] "
dat += href(src, list("set_staleness" = 1), "\[Set\]")
dat += "<br>"
dat += "<i>Staleness is an estimate of how boring the round might be, and if an event should be done. It is increased passively over time, \
and increases faster if people are AFK. It deceases when events and certain 'interesting' things happen in the round.</i><br>"
dat += "Danger: [danger] "
dat += href(src, list("set_danger" = 1), "\[Set\]")
dat += "<br>"
dat += "<i>Danger is an estimate of how chaotic the round has been so far. It is decreased passively over time, and is increased by having \
certain chaotic events be selected, or chaotic things happen in the round. A sufficently high amount of danger will make the system \
avoid using destructive events, to avoid pushing the station over the edge.</i><br>"
dat += "<h2>Player Activity:</h2>"
dat += "<table border='1' style='width:100%'>"
dat += "<tr>"
dat += "<th>Category</th>"
dat += "<th>Activity Percentage</th>"
dat += "</tr>"
dat += "<tr>"
dat += "<td>All Living Mobs</td>"
dat += "<td>[metric.assess_all_living_mobs()]%</td>"
dat += "</tr>"
dat += "<tr>"
dat += "<td>All Ghosts</td>"
dat += "<td>[metric.assess_all_dead_mobs()]%</td>"
dat += "</tr>"
dat += "<tr>"
dat += "<th colspan='2'>Departments</td>"
dat += "</tr>"
for(var/D in metric.departments)
dat += "<tr>"
dat += "<td>[D]</td>"
dat += "<td>[metric.assess_department(D)]%</td>"
dat += "</tr>"
dat += "<tr>"
dat += "<th colspan='2'>Players</td>"
dat += "</tr>"
for(var/P in player_list)
var/mob/M = P
dat += "<tr>"
dat += "<td>[M] ([M.ckey])</td>"
dat += "<td>[metric.assess_player_activity(M)]%</td>"
dat += "</tr>"
dat += "</table>"
dat += "<h2>Events available:</h2>"
dat += "<table border='1' style='width:100%'>"
dat += "<tr>"
dat += "<th>Event Name</th>"
dat += "<th>Involved Departments</th>"
dat += "<th>Chaos</th>"
dat += "<th>Chaotic Threshold</th>"
dat += "<th>Weight</th>"
dat += "<th>Buttons</th>"
dat += "</tr>"
for(var/E in available_events)
var/datum/event2/meta/event = E
dat += "<tr>"
if(!event.enabled)
dat += "<td><strike>[event.name]</strike></td>"
else
dat += "<td>[event.name]</td>"
dat += "<td>[english_list(event.departments)]</td>"
dat += "<td>[event.chaos]</td>"
dat += "<td>[event.chaotic_threshold]</td>"
dat += "<td>[event.get_weight()]</td>"
dat += "<td>[href(event, list("force" = 1), "\[Force\]")] [href(event, list("toggle" = 1), "\[Toggle\]")]</td>"
dat += "</tr>"
dat += "</table>"
dat += "<h2>Events active:</h2>"
dat += "Current time: [world.time]"
dat += "<table border='1' style='width:100%'>"
dat += "<tr>"
dat += "<th>Event Type</th>"
dat += "<th>Time Started</th>"
dat += "<th>Time to Announce</th>"
dat += "<th>Time to End</th>"
dat += "<th>Announced</th>"
dat += "<th>Started</th>"
dat += "<th>Ended</th>"
dat += "<th>Buttons</th>"
dat += "</tr>"
for(var/E in SSevent_ticker.active_events)
var/datum/event2/event/event = E
dat += "<tr>"
dat += "<td>[event.type]</td>"
dat += "<td>[event.time_started]</td>"
dat += "<td>[event.time_to_announce ? event.time_to_announce : "NULL"]</td>"
dat += "<td>[event.time_to_end ? event.time_to_end : "NULL"]</td>"
dat += "<td>[event.announced ? "Yes" : "No"]</td>"
dat += "<td>[event.started ? "Yes" : "No"]</td>"
dat += "<td>[event.ended ? "Yes" : "No"]</td>"
dat += "<td>[href(event, list("abort" = 1), "\[Abort\]")]</td>"
dat += "</tr>"
dat += "</table>"
dat += "</body></html>"
dat += "<h2>Events completed:</h2>"
dat += "<table border='1' style='width:100%'>"
dat += "<tr>"
dat += "<th>Event Type</th>"
dat += "<th>Start Time</th>"
dat += "<th>Finish Time</th>"
dat += "</tr>"
for(var/E in SSevent_ticker.finished_events)
var/datum/event2/event/event = E
dat += "<tr>"
dat += "<td>[event.type]</td>"
dat += "<td>[event.time_started]</td>"
dat += "<td>[event.time_finished]</td>"
dat += "</tr>"
dat += "</body></html>"
var/datum/browser/popup = new(user, "game_master_debug", "Automated Game Master Event System", 800, 500, src)
popup.set_content(dat.Join())
popup.open()
/datum/controller/subsystem/game_master/Topic(href, href_list)
if(..())
return
if(href_list["close"]) // Needed or the window re-opens after closing, making it last forever.
return
if(!check_rights(R_ADMIN|R_EVENT|R_DEBUG))
message_admins("[usr] has attempted to modify the Game Master values without sufficent privilages.")
return
if(href_list["toggle"])
can_fire = !can_fire
message_admins("GM was [!can_fire ? "dis" : "en"]abled by [usr.key].")
if(href_list["toggle_time_restrictions"])
GM.ignore_time_restrictions = !GM.ignore_time_restrictions
message_admins("GM event time restrictions was [GM.ignore_time_restrictions ? "dis" : "en"]abled by [usr.key].")
if(href_list["toggle_chaos_throttle"])
GM.ignore_round_chaos = !GM.ignore_round_chaos
message_admins("GM event chaos restrictions was [GM.ignore_round_chaos ? "dis" : "en"]abled by [usr.key].")
if(href_list["force_choose_event"])
do_event_decision()
message_admins("[usr.key] forced the Game Master to choose an event immediately.")
if(href_list["change_gm"])
choose_game_master(usr)
if(href_list["set_staleness"])
var/amount = input(usr, "How much staleness should there be?", "Game Master") as null|num
if(!isnull(amount))
staleness = amount
message_admins("GM staleness was set to [amount] by [usr.key].")
if(href_list["set_danger"])
var/amount = input(usr, "How much danger should there be?", "Game Master") as null|num
if(!isnull(amount))
danger = amount
message_admins("GM danger was set to [amount] by [usr.key].")
interact(usr) // To refresh the UI.

View File

@@ -0,0 +1,6 @@
// Push button, receive event.
// Returns a selected event datum.
/datum/game_master/proc/choose_event()
/datum/game_master/proc/log_game_master(message)
SSgame_master.log_game_master(message)

View File

@@ -0,0 +1,89 @@
// The default game master tries to choose events with these goals in mind.
// * Don't choose an event if the crew can't take it. E.g. no meteors after half of the crew died.
// * Try to involve lots of people, particuarly in active departments.
// * Avoid giving events to the same department multiple times in a row.
/datum/game_master/default
// If an event was done for a specific department, it is written here, so it doesn't do it again.
var/last_department_used = null
/datum/game_master/default/choose_event()
log_game_master("Now starting event decision.")
var/list/most_active_departments = metric.assess_all_departments(3, list(last_department_used))
var/list/best_events = decide_best_events(most_active_departments)
if(LAZYLEN(best_events))
log_game_master("Got [best_events.len] choice\s for the next event.")
var/list/weighted_events = list()
for(var/E in best_events)
var/datum/event2/meta/event = E
var/weight = event.get_weight()
if(weight <= 0)
continue
weighted_events[event] = weight
log_game_master("Filtered down to [weighted_events.len] choice\s.")
var/datum/event2/meta/choice = pickweight(weighted_events)
if(choice)
log_game_master("[choice.name] was chosen, and is now being ran.")
last_department_used = LAZYACCESS(choice.departments, 1)
return choice
/datum/game_master/default/proc/decide_best_events(list/most_active_departments)
if(!LAZYLEN(most_active_departments)) // Server's empty?
log_game_master("Game Master failed to find any active departments.")
return list()
var/list/best_events = list()
if(most_active_departments.len >= 2)
var/list/top_two = list(most_active_departments[1], most_active_departments[2])
best_events = filter_events_by_departments(top_two)
if(LAZYLEN(best_events)) // We found something for those two, let's do it.
return best_events
// Otherwise we probably couldn't find something for the second highest group, so let's ignore them.
best_events = filter_events_by_departments(most_active_departments[1])
if(LAZYLEN(best_events))
return best_events
// At this point we should expand our horizons.
best_events = filter_events_by_departments(list(DEPARTMENT_EVERYONE))
if(LAZYLEN(best_events))
return best_events
// Just give a random event if for some reason it still can't make up its mind.
best_events = filter_events_by_departments()
if(LAZYLEN(best_events))
return best_events
log_game_master("Game Master failed to find a suitable event, something very wrong is going on.")
return list()
// Filters the available events down to events for specific departments.
// Pass DEPARTMENT_EVERYONE if you want events that target the general population, like gravity failure.
// If no list is passed, all the events will be returned.
/datum/game_master/default/proc/filter_events_by_departments(list/departments)
. = list()
for(var/E in ticker.available_events)
var/datum/event2/meta/event = E
if(!event.enabled)
continue
if(event.chaotic_threshold && !ignore_round_chaos)
if(ticker.danger > event.chaotic_threshold)
continue
// An event has to involve all of these departments to pass.
var/viable = TRUE
if(LAZYLEN(departments))
for(var/department in departments)
if(!LAZYFIND(departments, department))
viable = FALSE
break
if(viable)
. += event

View File

@@ -0,0 +1,44 @@
// The `classic` game master tries to act like the old system, choosing events without any specific goals.
// * Has no goals, and instead operates purely off of the weights of the events it has.
// * Does not react to danger at all.
/datum/game_master/classic/choose_event()
var/list/weighted_events = list()
for(var/E in ticker.available_events)
var/datum/event2/meta/event = E
if(!event.enabled)
continue
weighted_events[event] = event.get_weight()
var/datum/event2/meta/choice = pickweight(weighted_events)
if(choice)
log_game_master("[choice.name] was chosen, and is now being ran.")
return choice
// The `super_random` game master chooses events purely at random, ignoring weights entirely.
// * Has no goals, and instead chooses randomly, ignoring weights.
// * Does not react to danger at all.
/datum/game_master/super_random/choose_event()
return pick(ticker.available_events)
// The `brutal` game master tries to run dangerous events frequently.
// * Chaotic events have their weights artifically boosted.
// * Ignores accumulated danger.
/datum/game_master/brutal
ignore_round_chaos = TRUE
/datum/game_master/brutal/choose_event()
var/list/weighted_events = list()
for(var/E in ticker.available_events)
var/datum/event2/meta/event = E
if(!event.enabled)
continue
weighted_events[event] = event.get_weight() + (event.chaos * 2)
var/datum/event2/meta/choice = pickweight(weighted_events)
if(choice)
log_game_master("[choice.name] was chosen, and is now being ran.")
return choice

View File

@@ -70,6 +70,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
flags = RAD_SHIELDED
sound_env = SMALL_ENCLOSED
base_turf = /turf/space
forbid_events = TRUE
/area/shuttle/arrival
name = "\improper Arrival Shuttle"
@@ -807,6 +808,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "\improper Construction Area"
icon_state = "construction"
/area/hallway/secondary/entry
forbid_events = TRUE
/area/hallway/secondary/entry/fore
name = "\improper Shuttle Dock Hallway - Mid"
icon_state = "entry_1"
@@ -981,6 +985,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
icon_state = "Sleep"
flags = RAD_SHIELDED
ambience = AMBIENCE_GENERIC
forbid_events = TRUE
/area/crew_quarters/toilet
name = "\improper Dormitory Toilets"
@@ -1281,6 +1286,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
icon_state = "Holodeck"
dynamic_lighting = 0
sound_env = LARGE_ENCLOSED
forbid_events = TRUE
/area/holodeck/alphadeck
name = "\improper Holodeck Alpha"
@@ -1380,6 +1386,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "\improper Engine Room"
icon_state = "engine"
sound_env = LARGE_ENCLOSED
forbid_events = TRUE
/area/engineering/engine_airlock
name = "\improper Engine Room Airlock"

View File

@@ -42,6 +42,7 @@
var/turf/base_turf //The base turf type of the area, which can be used to override the z-level's base turf
var/global/global_uid = 0
var/uid
var/forbid_events = FALSE // If true, random events will not start inside this area.
/area/New()
uid = ++global_uid
@@ -366,6 +367,8 @@ var/list/mob/living/forced_ambiance_list = new
temp_airlock.prison_open()
for(var/obj/machinery/door/window/temp_windoor in src)
temp_windoor.open()
for(var/obj/machinery/door/blast/temp_blast in src)
temp_blast.open()
/area/has_gravity()
return has_gravity

View File

@@ -286,6 +286,9 @@
grow_as = list(/mob/living/simple_mob/animal/giant_spider, /mob/living/simple_mob/animal/giant_spider/hunter)
/obj/effect/spider/spiderling/non_growing
amount_grown = -1
/obj/effect/decal/cleanable/spiderling_remains
name = "spiderling remains"
desc = "Green squishy mess."

View File

@@ -65,6 +65,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/obj/item/device/paicard/pai = null // A slot for a personal AI device
var/spam_proof = FALSE // If true, it can't be spammed by random events.
/obj/item/device/pda/examine(mob/user)
if(..(user, 1))
to_chat(user, "The time [stationtime2text()] is displayed in the corner of the screen.")
@@ -334,6 +336,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/ai/pai
ttone = "assist"
/obj/item/device/pda/ai/shell
spam_proof = TRUE // Since empty shells get a functional PDA.
// Used for the PDA multicaster, which mirrors messages sent to it to a specific department,
/obj/item/device/pda/multicaster
@@ -342,6 +346,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
ttone = "data"
detonate = 0
news_silent = 1
spam_proof = TRUE // Spam messages don't actually work and its difficult to disable these.
var/list/cartridges_to_send_to = list()
// This is what actually mirrors the message,
@@ -1195,6 +1200,15 @@ var/global/list/obj/item/device/pda/PDAs = list()
log_pda("(PDA: [sending_unit]) sent \"[message]\" to [name]",usr)
new_message = 1
/obj/item/device/pda/proc/spam_message(sender, message)
var/reception_message = "\icon[src] <b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)"
new_info(message_silent, ttone, reception_message)
if(prob(50)) // Give the AI an increased chance to intercept the message
for(var/mob/living/silicon/ai/ai in mob_list)
if(ai.aiPDA != src)
ai.show_message("<i>Intercepted message from <b>[sender]</b></i> (Unknown / spam?) <i>to <b>[owner]</b>: [message]</i>")
/obj/item/device/pda/verb/verb_reset_pda()
set category = "Object"
set name = "Reset PDA"

View File

@@ -502,6 +502,7 @@
M.emote("gasp")
M.Weaken(rand(10,25))
M.updatehealth()
SSgame_master.adjust_danger(-20)
apply_brain_damage(M, deadtime)
/obj/item/weapon/shockpaddles/proc/apply_brain_damage(mob/living/carbon/human/H, var/deadtime)

View File

@@ -442,6 +442,13 @@
//this way it will only update full-tile ones
overlays.Cut()
if(!is_fulltile())
// Rotate the sprite somewhat so non-fulltiled windows can be seen as needing repair.
var/full_tilt_degrees = 15
var/tilt_to_apply = abs((health / maxhealth) - 1)
if(tilt_to_apply && prob(50))
tilt_to_apply = -tilt_to_apply
adjust_rotation(LERP(0, full_tilt_degrees, tilt_to_apply))
icon_state = "[basestate]"
return
var/list/dirs = list()

View File

@@ -231,10 +231,25 @@
// Wall-rot effect, a nasty fungus that destroys walls.
/turf/simulated/wall/proc/rot()
if(locate(/obj/effect/overlay/wallrot) in src)
return
return FALSE
// Wall-rot can't go onto walls that are surrounded in all four cardinal directions.
// Because of spores, or something. It's actually to avoid the pain that is removing wallrot surrounded by
// four r-walls.
var/at_least_one_open_turf = FALSE
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(src, direction)
if(!T.check_density())
at_least_one_open_turf = TRUE
break
if(!at_least_one_open_turf)
return FALSE
var/number_rots = rand(2,3)
for(var/i=0, i<number_rots, i++)
new/obj/effect/overlay/wallrot(src)
return TRUE
/turf/simulated/wall/proc/can_melt()
if(material.flags & MATERIAL_UNMELTABLE)

View File

@@ -107,7 +107,6 @@ var/gravity_is_on = 1
var/join_motd = null
var/datum/game_master/game_master = new() // Game Master, an AI for choosing events.
var/datum/metric/metric = new() // Metric datum, used to keep track of the round.
var/list/awaydestinations = list() // Away missions. A list of landmarks that the warpgate can take you to.

View File

@@ -1,18 +0,0 @@
/proc/level_seven_blob_announcement(var/obj/structure/blob/core/B)
if(!B || !B.overmind)
return
var/datum/blob_type/blob = B.overmind.blob_type // Shortcut so we don't need to delve into three variables every time.
var/list/lines = list()
lines += "Confirmed outbreak of level [7 + blob.difficulty] biohazard aboard [station_name()]. All personnel must contain the outbreak."
if(blob.difficulty >= BLOB_DIFFICULTY_MEDIUM) // Tell them what kind of blob it is if it's tough.
lines += "The biohazard has been identified as a '[blob.name]'."
if(blob.difficulty >= BLOB_DIFFICULTY_HARD) // If it's really hard then tell them where it is so the response occurs faster.
lines += "It is suspected to have originated from \the [get_area(B)]."
if(blob.difficulty >= BLOB_DIFFICULTY_SUPERHARD)
lines += "Extreme caution is advised."
command_announcement.Announce(lines.Join("\n"), "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')

View File

@@ -1,4 +1,4 @@
var/list/blobs = list()
GLOBAL_LIST_EMPTY(all_blobs)
/obj/structure/blob
name = "blob"
@@ -18,21 +18,21 @@ var/list/blobs = list()
var/mob/observer/blob/overmind = null
var/base_name = "blob" // The name that gets appended along with the blob_type's name.
/obj/structure/blob/New(var/newloc, var/new_overmind)
..(newloc)
/obj/structure/blob/Initialize(newloc, new_overmind)
if(new_overmind)
overmind = new_overmind
update_icon()
if(!integrity)
integrity = max_integrity
set_dir(pick(cardinal))
blobs += src
GLOB.all_blobs += src
consume_tile()
return ..()
/obj/structure/blob/Destroy()
playsound(src.loc, 'sound/effects/splat.ogg', 50, 1) //Expand() is no longer broken, no check necessary.
blobs -= src
GLOB.all_blobs -= src
overmind = null
return ..()
@@ -112,7 +112,7 @@ var/list/blobs = list()
if(overmind)
expand_probablity *= overmind.blob_type.spread_modifier
if(overmind.blob_type.slow_spread_with_size)
expand_probablity /= (blobs.len / 10)
expand_probablity /= (GLOB.all_blobs.len / 10)
if(distance <= expand_range)
var/can_expand = TRUE

View File

@@ -12,6 +12,7 @@ var/list/blob_cores = list()
health_regen = 0 //we regen in Life() instead of when pulsed
var/datum/blob_type/desired_blob_type = null // If this is set, the core always creates an overmind possessing this blob type.
var/difficulty_threshold = null // Otherwise if this is set, it picks a random blob_type that is equal or lower in difficulty.
var/difficulty_floor = null // Related to the above var, acts as a floor value to the above, inclusive.
var/core_regen = 2
var/overmind_get_delay = 0 //we don't want to constantly try to find an overmind, this var tracks when we'll try to get an overmind again
var/resource_delay = 0
@@ -23,14 +24,18 @@ var/list/blob_cores = list()
ai_controlled = FALSE
// Spawn these if you want a semi-random blob.
// Can give a random easy blob.
/obj/structure/blob/core/random_easy
difficulty_threshold = BLOB_DIFFICULTY_EASY
// Can give a random easy or medium blob.
/obj/structure/blob/core/random_medium
difficulty_threshold = BLOB_DIFFICULTY_MEDIUM
// Can give a random medium or hard blob.
/obj/structure/blob/core/random_hard
difficulty_threshold = BLOB_DIFFICULTY_HARD
difficulty_floor = BLOB_DIFFICULTY_MEDIUM
// Spawn these if you want a specific blob.
/obj/structure/blob/core/blazing_oil
@@ -81,8 +86,8 @@ var/list/blob_cores = list()
/obj/structure/blob/core/classic
desired_blob_type = /datum/blob_type/classic
/obj/structure/blob/core/New(var/newloc, var/client/new_overmind = null, new_rate = 2, placed = 0)
..(newloc)
/obj/structure/blob/core/Initialize(newloc, client/new_overmind = null, new_rate = 2, placed = 0)
. = ..(newloc)
blob_cores += src
START_PROCESSING(SSobj, src)
update_icon() //so it atleast appears
@@ -180,7 +185,9 @@ var/list/blob_cores = list()
var/list/valid_types = list()
for(var/thing in subtypesof(/datum/blob_type))
var/datum/blob_type/BT = thing
if(initial(BT.difficulty) > difficulty_threshold)
if(initial(BT.difficulty) > difficulty_threshold) // Too hard.
continue
if(initial(BT.difficulty) < difficulty_floor) // Too easy.
continue
valid_types += BT
return pick(valid_types)

View File

@@ -9,10 +9,10 @@
var/resource_delay = 0
var/resource_cooldown = 4 SECONDS
/obj/structure/blob/resource/New(var/newloc, var/new_overmind)
..(newloc, new_overmind)
/obj/structure/blob/resource/Initialize(newloc, new_overmind)
if(overmind)
overmind.resource_blobs += src
return ..()
/obj/structure/blob/resource/Destroy()
if(overmind)

View File

@@ -23,7 +23,7 @@ var/list/overminds = list()
var/ai_controlled = TRUE
var/auto_pilot = FALSE // If true, and if a client is attached, the AI routine will continue running.
/mob/observer/blob/New(var/newloc, pre_placed = 0, starting_points = 60, desired_blob_type = null)
/mob/observer/blob/Initialize(newloc, pre_placed = 0, starting_points = 60, desired_blob_type = null)
blob_points = starting_points
if(pre_placed) //we already have a core!
placed = 1
@@ -40,12 +40,11 @@ var/list/overminds = list()
color = blob_type.complementary_color
if(blob_core)
blob_core.update_icon()
level_seven_blob_announcement(blob_core)
..(newloc)
return ..(newloc)
/mob/observer/blob/Destroy()
for(var/BL in blobs)
for(var/BL in GLOB.all_blobs)
var/obj/structure/blob/B = BL
if(B && B.overmind == src)
B.overmind = null
@@ -66,7 +65,7 @@ var/list/overminds = list()
if(blob_core)
stat(null, "Core Health: [blob_core.integrity]")
stat(null, "Power Stored: [blob_points]/[max_blob_points]")
stat(null, "Total Blobs: [blobs.len]")
stat(null, "Total Blobs: [GLOB.all_blobs.len]")
/mob/observer/blob/Move(NewLoc, Dir = 0)
if(placed)

View File

@@ -22,6 +22,9 @@
to_chat(src, "<span class='warning'>There is no blob here!</span>")
return
if(B.overmind != src)
to_chat(src, span("warning", "This blob isn't controlled by you."))
if(!istype(B, /obj/structure/blob/normal))
to_chat(src, "<span class='warning'>Unable to use this blob, find a normal one.</span>")
return
@@ -66,7 +69,7 @@
return FALSE
var/obj/structure/blob/B = null
var/list/potential_blobs = blobs.Copy()
var/list/potential_blobs = GLOB.all_blobs.Copy()
while(potential_blobs.len)
var/obj/structure/blob/temp = pick(potential_blobs)
if(!(locate(/obj/structure/blob/node) in range(temp, BLOB_NODE_PULSE_RANGE) ) && !(locate(/obj/structure/blob/core) in range(temp, BLOB_CORE_PULSE_RANGE) ))
@@ -77,6 +80,8 @@
potential_blobs -= temp // Don't take up the core's shield spot.
else if(!istype(temp, /obj/structure/blob/normal))
potential_blobs -= temp // Not a normal blob.
else if(temp.overmind != src)
potential_blobs -= temp // Not our blob.
else
B = temp
break
@@ -107,7 +112,7 @@
return FALSE
var/obj/structure/blob/B = null
var/list/potential_blobs = blobs.Copy()
var/list/potential_blobs = GLOB.all_blobs.Copy()
while(potential_blobs.len)
var/obj/structure/blob/temp = pick(potential_blobs)
if(!(locate(/obj/structure/blob/node) in range(temp, BLOB_NODE_PULSE_RANGE) ) && !(locate(/obj/structure/blob/core) in range(temp, BLOB_CORE_PULSE_RANGE) ))
@@ -118,6 +123,8 @@
potential_blobs -= temp // Don't take up the core's shield spot.
else if(!istype(temp, /obj/structure/blob/normal))
potential_blobs -= temp // Not a normal blob.
else if(temp.overmind != src)
potential_blobs -= temp // Not our blob.
else
B = temp
break
@@ -149,7 +156,7 @@
return FALSE
var/obj/structure/blob/B = null
var/list/potential_blobs = blobs.Copy()
var/list/potential_blobs = GLOB.all_blobs.Copy()
while(potential_blobs.len)
var/obj/structure/blob/temp = pick(potential_blobs)
if(locate(/obj/structure/blob/node) in range(temp, 5) )
@@ -158,6 +165,8 @@
potential_blobs -= temp
else if(!istype(temp, /obj/structure/blob/normal))
potential_blobs -= temp
else if(temp.overmind != src)
potential_blobs -= temp // Not our blob.
else
B = temp
break
@@ -184,7 +193,7 @@
other_T = get_step(T, direction)
if(other_T)
B = locate(/obj/structure/blob) in other_T
if(B)
if(B && B.overmind == src)
break
if(!B)
@@ -216,7 +225,7 @@
for(var/direction in cardinal)
var/turf/T = get_step(L, direction)
B = locate(/obj/structure/blob) in T
if(B)
if(B && B.overmind == src)
break
if(!B)
continue

View File

@@ -137,27 +137,29 @@
activeFor++
//Called when start(), announce() and end() has all been called.
/datum/event/proc/kill()
/datum/event/proc/kill(external_use = FALSE)
// If this event was forcefully killed run end() for individual cleanup
if(isRunning)
isRunning = 0
end()
endedAt = world.time
SSevents.event_complete(src)
if(!external_use)
SSevents.event_complete(src)
//Called during building of skybox to get overlays
/datum/event/proc/get_skybox_image()
return
/datum/event/New(var/datum/event_meta/EM)
/datum/event/New(var/datum/event_meta/EM, external_use = FALSE)
// event needs to be responsible for this, as stuff like APLUs currently make their own events for curious reasons
SSevents.active_events += src
if(!external_use)
SSevents.active_events += src
event_meta = EM
severity = event_meta.severity
if(severity < EVENT_LEVEL_MUNDANE) severity = EVENT_LEVEL_MUNDANE
if(severity > EVENT_LEVEL_MAJOR) severity = EVENT_LEVEL_MAJOR
event_meta = EM
severity = event_meta.severity
if(severity < EVENT_LEVEL_MUNDANE) severity = EVENT_LEVEL_MUNDANE
if(severity > EVENT_LEVEL_MAJOR) severity = EVENT_LEVEL_MAJOR
startedAt = world.time

View File

@@ -52,7 +52,7 @@ var/list/event_last_fired = list()
possibleEvents[/datum/event/pda_spam] = max(min(25, player_list.len) * 4, 200)
possibleEvents[/datum/event/money_lotto] = max(min(5, player_list.len), 50)
if(account_hack_attempted)
if(GLOB.account_hack_attempted)
possibleEvents[/datum/event/money_hacker] = max(min(25, player_list.len) * 4, 200)

View File

@@ -1,5 +1,7 @@
//var/global/account_hack_attempted = 0
GLOBAL_VAR_INIT(account_hack_attempted, 0)
/datum/event/money_hacker
var/datum/money_account/affected_account
endWhen = 100
@@ -10,7 +12,7 @@
if(all_money_accounts.len)
affected_account = pick(all_money_accounts)
account_hack_attempted = 1
GLOB.account_hack_attempted = 1
else
kill()

View File

@@ -1,27 +0,0 @@
/datum/gm_action
var/name = "no name" // Simple name, for organization.
var/enabled = TRUE // If not enabled, this action is never taken.
var/departments = list() // What kinds of departments are affected by this action. Multiple departments can be listed.
var/chaotic = 0 // A number showing how chaotic the action may be. If danger is high, the GM will avoid it.
var/reusable = FALSE // If true, the event does not become disabled upon being used. Should be used sparingly.
var/observers_used = FALSE // Determines if the GM should check if ghosts are available before using this.
var/length = 0 // Determines how long the event lasts, until end() is called.
var/datum/game_master/gm = null
var/severity = 1 // The severity of the action. This is here to prevent continued future defining of this var on actions, un-used.
/datum/gm_action/proc/set_up()
return
/datum/gm_action/proc/get_weight()
return
/datum/gm_action/proc/start()
if(!reusable)
enabled = FALSE
return
/datum/gm_action/proc/end()
return
/datum/gm_action/proc/announce()
return

View File

@@ -1,77 +0,0 @@
/datum/gm_action/atmos_leak
name = "atmospherics leak"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SYNTHETIC)
var/area/target_area // Chosen target area
var/area/target_turf // Chosen target turf in target_area
var/gas_type // Chosen gas to release
// Exclude these types and sub-types from targeting eligibilty
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters,
/area/holodeck,
/area/engineering/engine_room
)
severity
// Decide which area will be targeted!
/datum/gm_action/atmos_leak/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 8,
EVENT_LEVEL_MODERATE = 5,
EVENT_LEVEL_MAJOR = 3
)
var/gas_choices = list("carbon_dioxide", "sleeping_agent") // Annoying
if(severity >= EVENT_LEVEL_MODERATE)
gas_choices += "phoron" // Dangerous
if(severity >= EVENT_LEVEL_MAJOR)
gas_choices += "volatile_fuel" // Dangerous and no default atmos setup!
gas_type = pick(gas_choices)
var/list/area/grand_list_of_areas = get_station_areas(excluded)
// Okay, now lets try and pick a target! Lets try 10 times, otherwise give up
for(var/i in 1 to 10)
var/area/A = pick(grand_list_of_areas)
if(is_area_occupied(A))
log_debug("atmos_leak event: Rejected [A] because it is occupied.")
continue
// A good area, great! Lets try and pick a turf
var/list/turfs = list()
for(var/turf/simulated/floor/F in A)
if(turf_clear(F))
turfs += F
if(turfs.len == 0)
log_debug("atmos_leak event: Rejected [A] because it has no clear turfs.")
continue
target_area = A
target_turf = pick(turfs)
// If we can't find a good target, give up
if(!target_area)
log_debug("atmos_leak event: Giving up after too many failures to pick target area")
return
/datum/gm_action/atmos_leak/announce()
if(target_area)
command_announcement.Announce("Warning, hazardous [gas_data.name[gas_type]] gas leak detected in \the [target_area], evacuate the area.", "Hazard Alert")
/datum/gm_action/atmos_leak/start()
if(!target_turf)
return
..()
spawn(rand(0, 600))
// Okay, time to actually put the gas in the room!
// TODO - Would be nice to break a waste pipe perhaps?
// TODO - Maybe having it released from a single point and thus causing airflow to blow stuff around
// Fow now just add a bunch of it to the air
var/datum/gas_mixture/air_contents = new
air_contents.temperature = T20C + ((severity - 1) * rand(-50, 50))
air_contents.gas[gas_type] = 10 * MOLES_CELLSTANDARD
target_turf.assume_air(air_contents)
playsound(target_turf, 'sound/effects/smoke.ogg', 50, 1)
/datum/gm_action/atmos_leak/get_weight()
return 15 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 30) // Synthetics are counted in higher value because they can wirelessly connect to alarms.

View File

@@ -1,74 +0,0 @@
/datum/gm_action/blob
name = "blob infestation"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL)
chaotic = 25
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters,
/area/holodeck,
/area/engineering/engine_room
)
var/area/target_area // Chosen target area
var/turf/target_turf // Chosen target turf in target_area
var/obj/structure/blob/core/Blob
var/spawn_blob_type = /obj/structure/blob/core/random_medium
/datum/gm_action/blob/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 4,
EVENT_LEVEL_MODERATE = 2,
EVENT_LEVEL_MAJOR = 1
)
var/list/area/grand_list_of_areas = get_station_areas(excluded)
for(var/i in 1 to 10)
var/area/A = pick(grand_list_of_areas)
if(is_area_occupied(A))
log_debug("Blob infestation event: Rejected [A] because it is occupied.")
continue
var/list/turfs = list()
for(var/turf/simulated/floor/F in A)
if(turf_clear(F))
turfs += F
if(turfs.len == 0)
log_debug("Blob infestation event: Rejected [A] because it has no clear turfs.")
continue
target_area = A
target_turf = pick(turfs)
if(!target_area)
log_debug("Blob infestation event: Giving up after too many failures to pick target area")
/datum/gm_action/blob/start()
..()
var/turf/T
if(severity == EVENT_LEVEL_MUNDANE || !target_area || !target_turf)
T = pick(blobstart)
else if(severity == EVENT_LEVEL_MODERATE)
T = target_turf
else
T = target_turf
spawn_blob_type = /obj/structure/blob/core/random_hard
Blob = new spawn_blob_type(T)
/datum/gm_action/blob/announce()
spawn(rand(600, 3000)) // 1-5 minute leeway for the blob to go un-detected.
command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')
/datum/gm_action/blob/get_weight()
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/assigned_staff = engineers + security
if(engineers || security) // Medical only counts if one of the other two exists, and even then they count as half.
assigned_staff += round(medical / 2)
var/weight = (max(assigned_staff - 2, 0) * 20) // An assigned staff count of 2 must be had to spawn a blob.
return weight

View File

@@ -1,69 +0,0 @@
/datum/gm_action/brand_intelligence
name = "rampant vending machines"
length = 30 MINUTES
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
var/list/obj/machinery/vending/vendingMachines = list()
var/list/obj/machinery/vending/infectedVendingMachines = list()
var/obj/machinery/vending/originMachine
var/start_time = 0
var/active = FALSE // Are we currently infecting?
/datum/gm_action/brand_intelligence/announce()
if(prob(90))
command_announcement.Announce("An ongoing mass upload of malware for vendors has been detected onboard [station_name()], which appears to transmit \
to other nearby vendors. The original infected machine is believed to be \a [originMachine.name].", "Vendor Service Alert")
/datum/gm_action/brand_intelligence/set_up()
vendingMachines.Cut()
infectedVendingMachines.Cut()
for(var/obj/machinery/vending/V in machines)
if(isNotStationLevel(V.z)) continue
vendingMachines.Add(V)
if(!vendingMachines.len)
length = 0
return
originMachine = pick(vendingMachines)
vendingMachines.Remove(originMachine)
originMachine.shut_up = 0
originMachine.shoot_inventory = 1
start_time = world.time
active = TRUE
/datum/gm_action/brand_intelligence/start()
..()
while(originMachine || active)
if(!vendingMachines.len || !originMachine || originMachine.shut_up) //if every machine is infected, or if the original vending machine is missing or has it's voice switch flipped
end()
return
if(ISMULTIPLE(world.time - start_time, 5))
if(prob(15))
var/obj/machinery/vending/infectedMachine = pick(vendingMachines)
vendingMachines.Remove(infectedMachine)
infectedVendingMachines.Add(infectedMachine)
infectedMachine.shut_up = 0
infectedMachine.shoot_inventory = 1
if(ISMULTIPLE(world.time - start_time, 12))
originMachine.speak(pick("Try our aggressive new marketing strategies!", \
"You should buy products to feed your lifestyle obsession!", \
"Consume!", \
"Your money can buy happiness!", \
"Engage direct marketing!", \
"Advertising is legalized lying! But don't let that put you off our great deals!", \
"You don't want to buy anything? Yeah, well I didn't want to buy your mom either."))
/datum/gm_action/brand_intelligence/end()
active = FALSE
for(var/obj/machinery/vending/infectedMachine in infectedVendingMachines)
infectedMachine.shut_up = 1
infectedMachine.shoot_inventory = 0
/datum/gm_action/brand_intelligence/get_weight()
return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20)

View File

@@ -1,52 +0,0 @@
/datum/gm_action/camera_damage
name = "random camera damage"
reusable = TRUE
departments = list(DEPARTMENT_SYNTHETIC, DEPARTMENT_ENGINEERING)
/datum/gm_action/camera_damage/start()
var/obj/machinery/camera/C = acquire_random_camera()
if(!C)
return
..()
var/severity_range = 0
severity = pickweight(EVENT_LEVEL_MUNDANE = 10,
EVENT_LEVEL_MODERATE = 5,
EVENT_LEVEL_MAJOR = 1
)
switch(severity)
if(EVENT_LEVEL_MUNDANE)
severity_range = 0
if(EVENT_LEVEL_MODERATE)
severity_range = 7
if(EVENT_LEVEL_MAJOR)
severity_range = 15
for(var/obj/machinery/camera/cam in range(severity_range,C))
if(is_valid_camera(cam))
if(prob(2*severity))
cam.destroy()
else
cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0)
if(prob(5*severity))
cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0)
/datum/gm_action/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
if(!cameranet.cameras.len)
return
if(!remaining_attempts)
return
var/obj/machinery/camera/C = pick(cameranet.cameras)
if(is_valid_camera(C))
return C
return acquire_random_camera(remaining_attempts--)
/datum/gm_action/camera_damage/proc/is_valid_camera(var/obj/machinery/camera/C)
// Only return a functional camera, not installed in a silicon/hardsuit/circuit/etc, and that exists somewhere players have access
var/turf/T = get_turf(C)
return T && C.can_use() && istype(C.loc, /turf) && (T.z in using_map.player_levels)
/datum/gm_action/camera_damage/get_weight()
return 40 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 40)

View File

@@ -1,58 +0,0 @@
//carp_migration
/datum/gm_action/carp_migration
name = "carp migration"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
chaotic = 50
var/list/spawned_carp = list()
var/carp_amount = 0
length = 20 MINUTES
/datum/gm_action/carp_migration/get_weight()
return 50 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 20)
/datum/gm_action/carp_migration/announce()
var/announcement = "Unknown biological entities have been detected near [station_name()], please stand-by."
command_announcement.Announce(announcement, "Lifesign Alert")
/datum/gm_action/carp_migration/set_up()
// Higher filled roles means more groups of fish.
var/station_strength = 0
station_strength += (metric.count_people_in_department(DEPARTMENT_SECURITY) * 3)
station_strength += (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 2)
station_strength += metric.count_people_in_department(DEPARTMENT_MEDICAL)
// Less active emergency response departments tones the event down.
var/activeness = ((metric.assess_department(DEPARTMENT_SECURITY) + metric.assess_department(DEPARTMENT_ENGINEERING) + metric.assess_department(DEPARTMENT_MEDICAL)) / 3)
activeness = max(activeness, 20)
carp_amount = CEILING(station_strength * (activeness / 100) + 1, 1)
/datum/gm_action/carp_migration/start()
..()
var/list/spawn_locations = list()
var/group_size_min = 3
var/group_size_max = 5
for(var/obj/effect/landmark/C in landmarks_list)
if(C.name == "carpspawn")
spawn_locations.Add(C.loc)
spawn_locations = shuffle(spawn_locations)
carp_amount = min(carp_amount, spawn_locations.len)
var/i = 1
while (i <= carp_amount)
var/group_size = rand(group_size_min, group_size_max)
for (var/j = 1, j <= group_size, j++)
spawned_carp.Add(new /mob/living/simple_mob/animal/space/carp/event(spawn_locations[i]))
i++
message_admins("[spawned_carp.len] carp spawned by event.")
/datum/gm_action/carp_migration/end()
for(var/mob/living/simple_mob/animal/space/carp/C in spawned_carp)
if(!C.stat)
var/turf/T = get_turf(C)
if(istype(T, /turf/space))
if(!prob(25))
qdel(C)

View File

@@ -1,21 +0,0 @@
/datum/gm_action/comms_blackout
name = "communications blackout"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
chaotic = 35
/datum/gm_action/comms_blackout/get_weight()
return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 40)
/datum/gm_action/comms_blackout/announce()
if(prob(33))
command_announcement.Announce("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT", new_sound = 'sound/misc/interference.ogg')
// AIs will always know if there's a comm blackout, rogue AIs could then lie about comm blackouts in the future while they shutdown comms
for(var/mob/living/silicon/ai/A in player_list)
to_chat(A, "<br>")
to_chat(A, "<span class='warning'><b>Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT</b></span>")
to_chat(A, "<br>")
/datum/gm_action/comms_blackout/start()
..()
for(var/obj/machinery/telecomms/T in telecomms_list)
T.emp_act(1)

View File

@@ -1,10 +0,0 @@
/datum/gm_action/security_drill
name = "security drills"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
/datum/gm_action/security_drill/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("[pick("A NanoTrasen security director", "A Vir-Gov correspondant", "Local Sif authoritiy")] has advised the enactment of [pick("a rampant wildlife", "a fire", "a hostile boarding", "a nonstandard", "a bomb", "an emergent intelligence")] drill with the personnel onboard \the [station_name()].", "Security Advisement")
/datum/gm_action/security_drill/get_weight()
return max(-20, 10 + gm.staleness - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5)

View File

@@ -1,17 +0,0 @@
/datum/gm_action/dust
name = "dust"
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 10
reusable = TRUE
/datum/gm_action/dust/announce()
command_announcement.Announce("Debris resulting from activity on another nearby asteroid is approaching your colony.", "Dust Alert")
/datum/gm_action/dust/get_weight()
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/weight = 30 + (engineers * 25)
return weight
/datum/gm_action/dust/start()
..()
dust_swarm("norm")

View File

@@ -1,33 +0,0 @@
/datum/gm_action/electrical_storm
name = "electrical storm"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/lightsoutAmount = 1
var/lightsoutRange = 25
/datum/gm_action/electrical_storm/announce()
command_announcement.Announce("An electrical issue has been detected in your area, please repair potential electronic overloads.", "Electrical Alert")
/datum/gm_action/electrical_storm/start()
..()
var/list/epicentreList = list()
for(var/i=1, i <= lightsoutAmount, i++)
var/list/possibleEpicentres = list()
for(var/obj/effect/landmark/newEpicentre in landmarks_list)
if(newEpicentre.name == "lightsout" && !(newEpicentre in epicentreList))
possibleEpicentres += newEpicentre
if(possibleEpicentres.len)
epicentreList += pick(possibleEpicentres)
else
break
if(!epicentreList.len)
return
for(var/obj/effect/landmark/epicentre in epicentreList)
for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange))
apc.overload_lighting()
/datum/gm_action/electrical_storm/get_weight()
return 30 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 15) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)

View File

@@ -1,75 +0,0 @@
/datum/gm_action/electrified_door
name = "airlock short-circuit"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_MEDICAL)
chaotic = 10
var/obj/machinery/door/airlock/chosen_door
var/area/target_area
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters
)
/datum/gm_action/electrified_door/set_up()
var/list/area/grand_list_of_areas = get_station_areas(excluded)
severity = pickweight(EVENT_LEVEL_MUNDANE = 10,
EVENT_LEVEL_MODERATE = 5,
EVENT_LEVEL_MAJOR = 1
)
//try 10 times
for(var/i in 1 to 10)
target_area = pick(grand_list_of_areas)
var/list/obj/machinery/door/airlock/target_doors = list()
for(var/obj/machinery/door/airlock/target_door in target_area.contents)
target_doors += target_door
target_doors = shuffle(target_doors)
for(var/obj/machinery/door/airlock/target_door in target_doors)
if(!target_door.isElectrified() && target_door.arePowerSystemsOn() && target_door.maxhealth == target_door.health)
chosen_door = target_door
return
/datum/gm_action/electrified_door/start()
..()
if(!chosen_door)
return
command_announcement.Announce("An electrical issue has been detected in your area, please repair potential electronic overloads.", "Electrical Alert")
chosen_door.visible_message("<span class='danger'>\The [chosen_door]'s panel sparks!</span>")
chosen_door.set_safeties(0)
playsound(get_turf(chosen_door), 'sound/machines/buzz-sigh.ogg', 50, 1)
if(severity >= EVENT_LEVEL_MODERATE)
chosen_door.electrify(-1)
spawn(rand(10 SECONDS, 2 MINUTES))
if(chosen_door && chosen_door.arePowerSystemsOn() && prob(25 + 25 * severity))
command_announcement.Announce("Overload has been localized to \the [target_area].", "Electrical Alert")
if(severity >= EVENT_LEVEL_MAJOR) // New Major effect. Hydraulic boom.
spawn()
chosen_door.visible_message("<span class='warning'>\The [chosen_door] buzzes.</span>")
playsound(get_turf(chosen_door), 'sound/machines/buzz-sigh.ogg', 50, 1)
sleep(rand(10 SECONDS, 3 MINUTES))
if(!chosen_door || !chosen_door.arePowerSystemsOn())
return
chosen_door.visible_message("<span class='warning'>\The [chosen_door]'s hydraulics creak.</span>")
playsound(get_turf(chosen_door), 'sound/machines/airlock_creaking.ogg', 50, 1)
sleep(rand(30 SECONDS, 10 MINUTES))
if(!chosen_door || !chosen_door.arePowerSystemsOn())
return
chosen_door.visible_message("<span class='danger'>\The [chosen_door] emits a hydraulic shriek!</span>")
playsound(get_turf(chosen_door), 'sound/machines/airlock.ogg', 80, 1)
spawn(rand(5 SECONDS, 30 SECONDS))
if(!chosen_door || !chosen_door.arePowerSystemsOn())
return
chosen_door.visible_message("<span class='critical'>\The [chosen_door]'s hydraulics detonate!</span>")
chosen_door.fragmentate(get_turf(chosen_door), rand(5, 10), rand(3, 5), list(/obj/item/projectile/bullet/pellet/fragment/tank/small))
explosion(get_turf(chosen_door),-1,-1,2,3)
chosen_door.lock()
chosen_door.health = chosen_door.maxhealth / 6
chosen_door.aiControlDisabled = 1
chosen_door.update_icon()
/datum/gm_action/electrified_door/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 5 + metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10)

View File

@@ -1,36 +0,0 @@
/datum/gm_action/gravity
name = "gravity failure"
departments = list(DEPARTMENT_EVERYONE)
length = 600
var/list/zLevels
/datum/gm_action/gravity/set_up()
length = rand(length, length * 5)
// Setup which levels we will disrupt gravit on.
zLevels = using_map.station_levels.Copy()
for(var/datum/planet/P in SSplanets.planets)
zLevels -= P.expected_z_levels
/datum/gm_action/gravity/announce()
command_announcement.Announce("Feedback surge detected in mass-distributions systems. Artificial gravity has been disabled whilst the system \
reinitializes. Please stand by while the gravity system reinitializes.", "Gravity Failure")
/datum/gm_action/gravity/start()
..()
gravity_is_on = 0
for(var/area/A in all_areas)
if(A.z in zLevels)
A.gravitychange(gravity_is_on)
/datum/gm_action/gravity/end()
if(!gravity_is_on)
gravity_is_on = 1
for(var/area/A in all_areas)
if(A.z in zLevels)
A.gravitychange(gravity_is_on)
command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "Gravity Restored")
/datum/gm_action/gravity/get_weight()
return 30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)

View File

@@ -1,23 +0,0 @@
// New grid check event:
// Very similar to the old one, power goes out in most of the colony, however the new feature is the ability for engineering to
// get power back on sooner, if they are able to reach a special machine and initiate a manual reboot. If no one is able to do so,
// it will reboot itself after a few minutes, just like the old one. Bad things happen if there is no grid checker machine protecting
// the powernet when this event fires.
/datum/gm_action/grid_check
name = "grid check"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
chaotic = 20
/datum/gm_action/grid_check/get_weight()
return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30)
/datum/gm_action/grid_check/start()
..()
// This sets off a chain of events that lead to the actual grid check (or perhaps worse).
// First, the Supermatter engine makes a power spike.
for(var/obj/machinery/power/generator/engine in machines)
engine.power_spike()
break // Just one engine, please.
// After that, the engine checks if a grid checker exists on the same powernet, and if so, it triggers a blackout.
// If not, lots of stuff breaks. See code/modules/power/generator.dm for that piece of code.

View File

@@ -1,116 +0,0 @@
#define LOC_KITCHEN 0
#define LOC_ATMOS 1
#define LOC_CHAPEL 2
#define LOC_LIBRARY 3
#define LOC_HYDRO 4
#define LOC_VAULT 5
#define LOC_CONSTR 6
#define LOC_TECH 7
#define LOC_GARDEN 8
#define VERM_MICE 0
#define VERM_LIZARDS 1
#define VERM_SPIDERS 2
/datum/gm_action/infestation
name = "animal infestation"
departments = list(DEPARTMENT_EVERYONE)
var/location
var/locstring
var/vermin
var/vermstring
var/list/turf/simulated/floor/turfs = list()
var/spawn_types
var/max_number
/datum/gm_action/infestation/set_up()
location = rand(0,8)
turfs.Cut()
var/spawn_area_type
switch(location)
if(LOC_KITCHEN)
spawn_area_type = /area/crew_quarters/kitchen
locstring = "the kitchen"
if(LOC_ATMOS)
spawn_area_type = /area/engineering/atmos
locstring = "atmospherics"
if(LOC_CHAPEL)
spawn_area_type = /area/chapel/main
locstring = "the chapel"
if(LOC_LIBRARY)
spawn_area_type = /area/library
locstring = "the library"
if(LOC_HYDRO)
spawn_area_type = /area/hydroponics
locstring = "hydroponics"
if(LOC_VAULT)
spawn_area_type = /area/security/nuke_storage
locstring = "the vault"
if(LOC_CONSTR)
spawn_area_type = /area/construction
locstring = "the construction area"
if(LOC_TECH)
spawn_area_type = /area/storage/tech
locstring = "technical storage"
if(LOC_GARDEN)
spawn_area_type = /area/hydroponics/garden
locstring = "the public garden"
for(var/areapath in typesof(spawn_area_type))
var/area/A = locate(areapath)
for(var/turf/simulated/floor/F in A.contents)
if(turf_clear(F))
turfs += F
spawn_types = list()
max_number = 0
vermin = rand(0,2)
switch(vermin)
if(VERM_MICE)
spawn_types = list(/mob/living/simple_mob/animal/passive/mouse/gray, /mob/living/simple_mob/animal/passive/mouse/brown, /mob/living/simple_mob/animal/passive/mouse/white, /mob/living/simple_mob/animal/passive/mouse/rat)
max_number = 12
vermstring = "mice"
if(VERM_LIZARDS)
spawn_types = list(/mob/living/simple_mob/animal/passive/lizard, /mob/living/simple_mob/animal/passive/lizard, /mob/living/simple_mob/animal/passive/lizard/large, /mob/living/simple_mob/animal/passive/lizard/large/defensive)
max_number = 6
vermstring = "lizards"
if(VERM_SPIDERS)
spawn_types = list(/obj/effect/spider/spiderling)
max_number = 3
vermstring = "spiders"
/datum/gm_action/infestation/start()
spawn()
var/num = rand(2,max_number)
while(turfs.len > 0 && num > 0)
var/turf/simulated/floor/T = pick(turfs)
turfs.Remove(T)
num--
if(vermin == VERM_SPIDERS)
var/obj/effect/spider/spiderling/S = new(T)
S.amount_grown = -1
else
var/spawn_type = pick(spawn_types)
new spawn_type(T)
/datum/gm_action/infestation/announce()
command_announcement.Announce("Bioscans indicate that [vermstring] have been breeding in [locstring]. Clear them out, before this starts to affect productivity.", "Vermin infestation")
/datum/gm_action/infestation/get_weight()
return 5 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)
#undef LOC_KITCHEN
#undef LOC_ATMOS
#undef LOC_CHAPEL
#undef LOC_LIBRARY
#undef LOC_HYDRO
#undef LOC_VAULT
#undef LOC_TECH
#undef LOC_GARDEN
#undef VERM_MICE
#undef VERM_LIZARDS
#undef VERM_SPIDERS

View File

@@ -1,50 +0,0 @@
/datum/gm_action/ionstorm
name = "ion storm"
departments = list(DEPARTMENT_SYNTHETIC)
var/botEmagChance = 0.5
var/list/players = list()
var/active = FALSE
length = 1 MINUTE
/datum/gm_action/ionstorm/set_up()
length = rand(length, length * 10)
// command_alert("The station has entered an ion storm. Monitor all electronic equipment for malfunctions", "Anomaly Alert")
for (var/mob/living/carbon/human/player in player_list)
if( !player.mind || player_is_antag(player.mind, only_offstation_roles = 1) || player.client.inactivity > MinutesToTicks(10))
continue
players += player.real_name
for (var/mob/living/silicon/ai/target in silicon_mob_list)
var/law = target.generate_ion_law()
to_chat(target, "<font color='red'><b>You have detected a change in your laws information:</b></font>")
to_chat(target,law)
target.add_ion_law(law)
target.show_laws()
/datum/gm_action/ionstorm/announce()
if(message_servers)
for (var/obj/machinery/message_server/MS in message_servers)
MS.spamfilter.Cut()
var/i
for (i = 1, i <= MS.spamfilter_limit, i++)
MS.spamfilter += pick("kitty","HONK","rev","malf","liberty","freedom","drugs", "[using_map.station_short]", \
"admin","ponies","heresy","meow","Pun Pun","monkey","Ian","moron","pizza","message","spam",\
"director", "Hello", "Hi!"," ","nuke","crate","dwarf","xeno")
/datum/gm_action/ionstorm/start()
while(active)
sleep(1)
if(botEmagChance)
for(var/mob/living/bot/bot in mob_list)
if(prob(botEmagChance))
bot.emag_act(1)
/datum/gm_action/ionstorm/end()
spawn(rand(5000,8000))
if(prob(50))
ion_storm_announcement()
/datum/gm_action/ionstorm/get_weight()
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
var/weight = 5 + (bots * 20)
return weight

View File

@@ -1,52 +0,0 @@
/datum/gm_action/manifest_malfunction
name = "manifest malfunction"
enabled = TRUE
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC, DEPARTMENT_EVERYONE)
chaotic = 3
reusable = FALSE
length = 0
var/recordtype
/datum/gm_action/manifest_malfunction/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 6,
EVENT_LEVEL_MODERATE = 2,
EVENT_LEVEL_MAJOR = 1
)
recordtype = pickweight("medical" = 10,"security" = (severity * 15))
return
/datum/gm_action/manifest_malfunction/get_weight()
. = -10
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
if(security && data_core)
. += (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) - (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5)
return .
/datum/gm_action/manifest_malfunction/start()
..()
var/manifest_cut_count = 1 * severity
for(var/I = 1 to manifest_cut_count)
var/datum/data/record/R
switch(recordtype)
if("security")
R = pick(data_core.security)
if("medical")
R = pick(data_core.medical)
qdel(R)
/datum/gm_action/manifest_malfunction/announce()
if(prob(30 * severity))
spawn(rand(5 MINUTES, 10 MINUTES))
command_announcement.Announce("An ongoing mass upload of malware for [recordtype] record cores has been detected onboard [station_name()]", "Data Breach Alert")
return

View File

@@ -1,71 +0,0 @@
// 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(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO)
chaotic = 50
var/direction = null
var/dir_text = null
var/waves = 0
var/meteor_types
/datum/gm_action/meteor_defense/get_weight()
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
var/weight = (max(engineers - 1, 0) * 20) // If only one engineer exists, no meteors for now.
if(engineers >= 2)
weight += ((cargo - 1) * 10)
weight += (bots * 15)
return weight
/datum/gm_action/meteor_defense/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 10,
EVENT_LEVEL_MODERATE = 3
)
switch(severity)
if(EVENT_LEVEL_MUNDANE)
meteor_types = meteors_threatening.Copy()
if(EVENT_LEVEL_MODERATE)
meteor_types = meteors_catastrophic.Copy()
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 asteroids have collided near [station_name()]. Chunks of it are expected to approach from the [dir_text] side. ETA to arrival is \
approximately [round(5 * severity * 2)] minutes."
command_announcement.Announce(announcement, "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/gm_action/meteor_defense/start()
..()
spawn(0)
sleep(round(5 * severity) MINUTES)
var/announcement = "The incoming debris are expected to approach from the [dir_text] side. ETA to arrival is approximately [round(5 * severity)] minutes."
command_announcement.Announce(announcement, "Meteor Alert - Update")
sleep(round(5 * severity) 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 station has cleared the incoming debris."
command_announcement.Announce(announcement, "Meteor Alert - Update")
message_admins("Meteor defense event has ended.")

View File

@@ -1,79 +0,0 @@
/var/global/account_hack_attempted = 0
/datum/gm_action/money_hacker
name = "bank account hacker"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/datum/money_account/affected_account
var/active
var/activeFor
var/end_time
/datum/gm_action/money_hacker/set_up()
active = TRUE
end_time = world.time + 6000
if(all_money_accounts.len)
affected_account = pick(all_money_accounts)
account_hack_attempted = 1
/datum/gm_action/money_hacker/announce()
var/message = "A brute force hack has been detected (in progress since [stationtime2text()]). The target of the attack is: Financial account #[affected_account.account_number], \
without intervention this attack will succeed in approximately 10 minutes. Required intervention: temporary suspension of affected accounts until the attack has ceased. \
Notifications will be sent as updates occur.<br>"
var/my_department = "[station_name()] firewall subroutines"
for(var/obj/machinery/message_server/MS in machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
/datum/gm_action/money_hacker/start()
..()
spawn(0)
while(active)
sleep(1)
activeFor++
if(world.time >= end_time)
length = activeFor
else
length = activeFor + 10
/datum/gm_action/money_hacker/end()
active = FALSE
var/message
if(affected_account && !affected_account.suspended)
//hacker wins
message = "The hack attempt has succeeded."
//subtract the money
var/lost = affected_account.money * 0.8 + (rand(2,4) - 2) / 10
affected_account.money -= lost
//create a taunting log entry
var/datum/transaction/T = new()
T.target_name = pick("","yo brotha from anotha motha","el Presidente","chieF smackDowN","Nobody")
T.purpose = pick("Ne$ ---ount fu%ds init*&lisat@*n","PAY BACK YOUR MUM","Funds withdrawal","pWnAgE","l33t hax","liberationez","Hit","Nothing")
T.amount = pick("","([rand(0,99999)])","alla money","9001$","HOLLA HOLLA GET DOLLA","([lost])")
var/date1 = "31 December, 1999"
var/date2 = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [rand(1000,3000)]"
T.date = pick("", current_date_string, date1, date2,"Nowhen")
var/time1 = rand(0, 99999999)
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
T.time = pick("", stationtime2text(), time2, "Never")
T.source_terminal = pick("","[pick("Biesel","New Gibson")] GalaxyNet Terminal #[rand(111,999)]","your mums place","nantrasen high CommanD","Angessa's Pearl","Nowhere")
affected_account.transaction_log.Add(T)
else
//crew wins
message = "The attack has ceased, the affected accounts can now be brought online."
var/my_department = "[station_name()] firewall subroutines"
for(var/obj/machinery/message_server/MS in machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
/datum/gm_action/money_hacker/get_weight()
return 30 * all_money_accounts.len

View File

@@ -1,39 +0,0 @@
/datum/gm_action/money_lotto
name = "lottery win"
departments = list(DEPARTMENT_EVERYONE)
var/winner_name = "John Smith"
var/winner_sum = 0
var/deposit_success = 0
/datum/gm_action/money_lotto/start()
..()
winner_sum = pick(5000, 10000, 50000, 100000, 500000, 1000000, 1500000)
if(all_money_accounts.len)
var/datum/money_account/D = pick(all_money_accounts)
winner_name = D.owner_name
if(!D.suspended)
D.money += winner_sum
var/datum/transaction/T = new()
T.target_name = "The [using_map.starsys_name] Times Grand Slam -Stellar- Lottery"
T.purpose = "Winner!"
T.amount = winner_sum
T.date = current_date_string
T.time = stationtime2text()
T.source_terminal = "Sif TCD Terminal #[rand(111,333)]"
D.transaction_log.Add(T)
deposit_success = 1
/datum/gm_action/money_lotto/announce()
var/author = "[using_map.company_name] Editor"
var/channel = "The [using_map.starsys_name] Times"
var/body = "The [using_map.starsys_name] Times wishes to congratulate <b>[winner_name]</b> for recieving the [using_map.starsys_name] Stellar Slam Lottery, and receiving the out of this world sum of [winner_sum] credits!"
if(!deposit_success)
body += "<br>Unfortunately, we were unable to verify the account details provided, so we were unable to transfer the money. Send a cheque containing the sum of 5000 Thalers to ND 'Stellar Slam' office on the The [using_map.starsys_name] Times gateway containing updated details, and your winnings'll be re-sent within the month."
news_network.SubmitArticle(body, author, channel, null, 1)
/datum/gm_action/money_lotto/get_weight()
return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE)

View File

@@ -1,131 +0,0 @@
/datum/gm_action/pda_spam
name = "PDA spam"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/last_spam_time = 0
var/obj/machinery/message_server/useMS
var/obj/machinery/exonet_node/node
/datum/gm_action/pda_spam/set_up()
last_spam_time = world.time
pick_message_server()
/datum/gm_action/pda_spam/proc/pick_message_server()
if(message_servers)
for (var/obj/machinery/message_server/MS in message_servers)
if(MS.active)
useMS = MS
break
/datum/gm_action/pda_spam/start()
..()
while(world.time < last_spam_time + 3000)
if(!node)
node = get_exonet_node()
if(!node || !node.on || !node.allow_external_PDAs)
return
if(!useMS || !useMS.active)
useMS = null
pick_message_server()
if(useMS)
if(prob(5))
// /obj/machinery/message_server/proc/send_pda_message(var/recipient = "",var/sender = "",var/message = "")
var/obj/item/device/pda/P
var/list/viables = list()
for(var/obj/item/device/pda/check_pda in sortAtom(PDAs))
if (!check_pda.owner||check_pda.toff||check_pda == src||check_pda.hidden)
continue
viables.Add(check_pda)
if(!viables.len)
return
P = pick(viables)
var/sender
var/message
switch(pick(1,2,3,4,5,6,7))
if(1)
sender = pick("MaxBet","MaxBet Online Casino","There is no better time to register","I'm excited for you to join us")
message = pick("Triple deposits are waiting for you at MaxBet Online when you register to play with us.",\
"You can qualify for a 200% Welcome Bonus at MaxBet Online when you sign up today.",\
"Once you are a player with MaxBet, you will also receive lucrative weekly and monthly promotions.",\
"You will be able to enjoy over 450 top-flight casino games at MaxBet.")
if(2)
sender = pick(300;"QuickDatingSystem",200;"Find your russian bride",50;"Tajaran beauties are waiting",50;"Find your secret skrell crush",50;"Beautiful unathi brides")
message = pick("Your profile caught my attention and I wanted to write and say hello (QuickDating).",\
"If you will write to me on my email [pick(first_names_female)]@[pick(last_names)].[pick("ru","ck","tj","ur","nt")] I shall necessarily send you a photo (QuickDating).",\
"I want that we write each other and I hope, that you will like my profile and you will answer me (QuickDating).",\
"You have (1) new message!",\
"You have (2) new profile views!")
if(3)
sender = pick("Galactic Payments Association","Better Business Bureau","[using_map.starsys_name] E-Payments","NAnoTransen Finance Deparmtent","Luxury Replicas")
message = pick("Luxury watches for Blowout sale prices!",\
"Watches, Jewelry & Accessories, Bags & Wallets !",\
"Deposit 100$ and get 300$ totally free!",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
"We have been filed with a complaint from one of your customers in respect of their business relations with you.",\
"We kindly ask you to open the COMPLAINT REPORT (attached) to reply on this complaint..")
if(4)
sender = pick("Buy Dr. Maxman","Having dysfuctional troubles?")
message = pick("DR MAXMAN: REAL Doctors, REAL Science, REAL Results!",\
"Dr. Maxman was created by George Acuilar, M.D, a [using_map.boss_short] Certified Urologist who has treated over 70,000 patients sector wide with 'male problems'.",\
"After seven years of research, Dr Acuilar and his team came up with this simple breakthrough male enhancement formula.",\
"Men of all species report AMAZING increases in length, width and stamina.")
if(5)
sender = pick("Dr","Crown prince","King Regent","Professor","Captain")
sender += " " + pick("Robert","Alfred","Josephat","Kingsley","Sehi","Zbahi")
sender += " " + pick("Mugawe","Nkem","Gbatokwia","Nchekwube","Ndim","Ndubisi")
message = pick("YOUR FUND HAS BEEN MOVED TO [pick("Salusa","Segunda","Cepheus","Andromeda","Gruis","Corona","Aquila","ARES","Asellus")] DEVELOPMENTARY BANK FOR ONWARD REMITTANCE.",\
"We are happy to inform you that due to the delay, we have been instructed to IMMEDIATELY deposit all funds into your account",\
"Dear fund beneficiary, We have please to inform you that overdue funds payment has finally been approved and released for payment",\
"Due to my lack of agents I require an off-world financial account to immediately deposit the sum of 1 POINT FIVE MILLION credits.",\
"Greetings sir, I regretfully to inform you that as I lay dying here due to my lack ofheirs I have chosen you to recieve the full sum of my lifetime savings of 1.5 billion credits")
if(6)
sender = pick("[using_map.company_name] Morale Divison","Feeling Lonely?","Bored?","www.wetskrell.nt")
message = pick("The [using_map.company_name] Morale Division wishes to provide you with quality entertainment sites.",\
"WetSkrell.nt is a xenophillic website endorsed by NT for the use of male crewmembers among it's many stations and outposts.",\
"Wetskrell.nt only provides the higest quality of male entertaiment to [using_map.company_name] Employees.",\
"Simply enter your [using_map.company_name] Bank account system number and pin. With three easy steps this service could be yours!")
if(7)
sender = pick("You have won free tickets!","Click here to claim your prize!","You are the 1000th vistor!","You are our lucky grand prize winner!")
message = pick("You have won tickets to the newest ACTION JAXSON MOVIE!",\
"You have won tickets to the newest crime drama DETECTIVE MYSTERY IN THE CLAMITY CAPER!",\
"You have won tickets to the newest romantic comedy 16 RULES OF LOVE!",\
"You have won tickets to the newest thriller THE CULT OF THE SLEEPING ONE!")
if (useMS.send_pda_message("[P.owner]", sender, message)) //Message been filtered by spam filter.
return
last_spam_time = world.time
/* //VOREStation Removal: no need to spam the AI tenfold
if (prob(50)) //Give the AI an increased chance to intercept the message
for(var/mob/living/silicon/ai/ai in mob_list)
// Allows other AIs to intercept the message but the AI won't intercept their own message.
if(ai.aiPDA != P && ai.aiPDA != src)
ai.show_message("<i>Intercepted message from <b>[sender]</b></i> (Unknown / spam?) <i>to <b>[P:owner]</b>: [message]</i>")
*/
//Commented out because we don't send messages like this anymore. Instead it will just popup in their chat window.
//P.tnote += "<i><b>&larr; From [sender] (Unknown / spam?):</b></i><br>[message]<br>"
if (!P.message_silent)
playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(3, P.loc))
if(!P.message_silent) O.show_message(text("[bicon(P)] *[P.ttone]*"))
//Search for holder of the PDA.
var/mob/living/L = null
if(P.loc && isliving(P.loc))
L = P.loc
//Maybe they are a pAI!
else
L = get(P, /mob/living/silicon)
if(L)
to_chat(L, "[bicon(P)] <b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)")
/datum/gm_action/pda_spam/get_weight()
return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE)

View File

@@ -1,35 +0,0 @@
/datum/gm_action/planet_weather_shift
name = "sudden weather shift"
enabled = TRUE
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/datum/planet/target_planet
var/list/banned_weathers = list(
//VOREStation Edit - Virgo 3B Weather,
/datum/weather/virgo3b/ash_storm,
/datum/weather/virgo3b/emberfall,
/datum/weather/virgo3b/blood_moon,
/datum/weather/virgo3b/fallout)
//VOREStation Edit End
var/list/possible_weathers = list()
/datum/gm_action/planet_weather_shift/set_up()
if(!target_planet || isnull(target_planet))
target_planet = pick(SSplanets.planets)
possible_weathers |= target_planet.weather_holder.allowed_weather_types
possible_weathers -= banned_weathers
return
/datum/gm_action/planet_weather_shift/get_weight()
return max(0, -15 + (metric.count_all_outdoor_mobs() * 20))
/datum/gm_action/planet_weather_shift/start()
..()
var/new_weather = pick(possible_weathers)
target_planet.weather_holder.change_weather(new_weather)
/datum/gm_action/planet_weather_shift/announce()
spawn(rand(3 SECONDS, 2 MINUTES))
command_announcement.Announce("Local weather patterns on [target_planet.name] suggest that a sudden atmospheric fluctuation has occurred. All groundside personnel should be wary of rapidly deteriorating conditions.", "Weather Alert")
return

View File

@@ -1,93 +0,0 @@
/datum/gm_action/prison_break
name = "prison break"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC)
var/start_time = 0
var/active = FALSE // Are we doing stuff?
var/releaseWhen = 60 // The delay for the breakout to occur.
var/list/area/areas = list() // List of areas to affect. Filled by start()
var/eventDept = "Security" // Department name in announcement
var/list/areaName = list("Brig") // Names of areas mentioned in AI and Engineering announcements
var/list/areaType = list(/area/security/prison, /area/security/brig) // Area types to include.
var/list/areaNotType = list() // Area types to specifically exclude.
/datum/gm_action/prison_break/get_weight()
var/afflicted_staff = 0
var/assigned_staff = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
for(var/department in departments)
afflicted_staff += round(metric.count_people_in_department(department) / 2)
var/weight = 20 + (assigned_staff * 10)
if(assigned_staff)
weight += afflicted_staff
return weight
/datum/gm_action/prison_break/virology
name = "virology breakout"
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_SYNTHETIC)
eventDept = "Medical"
areaName = list("Virology")
areaType = list(/area/medical/virology, /area/medical/virologyaccess)
/datum/gm_action/prison_break/xenobiology
name = "xenobiology breakout"
departments = list(DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC)
eventDept = "Science"
areaName = list("Xenobiology")
areaType = list(/area/rnd/xenobiology)
areaNotType = list(/area/rnd/xenobiology/xenoflora, /area/rnd/xenobiology/xenoflora_storage)
/datum/gm_action/prison_break/station
name = "station-wide breakout"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC)
eventDept = "Station"
areaName = list("Brig","Virology","Xenobiology")
areaType = list(/area/security/prison, /area/security/brig, /area/medical/virology, /area/medical/virologyaccess, /area/rnd/xenobiology)
areaNotType = list(/area/rnd/xenobiology/xenoflora, /area/rnd/xenobiology/xenoflora_storage)
/datum/gm_action/prison_break/set_up()
releaseWhen = rand(60, 90)
start_time = world.time
active = TRUE
length = releaseWhen + 1 SECOND
/datum/gm_action/prison_break/announce()
if(areas && areas.len > 0)
command_announcement.Announce("[pick("Gr3y.T1d3 virus","Malignant trojan")] detected in [station_name()] [(eventDept == "Security")? "imprisonment":"containment"] subroutines. Secure any compromised areas immediately. Station AI involvement is recommended.", "[eventDept] Alert")
/datum/gm_action/prison_break/start()
..()
for(var/area/A in all_areas)
if(is_type_in_list(A,areaType) && !is_type_in_list(A,areaNotType))
areas += A
if(areas && areas.len > 0)
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [stationtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
for(var/obj/machinery/message_server/MS in machines)
MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2)
for(var/mob/living/silicon/ai/A in player_list)
to_chat(A, "<span class='danger'>Malicious program detected in the [english_list(areaName)] lighting and airlock control systems by [my_department].</span>")
else
to_world_log("ERROR: Could not initate grey-tide. Unable to find suitable containment area.")
if(areas && areas.len > 0)
spawn()
while(active)
sleep(1)
if(world.time >= releaseWhen + start_time)
var/obj/machinery/power/apc/theAPC = null
for(var/area/A in areas)
theAPC = A.get_apc()
if(theAPC.operating) //If the apc's off, it's a little hard to overload the lights.
for(var/obj/machinery/light/L in A)
L.flicker(10)
/datum/gm_action/prison_break/end()
active = FALSE
for(var/area/A in shuffle(areas))
A.prison_break()

View File

@@ -1,67 +0,0 @@
/datum/gm_action/radiation_storm
name = "radiation storm"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/enterBelt = 30
var/radIntervall = 5
var/leaveBelt = 80
var/revokeAccess = 165
var/activeFor = 0
var/postStartTicks = 0
var/active = FALSE
/datum/gm_action/radiation_storm/announce()
command_announcement.Announce("High levels of radiation detected near \the [station_name()]. Please evacuate into one of the shielded maintenance tunnels.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
/datum/gm_action/radiation_storm/set_up()
active = TRUE
/datum/gm_action/radiation_storm/start()
..()
make_maint_all_access()
while(active)
sleep(1 SECOND)
activeFor ++
if(activeFor == enterBelt)
command_announcement.Announce("The station has entered the radiation belt. Please remain in a sheltered area until we have passed the radiation belt.", "Anomaly Alert")
radiate()
if(activeFor >= enterBelt && activeFor <= leaveBelt)
postStartTicks++
if(postStartTicks == radIntervall)
postStartTicks = 0
radiate()
else if(activeFor == leaveBelt)
command_announcement.Announce("The station has passed the radiation belt. Please allow for up to one minute while radiation levels dissipate, and report to medbay if you experience any unusual symptoms. Maintenance will lose all access again shortly.", "Anomaly Alert")
/datum/gm_action/radiation_storm/proc/radiate()
var/radiation_level = rand(15, 35)
for(var/z in using_map.station_levels)
SSradiation.z_radiate(locate(1, 1, z), radiation_level, 1)
for(var/mob/living/carbon/C in living_mob_list)
var/area/A = get_area(C)
if(!A)
continue
if(A.flags & RAD_SHIELDED)
continue
if(istype(C,/mob/living/carbon/human))
var/mob/living/carbon/human/H = C
if(prob(5))
if (prob(75))
randmutb(H) // Applies bad mutation
domutcheck(H,null,MUTCHK_FORCED)
else
randmutg(H) // Applies good mutation
domutcheck(H,null,MUTCHK_FORCED)
/datum/gm_action/radiation_storm/end()
spawn(revokeAccess SECONDS)
revoke_maint_all_access()
/datum/gm_action/radiation_storm/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10) + (metric.count_all_space_mobs() * 40) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)

View File

@@ -1,23 +0,0 @@
// The random spawn proc on the antag datum will handle announcing the spawn and whatnot.
/datum/gm_action/random_antag
name = "random antagonist"
departments = list(DEPARTMENT_EVERYONE)
chaotic = 30
reusable = TRUE
/datum/gm_action/random_antag/start()
..()
var/list/valid_types = list()
for(var/antag_type in all_antag_types)
var/datum/antagonist/antag = all_antag_types[antag_type]
if(antag.flags & ANTAG_RANDSPAWN)
valid_types |= antag
if(valid_types.len)
var/datum/antagonist/antag = pick(valid_types)
antag.attempt_random_spawn()
/datum/gm_action/random_antag/get_weight()
. = ..()
if(gm)
var/weight = max(0, (metric.count_people_in_department(DEPARTMENT_SECURITY) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + gm.staleness)
return weight

View File

@@ -1,63 +0,0 @@
/datum/gm_action/rogue_drone
name = "rogue drones"
departments = list(DEPARTMENT_SECURITY)
chaotic = 60
length = 20 MINUTES
var/list/drones_list = list()
/datum/gm_action/rogue_drone/start()
..()
//spawn them at the same place as carp
var/list/possible_spawns = list()
for(var/obj/effect/landmark/C in landmarks_list)
if(C.name == "carpspawn")
possible_spawns.Add(C)
//25% chance for this to be a false alarm
var/num
if(prob(25))
num = 0
else
num = rand(2,6)
for(var/i=0, i<num, i++)
var/mob/living/simple_mob/mechanical/combat_drone/event/D = new(get_turf(pick(possible_spawns)))
drones_list.Add(D)
/datum/gm_action/rogue_drone/announce()
var/msg
var/rng = rand(1,5)
switch(rng)
if(1)
msg = "A combat drone wing operating in close orbit above Sif has failed to return from a anti-piracy sweep. If any are sighted, \
approach with caution."
if(2)
msg = "Contact has been lost with a combat drone wing in Sif orbit. If any are sighted in the area, approach with \
caution."
if(3)
msg = "Unidentified hackers have targeted a combat drone wing deployed around Sif. If any are sighted in the area, approach with caution."
if(4)
msg = "A passing derelict ship's drone defense systems have just activated. If any are sighted in the area, use caution."
if(5)
msg = "We're detecting a swarm of small objects approaching your station. Most likely a bunch of drones. Please exercise caution if you see any."
command_announcement.Announce(msg, "Rogue drone alert")
/datum/gm_action/rogue_drone/end()
var/num_recovered = 0
for(var/mob/living/simple_mob/mechanical/combat_drone/D in drones_list)
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
sparks.set_up(3, 0, D.loc)
sparks.start()
D.z = using_map.admin_levels[1]
D.loot_list = list()
qdel(D)
num_recovered++
if(num_recovered > drones_list.len * 0.75)
command_announcement.Announce("The drones that were malfunctioning have been recovered safely.", "Rogue drone alert")
else
command_announcement.Announce("We're disappointed at the loss of the drones, but the survivors have been recovered.", "Rogue drone alert")
/datum/gm_action/rogue_drone/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 30)

View File

@@ -1,49 +0,0 @@
/datum/gm_action/security_screening
name = "security screening"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
var/list/species_weights = list(
SPECIES_SKRELL = 9,
SPECIES_UNATHI = 15,
SPECIES_HUMAN_VATBORN = 6,
SPECIES_TESHARI = 2,
SPECIES_TAJ = 3,
SPECIES_DIONA = 1,
SPECIES_ZADDAT = 25,
SPECIES_HUMAN = 3,
SPECIES_PROMETHEAN = 30
)
var/list/synth_weights = list(
"Cybernetic" = 15,
"Drone" = 30,
"Positronic" = 25
)
var/list/end_weights = list()
/datum/gm_action/security_screening/set_up()
for(var/species_name in species_weights)
var/giveweight = 0
for(var/datum/data/record/R in data_core.general)
if(R.fields["species"] == species_name)
giveweight += species_weights[species_name]
end_weights[species_name] = giveweight
for(var/bottype in synth_weights)
var/giveweight = 0
for(var/datum/data/record/R in data_core.general)
if(R.fields["brain_type"] == bottype)
giveweight += synth_weights[bottype]
end_weights[bottype] = giveweight
/datum/gm_action/security_screening/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("[pick("A nearby Navy vessel", "A Solar official", "A Vir-Gov official", "A NanoTrasen board director")] has requested the screening of [pick("every other", "every", "suspicious", "willing")] [pickweight(end_weights)] personnel onboard \the [station_name()].", "Security Advisement")
/datum/gm_action/security_screening/get_weight()
return max(-20, 10 + round(gm.staleness * 1.5) - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5)

View File

@@ -1,17 +0,0 @@
/datum/gm_action/shipping_error
name = "shipping error"
departments = list(DEPARTMENT_CARGO)
reusable = TRUE
/datum/gm_action/shipping_error/get_weight()
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/weight = (cargo * 40)
return weight
/datum/gm_action/shipping_error/start()
..()
var/datum/supply_order/O = new /datum/supply_order()
O.ordernum = SSsupply.ordernum
O.object = SSsupply.supply_pack[pick(SSsupply.supply_pack)]
O.ordered_by = random_name(pick(MALE,FEMALE), species = "Human")
SSsupply.shoppinglist += O

View File

@@ -1,56 +0,0 @@
/datum/gm_action/solar_storm
name = "solar storm"
var/rad_interval = 1 SECOND
var/base_solar_gen_rate
length = 3 MINUTES
var/duration // Duration for the storm
var/start_time = 0
reusable = TRUE
/datum/gm_action/solar_storm/set_up()
start_time = world.time
duration = length
duration += rand(-1 * 1 MINUTE, 1 MINUTE)
/datum/gm_action/solar_storm/announce()
command_announcement.Announce("A solar storm has been detected approaching \the [station_name()]. Please halt all EVA activites immediately and return to the interior of the station.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
adjust_solar_output(1.5)
/datum/gm_action/solar_storm/proc/adjust_solar_output(var/mult = 1)
if(isnull(base_solar_gen_rate)) base_solar_gen_rate = GLOB.solar_gen_rate
GLOB.solar_gen_rate = mult * base_solar_gen_rate
/datum/gm_action/solar_storm/start()
..()
length = duration
command_announcement.Announce("The solar storm has reached the station. Please refain from EVA and remain inside the station until it has passed.", "Anomaly Alert")
adjust_solar_output(5)
var/start_time = world.time
spawn()
while(world.time <= start_time + duration)
sleep(rad_interval)
radiate()
/datum/gm_action/solar_storm/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) + (metric.count_all_space_mobs() * 30)
/datum/gm_action/solar_storm/proc/radiate()
// Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case.
for(var/mob/living/L in player_list)
var/turf/T = get_turf(L)
if(!T)
continue
if(!istype(T.loc,/area/space) && !istype(T,/turf/space)) //Make sure you're in a space area or on a space turf
continue
//Todo: Apply some burn damage from the heat of the sun. Until then, enjoy some moderate radiation.
L.rad_act(rand(15, 30))
/datum/gm_action/solar_storm/end()
command_announcement.Announce("The solar storm has passed the station. It is now safe to resume EVA activities. Please report to medbay if you experience any unusual symptoms. ", "Anomaly Alert")
adjust_solar_output()
length = initial(length)

View File

@@ -1,14 +0,0 @@
/datum/gm_action/spacevine
name = "space-vine infestation"
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 2
/datum/gm_action/spacevine/start()
..()
spacevine_infestation()
/datum/gm_action/spacevine/announce()
level_seven_announcement()
/datum/gm_action/spacevine/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10)

View File

@@ -1,56 +0,0 @@
/datum/gm_action/spider_infestation
name = "spider infestation"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 30
severity = 1
var/spawncount = 1
var/spawntype = /obj/effect/spider/spiderling
/datum/gm_action/spider_infestation/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = max(1,(12 - (3 * metric.count_people_in_department(DEPARTMENT_SECURITY)))),
EVENT_LEVEL_MODERATE = (7 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY))),
EVENT_LEVEL_MAJOR = (1 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY)))
)
switch(severity)
if(EVENT_LEVEL_MUNDANE)
spawntype = /obj/effect/spider/spiderling/stunted
if(EVENT_LEVEL_MODERATE)
spawntype = /obj/effect/spider/spiderling
if(EVENT_LEVEL_MAJOR)
spawntype = /obj/effect/spider/spiderling
spawncount = rand(4 * severity, 6 * severity)
/datum/gm_action/spider_infestation/announce()
command_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg')
if(severity >= EVENT_LEVEL_MAJOR)
spawn(rand(600, 3000))
command_announcement.Announce("Unidentified lifesigns previously detected coming aboard [station_name()] have been classified as a swarm of arachnids. Extreme caution is advised.", "Arachnid Alert")
/datum/gm_action/spider_infestation/start()
..()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in using_map.station_levels)
if(temp_vent.network.normal_members.len > 50)
vents += temp_vent
while((spawncount >= 1) && vents.len)
var/obj/vent = pick(vents)
new /obj/effect/spider/spiderling(vent.loc)
vents -= vent
spawncount--
/datum/gm_action/spider_infestation/get_weight()
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/engineering = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/assigned_staff = security + round(medical / 2) + round(engineering / 2)
return 10 + (assigned_staff * 15)

View File

@@ -1,13 +0,0 @@
/datum/gm_action/spontaneous_appendicitis
name = "appendicitis"
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 1
/datum/gm_action/spontaneous_appendicitis/start()
..()
for(var/mob/living/carbon/human/H in shuffle(living_mob_list))
if(H.client && !player_is_antag(H.mind) && H.appendicitis())
break
/datum/gm_action/spontaneous_appendicitis/get_weight()
return max(0, -5 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10))

View File

@@ -1,14 +0,0 @@
/datum/gm_action/station_fund_raise
name = "local funding drive"
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_CARGO, DEPARTMENT_EVERYONE)
/datum/gm_action/station_fund_raise/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("Due to [pick("recent", "unfortunate", "possible future")] budget [pick("changes", "issues")], in-system stations are now advised to increase funding income.", "Security & Supply Advisement")
/datum/gm_action/station_fund_raise/get_weight()
var/weight_modifier = 0.5
if(station_account.money <= 80000)
weight_modifier = 1
return (max(-20, 10 + gm.staleness) + ((metric.count_people_in_department(DEPARTMENT_SECURITY) + (metric.count_people_in_department(DEPARTMENT_CARGO))) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 3)) * weight_modifier

View File

@@ -1,80 +0,0 @@
/datum/gm_action/stowaway
name = "stowaway pod"
departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY)
chaotic = 10
observers_used = TRUE
var/area/target_area // Chosen target area
var/area/target_turf // Chosen target turf in target_area
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters,
/area/holodeck,
/area/engineering/engine_room
)
var/list/area/included = list(
/area/maintenance
)
/datum/gm_action/stowaway/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 20,
EVENT_LEVEL_MODERATE = 5,
EVENT_LEVEL_MAJOR = 1
)
var/list/area/grand_list_of_areas = get_station_areas(excluded)
for(var/area/Incl in included)
for(var/area/A in grand_list_of_areas)
if(!istype(A, Incl))
grand_list_of_areas -= A
// Okay, now lets try and pick a target! Lets try 10 times, otherwise give up
for(var/i in 1 to 10)
var/area/A = pick(grand_list_of_areas)
if(is_area_occupied(A))
log_debug("[name] event: Rejected [A] because it is occupied.")
continue
// A good area, great! Lets try and pick a turf
var/list/turfs = list()
for(var/turf/simulated/floor/F in A)
if(turf_clear(F))
turfs += F
if(turfs.len == 0)
log_debug("[name] event: Rejected [A] because it has no clear turfs.")
continue
target_area = A
target_turf = pick(turfs)
if(!target_area)
log_debug("[name] event: Giving up after too many failures to pick target area")
return
/datum/gm_action/stowaway/start()
if(!target_turf)
return
..()
var/obj/structure/ghost_pod/ghost_activated/human/HP = new (target_turf)
if(severity == EVENT_LEVEL_MUNDANE || istype(ticker.mode, /datum/game_mode/extended))
HP.make_antag = MODE_STOWAWAY
else if(severity == EVENT_LEVEL_MODERATE)
HP.make_antag = MODE_RENEGADE
HP.occupant_type = "renegade [HP.occupant_type]"
else if(severity == EVENT_LEVEL_MAJOR)
HP.make_antag = MODE_INFILTRATOR
HP.occupant_type = "volatile [HP.occupant_type]"
say_dead_object("A <span class='notice'>[HP.occupant_type]</span> pod is now available in \the [target_area].", HP)
/datum/gm_action/stowaway/get_weight()
return -20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 15 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5 + metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1)
/datum/gm_action/stowaway/announce()
spawn(rand(15 MINUTES, 30 MINUTES))
if(prob(20) && severity >= EVENT_LEVEL_MODERATE && atc && !atc.squelched)
atc.msg("Attention civilian vessels in [using_map.starsys_name] shipping lanes, caution is advised as [pick("an unidentified vessel", "a known criminal's vessel", "a derelict vessel")] has been detected passing multiple local stations.")

View File

@@ -1,65 +0,0 @@
/datum/gm_action/nanotrasen_budget_allocation
name = "supply point to cargo budget"
enabled = TRUE
departments = list(DEPARTMENT_CARGO)
chaotic = 0
reusable = TRUE
var/datum/controller/subsystem/supply/SC
var/running = FALSE
var/last_run
var/thaler_earned
/datum/gm_action/nanotrasen_budget_allocation/New()
..()
SC = SSsupply
/datum/gm_action/nanotrasen_budget_allocation/set_up()
running = TRUE
return
/datum/gm_action/nanotrasen_budget_allocation/get_weight()
. = round(SC.points / 15)
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/personnel = metric.count_people_in_department(DEPARTMENT_EVERYONE)
if(cargo)
. = round(SC.points / (10 + personnel)) + cargo * 10
if(running || ( world.time < (last_run + 30 MINUTES)))
. = 0
return .
/datum/gm_action/nanotrasen_budget_allocation/start()
. = ..()
last_run = world.time
var/point_difference = SC.points
if(SC.points >= 1000)
SC.points = round(SC.points / 3)
point_difference -= SC.points
else if(SC.points >= 500)
SC.points -= 100 * (rand(5, 20) / 10)
point_difference -= SC.points
else
SC.points = round(SC.points / 1.25)
point_difference -= SC.points
if(point_difference > 0)
thaler_earned = round(point_difference / SC.points_per_money)
/datum/gm_action/nanotrasen_budget_allocation/end()
spawn(5 MINUTES)
running = FALSE
return
/datum/gm_action/nanotrasen_budget_allocation/announce()
spawn(rand(1 MINUTE, 5 MINUTES))
command_announcement.Announce("[station_name()] Supply Department has earned a converted thaler budget of [thaler_earned] due to their backlogged daily requisition tokens.", "Supply Budget Conversion")
return

View File

@@ -1,11 +0,0 @@
/datum/gm_action/request
name = "general request"
departments = list(DEPARTMENT_CARGO)
/datum/gm_action/request/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("[pick("A nearby vessel", "A Solar contractor", "A Skrellian contractor", "A NanoTrasen board director")] has requested the delivery of [pick("one","two","three","several")] [pick("medical","engineering","research","civilian")] supply packages. The [station_name()] has been tasked with completing this request.", "Supply Request")
/datum/gm_action/request/get_weight()
return max(15, 15 + round(gm.staleness / 2) - gm.danger) + (metric.count_people_in_department(DEPARTMENT_CARGO) * 10)

View File

@@ -1,45 +0,0 @@
// This event sends a few carp after someone in space.
/datum/gm_action/surprise_carp_attack
name = "surprise carp attack"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
chaotic = 10
var/mob/living/victim = null
/datum/gm_action/surprise_carp_attack/get_weight()
return metric.count_all_space_mobs() * 50
/datum/gm_action/surprise_carp_attack/set_up()
var/list/potential_victims = list()
victim = null
for(var/mob/living/L in player_list)
if(!(L.z in using_map.station_levels))
continue // Not on the right z-level.
if(L.stat)
continue // Don't want dead people.
var/turf/T = get_turf(L)
if(istype(T, /turf/space) && istype(T.loc,/area/space))
potential_victims.Add(L)
if(potential_victims.len)
victim = pick(potential_victims)
/datum/gm_action/surprise_carp_attack/start()
..()
if(!victim)
message_admins("Surprise carp attack failed to find a target.")
return
var/number_of_carp = rand(1, 2)
message_admins("Sending [number_of_carp] carp\s after [victim].")
while(number_of_carp)
var/turf/spawning_turf = null
var/list/nearby_things = oview(10, victim)
for(var/turf/space/space in nearby_things)
if(get_dist(space, victim) <= 7)
continue
spawning_turf = space
break
if(spawning_turf)
new /mob/living/simple_mob/animal/space/carp(spawning_turf)
number_of_carp--

View File

@@ -1,17 +0,0 @@
// This event sends one wave of meteors unannounced.
/datum/gm_action/surprise_meteors
name = "surprise meteors"
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 25
/datum/gm_action/surprise_meteors/get_weight()
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/weight = (max(engineers - 1, 0) * 25) // If only one engineer exists, no meteors for now.
return weight
/datum/gm_action/surprise_meteors/start()
..()
spawn(1)
spawn_meteors(rand(4, 8), meteors_normal, pick(cardinal))
message_admins("Surprise meteors event has ended.")

View File

@@ -1,75 +0,0 @@
/datum/gm_action/swarm_boarder
name = "swarmer shell"
departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY, DEPARTMENT_ENGINEERING)
chaotic = 60
observers_used = TRUE
var/area/target_area // Chosen target area
var/area/target_turf // Chosen target turf in target_area
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters,
/area/holodeck,
/area/engineering/engine_room
)
var/list/area/included = list(
/area/maintenance
)
/datum/gm_action/swarm_boarder/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 30,
EVENT_LEVEL_MODERATE = 10,
EVENT_LEVEL_MAJOR = 1
)
var/list/area/grand_list_of_areas = get_station_areas(excluded)
for(var/area/Incl in included)
for(var/area/A in grand_list_of_areas)
if(!istype(A, Incl))
grand_list_of_areas -= A
// Okay, now lets try and pick a target! Lets try 10 times, otherwise give up
for(var/i in 1 to 10)
var/area/A = pick(grand_list_of_areas)
if(is_area_occupied(A))
log_debug("[name] event: Rejected [A] because it is occupied.")
continue
// A good area, great! Lets try and pick a turf
var/list/turfs = list()
for(var/turf/simulated/floor/F in A)
if(turf_clear(F))
turfs += F
if(turfs.len == 0)
log_debug("[name] event: Rejected [A] because it has no clear turfs.")
continue
target_area = A
target_turf = pick(turfs)
if(!target_area)
log_debug("[name] event: Giving up after too many failures to pick target area")
return
/datum/gm_action/swarm_boarder/start()
if(!target_turf)
return
..()
var/swarmertype = /obj/structure/ghost_pod/ghost_activated/swarm_drone/event
if(severity == EVENT_LEVEL_MODERATE)
swarmertype = /obj/structure/ghost_pod/ghost_activated/swarm_drone/event/melee
if(severity == EVENT_LEVEL_MAJOR)
swarmertype = /obj/structure/ghost_pod/ghost_activated/swarm_drone/event/gunner
new swarmertype(target_turf)
/datum/gm_action/swarm_boarder/get_weight()
return max(0, -60 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5))
/datum/gm_action/swarm_boarder/announce()
spawn(rand(5 MINUTES, 15 MINUTES))
if(prob(80) && severity >= EVENT_LEVEL_MODERATE && atc && !atc.squelched)
atc.msg("Attention civilian vessels in [using_map.starsys_name] shipping lanes, caution is advised as [pick("an unidentified vessel", "a known criminal's vessel", "a derelict vessel")] has been detected passing multiple local stations.")

View File

@@ -1,83 +0,0 @@
/var/global/list/event_viruses = list() // so that event viruses are kept around for admin logs, rather than being GCed
/datum/gm_action/viral_infection
name = "viral infection"
departments = list(DEPARTMENT_MEDICAL)
chaotic = 5
var/list/viruses = list()
severity = 1
/datum/gm_action/viral_infection/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = 20,
EVENT_LEVEL_MODERATE = 10,
EVENT_LEVEL_MAJOR = 3
)
//generate 1-3 viruses. This way there's an upper limit on how many individual diseases need to be cured if many people are initially infected
var/num_diseases = rand(1,3)
for (var/i=0, i < num_diseases, i++)
var/datum/disease2/disease/D = new /datum/disease2/disease
var/strength = 1 //whether the disease is of the greater or lesser variety
if (severity >= EVENT_LEVEL_MAJOR && prob(75))
strength = 2
D.makerandom(strength)
viruses += D
/datum/gm_action/viral_infection/announce()
var/level
if (severity == EVENT_LEVEL_MUNDANE)
return
else if (severity == EVENT_LEVEL_MODERATE)
level = pick("one", "two", "three", "four")
else
level = "five"
spawn(rand(0, 3000))
if(severity == EVENT_LEVEL_MAJOR || prob(60))
command_announcement.Announce("Confirmed outbreak of level [level] biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak5.ogg')
/datum/gm_action/viral_infection/start()
if(!viruses.len) return
..()
var/list/candidates = list() //list of candidate keys
for(var/mob/living/carbon/human/G in player_list)
if(G.mind && G.stat != DEAD && G.is_client_active(5) && !player_is_antag(G.mind))
var/turf/T = get_turf(G)
if(T.z in using_map.station_levels)
candidates += G
if(!candidates.len) return
candidates = shuffle(candidates)//Incorporating Donkie's list shuffle
var/list/used_viruses = list()
var/list/used_candidates = list()
severity = max(EVENT_LEVEL_MUNDANE, severity - 1)
var/actual_severity = severity * rand(1, 3)
while(actual_severity > 0 && candidates.len)
var/datum/disease2/disease/D = pick(viruses)
infect_mob(candidates[1], D.getcopy())
used_candidates += candidates[1]
candidates.Remove(candidates[1])
actual_severity--
used_viruses |= D
event_viruses |= used_viruses
var/list/used_viruses_links = list()
var/list/used_viruses_text = list()
for(var/datum/disease2/disease/D in used_viruses)
used_viruses_links += "<a href='?src=\ref[D];info=1'>[D.name()]</a>"
used_viruses_text += D.name()
var/list/used_candidates_links = list()
var/list/used_candidates_text = list()
for(var/mob/M in used_candidates)
used_candidates_links += key_name_admin(M)
used_candidates_text += key_name(M)
log_admin("Virus event affecting [english_list(used_candidates_text)] started; Viruses: [english_list(used_viruses_text)]")
message_admins("Virus event affecting [english_list(used_candidates_links)] started; Viruses: [english_list(used_viruses_links)]")
/datum/gm_action/viral_infection/get_weight()
return (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20)

View File

@@ -1,44 +0,0 @@
/datum/gm_action/viral_outbreak
name = "viral outbreak"
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 30
severity = 1
var/list/candidates = list()
/datum/gm_action/viral_outbreak/set_up()
candidates.Cut() // Incase we somehow get run twice.
severity = rand(2, 4)
for(var/mob/living/carbon/human/G in player_list)
if(G.client && G.stat != DEAD)
candidates += G
if(!candidates.len) return
candidates = shuffle(candidates)//Incorporating Donkie's list shuffle
/datum/gm_action/viral_outbreak/announce()
command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')
/datum/gm_action/viral_outbreak/start()
..()
while(severity > 0 && candidates.len)
if(prob(33))
infect_mob_random_lesser(candidates[1])
else
infect_mob_random_greater(candidates[1])
candidates.Remove(candidates[1])
severity--
/datum/gm_action/viral_outbreak/get_weight()
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/everyone = metric.count_people_in_department(DEPARTMENT_EVERYONE)
var/assigned_staff = medical + round(security / 2)
if(!medical) // No docs, no staff.
assigned_staff = 0
if(assigned_staff < round(everyone / 6) - assigned_staff) // A doc or half an officer per roughly six people. Any less, and assigned staff is halved.
assigned_staff /= 2
return (assigned_staff * 10)

View File

@@ -1,43 +0,0 @@
/datum/gm_action/wallrot
name = "wall rot"
departments = list(DEPARTMENT_ENGINEERING)
reusable = TRUE
var/turf/simulated/wall/center
severity = 1
/datum/gm_action/wallrot/set_up()
severity = rand(1,3)
center = null
// 100 attempts
for(var/i=0, i<100, i++)
var/turf/candidate = locate(rand(1, world.maxx), rand(1, world.maxy), 1)
if(istype(candidate, /turf/simulated/wall))
center = candidate
return 1
return 0
/datum/gm_action/wallrot/announce()
if(center && prob(min(90,40 * severity)))
command_announcement.Announce("Harmful fungi detected on \the [station_name()] nearby [center.loc.name]. Station structures may be contaminated.", "Biohazard Alert")
/datum/gm_action/wallrot/start()
..()
spawn()
if(center)
// Make sure at least one piece of wall rots!
center.rot()
// Have a chance to rot lots of other walls.
var/rotcount = 0
var/actual_severity = severity * rand(5, 10)
for(var/turf/simulated/wall/W in range(5, center))
if(prob(50))
W.rot()
rotcount++
// Only rot up to severity walls
if(rotcount >= actual_severity)
break
/datum/gm_action/wallrot/get_weight()
return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 35)

View File

@@ -1,9 +0,0 @@
// A shuttle full of junk docks, and cargo is tasked with sifting through it all to find valuables, or just dispose of it.
/datum/gm_action/waste_disposal
name = "waste disposal"
departments = list(DEPARTMENT_CARGO)
chaotic = 0
/datum/gm_action/waste_disposal/get_weight()
return metric.count_people_in_department(DEPARTMENT_CARGO) * 50

View File

@@ -1,78 +0,0 @@
/datum/gm_action/window_break
name = "window breach"
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 5
var/obj/structure/window/chosen_window
var/list/obj/structure/window/collateral_windows
var/turf/chosen_location
var/list/area/excluded = list(
/area/shuttle,
/area/crew_quarters
)
/datum/gm_action/window_break/set_up()
var/list/area/grand_list_of_areas = get_station_areas(excluded)
//try 10 times
for(var/i in 1 to 10)
var/area/A = pick(grand_list_of_areas)
var/list/obj/structure/window/possible_target_windows = list()
for(var/obj/structure/window/target_window in A.contents)
possible_target_windows += target_window
possible_target_windows = shuffle(possible_target_windows)
for(var/obj/structure/window/target_window in possible_target_windows)
//if() don't have any conditions, for isn't strictly necessary
chosen_window = target_window
chosen_location = chosen_window.loc
collateral_windows = gather_collateral_windows(chosen_window)
return
//TL;DR: breadth first search for all connected turfs with windows
/datum/gm_action/window_break/proc/gather_collateral_windows(var/obj/structure/window/target_window)
var/list/turf/frontier_set = list(target_window.loc)
var/list/obj/structure/window/result_set = list()
var/list/turf/explored_set = list()
while(frontier_set.len > 0)
var/turf/current = frontier_set[1]
frontier_set -= current
explored_set += current
var/contains_windows = 0
for(var/obj/structure/window/to_add in current.contents)
contains_windows = 1
result_set += to_add
if(contains_windows)
//add adjacent turfs to be checked for windows as well
var/turf/neighbor = locate(current.x + 1, current.y, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x - 1, current.y, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x, current.y + 1, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x, current.y - 1, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
return result_set
/datum/gm_action/window_break/start()
if(!chosen_window)
return
..()
chosen_window.shatter(0)
spawn()
for(var/obj/structure/window/current_collateral in collateral_windows)
sleep(rand(1,20))
current_collateral.take_damage(current_collateral.health - (current_collateral.maxhealth / 5)) //set to 1/5th health
/datum/gm_action/window_break/announce()
if(chosen_window)
command_announcement.Announce("Structural integrity of windows at [chosen_location.loc.name] is failing. Immediate repair or replacement is advised.", "Structural Alert")
/datum/gm_action/window_break/get_weight()
return 20 * metric.count_people_in_department(DEPARTMENT_ENGINEERING)

View File

@@ -1,23 +0,0 @@
/datum/gm_action/wormholes
name = "space-time anomalies"
chaotic = 70
length = 12 MINUTES
departments = list(DEPARTMENT_EVERYONE)
severity = 1
/datum/gm_action/wormholes/set_up() // 1 out of 5 will be full-duration wormholes, meaning up to a minute long.
severity = pickweight(list(
3 = 5,
2 = 7,
1 = 13
))
/datum/gm_action/wormholes/start()
..()
wormhole_event(length / 2, (severity / 3))
/datum/gm_action/wormholes/get_weight()
return 10 + max(0, -30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) + 10) + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20))
/datum/gm_action/wormholes/end()
command_announcement.Announce("There are no more space-time anomalies detected on the station.", "Anomaly Alert")

View File

@@ -1,92 +0,0 @@
/client/proc/show_gm_status()
set category = "Debug"
set name = "Show GM Status"
set desc = "Shows you what the GM is thinking. If only that existed in real life..."
game_master.interact(usr)
/datum/game_master/proc/interact(var/client/user)
if(!user)
return
var/HTML = "<html><head><title>Game Master AI</title></head><body>"
HTML += "<a href='?src=\ref[src];toggle_time_restrictions=1'>\[Toggle Time Restrictions\]</a> | \
<a href='?src=\ref[src];suspend=1'>\[Toggle GM\]</a> | \
<a href='?src=\ref[src];force_choose_event=1'>\[Force Event Decision\]</a><br>"
HTML += "Status: [pre_action_checks() ? "Ready" : "Suppressed"]<br><br>"
HTML += "Staleness: [staleness] <a href='?src=\ref[src];adjust_staleness=1'>\[Adjust\]</a><br>"
HTML += "Danger: [danger] <a href='?src=\ref[src];adjust_danger=1'>\[Adjust\]</a><br><br>"
HTML += "Actions available;<br>"
for(var/datum/gm_action/action in available_actions)
if(action.enabled == FALSE)
continue
HTML += "[action.name] ([english_list(action.departments)]) (weight: [action.get_weight()]) <a href='?src=\ref[action];force=1'>\[Force\]</a> <br>"
HTML += "<br>"
HTML += "All living mobs activity: [metric.assess_all_living_mobs()]%<br>"
HTML += "All ghost activity: [metric.assess_all_dead_mobs()]%<br>"
HTML += "<br>"
HTML += "Departmental activity;<br>"
for(var/department in metric.departments)
HTML += " [department] : [metric.assess_department(department)]%<br>"
HTML += "<br>"
HTML += "Activity of players;<br>"
for(var/mob/player in player_list)
HTML += " [player] ([player.key]) : [metric.assess_player_activity(player)]%<br>"
HTML +="</body></html>"
user << browse(HTML, "window=log;size=400x450;border=1;can_resize=1;can_close=1;can_minimize=1")
/datum/game_master/Topic(href, href_list)
if(..())
return
if(!is_admin(usr))
message_admins("[usr] has attempted to modify the Game Master values without being an admin.")
return
if(href_list["toggle_time_restrictions"])
ignore_time_restrictions = !ignore_time_restrictions
message_admins("GM event time restrictions was [ignore_time_restrictions ? "dis" : "en"]abled by [usr.key].")
if(href_list["force_choose_event"])
start_action()
message_admins("[usr.key] forced the Game Master to choose an event immediately.")
if(href_list["suspend"])
suspended = !suspended
message_admins("GM was [suspended ? "dis" : "en"]abled by [usr.key].")
if(href_list["adjust_staleness"])
var/amount = input(usr, "How much staleness should be added or subtracted?", "Game Master") as null|num
if(amount)
adjust_staleness(amount)
message_admins("GM staleness was adjusted by [amount] by [usr.key].")
if(href_list["adjust_danger"])
var/amount = input(usr, "How much danger should be added or subtracted?", "Game Master") as null|num
if(amount)
adjust_danger(amount)
message_admins("GM danger was adjusted by [amount] by [usr.key].")
interact(usr) // To refresh the UI.
/datum/gm_action/Topic(href, href_list)
if(..())
return
if(!is_admin(usr))
message_admins("[usr] has attempted to force an event without being an admin.")
return
if(href_list["force"])
gm.run_action(src)
message_admins("GM event [name] was forced by [usr.key].")

View File

@@ -1 +1,3 @@
#define EVENT_BASELINE_WEIGHT 200
#define EVENT_CHAOS_THRESHOLD_HIGH_IMPACT 25
#define EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT 50
#define EVENT_CHAOS_THRESHOLD_LOW_IMPACT 100

View File

@@ -0,0 +1,230 @@
// This object holds the code that is needed to execute an event.
// Code for judging whether doing that event is a good idea or not belongs inside its meta event object.
/*
Important: DO NOT `sleep()` in any of the procs here, or the GM will get stuck. Use callbacks insead.
Also please don't use spawn(), but use callbacks instead.
Note that there is an important distinction between an event being ended, and an event being finished.
- Ended is for when the actual event is over, regardless of whether an announcement happened or not.
- Finished is for when both the event itself is over, and it was announced. The event will stop being
processed after it is finished.
For an event to finish, it must have done two things:
- Go through its entire cycle, of start() -> end(), and
- Have the event be announced.
If an event has ended, but the announcement didn't happen, the event will not be finished.
This allows for events that have their announcement happen after the end itself.
*/
//
/datum/event2/event
var/announced = FALSE // Is set to TRUE when `announce()` is called by `process()`.
var/started = FALSE // Is set to TRUE when `start()` is called by `process()`.
var/ended = FALSE // Is set to TRUE when `end()` is called by `process()`.
var/finished = FALSE // Is set to TRUE when `ended` and `announced` are TRUE.
// `world.time`s when this event started, and finished, for bookkeeping.
var/time_started = null
var/time_finished = null
// If these are set, the announcement will be delayed by a random time between the lower and upper bounds.
// If the upper bound is not defined, then it will use the lower bound instead.
// Note that this is independant of the event itself, so you can have the announcement happen long after the event ended.
// This may not work if should_announce() is overrided.
var/announce_delay_lower_bound = null
var/announce_delay_upper_bound = null
// If these are set, the event will be delayed by a random time between the lower and upper bounds.
// If the upper bound is not defined, then it will use the lower bound instead.
// This may not work if should_start() is overrided.
var/start_delay_lower_bound = null
var/start_delay_upper_bound = null
// If these are set, the event will automatically end at a random time between the lower and upper bounds.
// If the upper bound is not defined, then it will use the lower bound instead.
// This may not work if should_end() is overrided.
var/length_lower_bound = null
var/length_upper_bound = null
// Set automatically, don't touch.
var/time_to_start = null
var/time_to_announce = null
var/time_to_end = null
// These are also set automatically, and are provided for events to know what RNG decided for the various durations.
var/start_delay = null
var/announce_delay = null
var/length = null
// Returns the name of where the event is taking place.
// In the future this might be handy for off-station events.
/datum/event2/event/proc/location_name()
return station_name()
// Returns the z-levels that are involved with the event.
// In the future this might be handy for off-station events.
/datum/event2/event/proc/get_location_z_levels()
return using_map.station_levels
// Returns a list of empty turfs in the same area.
/datum/event2/event/proc/find_random_turfs(minimum_free_space = 5, list/specific_areas = list(), ignore_occupancy = FALSE)
var/list/area/grand_list_of_areas = find_random_areas(specific_areas)
if(!LAZYLEN(grand_list_of_areas))
return list()
for(var/thing in grand_list_of_areas)
var/list/A = thing
var/list/turfs = list()
for(var/turf/T in A)
if(!T.check_density())
turfs += T
if(turfs.len < minimum_free_space)
continue // Not enough free space.
return turfs
return list()
/datum/event2/event/proc/find_random_areas(list/specific_areas = list(), ignore_occupancy = FALSE)
if(!LAZYLEN(specific_areas))
specific_areas = global.the_station_areas.Copy()
var/list/area/grand_list_of_areas = get_all_existing_areas_of_types(specific_areas)
. = list()
for(var/thing in shuffle(grand_list_of_areas))
var/area/A = thing
if(A.forbid_events)
continue
if(!(A.z in get_location_z_levels()))
continue
if(!ignore_occupancy && is_area_occupied(A))
continue // Occupied.
. += A
// Starts the event.
/datum/event2/event/proc/execute()
time_started = world.time
if(announce_delay_lower_bound)
announce_delay = rand(announce_delay_lower_bound, announce_delay_upper_bound ? announce_delay_upper_bound : announce_delay_lower_bound)
time_to_announce = world.time + announce_delay
if(start_delay_lower_bound)
start_delay = rand(start_delay_lower_bound, start_delay_upper_bound ? start_delay_upper_bound : start_delay_lower_bound)
time_to_start = world.time + start_delay
if(length_lower_bound)
var/starting_point = time_to_start ? time_to_start : world.time
length = rand(length_lower_bound, length_upper_bound ? length_upper_bound : length_lower_bound)
time_to_end = starting_point + length
set_up()
// Called at the very end of the event's lifecycle, or when aborted.
// Don't override this, use `end()` for cleanup instead.
/datum/event2/event/proc/finish()
finished = TRUE
time_finished = world.time
// Called by admins wanting to stop an event immediately.
/datum/event2/event/proc/abort()
if(!announced)
announce()
if(!ended) // `end()` generally has cleanup procs, so call that.
end()
finish()
// Called by the GM processer.
/datum/event2/event/process()
// Handle announcement track.
if(!announced && should_announce())
announced = TRUE
announce()
// Handle event track.
if(!started)
if(should_start())
started = TRUE
start()
else
wait_tick()
if(started && !ended)
if(should_end())
ended = TRUE
end()
else
event_tick()
// In order to be finished, the event needs to end, and be announced.
if(ended && announced)
finish()
/datum/event2/event/Topic(href, href_list)
if(..())
return
if(!check_rights(R_ADMIN|R_EVENT|R_DEBUG))
message_admins("[usr] has attempted to manipulate an event without sufficent privilages.")
return
if(href_list["abort"])
abort()
message_admins("Event '[type]' was aborted by [usr.key].")
SSgame_master.interact(usr) // To refresh the UI.
/*
* Procs to Override
*/
// Override this for code to be ran before the event is started.
/datum/event2/event/proc/set_up()
// Called every tick from the GM system, and determines if the announcement should happen.
// Override this for special logic on when it should be announced, e.g. after `ended` is set to TRUE,
// however be aware that the event cannot finish until this returns TRUE at some point.
/datum/event2/event/proc/should_announce()
if(!time_to_announce)
return TRUE
return time_to_announce <= world.time
// Override this for code that alerts the crew that the event is happening in some form, e.g. a centcom announcement or some other message.
// If you want them to not know, you can just not override it.
/datum/event2/event/proc/announce()
// Override for code that runs every few seconds, while the event is waiting for `should_start()` to return TRUE.
// Note that events that have `should_start()` return TRUE at the start will never have this proc called.
/datum/event2/event/proc/wait_tick()
// Called every tick from the GM system, and determines if the event should offically start.
// Override this for special logic on when it should start.
/datum/event2/event/proc/should_start()
if(!time_to_start)
return TRUE
return time_to_start <= world.time
// Override this for code to do the actual event.
/datum/event2/event/proc/start()
// Override for code that runs every few seconds, while the event is waiting for `should_end()` to return TRUE.
// Note that events that have `should_end()` return TRUE at the start will never have this proc called.
/datum/event2/event/proc/event_tick()
// Called every tick from the GM system, and determines if the event should end.
// If this returns TRUE at the very start, then the event ends instantly and `tick()` will never be called.
// Override this for special logic on when it should end, e.g. blob core has to die before event ends.
/datum/event2/event/proc/should_end()
if(!time_to_end)
return TRUE
return time_to_end <= world.time
// Override this for code to run when the event is over, e.g. cleanup.
/datum/event2/event/proc/end()

View File

@@ -0,0 +1,16 @@
/datum/event2/meta/shipping_error
name = "shipping error"
departments = list(DEPARTMENT_CARGO)
chaos = -10 // A helpful event.
reusable = TRUE
event_type = /datum/event2/event/shipping_error
/datum/event2/meta/shipping_error/get_weight()
return (metric.count_people_with_job(/datum/job/cargo_tech) + metric.count_people_with_job(/datum/job/qm)) * 30
/datum/event2/event/shipping_error/start()
var/datum/supply_order/O = new /datum/supply_order()
O.ordernum = SSsupply.ordernum
O.object = SSsupply.supply_pack[pick(SSsupply.supply_pack)]
O.ordered_by = random_name(pick(MALE,FEMALE), species = "Human")
SSsupply.shoppinglist += O

View File

@@ -0,0 +1,61 @@
/datum/event2/meta/manifest_malfunction
name = "manifest_malfunction"
departments = list(DEPARTMENT_COMMAND, DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/manifest_malfunction
/datum/event2/meta/manifest_malfunction/get_weight()
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
if(!security || !data_core)
return 0
var/command = metric.count_people_with_job(/datum/job/hop) + metric.count_people_with_job(/datum/job/captain)
var/synths = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
var/everyone = metric.count_people_in_department(DEPARTMENT_EVERYONE) - (synths + security + command) // So they don't get counted twice.
return (security * 10) + (synths * 20) + (command * 20) + (everyone * 5)
/datum/event2/event/manifest_malfunction
announce_delay_lower_bound = 5 MINUTES
announce_delay_upper_bound = 10 MINUTES
var/records_to_delete = 2
var/record_class_to_delete = null
/datum/event2/event/manifest_malfunction/set_up()
record_class_to_delete = pickweight(list("medical" = 10, "security" = 30))
/datum/event2/event/manifest_malfunction/announce()
if(prob(30))
var/message = null
var/author = null
var/rng = rand(1, 2)
switch(rng)
if(1)
author = "Data Breach Alert"
message = "The [record_class_to_delete] record database has suffered from an attack by one or more hackers. \
They appear to have wiped several records, before disconnecting."
if(2)
author = "Downtime Alert"
message = "The [record_class_to_delete] record database server has suffered a hardware failure, and is no longer functional. \
A temporary replacement server has been activated, containing recovered data from the main server. \
A few records became corrupted, and could not be transferred."
command_announcement.Announce(message, author)
/datum/event2/event/manifest_malfunction/start()
for(var/i = 1 to records_to_delete)
var/datum/data/record/R
switch(record_class_to_delete)
if("security")
R = safepick(data_core.security)
if("medical")
R = safepick(data_core.medical)
if(R)
log_debug("Manifest malfunction event is now deleting [R.fields["name"]]'s [record_class_to_delete] record.")
qdel(R)

View File

@@ -0,0 +1,110 @@
/datum/event2/meta/money_hacker
name = "money hacker"
departments = list(DEPARTMENT_COMMAND)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/money_hacker
/datum/event2/meta/money_hacker/get_weight()
var/command = metric.count_people_with_job(/datum/job/hop) + metric.count_people_with_job(/datum/job/captain)
if(!command)
return 0
return 30 + (command * 20) + (all_money_accounts.len * 5)
/datum/event2/event/money_hacker
length_lower_bound = 8 MINUTES
length_upper_bound = 12 MINUTES
var/datum/money_account/targeted_account = null
/datum/event2/event/money_hacker/set_up()
if(LAZYLEN(all_money_accounts))
targeted_account = pick(all_money_accounts)
if(!targeted_account)
log_debug("Money hacker event could not find an account to hack. Aborting.")
abort()
return
/datum/event2/event/money_hacker/announce()
var/message = "A brute force hack has been detected (in progress since [stationtime2text()]). The target of the attack is: Financial account #[targeted_account.account_number], \
without intervention this attack will succeed in approximately 10 minutes. Required intervention: temporary suspension of affected accounts until the attack has ceased. \
Notifications will be sent as updates occur."
var/my_department = "[location_name()] Firewall Subroutines"
for(var/obj/machinery/message_server/MS in machines)
if(!MS.active)
continue
MS.send_rc_message("Head of Personnel's Desk", my_department, "[message]<br>", "", "", 2)
// Nobody reads the requests consoles so lets use the radio as well.
global_announcer.autosay(message, my_department, DEPARTMENT_COMMAND)
/datum/event2/event/money_hacker/end()
var/message = null
if(targeted_account && !targeted_account.suspended) // Hacker wins.
message = "The hack attempt has succeeded."
hack_account(targeted_account)
log_debug("Money hacker event managed to hack the targeted account.")
else // Crew wins.
message = "The attack has ceased, the affected accounts can now be brought online."
log_debug("Money hacker event failed to hack the targeted account due to intervention by the crew.")
var/my_department = "[location_name()] Firewall Subroutines"
for(var/obj/machinery/message_server/MS in machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
global_announcer.autosay(message, my_department, DEPARTMENT_COMMAND)
/datum/event2/event/money_hacker/proc/hack_account(datum/money_account/A)
// Subtract the money.
var/lost = A.money * 0.8 + (rand(2,4) - 2) / 10
A.money -= lost
// Create a taunting log entry.
var/datum/transaction/T = new()
T.target_name = pick(list(
"",
"yo brotha from anotha motha",
"el Presidente",
"chieF smackDowN",
"Nobody"
))
T.purpose = pick(list(
"Ne$ ---ount fu%ds init*&lisat@*n",
"PAY BACK YOUR MUM",
"Funds withdrawal",
"pWnAgE",
"l33t hax",
"liberationez",
"Hit",
"Nothing"
))
T.amount = pick(list(
"",
"([rand(0,99999)])",
"alla money",
"9001$",
"HOLLA HOLLA GET DOLLA",
"([lost])",
"69,420t"
))
var/date1 = "1 January 1970" // Unix epoch.
var/date2 = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [rand(1000,3000)]"
T.date = pick("", current_date_string, date1, date2,"Nowhen")
var/time1 = rand(0, 99999999)
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
T.time = pick("", stationtime2text(), time2, "Never")
T.source_terminal = pick("","[pick("Biesel","New Gibson")] GalaxyNet Terminal #[rand(111,999)]","your mums place","nantrasen high CommanD","Angessa's Pearl","Nowhere")
A.transaction_log.Add(T)

View File

@@ -0,0 +1,96 @@
/datum/event2/meta/raise_funds
name = "local funding drive"
enabled = FALSE // There isn't really any suitable way for the crew to generate thalers right now, if that gets fixed feel free to turn this event on.
departments = list(DEPARTMENT_COMMAND, DEPARTMENT_CARGO)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/raise_funds
/datum/event2/meta/raise_funds/get_weight()
var/command = metric.count_people_in_department(DEPARTMENT_COMMAND)
if(!command) // Need someone to read the centcom message.
return 0
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
return (command * 20) + (cargo * 20)
/datum/event2/event/raise_funds
length_lower_bound = 30 MINUTES
length_upper_bound = 45 MINUTES
var/money_at_start = 0
/datum/event2/event/raise_funds/announce()
var/message = "Due to [pick("recent", "unfortunate", "possible future")] budget \
[pick("changes", "issues")], in-system stations are now advised to increase funding income."
send_command_report("Budget Advisement", message)
/datum/event2/event/raise_funds/start()
// Note that the event remembers the amount of money when it started. If an issue develops where people try to scam centcom by
// taking out loads of money before the event, then depositing it back in after the event fires, feel free to make this check for
// roundstart money instead.
money_at_start = count_money()
log_debug("Funding Drive event logged a sum of [money_at_start] thalers in all station accounts at the start of the event.")
/datum/event2/event/raise_funds/end()
var/money_at_end = count_money()
log_debug("Funding Drive event logged a sum of [money_at_end] thalers in all station accounts at the end of the event, compared \
to [money_at_start] thalers. A difference of [money_at_end / money_at_start] was calculated.")
// A number above 1 indicates money was made, while below 1 does the opposite.
var/budget_shift = money_at_end / money_at_start
// Centcom will say different things based on if they gained or lost money.
var/message = null
switch(budget_shift)
if(0 to 0.02) // Abyssmal response.
message = "We are very interested in learning where [round(money_at_start, 1000)] thaler went in \
just half an hour. We highly recommend rectifying this issue before the end of the shift, otherwise a \
discussion regarding your future employment prospects will occur.<br><br>\
Your facility's current balance of requisition tokens has been revoked."
SSsupply.points = 0
log_debug("Funding Drive event ended with an abyssmal response, and the loss of all cargo points.")
if(0.02 to 0.98) // Bad response.
message = "We're very disappointed that \the [location_name()] has ran a deficit since our request. \
As such, we will be taking away some requisition tokens to cover the cost of operating your facility."
var/points_lost = round(SSsupply.points * rand(0.5, 0.8))
SSsupply.points -= points_lost
log_debug("Funding Drive event ended with a bad response, and [points_lost] cargo points was taken away.")
if(0.98 to 1.02) // Neutral response.
message = "It is unfortunate that \the [location_name()]'s finances remain at a standstill, however \
that is still preferred over having a decicit. We hope that in the future, your facility will be able to be \
more profitable."
log_debug("Funding Drive event ended with a neutral response.")
if(1.02 to INFINITY) // Good response.
message = "We appreciate the efforts made by \the [location_name()] to run at a surplus. \
Together, along with the other facilities present in the [using_map.starsys_name] system, \
the company is expected to meet the quota.<br><br>\
We will allocate additional requisition tokens for the cargo department as a reward."
// If cargo is ever made to use station funds instead of cargo points, then a new kind of reward will be needed.
// Otherwise it would be weird for centcom to go 'thanks for not spending money, your reward is money to spend'.
var/point_reward = rand(100, 200)
SSsupply.points += point_reward
log_debug("Funding Drive event ended with a good response and a bonus of [point_reward] cargo points.")
send_command_report("Budget Followup", message)
// Returns the sum of the station account and all the departmental accounts.
/datum/event2/event/raise_funds/proc/count_money()
. = 0
. += station_account.money
for(var/i = 1 to SSjob.department_datums.len)
var/datum/money_account/account = LAZYACCESS(department_accounts, SSjob.department_datums[i])
if(istype(account))
. += account.money
/datum/event2/event/raise_funds/proc/send_command_report(title, message)
post_comm_message(title, message)
to_world(span("danger", "New [using_map.company_name] Update available at all communication consoles."))
SEND_SOUND(world, 'sound/AI/commandreport.ogg')

View File

@@ -0,0 +1,100 @@
/datum/event2/meta/airlock_failure
event_class = "airlock failure"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_MEDICAL)
chaos = 15
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/airlock_failure
/datum/event2/meta/airlock_failure/emag
name = "airlock failure - emag"
event_type = /datum/event2/event/airlock_failure/emag
/datum/event2/meta/airlock_failure/door_crush
name = "airlock failure - crushing"
event_type = /datum/event2/event/airlock_failure/door_crush
/datum/event2/meta/airlock_failure/shock
name = "airlock failure - shock"
chaos = 30
event_type = /datum/event2/event/airlock_failure/shock
/datum/event2/meta/airlock_failure/get_weight()
var/engineering = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
// Synths are good both for fixing the doors and getting blamed for the doors zapping people.
var/synths = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
if(!engineering && !synths) // Nobody's around to fix the door.
return 0
// Medical might be needed for some of the more violent airlock failures.
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
return (engineering * 20) + (medical * 20) + (synths * 20)
/datum/event2/event/airlock_failure
announce_delay_lower_bound = 20 SECONDS
announce_delay_upper_bound = 40 SECONDS
var/announce_odds = 0
var/doors_to_break = 1
var/list/affected_areas = list()
/datum/event2/event/airlock_failure/emag
announce_odds = 10 // To make people wonder if the emagged door was from a baddie or from this event.
doors_to_break = 2 // Replacing emagged doors really sucks for engineering so don't overdo it.
/datum/event2/event/airlock_failure/door_crush
announce_odds = 30
doors_to_break = 5
/datum/event2/event/airlock_failure/shock
announce_odds = 70
/datum/event2/event/airlock_failure/start()
var/list/areas = find_random_areas()
if(!LAZYLEN(areas))
log_debug("Airlock Failure event could not find any areas. Aborting.")
abort()
return
while(areas.len)
var/area/area = pick(areas)
areas -= area
for(var/obj/machinery/door/airlock/door in area.contents)
if(can_break_door(door))
addtimer(CALLBACK(src, .proc/break_door, door), 1) // Emagging proc is actually a blocking proc and that's bad for the ticker.
door.visible_message(span("danger", "\The [door]'s panel sparks!"))
playsound(door, "sparks", 50, 1)
log_debug("Airlock Failure event has broken \the [door] airlock in [area].")
affected_areas |= area
doors_to_break--
if(doors_to_break <= 0)
return
/datum/event2/event/airlock_failure/announce()
if(prob(announce_odds))
command_announcement.Announce("An electrical issue has been detected in the airlock grid at [english_list(affected_areas)]. \
Some airlocks may require servicing by a qualified technician.", "Electrical Alert")
/datum/event2/event/airlock_failure/proc/can_break_door(obj/machinery/door/airlock/door)
if(istype(door, /obj/machinery/door/airlock/lift))
return FALSE
return door.arePowerSystemsOn()
// Override this for door busting.
/datum/event2/event/airlock_failure/proc/break_door(obj/machinery/door/airlock/door)
/datum/event2/event/airlock_failure/emag/break_door(obj/machinery/door/airlock/door)
door.emag_act(1)
/datum/event2/event/airlock_failure/door_crush/break_door(obj/machinery/door/airlock/door)
door.normalspeed = FALSE
door.safe = FALSE
/datum/event2/event/airlock_failure/shock/break_door(obj/machinery/door/airlock/door)
door.electrify(-1)

View File

@@ -0,0 +1,163 @@
/datum/event2/meta/blob
name = "blob"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL)
chaos = 30
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
event_class = "blob" // This makes it so there is no potential for multiple blob events of different types happening in the same round.
event_type = /datum/event2/event/blob
// In the distant future, if a mechanical skill system were to come into being, these vars could be replaced with skill checks so off duty people could count.
var/required_fighters = 2 // Fighters refers to engineering OR security.
var/required_support = 1 // Support refers to doctors AND roboticists, depending on fighter composition.
/datum/event2/meta/blob/hard
name = "harder blob"
chaos = 40
event_type = /datum/event2/event/blob/hard_blob
required_fighters = 3
/datum/event2/meta/blob/multi_blob
name = "multi blob"
chaos = 60
event_type = /datum/event2/event/blob/multi_blob
required_fighters = 4
required_support = 2
// For bussing only.
/datum/event2/meta/blob/omni_blob
name = "omni blob"
chaos = 200
event_type = /datum/event2/event/blob/omni_blob
enabled = FALSE
/datum/event2/meta/blob/get_weight()
// Count the 'fighters'.
var/list/engineers = metric.get_people_in_department(DEPARTMENT_ENGINEERING)
var/list/security = metric.get_people_in_department(DEPARTMENT_SECURITY)
if(engineers.len + security.len < required_fighters)
return 0
// Now count the 'support'.
var/list/medical = metric.get_people_in_department(DEPARTMENT_MEDICAL)
var/need_medical = FALSE
var/list/robotics = metric.get_people_with_job(/datum/job/roboticist)
var/need_robotics = FALSE
// Determine what kind of support might be needed.
for(var/mob/living/L in engineers|security)
if(L.isSynthetic())
need_robotics = TRUE
else
need_medical = TRUE
// Medical is more important than robotics, since robits tend to not suffer slow deaths if there isn't a roboticist.
if(medical.len < required_support && need_medical)
return 0
// Engineers can sometimes fill in as robotics. This is done in the interest of the event having a chance of not being super rare.
// In the uncertain future, a mechanical skill system check could replace this check here.
if(robotics.len + engineers.len < required_support && need_robotics)
return 0
var/fighter_weight = (engineers.len + security.len) * 20
var/support_weight = (medical.len + robotics.len) * 10 // Not counting engineers as support so they don't cause 30 weight each.
var/chaos_weight = chaos / 2 // Chaos is added as a weight in order to make more chaotic variants be preferred if they are allowed to be picked.
return fighter_weight + support_weight + chaos_weight
/datum/event2/event/blob
announce_delay_lower_bound = 1 MINUTE
announce_delay_upper_bound = 5 MINUTES
// This could be made into a GLOB accessible list for reuse if needed.
var/list/area/excluded = list(
/area/submap,
/area/shuttle,
/area/crew_quarters,
/area/holodeck,
/area/engineering/engine_room
)
var/list/open_turfs = list()
var/spawn_blob_type = /obj/structure/blob/core/random_medium
var/number_of_blobs = 1
var/list/blobs = list() // A list containing weakrefs to blob cores created. Weakrefs mean this event won't interfere with qdel.
/datum/event2/event/blob/hard_blob
spawn_blob_type = /obj/structure/blob/core/random_hard
/datum/event2/event/blob/multi_blob
spawn_blob_type = /obj/structure/blob/core/random_hard // Lethargic blobs are boring.
number_of_blobs = 2
// For adminbus only.
/datum/event2/event/blob/omni_blob
number_of_blobs = 16 // Someday maybe we can get this to specifically spawn every blob.
/datum/event2/event/blob/set_up()
open_turfs = find_random_turfs(5 + number_of_blobs)
if(!open_turfs.len)
log_debug("Blob infestation event: Giving up after failure to find blob spots.")
abort()
/datum/event2/event/blob/start()
for(var/i = 1 to number_of_blobs)
var/turf/T = pick(open_turfs)
var/obj/structure/blob/core/new_blob = new spawn_blob_type(T)
blobs += weakref(new_blob)
open_turfs -= T // So we can't put two cores on the same tile if doing multiblob.
log_debug("Spawned [new_blob.overmind.blob_type.name] blob at [get_area(new_blob)].")
/datum/event2/event/blob/should_end()
for(var/WR in blobs)
var/weakref/weakref = WR
if(weakref.resolve()) // If the weakref is resolvable, that means the blob hasn't been deleted yet.
return FALSE
return TRUE // Only end if all blobs die.
// Normally this does nothing, but is useful if aborted by an admin.
/datum/event2/event/blob/end()
for(var/WR in blobs)
var/weakref/weakref = WR
var/obj/structure/blob/core/B = weakref.resolve()
if(istype(B))
qdel(B)
/datum/event2/event/blob/announce()
if(!ended) // Don't announce if the blobs die early.
var/danger_level = 0
var/list/blob_type_names = list()
var/multiblob = FALSE
for(var/WR in blobs)
var/weakref/weakref = WR
var/obj/structure/blob/core/B = weakref.resolve()
if(!istype(B))
continue
var/datum/blob_type/blob_type = B.overmind.blob_type
blob_type_names += blob_type.name
if(danger_level > blob_type.difficulty) // The highest difficulty is used, if multiple blobs are present.
danger_level = blob_type.difficulty
if(blob_type_names.len > 1) // More than one blob is harder.
danger_level += blob_type_names.len
multiblob = TRUE
var/list/lines = list()
lines += "Confirmed outbreak of level [7 + danger_level] biohazard[multiblob ? "s": ""] \
aboard [location_name()]. All personnel must contain the outbreak."
if(danger_level >= BLOB_DIFFICULTY_MEDIUM) // Tell them what kind of blob it is if it's tough.
lines += "The biohazard[multiblob ? "s have": " has"] been identified as [english_list(blob_type_names)]."
if(danger_level >= BLOB_DIFFICULTY_HARD) // If it's really hard then tell them where it is so the response occurs faster.
var/turf/T = open_turfs[1]
var/area/A = T.loc
lines += "[multiblob ? "It is": "They are"] suspected to have originated from \the [A]."
if(danger_level >= BLOB_DIFFICULTY_SUPERHARD)
lines += "Extreme caution is advised."
command_announcement.Announce(lines.Join("\n"), "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')

View File

@@ -0,0 +1,90 @@
/datum/event2/meta/brand_intelligence
name = "vending machine malware"
departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_EVERYONE)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/brand_intelligence
/datum/event2/meta/brand_intelligence/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20)
/datum/event2/event/brand_intelligence
var/malware_spread_cooldown = 30 SECONDS
var/list/vending_machines = list() // List of venders that can potentially be infected.
var/list/infected_vending_machines = list() // List of venders that have been infected.
var/obj/machinery/vending/vender_zero = null // The first vending machine infected. If that one gets fixed, all other infected machines will be cured.
var/last_malware_spread_time = null
/datum/event2/event/brand_intelligence/set_up()
for(var/obj/machinery/vending/V in machines)
if(!(V.z in using_map.station_levels))
continue
vending_machines += V
if(!vending_machines.len)
log_debug("Could not find any vending machines on station Z levels. Aborting.")
abort()
return
vender_zero = pick(vending_machines)
/datum/event2/event/brand_intelligence/announce()
if(prob(90))
command_announcement.Announce("An ongoing mass upload of malware for venders has been detected onboard \the [location_name()], \
which appears to transmit to nearby vendors. The original infected machine is believed to be \a [vender_zero].", "Vender Service Alert")
/datum/event2/event/brand_intelligence/start()
infect_vender(vender_zero)
/datum/event2/event/brand_intelligence/event_tick()
if(last_malware_spread_time + malware_spread_cooldown > world.time)
return // Still on cooldown.
last_malware_spread_time = world.time
if(vending_machines.len)
var/next_victim = pick(vending_machines)
infect_vender(next_victim)
// Every time Vender Zero infects, it says something.
vender_zero.speak(pick("Try our aggressive new marketing strategies!", \
"You should buy products to feed your lifestyle obsession!", \
"Consume!", \
"Your money can buy happiness!", \
"Engage direct marketing!", \
"Advertising is legalized lying! But don't let that put you off our great deals!", \
"You don't want to buy anything? Yeah, well I didn't want to buy your mom either."))
/datum/event2/event/brand_intelligence/should_end()
if(!vending_machines.len)
return TRUE
if(!can_propagate(vender_zero))
return TRUE
return FALSE
/datum/event2/event/brand_intelligence/end()
if(can_propagate(vender_zero)) // The crew failed and all the machines are infected!
return
// Otherwise Vender Zero was taken out in some form.
if(vender_zero)
vender_zero.visible_message(span("notice", "\The [vender_zero]'s network activity light flickers wildly \
for a few seconds as a small screen reads: 'Rolling out firmware reset to networked machines'."))
for(var/obj/machinery/vending/vender in infected_vending_machines)
cure_vender(vender)
/datum/event2/event/brand_intelligence/proc/infect_vender(obj/machinery/vending/V)
vending_machines -= V
infected_vending_machines += V
V.shut_up = FALSE
V.shoot_inventory = TRUE
/datum/event2/event/brand_intelligence/proc/cure_vender(obj/machinery/vending/V)
infected_vending_machines -= V
V.shut_up = TRUE
V.shoot_inventory = FALSE
/datum/event2/event/brand_intelligence/proc/can_propagate(obj/machinery/vending/V)
return V && V.shut_up == FALSE

View File

@@ -0,0 +1,41 @@
/datum/event2/meta/camera_damage
name = "random camera damage"
departments = list(DEPARTMENT_SYNTHETIC, DEPARTMENT_ENGINEERING)
chaos = 5
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/camera_damage
/datum/event2/meta/camera_damage/get_weight()
return 30 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 40)
/datum/event2/event/camera_damage
var/camera_range = 7
/datum/event2/event/camera_damage/start()
var/obj/machinery/camera/C = acquire_random_camera()
if(!C)
return
for(var/obj/machinery/camera/cam in range(camera_range, C))
if(is_valid_camera(cam))
cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0)
if(prob(25))
cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0)
/datum/event2/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
if(!cameranet.cameras.len)
return
if(!remaining_attempts)
return
var/obj/machinery/camera/C = pick(cameranet.cameras)
if(is_valid_camera(C))
return C
// It is very important to use --var and not var-- for recursive calls, as var-- will cause an infinite loop.
return acquire_random_camera(--remaining_attempts)
/datum/event2/event/camera_damage/proc/is_valid_camera(var/obj/machinery/camera/C)
// Only return a functional camera, not installed in a silicon/hardsuit/circuit/etc, and that exists somewhere players have access
var/turf/T = get_turf(C)
return T && C?.can_use() && istype(C.loc, /turf) && (T.z in using_map.player_levels)

View File

@@ -1,24 +1,26 @@
//
// This event chooses a random canister on player levels and breaks it, releasing its contents!
//
/datum/gm_action/canister_leak
name = "Canister Leak"
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 20
/datum/gm_action/canister_leak/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30
/datum/gm_action/canister_leak/start()
..()
// List of all non-destroyed canisters on station levels
var/list/all_canisters = list()
for(var/obj/machinery/portable_atmospherics/canister/C in machines)
if(!C.destroyed && (C.z in using_map.station_levels) && C.air_contents.total_moles >= MOLES_CELLSTANDARD)
all_canisters += C
var/obj/machinery/portable_atmospherics/canister/C = pick(all_canisters)
log_debug("canister_leak event: Canister [C] ([C.x],[C.y],[C.z]) destroyed.")
C.health = 0
C.healthcheck()
return
//
// This event chooses a random canister on player levels and breaks it, releasing its contents!
//
/datum/event2/meta/canister_leak
name = "canister leak"
departments = list(DEPARTMENT_ENGINEERING)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/canister_leak
/datum/event2/meta/canister_leak/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30
/datum/event2/event/canister_leak/start()
// List of all non-destroyed canisters on station levels
var/list/all_canisters = list()
for(var/obj/machinery/portable_atmospherics/canister/C in machines)
if(!C.destroyed && (C.z in using_map.station_levels) && C.air_contents.total_moles >= MOLES_CELLSTANDARD)
all_canisters += C
var/obj/machinery/portable_atmospherics/canister/C = pick(all_canisters)
log_debug("canister_leak event: Canister [C] ([C.x],[C.y],[C.z]) destroyed.")
C.health = 0
C.healthcheck()

View File

@@ -0,0 +1,19 @@
/datum/event2/meta/dust
name = "dust"
departments = list(DEPARTMENT_ENGINEERING)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/dust
/datum/event2/meta/dust/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20
/datum/event2/event/dust/announce()
if(prob(33))
command_announcement.Announce("Dust has been detected on a collision course with \the [location_name()].")
/datum/event2/event/dust/start()
dust_swarm("norm")

View File

@@ -0,0 +1,47 @@
/datum/event2/meta/gas_leak
name = "gas leak"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SYNTHETIC)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/gas_leak
/datum/event2/meta/gas_leak/get_weight()
// Synthetics are counted in higher value because they can wirelessly connect to alarms.
var/engineering_factor = metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10
var/synthetic_factor = metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 30
return (15 + engineering_factor + synthetic_factor) / (times_ran + 1)
/datum/event2/event/gas_leak
var/potential_gas_choices = list("carbon_dioxide", "sleeping_agent", "phoron", "volatile_fuel")
var/chosen_gas = null
var/turf/chosen_turf = null
/datum/event2/event/gas_leak/set_up()
chosen_gas = pick(potential_gas_choices)
var/list/turfs = find_random_turfs()
if(!turfs.len)
log_debug("Gas Leak event failed to find any available turfs to leak into. Aborting.")
abort()
return
chosen_turf = pick(turfs)
/datum/event2/event/gas_leak/announce()
if(chosen_turf)
command_announcement.Announce("Warning, hazardous [lowertext(gas_data.name[chosen_gas])] gas leak detected in \the [chosen_turf.loc], evacuate the area.", "Hazard Alert")
/datum/event2/event/gas_leak/start()
// Okay, time to actually put the gas in the room!
// TODO - Would be nice to break a waste pipe perhaps?
// TODO - Maybe having it released from a single point and thus causing airflow to blow stuff around
// Fow now just add a bunch of it to the air
var/datum/gas_mixture/air_contents = new
air_contents.temperature = T20C + rand(-50, 50)
air_contents.gas[chosen_gas] = 10 * MOLES_CELLSTANDARD
chosen_turf.assume_air(air_contents)
playsound(chosen_turf, 'sound/effects/smoke.ogg', 75, 1)

View File

@@ -0,0 +1,52 @@
// New grid check event:
// Very similar to the old one, power goes out in most of the station, however the new feature is the ability for engineering to
// get power back on sooner, if they are able to reach a special machine and initiate a manual reboot. If no one is able to do so,
// it will reboot itself after a few minutes, just like the old one. Bad things happen if there is no grid checker machine protecting
// the powernet when this event fires.
/datum/event2/meta/grid_check
name = "grid check"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/grid_check
// Having the turbines be way over their rated limit makes grid checks more likely.
/datum/event2/meta/grid_check/proc/get_overpower()
var/highest_overpower = 0
for(var/T in GLOB.all_turbines)
var/obj/machinery/power/generator/turbine = T
var/overpower = max((turbine.effective_gen / turbine.max_power) - 1, 0)
if(overpower > highest_overpower)
highest_overpower = overpower
return highest_overpower
/datum/event2/meta/grid_check/get_weight()
var/population_factor = metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10
var/overpower_factor = 50 * get_overpower() // Will be 0 if not overloaded at all, and 50 if turbines are outputting twice as much as rated.
return (20 + population_factor + overpower_factor) / (times_ran + 1)
/datum/event2/event/grid_check
var/obj/machinery/power/generator/engine // The turbine that will send a power spike.
/datum/event2/event/grid_check/set_up()
// Find the turbine being pushed the most.
var/obj/machinery/power/generator/most_stressed_turbine = null
for(var/T in GLOB.all_turbines)
var/obj/machinery/power/generator/turbine = T
if(!most_stressed_turbine)
most_stressed_turbine = turbine
else if(turbine.effective_gen > most_stressed_turbine.effective_gen)
most_stressed_turbine = turbine
engine = most_stressed_turbine
/datum/event2/event/grid_check/start()
// This sets off a chain of events that lead to the actual grid check (or perhaps worse).
// First, the Supermatter engine makes a power spike.
if(engine)
engine.power_spike()
// After that, the engine checks if a grid checker exists on the same powernet, and if so, it triggers a blackout.
// If not, lots of stuff breaks. See code/modules/power/generator.dm for that piece of code.

View File

@@ -0,0 +1,83 @@
// This event gives the station an advance warning about meteors, so that they can prepare in various ways.
/datum/event2/meta/meteor_defense
name = "meteor defense"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO)
chaos = 50
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
event_class = "meteor defense"
event_type = /datum/event2/event/meteor_defense
/datum/event2/meta/meteor_defense/get_weight()
// Engineers count as 20.
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
if(engineers < 3) // There -must- be at least three engineers for this to be possible.
return 0
. = engineers * 20
// Cargo and AI/borgs count as 10.
var/cargo = metric.count_people_with_job(/datum/job/cargo_tech) + metric.count_people_with_job(/datum/job/qm)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
. += (cargo + bots) * 10
/datum/event2/event/meteor_defense
start_delay_lower_bound = 10 MINUTES
start_delay_upper_bound = 15 MINUTES
var/soon_announced = FALSE
var/direction = null // Actual dir used for which side the meteors come from.
var/dir_text = null // Direction shown in the announcement.
var/list/meteor_types = null
var/waves = null // How many times to send meteors.
var/last_wave_time = null // world.time of latest wave.
var/wave_delay = 10 SECONDS
var/wave_upper_bound = 8 // Max amount of meteors per wave.
var/wave_lower_bound = 4 // Min amount.
/datum/event2/event/meteor_defense/proc/set_meteor_types()
meteor_types = meteors_threatening.Copy()
/datum/event2/event/meteor_defense/set_up()
direction = pick(cardinal) // alldirs doesn't work with current meteor code unfortunately.
waves = rand(3, 6)
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"
set_meteor_types()
/datum/event2/event/meteor_defense/announce()
var/announcement = "Meteors are expected to approach from the [dir_text] side, in approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/event2/event/meteor_defense/wait_tick()
if(!soon_announced)
if((time_to_start - world.time) <= 5 MINUTES)
soon_announced = TRUE
var/announcement = "The incoming meteors are expected to approach from the [dir_text] side. \
ETA to arrival is approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert - Update")
/datum/event2/event/meteor_defense/start()
command_announcement.Announce("Incoming meteors approach from \the [dir_text] side!", "Meteor Alert - Update")
/datum/event2/event/meteor_defense/event_tick()
if(world.time > last_wave_time + wave_delay)
last_wave_time = world.time
waves--
message_admins("[waves] more wave\s of meteors remain.")
// Dir is reversed because the direction describes where meteors are going, not what side it's gonna hit.
spawn_meteors(rand(wave_upper_bound, wave_lower_bound), meteor_types, reverse_dir[direction])
/datum/event2/event/meteor_defense/should_end()
return waves <= 0
/datum/event2/event/meteor_defense/end()
command_announcement.Announce("\The [location_name()] will clear the incoming meteors in a moment.", "Meteor Alert - Update")

View File

@@ -0,0 +1,17 @@
/datum/event2/meta/spacevine
name = "space-vine infestation"
departments = list(DEPARTMENT_ENGINEERING)
chaos = 10 // There's a really rare chance of vines getting something awful like phoron atmosphere but thats not really controllable.
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/spacevine
/datum/event2/meta/spacevine/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10)
/datum/event2/event/spacevine/announce()
level_seven_announcement()
/datum/event2/event/spacevine/start()
spacevine_infestation()

View File

@@ -0,0 +1,46 @@
/datum/event2/meta/wallrot
name = "wall-rot"
departments = list(DEPARTMENT_ENGINEERING)
reusable = TRUE
event_type = /datum/event2/event/wallrot
/datum/event2/meta/wallrot/get_weight()
return (10 + metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) / (times_ran + 1)
/datum/event2/event/wallrot
var/turf/simulated/wall/origin = null
/datum/event2/event/wallrot/set_up()
for(var/i = 1 to 100)
var/turf/candidate = locate(rand(1, world.maxx), rand(1, world.maxy), pick(get_location_z_levels()) )
if(istype(candidate, /turf/simulated/wall))
origin = candidate
log_debug("Wall-rot event has chosen \the [origin] ([origin.loc]) as the origin for the wallrot infestation.")
return
log_debug("Wall-rot event failed to find a valid wall after one hundred tries. Aborting.")
abort()
/datum/event2/event/wallrot/announce()
if(origin && prob(80))
command_announcement.Announce("Harmful fungi detected on \the [location_name()], near \the [origin.loc]. \
Station structural integrity may be compromised.", "Biohazard Alert")
/datum/event2/event/wallrot/start()
if(origin)
origin.rot()
var/rot_count = 0
var/target_rot = rand(5, 20)
for(var/turf/simulated/wall/W in range(7, origin))
if(prob(50))
if(W.rot())
rot_count++
if(rot_count >= target_rot)
break

View File

@@ -0,0 +1,148 @@
// This event causes a random window near space to become damaged.
// If that window is not fixed in a certain amount of time,
// that window and nearby windows will shatter, causing a breach.
/datum/event2/meta/window_break
name = "window break"
departments = list(DEPARTMENT_ENGINEERING)
chaos = 10
reusable = TRUE
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/window_break
/datum/event2/meta/window_break/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20
/datum/event2/event/window_break
announce_delay_lower_bound = 10 SECONDS
announce_delay_upper_bound = 20 SECONDS
length_lower_bound = 8 MINUTES
length_upper_bound = 12 MINUTES
var/turf/chosen_turf_with_windows = null
var/obj/structure/window/chosen_window = null
var/list/collateral_windows = list()
/datum/event2/event/window_break/set_up()
var/list/areas = find_random_areas()
if(!LAZYLEN(areas))
log_debug("Window Break event could not find any areas. Aborting.")
abort()
return
while(areas.len)
var/area/area = pick(areas)
areas -= area
for(var/obj/structure/window/W in area.contents)
if(!is_window_to_space(W))
continue
chosen_turf_with_windows = get_turf(W)
collateral_windows = gather_collateral_windows(W)
break // Break out of the inner loop.
if(chosen_turf_with_windows)
log_debug("Window Break event has chosen turf '[chosen_turf_with_windows.name]' in [chosen_turf_with_windows.loc].")
break // Then the outer loop.
if(!chosen_turf_with_windows)
log_debug("Window Break event could not find a turf with valid windows to break. Aborting.")
abort()
return
/datum/event2/event/window_break/announce()
if(chosen_window)
command_announcement.Announce("Structural integrity of space-facing windows at \the [get_area(chosen_turf_with_windows)] are failing. \
Repair of the damaged window is advised. Personnel without EVA suits in the area should leave until repairs are complete.", "Structural Alert")
/datum/event2/event/window_break/start()
if(!chosen_turf_with_windows)
return
for(var/obj/structure/window/W in chosen_turf_with_windows.contents)
if(W.is_fulltile()) // Full tile windows are simple and can always be used.
chosen_window = W
break
else // Otherwise we only want the window that is on the inside side of the station.
var/turf/T = get_step(W, W.dir)
if(T.is_space())
continue
if(T.check_density())
continue
chosen_window = W
break
if(!chosen_window)
return
chosen_window.take_damage(chosen_window.maxhealth * 0.8)
playsound(chosen_window, 'sound/effects/Glasshit.ogg', 100, 1)
chosen_window.visible_message(span("danger", "\The [chosen_window] suddenly begins to crack!"))
/datum/event2/event/window_break/should_end()
. = ..()
if(!.) // If the timer didn't expire, we can still end it early if someone messes up.
if(!chosen_window || !chosen_window.anchored || chosen_window.health == chosen_window.maxhealth)
// If the window got deconstructed/moved/etc, immediately end and make the breach happen.
// Also end early if it was repaired.
return TRUE
/datum/event2/event/window_break/end()
// If someone fixed the window, then everything is fine.
if(chosen_window && chosen_window.anchored && chosen_window.health == chosen_window.maxhealth)
log_debug("Window Break event ended with window repaired.")
return
// Otherwise a bunch of windows shatter.
chosen_window?.shatter()
var/windows_to_shatter = min(rand(4, 10), collateral_windows.len)
for(var/i = 1 to windows_to_shatter)
var/obj/structure/window/W = collateral_windows[i]
W?.shatter()
log_debug("Window Break event ended with [windows_to_shatter] shattered windows and a breach.")
// Checks if a window is adjacent to a space tile, and also that the opposite direction is open.
// This is done to avoid getting caught in corner parts of windows.
/datum/event2/event/window_break/proc/is_window_to_space(obj/structure/window/W)
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(W, direction)
if(T.is_space())
var/turf/opposite_T = get_step(W, GLOB.reverse_dir[direction])
if(!opposite_T.check_density())
return TRUE
return FALSE
//TL;DR: breadth first search for all connected turfs with windows
/datum/event2/event/window_break/proc/gather_collateral_windows(var/obj/structure/window/target_window)
var/list/turf/frontier_set = list(target_window.loc)
var/list/obj/structure/window/result_set = list()
var/list/turf/explored_set = list()
while(frontier_set.len > 0)
var/turf/current = frontier_set[1]
frontier_set -= current
explored_set += current
var/contains_windows = 0
for(var/obj/structure/window/to_add in current.contents)
contains_windows = 1
result_set += to_add
if(contains_windows)
//add adjacent turfs to be checked for windows as well
var/turf/neighbor = locate(current.x + 1, current.y, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x - 1, current.y, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x, current.y + 1, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
neighbor = locate(current.x, current.y - 1, current.z)
if(!(neighbor in frontier_set) && !(neighbor in explored_set))
frontier_set += neighbor
return result_set

View File

@@ -0,0 +1,43 @@
/datum/event2/meta/comms_blackout
name = "communications blackout"
departments = list(DEPARTMENT_EVERYONE) // It's not an engineering event because engineering can't do anything to help . . . for now.
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
reusable = TRUE
event_type = /datum/event2/event/comms_blackout
/datum/event2/meta/comms_blackout/get_weight()
return 50 + metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5
/datum/event2/event/comms_blackout/announce()
var/alert = pick("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00)`5vc-BZZT", \
"Ionospheric anomalies detected. Temporary telecommunication failu*3mga;b4;'1v¬-BZZZT", \
"Ionospheric anomalies detected. Temporary telec#MCi46:5.;@63-BZZZZT", \
"Ionospheric anomalies dete'fZ\\kg5_0-BZZZZZT", \
"Ionospheri:%£ MCayj^j<.3-BZZZZZZT", \
"#4nd%;f4y6,>£%-BZZZZZZZT")
if(prob(33))
command_announcement.Announce(alert, new_sound = 'sound/misc/interference.ogg')
// AIs will always know if there's a comm blackout, rogue AIs could then lie about comm blackouts in the future while they shutdown comms
for(var/mob/living/silicon/ai/A in player_list)
to_chat(A, "<br>")
to_chat(A, "<span class='warning'><b>[alert]</b></span>")
to_chat(A, "<br>")
/datum/event2/event/comms_blackout/start()
if(prob(50))
// One in two chance for the radios to turn i%t# t&_)#%, which can be more alarming than radio silence.
log_debug("Doing partial outage of telecomms.")
for(var/obj/machinery/telecomms/processor/P in telecomms_list)
P.emp_act(1)
else
// Otherwise just shut everything down, madagascar style.
log_debug("Doing complete outage of telecomms.")
for(var/obj/machinery/telecomms/T in telecomms_list)
T.emp_act(1)
// Communicators go down no matter what.
for(var/obj/machinery/exonet_node/N in machines)
N.emp_act(1)

View File

@@ -0,0 +1,99 @@
// Makes a spooky electrical thing happen, that can blow the lights or make the APCs turn off for a short period of time.
// Doesn't do any permanent damage beyond the small chance to emag an APC, which just unlocks it forever. As such, this is free to occur even with no engineers.
// Since this is an 'external' thing, the Grid Checker can't stop it.
/datum/event2/meta/electrical_fault
name = "electrical fault"
departments = list(DEPARTMENT_EVERYONE)
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/electrical_fault
/datum/event2/meta/electrical_fault/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)
/datum/event2/event/electrical_fault
start_delay_lower_bound = 30 SECONDS
start_delay_upper_bound = 1 MINUTE
length_lower_bound = 20 SECONDS
length_upper_bound = 40 SECONDS
var/max_apcs_per_tick = 6
var/list/valid_apcs = null
var/list/valid_z_levels = null
var/apcs_disabled = 0
var/apcs_overloaded = 0
var/apcs_emagged = 0
/datum/event2/event/electrical_fault/announce()
// Trying to be vague to avoid 'space lightning storms'.
// This could be re-flavored to be a solar flare or something and have robots outside be sad.
command_announcement.Announce("External conditions near \the [location_name()] are likely \
to cause voltage spikes and other electrical issues very soon. Please secure sensitive electrical equipment until the situation passes.", "[location_name()] Sensor Array")
/datum/event2/event/electrical_fault/set_up()
valid_z_levels = get_location_z_levels()
valid_z_levels -= using_map.sealed_levels // Space levels only please!
valid_apcs = list()
for(var/obj/machinery/power/apc/A in global.machines)
if(A.z in valid_z_levels)
valid_apcs += A
/datum/event2/event/electrical_fault/start()
command_announcement.Announce("Irregularities detected in \the [location_name()] power grid.", "[location_name()] Power Grid Monitoring")
/datum/event2/event/electrical_fault/event_tick()
if(!valid_apcs.len)
log_debug("ELECTRICAL EVENT: No valid APCs found for electrical fault event. Aborting.")
abort()
return
var/list/picked_apcs = list()
for(var/i = 1 to max_apcs_per_tick)
picked_apcs |= pick(valid_apcs)
for(var/A in picked_apcs)
affect_apc(A)
/datum/event2/event/electrical_fault/end()
command_announcement.Announce("The irregular electrical conditions inside \the [location_name()] power grid has ceased.", "[location_name()] Power Grid Monitoring")
log_debug("Electrical Fault event caused [apcs_disabled] APC\s to shut off, \
[apcs_overloaded] APC\s to overload lighting, and [apcs_emagged] APC\s to be emagged.")
/datum/event2/event/electrical_fault/proc/affect_apc(obj/machinery/power/apc/A)
// Main breaker is turned off or is Special(tm). Consider it protected.
// Important APCs like the AI or the engine core shouldn't get shut off by this event.
if((!A.operating || A.failure_timer > 0) || A.is_critical)
return
// In reality this would probably make the lights get brighter but oh well.
for(var/obj/machinery/light/L in get_area(A))
L.flicker(rand(10, 20))
// Chance to make the APC turn off for awhile.
// This will actually protect it from further damage.
if(prob(25))
A.energy_fail(rand(60, 120))
log_debug("ELECTRICAL EVENT: Disabled \the [A]'s power for a temporary amount of time.")
playsound(A, 'sound/machines/defib_success.ogg', 50, 1)
apcs_disabled++
return
// Decent chance to overload lighting circuit.
if(prob(30))
A.overload_lighting()
log_debug("ELECTRICAL EVENT: Overloaded \the [A]'s lighting.")
playsound(A, 'sound/effects/lightningshock.ogg', 50, 1)
apcs_overloaded++
// Relatively small chance to emag the apc as apc_damage event does.
if(prob(5))
A.emagged = TRUE
A.update_icon()
log_debug("ELECTRICAL EVENT: Emagged \the [A].")
playsound(A, 'sound/machines/chime.ogg', 50, 1)
apcs_emagged++

View File

@@ -0,0 +1,34 @@
/datum/event2/meta/gravity
name = "gravity failure"
departments = list(DEPARTMENT_EVERYONE)
chaos = 20
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/gravity
/datum/event2/meta/gravity/get_weight()
return (20 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)) / (times_ran + 1)
/datum/event2/event/gravity
length_lower_bound = 5 MINUTES
length_upper_bound = 10 MINUTES
/datum/event2/event/gravity/announce()
command_announcement.Announce("Feedback surge detected in mass-distributions systems. \
Artificial gravity has been disabled whilst the system reinitializes. \
Please stand by while the gravity system reinitializes.", "Gravity Failure")
/datum/event2/event/gravity/start()
for(var/area/A in all_areas)
if(A.z in get_location_z_levels())
A.gravitychange(FALSE)
/datum/event2/event/gravity/end()
for(var/area/A in all_areas)
if(A.z in get_location_z_levels())
A.gravitychange(TRUE)
command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "Gravity Restored")

View File

@@ -0,0 +1,72 @@
/datum/event2/meta/infestation
event_class = "infestation"
departments = list(DEPARTMENT_EVERYONE)
/datum/event2/meta/infestation/get_weight()
return metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10
/datum/event2/meta/infestation/rodents
name = "infestation - rodents"
event_type = /datum/event2/event/infestation/rodents
/datum/event2/meta/infestation/lizards
name = "infestation - lizards"
event_type = /datum/event2/event/infestation/lizards
/datum/event2/meta/infestation/spiderlings
name = "infestation - spiders"
event_type = /datum/event2/event/infestation/spiderlings
/datum/event2/event/infestation
var/vermin_string = null
var/max_vermin = 0
var/list/things_to_spawn = list()
var/list/turfs = list()
/datum/event2/event/infestation/rodents
vermin_string = "rodents"
max_vermin = 12
things_to_spawn = list(
/mob/living/simple_mob/animal/passive/mouse/gray,
/mob/living/simple_mob/animal/passive/mouse/brown,
/mob/living/simple_mob/animal/passive/mouse/white,
/mob/living/simple_mob/animal/passive/mouse/rat
)
/datum/event2/event/infestation/lizards
vermin_string = "lizards"
max_vermin = 6
things_to_spawn = list(
/mob/living/simple_mob/animal/passive/lizard,
/mob/living/simple_mob/animal/passive/lizard/large,
/mob/living/simple_mob/animal/passive/lizard/large/defensive
)
/datum/event2/event/infestation/spiderlings
vermin_string = "spiders"
max_vermin = 3
things_to_spawn = list(/obj/effect/spider/spiderling/non_growing)
/datum/event2/event/infestation/set_up()
turfs = find_random_turfs(max_vermin)
if(!turfs.len)
log_debug("Infestation event failed to find any valid turfs. Aborting.")
abort()
return
/datum/event2/event/infestation/announce()
var/turf/T = turfs[1]
command_announcement.Announce("Bioscans indicate that [vermin_string] have been breeding \
in \the [T.loc]. Clear them out, before this starts to affect productivity.", "Vermin infestation")
/datum/event2/event/infestation/start()
var/vermin_to_spawn = rand(2, max_vermin)
for(var/i = 1 to vermin_to_spawn)
var/turf/T = pick(turfs)
turfs -= T
var/spawn_type = pick(things_to_spawn)
new spawn_type(T)

View File

@@ -0,0 +1,137 @@
/datum/event2/meta/pda_spam
name = "pda spam"
departments = list(DEPARTMENT_EVERYONE)
event_type = /datum/event2/event/pda_spam
/datum/event2/meta/pda_spam/get_weight()
return metric.count_people_in_department(DEPARTMENT_EVERYONE) * 2
/datum/event2/event/pda_spam
length_lower_bound = 30 MINUTES
length_upper_bound = 1 HOUR
var/spam_debug = FALSE // If true, notices of the event sending spam go to `log_debug()`.
var/last_spam_time = null // world.time of most recent spam.
var/next_spam_attempt_time = 0 // world.time of next attempt to try to spam.
var/give_up_after = 5 MINUTES
var/obj/machinery/message_server/MS = null
var/obj/machinery/exonet_node/node = null
/datum/event2/event/pda_spam/set_up()
last_spam_time = world.time // So it won't immediately give up.
MS = pick_message_server()
node = get_exonet_node()
/datum/event2/event/pda_spam/event_tick()
if(!can_spam())
return
if(world.time < next_spam_attempt_time)
return
next_spam_attempt_time = world.time + rand(30 SECONDS, 2 MINUTES)
var/obj/item/device/pda/P = null
var/list/viables = list()
for(var/obj/item/device/pda/check_pda in sortAtom(PDAs))
if(!check_pda.owner || check_pda.toff || check_pda.hidden || check_pda.spam_proof)
continue
viables += check_pda
if(!viables.len)
return
P = pick(viables)
var/list/spam = generate_spam()
if(MS.send_pda_message("[P.owner]", spam[1], spam[2])) // Message been filtered by spam filter.
return
send_spam(P, spam[1], spam[2])
/datum/event2/event/pda_spam/should_end()
. = ..()
if(!.)
// Give up if nobody was reachable for five minutes.
if(last_spam_time + give_up_after < world.time)
log_debug("PDA Spam event giving up after not being able to spam for awhile.")
return TRUE
/datum/event2/event/pda_spam/proc/can_spam()
if(!node || !node.on || !node.allow_external_PDAs)
node = get_exonet_node()
return FALSE
if(!MS || !MS.active)
MS = pick_message_server()
return FALSE
return TRUE
// Returns a list containing two items, the sender and message.
/datum/event2/event/pda_spam/proc/generate_spam()
var/sender = null
var/message = null
switch(rand(1, 7))
if(1)
sender = pick("MaxBet","MaxBet Online Casino","There is no better time to register","I'm excited for you to join us")
message = pick("Triple deposits are waiting for you at MaxBet Online when you register to play with us.",\
"You can qualify for a 200% Welcome Bonus at MaxBet Online when you sign up today.",\
"Once you are a player with MaxBet, you will also receive lucrative weekly and monthly promotions.",\
"You will be able to enjoy over 450 top-flight casino games at MaxBet.")
if(2)
sender = pick(300;"QuickDatingSystem",200;"Find your russian bride",50;"Tajaran beauties are waiting",50;"Find your secret skrell crush",50;"Beautiful unathi brides")
message = pick("Your profile caught my attention and I wanted to write and say hello (QuickDating).",\
"If you will write to me on my email [pick(first_names_female)]@[pick(last_names)].[pick("ru","ck","tj","ur","nt")] I shall necessarily send you a photo (QuickDating).",\
"I want that we write each other and I hope, that you will like my profile and you will answer me (QuickDating).",\
"You have (1) new message!",\
"You have (2) new profile views!")
if(3)
sender = pick("Galactic Payments Association","Better Business Bureau","[using_map.starsys_name] E-Payments","NAnoTransen Finance Deparmtent","Luxury Replicas")
message = pick("Luxury watches for Blowout sale prices!",\
"Watches, Jewelry & Accessories, Bags & Wallets !",\
"Deposit 100$ and get 300$ totally free!",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
"We have been filed with a complaint from one of your customers in respect of their business relations with you.",\
"We kindly ask you to open the COMPLAINT REPORT (attached) to reply on this complaint..")
if(4)
sender = pick("Buy Dr. Maxman","Having dysfuctional troubles?")
message = pick("DR MAXMAN: REAL Doctors, REAL Science, REAL Results!",\
"Dr. Maxman was created by George Acuilar, M.D, a [using_map.boss_short] Certified Urologist who has treated over 70,000 patients sector wide with 'male problems'.",\
"After seven years of research, Dr Acuilar and his team came up with this simple breakthrough male enhancement formula.",\
"Men of all species report AMAZING increases in length, width and stamina.")
if(5)
sender = pick("Dr","Crown prince","King Regent","Professor","Captain")
sender += " " + pick("Robert","Alfred","Josephat","Kingsley","Sehi","Zbahi")
sender += " " + pick("Mugawe","Nkem","Gbatokwia","Nchekwube","Ndim","Ndubisi")
message = pick("YOUR FUND HAS BEEN MOVED TO [uppertext(pick("Salusa","Segunda","Cepheus","Andromeda","Gruis","Corona","Aquila","ARES","Asellus"))] DEVELOPMENTARY BANK FOR ONWARD REMITTANCE.",\
"We are happy to inform you that due to the delay, we have been instructed to IMMEDIATELY deposit all funds into your account",\
"Dear fund beneficiary, We have please to inform you that overdue funds payment has finally been approved and released for payment",\
"Due to my lack of agents I require an off-world financial account to immediately deposit the sum of 1 POINT FIVE MILLION credits.",\
"Greetings sir, I regretfully to inform you that as I lay dying here due to my lack ofheirs I have chosen you to recieve the full sum of my lifetime savings of 1.5 billion credits")
if(6)
sender = pick("[using_map.company_name] Morale Divison","Feeling Lonely?","Bored?","www.wetskrell.nt")
message = pick("The [using_map.company_name] Morale Division wishes to provide you with quality entertainment sites.",\
"WetSkrell.nt is a xenophillic website endorsed by NT for the use of male crewmembers among it's many stations and outposts.",\
"Wetskrell.nt only provides the higest quality of male entertaiment to [using_map.company_name] Employees.",\
"Simply enter your [using_map.company_name] Bank account system number and pin. With three easy steps this service could be yours!")
if(7)
sender = pick("You have won free tickets!","Click here to claim your prize!","You are the 1000th vistor!","You are our lucky grand prize winner!")
message = pick("You have won tickets to the newest ACTION JAXSON MOVIE!",\
"You have won tickets to the newest crime drama DETECTIVE MYSTERY IN THE CLAMITY CAPER!",\
"You have won tickets to the newest romantic comedy 16 RULES OF LOVE!",\
"You have won tickets to the newest thriller THE CULT OF THE SLEEPING ONE!")
return list(sender, message)
/datum/event2/event/pda_spam/proc/send_spam(obj/item/device/pda/P, sender, message)
last_spam_time = world.time
P.spam_message(sender, message)
if(spam_debug)
log_debug("PDA Spam event sent spam to \the [P].")
/datum/event2/event/pda_spam/proc/pick_message_server()
if(LAZYLEN(message_servers))
return pick(message_servers)

View File

@@ -0,0 +1,49 @@
/datum/event2/meta/radiation_storm
name = "radiation storm"
departments = list(DEPARTMENT_EVERYONE)
chaos = 20
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/radiation_storm
/datum/event2/meta/radiation_storm/get_weight()
var/medical_factor = metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10
var/population_factor = metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5 // Note medical people will get counted twice at 25 weight.
return 20 + medical_factor + population_factor
/datum/event2/event/radiation_storm
start_delay_lower_bound = 1 MINUTE
length_lower_bound = 1 MINUTE
/datum/event2/event/radiation_storm/announce()
command_announcement.Announce("High levels of radiation detected near \the [location_name()]. \
Please evacuate into one of the shielded maintenance tunnels.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
make_maint_all_access()
/datum/event2/event/radiation_storm/start()
command_announcement.Announce("The station has entered the radiation belt. \
Please remain in a sheltered area until we have passed the radiation belt.", "Anomaly Alert")
/datum/event2/event/radiation_storm/event_tick()
radiate()
/datum/event2/event/radiation_storm/proc/radiate()
var/radiation_level = rand(15, 35)
for(var/z in using_map.station_levels)
SSradiation.z_radiate(locate(1, 1, z), radiation_level, 1)
/datum/event2/event/radiation_storm/end()
command_announcement.Announce("The station has passed the radiation belt. \
Please allow for up to one minute while radiation levels dissipate, and report to \
medbay if you experience any unusual symptoms. Maintenance will lose all \
access again shortly.", "Anomaly Alert")
addtimer(CALLBACK(src, .proc/maint_callback), 2 MINUTES)
/datum/event2/event/radiation_storm/proc/maint_callback()
revoke_maint_all_access()
// There is no actual radiation during a fake storm.
/datum/event2/event/radiation_storm/fake/radiate()
return

View File

@@ -0,0 +1,31 @@
// No idea if this is needed for autotraitor or not.
// If it is, it shouldn't depend on the event system, but fixing that would be it's own project.
// If not, it can stay off until an admin wants to play with it.
/datum/event2/meta/random_antagonist
name = "random antagonist"
enabled = FALSE
reusable = TRUE
chaos = 0 // This is zero due to the event system not being able to know if an antag actually got spawned or not.
departments = list(DEPARTMENT_EVERYONE)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/random_antagonist
// This has an abnormally high weight due to antags being very important for the round,
// however the weight will decay with more antags, and more attempts to add antags.
/datum/event2/meta/random_antagonist/get_weight()
var/antags = metric.count_all_antags()
return 200 / (antags + times_ran + 1)
// The random spawn proc on the antag datum will handle announcing the spawn and whatnot, in theory.
/datum/event2/event/random_antagonist/start()
var/list/valid_types = list()
for(var/antag_type in all_antag_types)
var/datum/antagonist/antag = all_antag_types[antag_type]
if(antag.flags & ANTAG_RANDSPAWN)
valid_types |= antag
if(valid_types.len)
var/datum/antagonist/antag = pick(valid_types)
antag.attempt_random_spawn()

View File

@@ -0,0 +1,52 @@
/datum/event2/meta/solar_storm
name = "solar storm"
reusable = TRUE
event_type = /datum/event2/event/solar_storm
/datum/event2/meta/solar_storm/get_weight()
var/population_factor = metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10
var/space_factor = metric.count_all_space_mobs() * 50
return (20 + population_factor + space_factor) / (times_ran + 1)
/datum/event2/event/solar_storm
start_delay_lower_bound = 1 MINUTE
start_delay_upper_bound = 1 MINUTE
length_lower_bound = 2 MINUTES
length_upper_bound = 4 MINUTES
var/base_solar_gen_rate = null
/datum/event2/event/solar_storm/announce()
command_announcement.Announce("A solar storm has been detected approaching \the [station_name()]. \
Please halt all EVA activites immediately and return to the interior of the station.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
adjust_solar_output(1.5)
/datum/event2/event/solar_storm/start()
command_announcement.Announce("The solar storm has reached the station. Please refain from EVA and remain inside the station until it has passed.", "Anomaly Alert")
adjust_solar_output(5)
/datum/event2/event/solar_storm/event_tick()
radiate()
/datum/event2/event/solar_storm/end()
command_announcement.Announce("The solar storm has passed the station. It is now safe to resume EVA activities. \
Please report to medbay if you experience any unusual symptoms.", "Anomaly Alert")
adjust_solar_output(1)
/datum/event2/event/solar_storm/proc/adjust_solar_output(var/mult = 1)
if(isnull(base_solar_gen_rate))
base_solar_gen_rate = GLOB.solar_gen_rate
GLOB.solar_gen_rate = mult * base_solar_gen_rate
/datum/event2/event/solar_storm/proc/radiate()
// Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case.
for(var/mob/living/L in player_list)
var/turf/T = get_turf(L)
if(!T)
continue
if(!istype(T.loc,/area/space) && !istype(T,/turf/space)) //Make sure you're in a space area or on a space turf
continue
//Todo: Apply some burn damage from the heat of the sun. Until then, enjoy some moderate radiation.
L.rad_act(rand(15, 30))

View File

@@ -0,0 +1,45 @@
/datum/event2/meta/sudden_weather_shift
name = "sudden weather shift"
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
event_type = /datum/event2/event/sudden_weather_shift
/datum/event2/meta/sudden_weather_shift/get_weight()
// The proc name is a bit misleading, it only counts players outside, not all mobs.
return (metric.count_all_outdoor_mobs() * 20) / (times_ran + 1)
/datum/event2/event/sudden_weather_shift
start_delay_lower_bound = 30 SECONDS
start_delay_upper_bound = 1 MINUTE
var/datum/planet/chosen_planet = null
/datum/event2/event/sudden_weather_shift/set_up()
if(!LAZYLEN(SSplanets.planets))
log_debug("Weather shift event was ran when no planets exist. Aborting.")
abort()
return
chosen_planet = pick(SSplanets.planets)
/datum/event2/event/sudden_weather_shift/announce()
if(!chosen_planet)
return
command_announcement.Announce("Local weather patterns on [chosen_planet.name] suggest that a \
sudden atmospheric fluctuation has occurred. All groundside personnel should be wary of \
rapidly deteriorating conditions.", "Weather Alert")
/datum/event2/event/sudden_weather_shift/start()
// Using the roundstart weather list is handy, because it avoids the chance of choosing a bus-only weather.
// It also makes this event generic and suitable for other planets besides the main one, with no additional code needed.
// Only flaw is that roundstart weathers are -usually- safe ones, but we can fix that by tweaking a copy of it.
var/list/weather_choices = chosen_planet.weather_holder.roundstart_weather_chances.Copy()
var/list/new_weather_weights = list()
// A lazy way of inverting the odds is to use some division.
for(var/weather in weather_choices)
new_weather_weights[weather] = 100 / weather_choices[weather]
// Now choose a new weather.
var/new_weather = pickweight(new_weather_weights)
log_debug("Sudden weather shift event is now changing [chosen_planet.name]'s weather to [new_weather].")
chosen_planet.weather_holder.change_weather(new_weather)

Some files were not shown because too many files have changed in this diff Show More