mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Random Event Overhaul
Alters the event controller based on http://baystation12.net/forums/viewtopic.php?f=5&t=10706. Exception is that there is always some start time variance to prevent metagaming. Mundane, moderate, and major events run on their own timers and start and run independantly of each other. Multiple events of the same severity degree can run at the same time. However, currently only one instance of the same event can be active at a time.
This commit is contained in:
@@ -155,6 +155,20 @@
|
||||
var/list/contact_levels = list(1, 5) // Defines which Z-levels which, for example, a Code Red announcement may affect
|
||||
var/list/player_levels = list(1, 3, 4, 5, 6) // Defines all Z-levels a character can typically reach
|
||||
|
||||
var/const/minutes_to_ticks = 60 * 10
|
||||
// Event settings
|
||||
var/expected_round_length = 60 * 3 * minutes_to_ticks // 3 hours
|
||||
// If the first delay has a custom start time
|
||||
// No custom time, no custom time, between 80 to 100 minutes respectively.
|
||||
var/list/event_first_run = list(EVENT_LEVEL_MUNDANE = null, EVENT_LEVEL_MODERATE = null, EVENT_LEVEL_MAJOR = list("lower" = 48000, "upper" = 60000))
|
||||
// The lowest delay until next event
|
||||
// 10, 30, 50 minutes respectively
|
||||
var/list/event_delay_lower = list(EVENT_LEVEL_MUNDANE = 6000, EVENT_LEVEL_MODERATE = 18000, EVENT_LEVEL_MAJOR = 30000)
|
||||
// The upper delay until next event
|
||||
// 15, 45, 70 minutes respectively
|
||||
var/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 9000, EVENT_LEVEL_MODERATE = 27000, EVENT_LEVEL_MAJOR = 42000)
|
||||
|
||||
|
||||
/datum/configuration/New()
|
||||
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
|
||||
for (var/T in L)
|
||||
@@ -524,6 +538,33 @@
|
||||
if("player_levels")
|
||||
config.player_levels = text2numlist(value, ";")
|
||||
|
||||
if("expected_round_length")
|
||||
config.expected_round_length = text2num(value) * minutes_to_ticks
|
||||
|
||||
if("event_custom_start_mundane")
|
||||
var/values = text2numlist(value, ";")
|
||||
config.event_first_run[EVENT_LEVEL_MUNDANE] = list("lower" = values[1] * minutes_to_ticks, "upper" = values[2] * minutes_to_ticks)
|
||||
|
||||
if("event_custom_start_moderate")
|
||||
var/values = text2numlist(value, ";")
|
||||
config.event_first_run[EVENT_LEVEL_MODERATE] = list("lower" = values[1] * minutes_to_ticks, "upper" = values[2] * minutes_to_ticks)
|
||||
|
||||
if("event_custom_start_major")
|
||||
var/values = text2numlist(value, ";")
|
||||
config.event_first_run[EVENT_LEVEL_MAJOR] = list("lower" = values[1] * minutes_to_ticks, "upper" = values[2] * minutes_to_ticks)
|
||||
|
||||
if("event_delay_lower")
|
||||
var/values = text2numlist(value, ";")
|
||||
config.event_delay_lower[EVENT_LEVEL_MUNDANE] = values[1] * minutes_to_ticks
|
||||
config.event_delay_lower[EVENT_LEVEL_MODERATE] = values[2] * minutes_to_ticks
|
||||
config.event_delay_lower[EVENT_LEVEL_MAJOR] = values[3] * minutes_to_ticks
|
||||
|
||||
if("event_delay_upper")
|
||||
var/values = text2numlist(value, ";")
|
||||
config.event_delay_upper[EVENT_LEVEL_MUNDANE] = values[1] * minutes_to_ticks
|
||||
config.event_delay_upper[EVENT_LEVEL_MODERATE] = values[2] * minutes_to_ticks
|
||||
config.event_delay_upper[EVENT_LEVEL_MAJOR] = values[3] * minutes_to_ticks
|
||||
|
||||
else
|
||||
log_misc("Unknown setting in configuration: '[name]'")
|
||||
|
||||
|
||||
@@ -360,6 +360,7 @@ datum/controller/game_controller/proc/process_pipenets()
|
||||
Powernet.reset()
|
||||
|
||||
datum/controller/game_controller/proc/process_nano()
|
||||
last_thing_processed = /datum/nanoui
|
||||
var/i = 1
|
||||
while(i<=nanomanager.processing_uis.len)
|
||||
var/datum/nanoui/ui = nanomanager.processing_uis[i]
|
||||
@@ -371,15 +372,7 @@ datum/controller/game_controller/proc/process_nano()
|
||||
|
||||
datum/controller/game_controller/proc/process_events()
|
||||
last_thing_processed = /datum/event
|
||||
var/i = 1
|
||||
while(i<=events.len)
|
||||
var/datum/event/Event = events[i]
|
||||
if(Event)
|
||||
Event.process()
|
||||
i++
|
||||
continue
|
||||
events.Cut(i,i+1)
|
||||
checkEvent()
|
||||
event_manager.process()
|
||||
|
||||
datum/controller/game_controller/proc/Recover() //Mostly a placeholder for now.
|
||||
var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
|
||||
return
|
||||
|
||||
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller", "Gas Data"))
|
||||
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller", "Gas Data","Event"))
|
||||
set category = "Debug"
|
||||
set name = "Debug Controller"
|
||||
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
|
||||
@@ -102,6 +102,9 @@
|
||||
feedback_add_details("admin_verb","DAutovoter")
|
||||
if("Gas Data")
|
||||
debug_variables(gas_data)
|
||||
feedback_add_details("admin_verv","DGasdata")
|
||||
feedback_add_details("admin_verb","DGasdata")
|
||||
if("Event")
|
||||
debug_variables(event_manager)
|
||||
feedback_add_details("admin_verb", "DEvent")
|
||||
message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user