From 48923f580ef7ce07d262b359af802b62e43eadda Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Mon, 2 Sep 2024 18:46:01 -0700
Subject: [PATCH 01/61] Initial work on unified
---
modular_zzbug/code/modules/unified/unified.dm | 828 ++++++++++++++++++
tgstation.dme | 1 +
2 files changed, 829 insertions(+)
create mode 100644 modular_zzbug/code/modules/unified/unified.dm
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
new file mode 100644
index 000000000000..262cc80f549c
--- /dev/null
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -0,0 +1,828 @@
+#define INIT_ORDER_UNIFIED 70
+
+SUBSYSTEM_DEF(unified)
+ name = "Unified"
+ init_order = INIT_ORDER_UNIFIED
+ runlevels = RUNLEVEL_GAME
+ flags = SS_BACKGROUND | SS_KEEP_TIMING
+ wait = 2 SECONDS
+
+ /// Whether we allow pop scaling. This is configured by config, or the storyteller UI
+ var/allow_pop_scaling = TRUE
+
+ /// Events that we have scheduled to run in the nearby future
+ var/list/scheduled_events = list()
+
+ /// Associative list of tracks to forced event controls. For admins to force events (though they can still invoke them freely outside of the track system)
+ var/list/forced_next_events = list()
+
+ var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences.
+ var/list/running = list() //list of all existing /datum/round_event
+ var/list/currentrun = list()
+
+ /// List of all uncategorized events, because they were wizard or holiday events
+ var/list/uncategorized = list()
+
+ var/list/holidays //List of all holidays occuring today or null if no holidays
+
+ /// Event frequency multiplier, it exists because wizard, eugh.
+ var/event_frequency_multiplier = 1
+
+ /// Current preview page for the statistics UI.
+ var/statistics_track_page = EVENT_TRACK_MUNDANE
+ /// Page of the UI panel.
+ var/panel_page = UNIFIED_PANEL_MAIN
+ /// Whether we are viewing the roundstart events or not
+ var/roundstart_event_view = TRUE
+
+ /// Whether the storyteller has been halted
+ var/halted_storyteller = FALSE
+
+ /// Ready players for roundstart events.
+ var/ready_players = 0
+ var/active_players = 0
+ var/head_crew = 0
+ var/eng_crew = 0
+ var/sec_crew = 0
+ var/med_crew = 0
+
+ var/wizardmode = FALSE
+
+ var/storyteller_voted = FALSE
+
+/datum/controller/subsystem/unified/Initialize(time, zlevel)
+ for(var/type in typesof(/datum/round_event_control))
+ var/datum/round_event_control/event = new type()
+ if(!event.typepath || !event.name || !event.valid_for_map())
+ continue //don't want this one! leave it for the garbage collector
+ control += event //add it to the list of all events (controls)
+ getHoliday()
+
+ load_config_vars()
+ load_event_config_vars()
+// return ..()
+
+
+/datum/controller/subsystem/unified/fire(resumed = FALSE)
+ if(!resumed)
+ src.currentrun = running.Copy()
+
+ ///Handle scheduled events
+ for(var/datum/scheduled_event/sch_event in scheduled_events)
+ if(world.time >= sch_event.start_time)
+ sch_event.try_fire()
+ else if(!sch_event.alerted_admins && world.time >= sch_event.start_time - 1 MINUTES)
+ ///Alert admins 1 minute before running and allow them to cancel or refund the event, once again.
+ sch_event.alerted_admins = TRUE
+ message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
+
+ if(!halted_storyteller && next_storyteller_process <= world.time && storyteller)
+ // We update crew information here to adjust population scalling and event thresholds for the storyteller.
+ update_crew_infos()
+ next_storyteller_process = world.time + STORYTELLER_WAIT_TIME
+ storyteller.process(STORYTELLER_WAIT_TIME * 0.1)
+
+ //cache for sanic speed (lists are references anyways)
+ var/list/currentrun = src.currentrun
+
+ while(currentrun.len)
+ var/datum/thing = currentrun[currentrun.len]
+ currentrun.len--
+ if(thing)
+ thing.process(wait * 0.1)
+ else
+ running.Remove(thing)
+ if (MC_TICK_CHECK)
+ return
+
+/// Gets the number of antagonists the antagonist injection events will stop rolling after.
+/datum/controller/subsystem/unified/proc/get_antag_cap()
+ return round(max(min(get_correct_popcount() / storyteller.antag_divisor + sec_crew,sec_crew*1.5),ANTAG_CAP_FLAT))
+
+/// Whether events can inject more antagonists into the round
+/datum/controller/subsystem/unified/proc/can_inject_antags()
+ return (get_antag_cap() > length(GLOB.antagonists))
+
+/// Gets candidates for antagonist roles.
+
+/// Todo: Split into get_candidates and post_get_candidates
+/datum/controller/subsystem/unified/proc/get_candidates(
+ special_role_flag,
+ pick_observers,
+ pick_roundstart_players,
+ required_time,
+ inherit_required_time = TRUE,
+ no_antags = TRUE,
+ list/restricted_roles,
+ )
+
+
+ var/list/candidates = list()
+ var/list/candidate_candidates = list() //lol
+ if(pick_roundstart_players)
+ for(var/mob/dead/new_player/player in GLOB.new_player_list)
+ if(player.ready == PLAYER_READY_TO_PLAY && player.mind && player.check_preferences())
+ candidate_candidates += player
+ else if(pick_observers)
+ for(var/mob/player as anything in GLOB.dead_mob_list)
+ candidate_candidates += player
+ else
+ for(var/datum/record/locked/manifest_log as anything in GLOB.manifest.locked)
+ var/datum/mind/player_mind = manifest_log.mind_ref.resolve()
+ var/mob/living/player = player_mind.current
+ if(isnull(player))
+ continue
+ candidate_candidates += player
+
+
+ for(var/mob/candidate as anything in candidate_candidates)
+ if(QDELETED(candidate) || !candidate.key || !candidate.client || !candidate.mind)
+ continue
+ if(no_antags && candidate.mind.special_role)
+ continue
+ if(restricted_roles && (candidate.mind.assigned_role.title in restricted_roles))
+ continue
+ if(special_role_flag)
+ if(!(candidate.client.prefs) || !(special_role_flag in candidate.client.prefs.be_special))
+ continue
+
+ var/time_to_check
+ if(required_time)
+ time_to_check = required_time
+ else if (inherit_required_time)
+ time_to_check = GLOB.special_roles[special_role_flag]
+
+ if(time_to_check && candidate.client.get_remaining_days(time_to_check) > 0)
+ continue
+
+ if(special_role_flag && is_banned_from(candidate.ckey, list(special_role_flag, ROLE_SYNDICATE)))
+ continue
+ if(is_banned_from(candidate.client.ckey, BAN_ANTAGONIST))
+ continue
+ if(!candidate.client?.prefs?.read_preference(/datum/preference/toggle/be_antag))
+ continue
+ candidates += candidate
+ return candidates
+
+/// Gets the correct popcount, returning READY people if roundstart, and active people if not.
+/datum/controller/subsystem/unified/proc/get_correct_popcount()
+ if(SSticker.HasRoundStarted())
+ update_crew_infos()
+ return active_players
+ else
+ calculate_ready_players()
+ return ready_players
+
+/// Refunds and removes a scheduled event.
+/datum/controller/subsystem/unified/proc/refund_scheduled_event(datum/scheduled_event/refunded)
+ if(refunded.cost)
+ var/track_type = refunded.event.track
+ event_track_points[track_type] += refunded.cost
+ remove_scheduled_event(refunded)
+
+/// Schedules an event.
+/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
+ forced_next_events[event.track] = event
+
+/// Removes a scheduled event.
+/datum/controller/subsystem/unified/proc/remove_scheduled_event(datum/scheduled_event/removed)
+ scheduled_events -= removed
+ qdel(removed)
+
+/// We need to calculate ready players for the sake of roundstart events becoming eligible.
+/datum/controller/subsystem/unified/proc/calculate_ready_players()
+ ready_players = 0
+ for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
+ if(player.ready == PLAYER_READY_TO_PLAY)
+ ready_players++
+
+/// We roll points to be spent for roundstart events, including antagonists.
+/datum/controller/subsystem/unified/proc/roll_pre_setup_points()
+ if(storyteller.disable_distribution || halted_storyteller)
+ return
+ /// Distribute points
+ for(var/track in event_track_points)
+ // BUG EDIT START
+ var/calc_value = roundstart_base_points[track]
+ calc_value *= storyteller.starting_point_multipliers[track]
+ var/total_variance = roundstart_variance[track] * storyteller.starting_point_variance_multiplier[track]
+ calc_value += rand(-total_variance, total_variance)
+ event_track_points[track] = round(calc_value, EVENT_POINT_GAINED_PER_SECOND)
+ // BUG EDIT END
+
+ /// If the storyteller guarantees an antagonist roll, add points to make it so.
+ if(storyteller.guarantees_roundstart_roleset && event_track_points[EVENT_TRACK_ROLESET] < point_thresholds[EVENT_TRACK_ROLESET])
+ event_track_points[EVENT_TRACK_ROLESET] = point_thresholds[EVENT_TRACK_ROLESET]
+
+ /// If we have any forced events, ensure we get enough points for them
+ for(var/track in event_tracks)
+ if(forced_next_events[track] && event_track_points[track] < point_thresholds[track])
+ event_track_points[track] = point_thresholds[track]
+
+/// At this point we've rolled roundstart events and antags and we handle leftover points here.
+/datum/controller/subsystem/unified/proc/handle_post_setup_points()
+ for(var/track in event_track_points) //Just halve the points for now.
+ event_track_points[track] *= 0.5
+
+/// Because roundstart events need 2 steps of firing for purposes of antags, here is the first step handled, happening before occupation division.
+/datum/controller/subsystem/unified/proc/handle_pre_setup_roundstart_events()
+ if(storyteller.disable_distribution)
+ return
+ if(halted_storyteller)
+ message_admins("WARNING: Didn't roll roundstart events (including antagonists) due to the storyteller being halted.")
+ return
+ while(TRUE)
+ if(!storyteller.handle_tracks())
+ break
+
+/// Second step of handlind roundstart events, happening after people spawn.
+/datum/controller/subsystem/unified/proc/handle_post_setup_roundstart_events()
+ /// Start all roundstart events on post_setup immediately
+ for(var/datum/round_event/event as anything in running)
+ if(!event.control.roundstart)
+ continue
+ ASYNC
+ event.try_start()
+// INVOKE_ASYNC(event, /datum/round_event.proc/try_start)
+
+/// Schedules an event to run later.
+/datum/controller/subsystem/unified/proc/schedule_event(datum/round_event_control/passed_event, passed_time, passed_cost, passed_ignore, passed_announce)
+ var/datum/scheduled_event/scheduled = new (passed_event, world.time + passed_time, passed_cost, passed_ignore, passed_announce)
+ var/round_started = SSticker.HasRoundStarted()
+ if(round_started)
+ message_admins("Event: [passed_event] has been scheduled to run in [passed_time / 10] seconds. (CANCEL) (REFUND)")
+ else //Only roundstart events can be scheduled before round start
+ message_admins("Event: [passed_event] has been scheduled to run on roundstart. (CANCEL)")
+ scheduled_events += scheduled
+
+/datum/controller/subsystem/unified/proc/update_crew_infos()
+ // Very similar logic to `get_active_player_count()`
+ active_players = 0
+ head_crew = 0
+ eng_crew = 0
+ med_crew = 0
+ sec_crew = 0
+ for(var/mob/player_mob as anything in GLOB.player_list)
+ if(!player_mob.client)
+ continue
+ if(player_mob.stat) //If they're alive
+ continue
+ if(player_mob.client.is_afk()) //If afk
+ continue
+ if(!ishuman(player_mob))
+ continue
+ active_players++
+ if(player_mob.mind?.assigned_role)
+ var/datum/job/player_role = player_mob.mind.assigned_role
+ if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND)
+ head_crew++
+ if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_ENGINEERING)
+ eng_crew++
+ if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_MEDICAL)
+ med_crew++
+ if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)
+ sec_crew++
+ update_pop_scaling()
+
+/datum/controller/subsystem/unified/proc/update_pop_scaling()
+ for(var/track in event_tracks)
+ var/low_pop_bound = min_pop_thresholds[track]
+ var/high_pop_bound = pop_scale_thresholds[track]
+ var/scale_penalty = pop_scale_penalties[track]
+
+ var/perceived_pop = min(max(low_pop_bound, active_players), high_pop_bound)
+
+ var/divisor = high_pop_bound - low_pop_bound
+ /// If the bounds are equal, we'd be dividing by zero or worse, if upper is smaller than lower, we'd be increasing the factor, just make it 1 and continue.
+ /// this is only a problem for bad configs
+ if(divisor <= 0)
+ current_pop_scale_multipliers[track] = 1
+ continue
+ var/scalar = (perceived_pop - low_pop_bound) / divisor
+ var/penalty = scale_penalty - (scale_penalty * scalar)
+ var/calculated_multiplier = 1 - (penalty / 100)
+
+ current_pop_scale_multipliers[track] = calculated_multiplier
+
+/datum/controller/subsystem/unified/proc/TriggerEvent(datum/round_event_control/event)
+ . = event.preRunEvent()
+ if(. == EVENT_CANT_RUN)//we couldn't run this event for some reason, set its max_occurrences to 0
+ event.max_occurrences = 0
+ else if(. == EVENT_READY)
+ event.run_event(random = TRUE) // fallback to dynamic
+
+///Resets frequency multiplier.
+/datum/controller/subsystem/unified/proc/resetFrequency()
+ event_frequency_multiplier = 1
+
+/* /client/proc/forceEvent()
+ set name = "Trigger Event"
+ set category = "Admin.Events"
+
+ if(!holder ||!check_rights(R_FUN))
+ return
+
+ holder.forceEvent(usr) */
+
+/* /datum/admins/forceEvent(mob/user)
+ SSgamemode.event_panel(user) */
+
+
+//////////////
+// HOLIDAYS //
+//////////////
+//Uncommenting ALLOW_HOLIDAYS in config.txt will enable holidays
+
+//It's easy to add stuff. Just add a holiday datum in code/modules/holiday/holidays.dm
+//You can then check if it's a special day in any code in the game by doing if(SSgamemode.holidays["Groundhog Day"])
+
+//You can also make holiday random events easily thanks to Pete/Gia's system.
+//simply make a random event normally, then assign it a holidayID string which matches the holiday's name.
+//Anything with a holidayID, which isn't in the holidays list, will never occur.
+
+//Please, Don't spam stuff up with stupid stuff (key example being april-fools Pooh/ERP/etc),
+//And don't forget: CHECK YOUR CODE!!!! We don't want any zero-day bugs which happen only on holidays and never get found/fixed!
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//ALSO, MOST IMPORTANTLY: Don't add stupid stuff! Discuss bonus content with Project-Heads first please!//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+//sets up the holidays and holidays list
+/datum/controller/subsystem/unified/proc/getHoliday()
+ if(!CONFIG_GET(flag/allow_holidays))
+ return // Holiday stuff was not enabled in the config!
+ for(var/H in subtypesof(/datum/holiday))
+ var/datum/holiday/holiday = new H()
+ var/delete_holiday = TRUE
+ for(var/timezone in holiday.timezones)
+ var/time_in_timezone = world.realtime + timezone HOURS
+
+ var/YYYY = text2num(time2text(time_in_timezone, "YYYY")) // get the current year
+ var/MM = text2num(time2text(time_in_timezone, "MM")) // get the current month
+ var/DD = text2num(time2text(time_in_timezone, "DD")) // get the current day
+ var/DDD = time2text(time_in_timezone, "DDD") // get the current weekday
+
+ if(holiday.shouldCelebrate(DD, MM, YYYY, DDD))
+ holiday.celebrate()
+ LAZYSET(holidays, holiday.name, holiday)
+ delete_holiday = FALSE
+ break
+ if(delete_holiday)
+ qdel(holiday)
+
+ if(holidays)
+ holidays = shuffle(holidays)
+ // regenerate station name because holiday prefixes.
+ set_station_name(new_station_name())
+ world.update_status()
+
+/datum/controller/subsystem/unified/proc/toggleWizardmode()
+ wizardmode = !wizardmode //TODO: decide what to do with wiz events
+ message_admins("Summon Events has been [wizardmode ? "enabled, events will occur [SSunified.event_frequency_multiplier] times as fast" : "disabled"]!")
+ log_game("Summon Events was [wizardmode ? "enabled" : "disabled"]!")
+
+///Attempts to select players for special roles the mode might have.
+/datum/controller/subsystem/unified/proc/pre_setup()
+ // We need to do this to prevent some niche fuckery... and make dep. orders work. Lol
+ SSjob.ResetOccupations()
+ calculate_ready_players()
+ roll_pre_setup_points()
+ handle_pre_setup_roundstart_events()
+ return TRUE
+
+///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
+/datum/controller/subsystem/unified/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report.
+ if(!report)
+ report = !CONFIG_GET(flag/no_intercept_report)
+ addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME)
+
+ if(SSdbcore.Connect())
+ var/list/to_set = list()
+ var/arguments = list()
+ if(storyteller)
+ to_set += "game_mode = :game_mode"
+ arguments["game_mode"] = storyteller.name
+ if(GLOB.revdata.originmastercommit)
+ to_set += "commit_hash = :commit_hash"
+ arguments["commit_hash"] = GLOB.revdata.originmastercommit
+ if(to_set.len)
+ arguments["round_id"] = GLOB.round_id
+ var/datum/db_query/query_round_game_mode = SSdbcore.NewQuery(
+ "UPDATE [format_table_name("round")] SET [to_set.Join(", ")] WHERE id = :round_id",
+ arguments
+ )
+ query_round_game_mode.Execute()
+ qdel(query_round_game_mode)
+ addtimer(CALLBACK(src, PROC_REF(send_trait_report)), rand(1 MINUTES, 5 MINUTES))
+ handle_post_setup_roundstart_events()
+ handle_post_setup_points()
+ roundstart_event_view = FALSE
+ return TRUE
+
+
+///Handles late-join antag assignments
+/datum/controller/subsystem/unified/proc/make_antag_chance(mob/living/carbon/human/character)
+ return
+
+/datum/controller/subsystem/unified/proc/check_finished(force_ending) //to be called by SSticker
+ if(!SSticker.setup_done)
+ return FALSE
+ if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME))
+ return TRUE
+ if(GLOB.station_was_nuked)
+ return TRUE
+ if(force_ending)
+ return TRUE
+
+//////////////////////////
+//Reports player logouts//
+//////////////////////////
+/proc/display_roundstart_logout_report()
+ var/list/msg = list("[span_boldnotice("Roundstart logout report")]\n\n")
+ for(var/i in GLOB.mob_living_list)
+ var/mob/living/L = i
+ var/mob/living/carbon/C = L
+ var/mob/living/carbon/human/H = C
+ if (istype(C) && !C.last_mind)
+ continue // never had a client
+
+ if(L.ckey && !GLOB.directory[L.ckey])
+ msg += "[L.name] ([L.key]), the [L.job] (Disconnected)\n"
+
+
+ if(L.ckey && L.client)
+ var/failed = FALSE
+ if(L.client.inactivity >= (ROUNDSTART_LOGOUT_REPORT_TIME / 2)) //Connected, but inactive (alt+tabbed or something)
+ msg += "[L.name] ([L.key]), the [L.job] (Connected, Inactive)\n"
+ failed = TRUE //AFK client
+ if(!failed && L.stat)
+ if(H.get_dnr()) //Suicider
+ msg += "[L.name] ([L.key]), the [L.job] ([span_boldannounce("Suicide")])\n"
+ failed = TRUE //Disconnected client
+ if(!failed && (L.stat == UNCONSCIOUS || L.stat == HARD_CRIT))
+ msg += "[L.name] ([L.key]), the [L.job] (Dying)\n"
+ failed = TRUE //Unconscious
+ if(!failed && L.stat == DEAD)
+ msg += "[L.name] ([L.key]), the [L.job] (Dead)\n"
+ failed = TRUE //Dead
+
+ continue //Happy connected client
+ for(var/mob/dead/observer/D in GLOB.dead_mob_list)
+ if(D.mind && D.mind.current == L)
+ if(L.stat == DEAD)
+ if(H.get_dnr()) //Suicider
+ msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] ([span_boldannounce("Suicide")])\n"
+ continue //Disconnected client
+ else
+ msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Dead)\n"
+ continue //Dead mob, ghost abandoned
+ else
+ if(D.can_reenter_corpse)
+ continue //Adminghost, or cult/wizard ghost
+ else
+ msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] ([span_boldannounce("Ghosted")])\n"
+ continue //Ghosted while alive
+
+
+ for (var/C in GLOB.admins)
+ to_chat(C, msg.Join())
+
+//Set result and news report here
+/datum/controller/subsystem/unified/proc/set_round_result()
+ SSticker.mode_result = "undefined"
+ if(GLOB.station_was_nuked)
+ SSticker.news_report = STATION_DESTROYED_NUKE
+ if(EMERGENCY_ESCAPED_OR_ENDGAMED)
+ SSticker.news_report = STATION_EVACUATED
+ if(SSshuttle.emergency.is_hijacked())
+ SSticker.news_report = SHUTTLE_HIJACK
+
+/// Loads json event config values from events.txt
+/datum/controller/subsystem/unified/proc/load_event_config_vars()
+ var/json_file = file("[global.config.directory]/events.json")
+ if(!fexists(json_file))
+ return
+ var/list/decoded = json_decode(file2text(json_file))
+ for(var/event_text_path in decoded)
+ var/event_path = text2path(event_text_path)
+ var/datum/round_event_control/event
+ for(var/datum/round_event_control/iterated_event as anything in control)
+ if(iterated_event.type == event_path)
+ event = iterated_event
+ break
+ if(!event)
+ continue
+ var/list/var_list = decoded[event_text_path]
+ for(var/variable in var_list)
+ var/value = var_list[variable]
+ switch(variable)
+ if("weight")
+ event.weight = value
+ if("min_players")
+ event.min_players = value
+ if("max_occurrences")
+ event.max_occurrences = value
+ if("earliest_start")
+ event.earliest_start = value * (1 MINUTES)
+ if("track")
+ if(value in event_tracks)
+ event.track = value
+ if("cost")
+ event.cost = value
+ if("reoccurence_penalty_multiplier")
+ event.reoccurence_penalty_multiplier = value
+ if("shared_occurence_type")
+ if(!isnull(value))
+ value = text2path(value)
+ event.shared_occurence_type = value
+
+/// Loads config values from game_options.txt
+/datum/controller/subsystem/unified/proc/load_config_vars()
+ allow_pop_scaling = CONFIG_GET(flag/allow_storyteller_pop_scaling)
+
+/// Panel containing information, variables and controls about the gamemode and scheduled event
+/datum/controller/subsystem/unified/proc/admin_panel(mob/user)
+ update_crew_infos()
+ var/round_started = SSticker.HasRoundStarted()
+ var/list/dat = list()
+ var/active_pop = get_correct_popcount()
+ dat += " HALT Storyteller Event Panel Set Storyteller Refresh"
+ dat += "
Storyteller determines points gained, event chances, and is the entity responsible for rolling events."
+ dat += "
Active Players: [active_pop] (Head: [head_crew], Sec: [sec_crew], Eng: [eng_crew], Med: [med_crew]) - Antag Cap: [get_antag_cap()]"
+ dat += "
"
+ dat += "Main"
+ dat += " Variables"
+ dat += "
"
+ switch(panel_page)
+ if(UNIFIED_PANEL_VARIABLES)
+ /*
+ dat += "Reload Config Vars Configs located in game_options.txt."
+ dat += "
Point Gains Multipliers (only over time):"
+ dat += "
This affects points gained over time towards scheduling new events of the tracks."
+ for(var/track in event_tracks)
+ dat += "
[track]: [point_gain_multipliers[track]]"
+ dat += "
"
+
+ dat += "Roundstart Points Multipliers:"
+ dat += "
This affects points generated for roundstart events and antagonists."
+ for(var/track in event_tracks)
+ dat += "
[track]: [roundstart_point_multipliers[track]]"
+ dat += "
"
+ */
+
+ dat += "Minimum Population for Tracks:"
+ dat += "
This are the minimum population caps for events to be able to run."
+ for(var/track in event_tracks)
+ dat += "
[track]: [min_pop_thresholds[track]]"
+ dat += "
"
+
+ dat += "Point Thresholds:"
+ dat += "
Those are thresholds the tracks require to reach with points to make an event."
+ for(var/track in event_tracks)
+ dat += "
[track]: [point_thresholds[track]]"
+
+ if(UNIFIED_PANEL_MAIN)
+ var/even = TRUE
+ dat += "Event Tracks:
"
+ dat += "Every track represents progression towards scheduling an event of it's severity"
+ dat += ""
+ dat += ""
+ dat += "| Track | "
+ dat += "Progress | "
+ dat += "Next | "
+ dat += "Forced | "
+ dat += "Actions | "
+ dat += "
"
+ for(var/track in event_tracks)
+ even = !even
+ var/background_cl = even ? "#17191C" : "#23273C"
+ var/lower = event_track_points[track]
+ var/upper = point_thresholds[track]
+ var/percent = round((lower/upper)*100)
+ var/next = 0
+ var/last_points = last_point_gains[track]
+ if(last_points)
+ next = round((upper - lower) / last_points / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
+ dat += ""
+ dat += "| [track] | " //Track
+ dat += "[percent]% ([lower]/[upper]) | " //Progress
+ dat += "~[next] m. | " //Next
+ var/datum/round_event_control/forced_event = forced_next_events[track]
+ var/forced = forced_event ? "[forced_event.name] X" : ""
+ dat += "[forced] | " //Forced
+ dat += "Set Pts. Next Event | " //Actions
+ dat += "
"
+ dat += "
"
+
+ dat += "Scheduled Events:
"
+ dat += ""
+ dat += ""
+ dat += "| Name | "
+ dat += "Severity | "
+ dat += "Time | "
+ dat += "Actions | "
+ dat += "
"
+ var/sorted_scheduled = list()
+ for(var/datum/scheduled_event/scheduled as anything in scheduled_events)
+ sorted_scheduled[scheduled] = scheduled.start_time
+ sortTim(sorted_scheduled, cmp=/proc/cmp_numeric_asc, associative = TRUE)
+ even = TRUE
+ for(var/datum/scheduled_event/scheduled as anything in sorted_scheduled)
+ even = !even
+ var/background_cl = even ? "#17191C" : "#23273C"
+ dat += ""
+ dat += "| [scheduled.event.name] | " //Name
+ dat += "[scheduled.event.track] | " //Severity
+ var/time = (scheduled.event.roundstart && !round_started) ? "ROUNDSTART" : "[(scheduled.start_time - world.time) / (1 SECONDS)] s."
+ dat += "[time] | " //Time
+ dat += "[scheduled.get_href_actions()] | " //Actions
+ dat += "
"
+ dat += "
"
+
+ dat += "Running Events:
"
+ dat += ""
+ dat += ""
+ dat += "| Name | "
+ dat += "Actions | "
+ dat += "
"
+ even = TRUE
+ for(var/datum/round_event/event as anything in running)
+ even = !even
+ var/background_cl = even ? "#17191C" : "#23273C"
+ dat += ""
+ dat += "| [event.control.name] | " //Name
+ dat += "-TBA- | " //Actions
+ dat += "
"
+ dat += "
"
+
+ var/datum/browser/popup = new(user, "unified_admin_panel", "Unified Panel", 670, 650)
+ popup.set_content(dat.Join())
+ popup.open()
+
+ /// Panel containing information and actions regarding events
+/datum/controller/subsystem/unified/proc/event_panel(mob/user)
+ var/list/dat = list()
+ if(storyteller)
+ dat += "Storyteller: [storyteller.name]"
+ dat += "
Repetition penalty multiplier: [storyteller.event_repetition_multiplier]"
+ dat += "
Cost variance: [storyteller.cost_variance]"
+ if(storyteller.tag_weight_multipliers)
+ dat += "
Tag weight multipliers:"
+ for(var/tag in storyteller.tag_weight_multipliers)
+ dat += "[tag]:[storyteller.tag_weight_multipliers[tag]] | "
+ storyteller.calculate_weights(statistics_track_page)
+ else
+ dat += "Storyteller: None
Weight and chance statistics will be inaccurate due to the present lack of a storyteller."
+ dat += "
Roundstart Events Forced Roundstart events will use rolled points, and are guaranteed to trigger (even if the used points are not enough)"
+ dat += "
Avg. event intervals: "
+ for(var/track in event_tracks)
+ if(last_point_gains[track])
+ var/est_time = round(point_thresholds[track] / last_point_gains[track] / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
+ dat += "[track]: ~[est_time] m. | "
+ dat += "
"
+ for(var/track in EVENT_PANEL_TRACKS)
+ dat += "[track]"
+ dat += "
"
+ /// Create event info and stats table
+ dat += ""
+ dat += ""
+ dat += "| Name | "
+ dat += "Tags | "
+ dat += "Occurences | "
+ dat += "M.Pop | "
+ dat += "M.Time | "
+ dat += "Can Occur | "
+ dat += "Weight | "
+ dat += "Actions | "
+ dat += "
"
+ var/even = TRUE
+ var/total_weight = 0
+ var/list/event_lookup
+ switch(statistics_track_page)
+ if(ALL_EVENTS)
+ event_lookup = control
+ if(UNCATEGORIZED_EVENTS)
+ event_lookup = uncategorized
+ else
+ event_lookup = event_pools[statistics_track_page]
+ var/list/assoc_spawn_weight = list()
+ var/active_pop = get_correct_popcount()
+ for(var/datum/round_event_control/event as anything in event_lookup)
+ if(event.roundstart != roundstart_event_view)
+ continue
+ if(event.can_spawn_event(active_pop))
+ total_weight += event.calculated_weight
+ assoc_spawn_weight[event] = event.calculated_weight
+ else
+ assoc_spawn_weight[event] = 0
+ sortTim(assoc_spawn_weight, cmp=/proc/cmp_numeric_dsc, associative = TRUE)
+ for(var/datum/round_event_control/event as anything in assoc_spawn_weight)
+ even = !even
+ var/background_cl = even ? "#17191C" : "#23273C"
+ dat += ""
+ dat += "| [event.name] | " //Name
+ dat += "" //Tags
+ for(var/tag in event.tags)
+ dat += "[tag] "
+ dat += " | "
+ var/occurence_string = "[event.occurrences]"
+ if(event.shared_occurence_type)
+ occurence_string += " (shared: [event.get_occurences()])"
+ dat += "[occurence_string] | " //Occurences
+ dat += "[event.min_players] | " //Minimum pop
+ dat += "[event.earliest_start / (1 MINUTES)] m. | " //Minimum time
+ dat += "[assoc_spawn_weight[event] ? "Yes" : "No"] | " //Can happen?
+ var/weight_string = "([event.calculated_weight] /raw.[event.weight])"
+ if(assoc_spawn_weight[event])
+ var/percent = round((event.calculated_weight / total_weight) * 100)
+ weight_string = "[percent]% - [weight_string]"
+ dat += "[weight_string] | " //Weight
+ dat += "[event.get_href_actions()] | " //Actions
+ dat += "
"
+ dat += "
"
+ var/datum/browser/popup = new(user, "unified_event_panel", "Event Panel", 1000, 600)
+ popup.set_content(dat.Join())
+ popup.open()
+
+/datum/controller/subsystem/unified/Topic(href, href_list)
+ . = ..()
+ var/mob/user = usr
+ if(!check_rights(R_ADMIN))
+ return
+ switch(href_list["panel"])
+ if("main")
+ switch(href_list["action"])
+ if("halt_storyteller")
+ halted_storyteller = !halted_storyteller
+ message_admins("[key_name_admin(usr)] has [halted_storyteller ? "HALTED" : "un-halted"] the Storyteller.")
+ if("vars")
+ var/track = href_list["track"]
+ switch(href_list["var"])
+ /*if("pts_multiplier")
+ var/new_value = input(usr, "New value:", "Set new value") as num|null
+ if(isnull(new_value) || new_value < 0)
+ return
+ message_admins("[key_name_admin(usr)] set point gain multiplier for [track] track to [new_value].")
+ point_gain_multipliers[track] = new_value
+ if("roundstart_pts")
+ var/new_value = input(usr, "New value:", "Set new value") as num|null
+ if(isnull(new_value) || new_value < 0)
+ return
+ message_admins("[key_name_admin(usr)] set roundstart pts multiplier for [track] track to [new_value].")
+ roundstart_point_multipliers[track] = new_value
+ */
+ if("min_pop")
+ var/new_value = input(usr, "New value:", "Set new value") as num|null
+ if(isnull(new_value) || new_value < 0)
+ return
+ message_admins("[key_name_admin(usr)] set minimum population for [track] track to [new_value].")
+ min_pop_thresholds[track] = new_value
+ if("pts_threshold")
+ var/new_value = input(usr, "New value:", "Set new value") as num|null
+ if(isnull(new_value) || new_value < 0)
+ return
+ message_admins("[key_name_admin(usr)] set point threshold of [track] track to [new_value].")
+ point_thresholds[track] = new_value
+ if("reload_config_vars")
+ message_admins("[key_name_admin(usr)] reloaded unified config vars.")
+ load_config_vars()
+ if("tab")
+ var/tab = href_list["tab"]
+ panel_page = tab
+ if("open_stats")
+ event_panel(user)
+ return
+ if("track_action")
+ var/track = href_list["track"]
+ if(!(track in event_tracks))
+ return
+ switch(href_list["track_action"])
+ if("remove_forced")
+ if(forced_next_events[track])
+ var/datum/round_event_control/event = forced_next_events[track]
+ message_admins("[key_name_admin(usr)] removed forced event [event.name] from track [track].")
+ forced_next_events -= track
+ if("set_pts")
+ var/set_pts = input(usr, "New point amount ([point_thresholds[track]]+ invokes event):", "Set points for [track]") as num|null
+ if(isnull(set_pts))
+ return
+ event_track_points[track] = set_pts
+ message_admins("[key_name_admin(usr)] set points of [track] track to [set_pts].")
+ log_admin_private("[key_name(usr)] set points of [track] track to [set_pts].")
+ if("next_event")
+ message_admins("[key_name_admin(usr)] invoked next event for [track] track.")
+ log_admin_private("[key_name(usr)] invoked next event for [track] track.")
+ event_track_points[track] = point_thresholds[track]
+ if(storyteller)
+ storyteller.handle_tracks()
+ admin_panel(user)
+ if("stats")
+ switch(href_list["action"])
+ if("set_roundstart")
+ roundstart_event_view = !roundstart_event_view
+ if("set_cat")
+ var/new_category = href_list["cat"]
+ if(new_category in EVENT_PANEL_TRACKS)
+ statistics_track_page = new_category
+ event_panel(user)
diff --git a/tgstation.dme b/tgstation.dme
index 44637952f813..a8d0513af9ef 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -9276,6 +9276,7 @@
#include "modular_zzbug\code\modules\research\designs\weapon_designs.dm"
#include "modular_zzbug\code\modules\research\techweb\all_nodes.dm"
#include "modular_zzbug\code\modules\storyteller\storytellers\storyteller_tellers.dm"
+#include "modular_zzbug\code\modules\unified\unified.dm"
#include "modular_zzbug\master_files\code\modules\client\examine_tgui.dm"
#include "modular_zzbug\master_files\code\modules\research\techweb\all_nodes.dm"
// END_INCLUDE
From 9f43171cf1d45015289c52a7515934951695b6f6 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 3 Sep 2024 22:19:29 -0700
Subject: [PATCH 02/61] Fix doubled defs
---
.../storyteller/event_defines/major/major_overrides.dm | 8 --------
1 file changed, 8 deletions(-)
diff --git a/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm b/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
index f02a49218ad4..13907c4dbddd 100644
--- a/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
+++ b/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
@@ -90,11 +90,3 @@ BUG EDIT END */
/datum/round_event_control/stray_cargo/changeling_zombie
track = EVENT_TRACK_MAJOR
tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
-
-/datum/round_event_control/cme
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
-
-/datum/round_event_control/stray_cargo/changeling_zombie
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
From 9732f40437d6690a6ebf2b00823d5cdbb19222d5 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 3 Sep 2024 22:19:50 -0700
Subject: [PATCH 03/61] More work :3
---
code/controllers/subsystem/statpanel.dm | 2 +-
code/controllers/subsystem/ticker.dm | 7 +-
code/modules/admin/topic.dm | 2 +-
.../modules/storyteller/_events/_event.dm | 2 +-
.../roleset/_antagonist_event.dm | 6 +-
.../modules/storyteller/scheduled_event.dm | 12 +-
.../code/__DEFINES/unified_defines.dm | 8 +
modular_zzbug/code/modules/unified/_event.dm | 3 +
.../code/modules/unified/divergency_report.dm | 60 +++
.../code/modules/unified/event_overrides.dm | 421 ++++++++++++++++++
modular_zzbug/code/modules/unified/unified.dm | 311 ++++++++-----
tgstation.dme | 4 +
12 files changed, 703 insertions(+), 135 deletions(-)
create mode 100644 modular_zzbug/code/__DEFINES/unified_defines.dm
create mode 100644 modular_zzbug/code/modules/unified/_event.dm
create mode 100644 modular_zzbug/code/modules/unified/divergency_report.dm
create mode 100644 modular_zzbug/code/modules/unified/event_overrides.dm
diff --git a/code/controllers/subsystem/statpanel.dm b/code/controllers/subsystem/statpanel.dm
index 4daf107083f9..1c943c0d8737 100644
--- a/code/controllers/subsystem/statpanel.dm
+++ b/code/controllers/subsystem/statpanel.dm
@@ -45,7 +45,7 @@ SUBSYSTEM_DEF(statpanels)
"Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)",
"Map: [SSmapping.config?.map_name || "Loading..."]",
cached ? "Next Map: [cached.map_name]" : null,
- "Storyteller: [SSgamemode.storyteller ? SSgamemode.storyteller.name : "N/A"]", // BUBBER EDIT ADDITION
+ // "Storyteller: [SSgamemode.storyteller ? SSgamemode.storyteller.name : "N/A"]", // BUBBER EDIT ADDITION // BUG REMOVAL
"Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]",
"Connected: [GLOB.clients.len] | Active: [active_players]/[CONFIG_GET(number/hard_popcap)] | Observing: [observing_players]", //BUBBER EDIT: ACTIVE AND OBSERVING PLAYERS
" ",
diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm
index c9ff144aab47..8d7bdf2891e8 100644
--- a/code/controllers/subsystem/ticker.dm
+++ b/code/controllers/subsystem/ticker.dm
@@ -251,10 +251,15 @@ SUBSYSTEM_DEF(ticker)
//Configure mode and assign player to antagonists
var/can_continue = FALSE
// can_continue = SSdynamic.pre_setup() //Choose antagonists // BUBBER EDIT - STORYTELLER (note: maybe disable)
+ /* BUG REMOVAL START
//BUBBER EDIT BEGIN - STORYTELLER
SSgamemode.init_storyteller()
can_continue = SSgamemode.pre_setup()
//BUBBER EDIT END - STORYTELLER
+ BUG REMOVAL END */
+ // BUG ADDITION START
+ can_continue = SSunified.pre_setup()
+ // BUG ADDITION END
CHECK_TICK
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PRE_JOBS_ASSIGNED, src)
@@ -324,7 +329,7 @@ SUBSYSTEM_DEF(ticker)
/datum/controller/subsystem/ticker/proc/PostSetup()
set waitfor = FALSE
SSdynamic.post_setup()
- SSgamemode.post_setup() // BUBBER EDIT - Storyteller
+ SSunified.post_setup() // BUBBER EDIT - Storyteller // BUG EDIT - Unified
GLOB.start_state = new /datum/station_state()
GLOB.start_state.count()
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 9daf217af970..ae309e2e674f 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -114,7 +114,7 @@
if(!check_rights(R_ADMIN))
return
//SSdynamic.admin_panel() // BUBBER EDIT - STORYTELLER
- SSgamemode.admin_panel(usr) // BUBBER EDIT - STORYTELLER
+ SSunified.admin_panel(usr) // BUBBER EDIT - STORYTELLER // BUG EDIT - Unified
else if(href_list["call_shuttle"])
if(!check_rights(R_ADMIN))
return
diff --git a/modular_zubbers/code/modules/storyteller/_events/_event.dm b/modular_zubbers/code/modules/storyteller/_events/_event.dm
index 232381eddb3b..86ce6861db99 100644
--- a/modular_zubbers/code/modules/storyteller/_events/_event.dm
+++ b/modular_zubbers/code/modules/storyteller/_events/_event.dm
@@ -74,4 +74,4 @@
if("force_next")
message_admins("[key_name_admin(usr)] has forced scheduled event [src.name].")
log_admin_private("[key_name(usr)] has forced scheduled event [src.name].")
- SSgamemode.force_event(src)
+ SSunified.force_event(src) // BUG EDIT
diff --git a/modular_zubbers/code/modules/storyteller/event_defines/roleset/_antagonist_event.dm b/modular_zubbers/code/modules/storyteller/event_defines/roleset/_antagonist_event.dm
index c58aff782fca..82943c65f5de 100644
--- a/modular_zubbers/code/modules/storyteller/event_defines/roleset/_antagonist_event.dm
+++ b/modular_zubbers/code/modules/storyteller/event_defines/roleset/_antagonist_event.dm
@@ -67,7 +67,7 @@
. = ..()
if(!.)
return
- if(!roundstart && !SSgamemode.can_inject_antags())
+ if(!roundstart && !SSunified.can_inject_antags()) // BUG EDIT
return FALSE
var/list/candidates = get_candidates()
if(candidates.len < get_minimum_candidates())
@@ -78,7 +78,7 @@
/datum/round_event_control/antagonist/proc/get_candidates()
var/round_started = SSticker.HasRoundStarted()
- var/list/candidates = SSgamemode.get_candidates(antag_flag, pick_roundstart_players = !round_started, restricted_roles = restricted_roles)
+ var/list/candidates = SSunified.get_candidates(antag_flag, pick_roundstart_players = !round_started, restricted_roles = restricted_roles) // BUG EDIT
return candidates
/datum/round_event_control/antagonist/solo
@@ -86,7 +86,7 @@
/datum/round_event_control/antagonist/proc/get_antag_amount()
- var/people = SSgamemode.get_correct_popcount()
+ var/people = SSunified.get_correct_popcount() // BUG EDIT
var/amount = base_antags + FLOOR(people / denominator, 1)
if(antag_datum && maximum_antags_global > 0)
diff --git a/modular_zubbers/code/modules/storyteller/scheduled_event.dm b/modular_zubbers/code/modules/storyteller/scheduled_event.dm
index df501e14e495..8c367be6c9e1 100644
--- a/modular_zubbers/code/modules/storyteller/scheduled_event.dm
+++ b/modular_zubbers/code/modules/storyteller/scheduled_event.dm
@@ -1,4 +1,4 @@
-///Scheduled event datum for SSgamemode to put events into.
+///Scheduled event datum for SSunified to put events into. // BUG EDIT
/datum/scheduled_event
/// What event are scheduling.
var/datum/round_event_control/event
@@ -54,13 +54,13 @@
message_admins("Scheduled Event: [event] was unable to run and has been refunded.")
log_admin("Scheduled Event: [event] was unable to run and has been refunded.")
- SSgamemode.refund_scheduled_event(src)
+ SSunified.refund_scheduled_event(src) // BUG EDIT
return
///Trigger the event and remove the scheduled datum
message_admins("Scheduled Event: [event] successfully triggered.")
- SSgamemode.TriggerEvent(event)
- SSgamemode.remove_scheduled_event(src)
+ SSunified.TriggerEvent(event) // BUG EDIT
+ SSunified.remove_scheduled_event(src) // BUG EDIT
/datum/scheduled_event/Destroy()
remove_occurence()
@@ -76,11 +76,11 @@
if("cancel")
message_admins("[key_name_admin(usr)] cancelled scheduled event [event.name].")
log_admin_private("[key_name(usr)] cancelled scheduled event [event.name].")
- SSgamemode.remove_scheduled_event(src)
+ SSunified.remove_scheduled_event(src) // BUG EDIT
if("refund")
message_admins("[key_name_admin(usr)] refunded scheduled event [event.name].")
log_admin_private("[key_name(usr)] refunded scheduled event [event.name].")
- SSgamemode.refund_scheduled_event(src)
+ SSunified.refund_scheduled_event(src) // BUG EDIT
if("reschedule")
var/new_schedule = input(usr, "New schedule time (in seconds):", "Reschedule Event") as num|null
if(isnull(new_schedule) || QDELETED(src))
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
new file mode 100644
index 000000000000..d4226d46f3d8
--- /dev/null
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -0,0 +1,8 @@
+#define TAG_ENGINEERING "engineering"
+#define TAG_MEDICAL "medical"
+#define TAG_SECURITY "security"
+
+#define UNIFIED_WAIT_TIME 20 SECONDS
+
+#define UNIFIED_PANEL_MAIN "Main"
+#define UNIFIED_PANEL_VARIABLES "Variables"
diff --git a/modular_zzbug/code/modules/unified/_event.dm b/modular_zzbug/code/modules/unified/_event.dm
new file mode 100644
index 000000000000..9316730a482e
--- /dev/null
+++ b/modular_zzbug/code/modules/unified/_event.dm
@@ -0,0 +1,3 @@
+/datum/round_event_control
+ var/unified_cost = 5
+ var/cooldown_override = 0
diff --git a/modular_zzbug/code/modules/unified/divergency_report.dm b/modular_zzbug/code/modules/unified/divergency_report.dm
new file mode 100644
index 000000000000..793c32cad0d5
--- /dev/null
+++ b/modular_zzbug/code/modules/unified/divergency_report.dm
@@ -0,0 +1,60 @@
+/datum/controller/subsystem/unified/proc/send_trait_report()
+ . = "Central Command Status Summary
"
+ SSstation.generate_station_goals(20)
+
+ var/list/station_goals = SSstation.get_station_goals()
+
+ if(!length(station_goals))
+ . = "
No assigned goals.
"
+ else
+ . += generate_station_goal_report(station_goals)
+ if(!SSstation.station_traits.len)
+ . = "
No identified shift divergencies.
"
+ else
+ . += generate_station_trait_report()
+
+ . += "
This concludes your shift-start evaluation. Have a secure shift!
\
+ This label certifies an Intern has reviewed the above before sending. This document is the property of Nanotrasen Corporation.
"
+
+ print_command_report(., "Central Command Status Summary", announce = FALSE)
+ priority_announce("Hello, crew of [station_name()]. Our intern has finished their shift-start divergency and goals evaluation, which has been sent to your communications console. Have a secure shift!", "Divergency Report", SSstation.announcer.get_rand_report_sound())
+
+
+
+/*
+ * Generate a list of station goals available to purchase to report to the crew.
+ *
+ * Returns a formatted string all station goals that are available to the station.
+ */
+/datum/controller/subsystem/unified/proc/generate_station_goal_report(var/list/station_goals)
+ . = "
Special Orders for [station_name()]:
"
+ var/list/goal_reports = list()
+ for(var/datum/station_goal/station_goal as anything in station_goals)
+ station_goal.on_report()
+ goal_reports += station_goal.get_report()
+
+ . += goal_reports.Join("
")
+ return
+/*
+ * Generate a list of active station traits to report to the crew.
+ *
+ * Returns a formatted string of all station traits (that are shown) affecting the station.
+ */
+/datum/controller/subsystem/unified/proc/generate_station_trait_report()
+ if(!SSstation.station_traits.len)
+ return
+ . = "
Identified shift divergencies:
"
+ for(var/datum/station_trait/station_trait as anything in SSstation.station_traits)
+ if(!station_trait.show_in_report)
+ continue
+ . += "[station_trait.get_report()]
"
+ return
+
+/*/datum/controller/subsystem/unified/proc/generate_station_goals()
+ var/list/possible = subtypesof(/datum/station_goal)
+ var/goal_weights = 0
+ while(possible.len && goal_weights < 1) // station goal budget is 1
+ var/datum/station_goal/picked = pick_n_take(possible)
+ goal_weights += initial(picked.weight)
+ SSstation.goals_by_type += new picked // does this still work?
+*/
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
new file mode 100644
index 000000000000..fb90c0574a8d
--- /dev/null
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -0,0 +1,421 @@
+/datum/round_event_control/scrubber_overflow/threatening
+ weight = 0
+ max_occurrences = 0
+
+/datum/round_event_control/scrubber_overflow/catastrophic
+ weight = 0
+ max_occurrences = 0
+
+/datum/round_event_control/scrubber_overflow/every_vent
+ weight = 0
+ max_occurrences = 0
+
+/datum/round_event_control/scrubber_overflow/ices
+ weight = 0
+ max_occurrences = 0
+
+/datum/round_event_control/aurora_caelus
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL, TAG_POSITIVE, TAG_SPACE)
+ weight = 10
+
+/datum/round_event_control/camera_failure
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL, TAG_SPOOKY)
+ weight = 10
+
+/datum/round_event_control/space_dust
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_DESTRUCTIVE, TAG_SPACE)
+ weight = 10
+ max_occurrences = 0 // space dust is a nothing event
+
+/datum/round_event_control/electrical_storm
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_SPOOKY)
+ weight = 5 // it's annoying
+
+/datum/round_event_control/fake_virus
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_TARGETED)
+ weight = 10
+
+/datum/round_event_control/falsealarm
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/market_crash
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/mice_migration
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/wisdomcow
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL, TAG_POSITIVE)
+ weight = 10
+
+/datum/round_event_control/shuttle_loan
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/mass_hallucination
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/stray_cargo
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/grey_tide
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_DESTRUCTIVE, TAG_SPOOKY)
+ weight = 10
+
+/datum/round_event_control/gravity_generator_blackout
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL, TAG_SPACE)
+ weight = 10
+
+/datum/round_event_control/shuttle_insurance
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/tram_malfunction
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/grid_check
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL, TAG_SPOOKY)
+ weight = 10
+
+/datum/round_event_control/bureaucratic_error
+ track = EVENT_TRACK_MUNDANE
+ weight = 5 // It's annoying
+
+/datum/round_event_control/vent_clog
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_hallucination
+ track = EVENT_TRACK_MUNDANE
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_grav
+ track = EVENT_TRACK_MUNDANE
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_bioscrambler
+ track = EVENT_TRACK_MUNDANE
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_bluespace
+ track = EVENT_TRACK_MUNDANE
+ weight = 7.5 // Our stuff being teleported away is kinda annoying but not too bad
+
+/datum/round_event_control/vent_clog/strange
+ track = EVENT_TRACK_MUNDANE
+ max_occurrences = 0 // none of this for now, not sure about the animals in it
+
+/datum/round_event_control/brand_intelligence
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/carp_migration
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_COMBAT)
+ weight = 10
+
+/datum/round_event_control/communications_blackout
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_SPOOKY)
+ weight = 10
+
+/datum/round_event_control/ion_storm
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_TARGETED)
+ weight = 10
+
+/datum/round_event_control/processor_overload
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_DESTRUCTIVE)
+ weight = 5 // More severe version of comms blackout
+
+/datum/round_event_control/radiation_leak
+ track = EVENT_TRACK_MODERATE
+ weight = 10
+
+/datum/round_event_control/sandstorm
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/shuttle_catastrophe
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL)
+ weight = 10
+
+/datum/round_event_control/spacevine
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/portal_storm_syndicate
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_COMBAT)
+ weight = 10
+
+// BUG EDIT START
+/datum/round_event_control/radiation_storm
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL)
+ max_occurrences = 2
+ weight = 10
+
+/datum/round_event_control/wormholes
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL)
+ max_occurrences = 2 // BUG: more than two wormholes would be pretty annoying, like the radstorm
+ weight = 10
+
+/datum/round_event_control/heart_attack
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_TARGETED, TAG_VERY_TARGETED)
+ weight = 10
+
+/datum/round_event_control/appendicitis
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_TARGETED, TAG_VERY_TARGETED)
+ weight = 10
+
+/datum/round_event_control/disease_outbreak
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_TARGETED)
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_dimensional
+ track = EVENT_TRACK_MODERATE
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_ectoplasm
+ track = EVENT_TRACK_MODERATE
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_flux
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_grav/high
+ track = EVENT_TRACK_MODERATE
+ weight = 10
+
+/datum/round_event_control/vent_clog/major
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMBAT)
+ weight = 10
+
+/datum/round_event_control/vent_clog/critical
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMBAT, TAG_CHAOTIC)
+
+/datum/round_event_control/mold
+ track = EVENT_TRACK_MODERATE
+ tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/earthquake
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/blob
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE, TAG_COMBAT, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/meteor_wave
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMMUNAL, TAG_SPACE, TAG_DESTRUCTIVE, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/meteor_wave/meaty
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMMUNAL, TAG_SPACE, TAG_DESTRUCTIVE)
+ weight = 20 // meat meteors?? how queer
+
+/datum/round_event_control/meteor_wave/ices
+ weight = 0
+
+/datum/round_event_control/immovable_rod
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/stray_meteor
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE, TAG_SPACE)
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_vortex
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/anomaly/anomaly_pyro
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE)
+ weight = 10
+
+/datum/round_event_control/spider_infestation
+ track = EVENT_TRACK_MAJOR
+ weight = 10
+
+/datum/round_event_control/revenant
+ min_players = 20
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE, TAG_SPOOKY)
+ weight = 10
+
+/datum/round_event_control/abductor
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CHAOTIC)
+ weight = 10
+
+/datum/round_event_control/fugitives
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMBAT)
+ weight = 10
+
+/datum/round_event_control/voidwalker
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_SPACE)
+ weight = 10
+
+/datum/round_event_control/cme
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
+
+/datum/round_event_control/stray_cargo/changeling_zombie
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
+
+/datum/round_event_control/cme
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
+
+/datum/round_event_control/stray_cargo/changeling_zombie
+ track = EVENT_TRACK_MAJOR
+ tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
+
+/datum/round_event_control/scrubber_overflow
+ track = EVENT_TRACK_MUNDANE
+ tags = list(TAG_COMMUNAL)
+
+// ANTAGS
+
+/datum/round_event_control/antagonist/solo/bloodsucker
+ name = "Bloodsuckers"
+ roundstart = TRUE
+
+ antag_flag = ROLE_BLOODSUCKER
+ antag_datum = /datum/antagonist/bloodsucker
+ weight = 8
+ min_players = 20
+
+ base_antags = 2
+ maximum_antags = 3
+ maximum_antags_global = 3
+
+ tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/bloodsucker/midround
+ name = "Vampiric Accident"
+ roundstart = FALSE
+
+/datum/round_event_control/antagonist/solo/changeling
+ name = "Changelings"
+ roundstart = TRUE
+
+ antag_flag = ROLE_CHANGELING
+ antag_datum = /datum/antagonist/changeling
+ weight = 8
+ min_players = 20
+ maximum_antags_global = 4
+
+ tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/changeling/midround
+ name = "Genome Awakening (Changelings)"
+ roundstart = FALSE
+
+/datum/round_event_control/antagonist/solo/heretic
+ name = "Heretics"
+ roundstart = TRUE
+
+ antag_flag = ROLE_HERETIC
+ antag_datum = /datum/antagonist/heretic
+ weight = 8
+ min_players = 30
+
+ base_antags = 1
+ maximum_antags = 2
+ maximum_antags_global = 2
+
+ tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/heretic/midround
+ name = "Midround Heretics"
+ roundstart = FALSE
+
+/datum/round_event_control/antagonist/solo/malf
+ name = "Malfunctioning AI"
+
+ base_antags = 1
+ maximum_antags = 1
+ maximum_antags_global = 1
+
+ min_players = 20
+
+ antag_datum = /datum/antagonist/malf_ai
+ antag_flag = ROLE_MALF
+ weight = 0
+ tags = list(TAG_CREW_ANTAG, TAG_COMBAT, TAG_DESTRUCTIVE, TAG_CHAOTIC)
+ restricted_roles = list()
+
+/datum/round_event_control/antagonist/solo/malf/roundstart
+ roundstart = TRUE
+ typepath = /datum/round_event/antagonist/solo/malf_ai/roundstart
+ weight = 10
+
+/datum/round_event_control/antagonist/team/nuke_ops
+ name = "Nuclear Operatives"
+ roundstart = TRUE
+
+ antag_flag = ROLE_OPERATIVE
+ antag_datum = /datum/antagonist/nukeop
+ antag_leader_datum = /datum/antagonist/nukeop/leader
+
+ weight = 0
+ tags = list(TAG_COMBAT, TAG_CHAOTIC)
+
+ base_antags = 2
+ maximum_antags = 5
+ maximum_antags_global = 5
+
+ typepath = /datum/round_event/antagonist/team/nukie
+
+ ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_NUKIEBASE)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 262cc80f549c..a9d50444ac6d 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -7,14 +7,23 @@ SUBSYSTEM_DEF(unified)
flags = SS_BACKGROUND | SS_KEEP_TIMING
wait = 2 SECONDS
+ /// Next process for our storyteller. The wait time is STORYTELLER_WAIT_TIME
+ var/next_process = 0
+
+ /// Our total event point budget for the shift. Initialized in Initialize()
+ var/points = 0
+
+ /// The time after which we can schedule another event
+ var/cooldown_over = 0
+
/// Whether we allow pop scaling. This is configured by config, or the storyteller UI
var/allow_pop_scaling = TRUE
/// Events that we have scheduled to run in the nearby future
var/list/scheduled_events = list()
- /// Associative list of tracks to forced event controls. For admins to force events (though they can still invoke them freely outside of the track system)
- var/list/forced_next_events = list()
+ /// For admins to force events (though they can still invoke them freely outside of the track system)
+ var/datum/round_event_control/forced_next_event
var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences.
var/list/running = list() //list of all existing /datum/round_event
@@ -35,8 +44,8 @@ SUBSYSTEM_DEF(unified)
/// Whether we are viewing the roundstart events or not
var/roundstart_event_view = TRUE
- /// Whether the storyteller has been halted
- var/halted_storyteller = FALSE
+ /// Whether the gamemode has been halted
+ var/halted = FALSE
/// Ready players for roundstart events.
var/ready_players = 0
@@ -50,12 +59,26 @@ SUBSYSTEM_DEF(unified)
var/storyteller_voted = FALSE
+ /// Whether we account for currently filled jobs when scheduling events TODO add to config
+ var/allow_job_weighting = TRUE
+
+ // TODO add to config
+ var/antag_divisor = 8
+
+ /// % chance of having an antag created at roundstart
+ var/roundstart_event_chance = 40
+
+ /// List of all datum/round_event_control with roundstart=true.
+ var/list/roundstart_control = list()
+
/datum/controller/subsystem/unified/Initialize(time, zlevel)
for(var/type in typesof(/datum/round_event_control))
var/datum/round_event_control/event = new type()
if(!event.typepath || !event.name || !event.valid_for_map())
continue //don't want this one! leave it for the garbage collector
control += event //add it to the list of all events (controls)
+ if(event.roundstart)
+ roundstart_control += event
getHoliday()
load_config_vars()
@@ -76,11 +99,10 @@ SUBSYSTEM_DEF(unified)
sch_event.alerted_admins = TRUE
message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
- if(!halted_storyteller && next_storyteller_process <= world.time && storyteller)
- // We update crew information here to adjust population scalling and event thresholds for the storyteller.
+ if(!halted && cooldown_over <= world.time)
+ // We update crew information here to adjust population scaling and event thresholds
update_crew_infos()
- next_storyteller_process = world.time + STORYTELLER_WAIT_TIME
- storyteller.process(STORYTELLER_WAIT_TIME * 0.1)
+ add_event()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
@@ -95,9 +117,123 @@ SUBSYSTEM_DEF(unified)
if (MC_TICK_CHECK)
return
+/datum/controller/subsystem/unified/proc/add_event()
+ . = FALSE
+ var/datum/round_event_control/picked_event
+
+ var/player_pop = SSunified.get_correct_popcount()
+ calculate_weights(control)
+ var/list/valid_events = list()
+ // Determine which events are valid to pick
+ for(var/datum/round_event_control/event as anything in SSunified.control)
+ if(isnull(event))
+ continue
+ if(event.can_spawn_event(player_pop))
+ valid_events[event] = event.calculated_weight
+ ///If we didn't get any events, remove the points inform admins and dont do anything
+ if(!length(valid_events))
+ message_admins("Storyteller failed to pick an event.")
+ log_admin("Storyteller failed to pick an event.")
+ return
+ picked_event = pick_weight(valid_events)
+ if(!picked_event)
+ message_admins("WARNING: Unified picked a null from event pool. Aborting event roll.")
+ log_admin("WARNING: Unified picked a null from event pool. Aborting event roll.")
+ stack_trace("WARNING: Unified picked a null from event pool.")
+ return
+
+ // Calculate event cost and buy it
+ var/total_cost = picked_event.unified_cost
+ if(allow_job_weighting)
+ var/job_cost = 1
+ if(TAG_ENGINEERING in picked_event.tags && eng_crew == 0)
+ job_cost *= 2
+ if(TAG_MEDICAL in picked_event.tags && med_crew == 0)
+ job_cost *= 2
+ if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
+ job_cost *= 2
+ total_cost *= job_cost
+ points -= total_cost
+ var/cooldown // in minutes
+ if(picked_event.cooldown_override)
+ cooldown = rand(picked_event.cooldown_override/2, picked_event.cooldown_override*1.5)
+ else
+ cooldown = rand(total_cost/2, total_cost*1.5)
+ cooldown_over = world.time + cooldown MINUTES // convert cooldown to deciseconds
+ message_admins("Unified purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
+ log_admin("Storyteller purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
+ if(picked_event.roundstart)
+ TriggerEvent(picked_event)
+ else
+ schedule_event(picked_event, 3 MINUTES, total_cost) // We already randomize cooldown, we don't need to randomize this
+
+ . = TRUE
+
+/datum/controller/subsystem/unified/proc/add_roundstart_event()
+ . = FALSE
+ var/datum/round_event_control/picked_event
+
+ var/player_pop = SSunified.get_correct_popcount()
+ calculate_weights(control)
+ var/list/valid_events = list()
+ // Determine which events are valid to pick
+ for(var/datum/round_event_control/event as anything in SSunified.roundstart_control)
+ if(isnull(event))
+ continue
+ if(event.can_spawn_event(player_pop))
+ valid_events[event] = event.calculated_weight
+ ///If we didn't get any events, remove the points inform admins and dont do anything
+ if(!length(valid_events))
+ message_admins("Storyteller failed to pick an event.")
+ log_admin("Storyteller failed to pick an event.")
+ return
+ picked_event = pick_weight(valid_events)
+ if(!picked_event)
+ message_admins("WARNING: Unified picked a null from event pool. Aborting event roll.")
+ log_admin("WARNING: Unified picked a null from event pool. Aborting event roll.")
+ stack_trace("WARNING: Unified picked a null from event pool.")
+ return
+
+ // Calculate event cost and buy it
+ var/total_cost = picked_event.unified_cost
+ if(allow_job_weighting)
+ var/job_cost = 1
+ if(TAG_ENGINEERING in picked_event.tags && eng_crew == 0)
+ job_cost *= 2
+ if(TAG_MEDICAL in picked_event.tags && med_crew == 0)
+ job_cost *= 2
+ if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
+ job_cost *= 2
+ total_cost *= job_cost
+ points -= total_cost
+
+ . = TRUE
+
+/datum/controller/subsystem/unified/proc/calculate_weights()
+ for(var/datum/round_event_control/event in control)
+ var/weight_total = event.weight
+ if(allow_job_weighting)
+ var/job_weighting = 1
+ if(TAG_ENGINEERING in event.tags && eng_crew == 0)
+ job_weighting *= 0.5
+ if(TAG_MEDICAL in event.tags && med_crew == 0)
+ job_weighting *= 0.5
+ if(TAG_SECURITY in event.tags && sec_crew == 0)
+ job_weighting *= 0.5
+ if(head_crew == 0)
+ job_weighting = 0
+ weight_total *= job_weighting
+ /// Apply occurence multipliers if able
+ var/occurences = event.get_occurences()
+ if(occurences)
+ ///If the event has occured already, apply a penalty multiplier based on amount of occurences
+ weight_total *= event.reoccurence_penalty_multiplier ** occurences
+ /// Write it
+ event.calculated_weight = weight_total
+
/// Gets the number of antagonists the antagonist injection events will stop rolling after.
/datum/controller/subsystem/unified/proc/get_antag_cap()
- return round(max(min(get_correct_popcount() / storyteller.antag_divisor + sec_crew,sec_crew*1.5),ANTAG_CAP_FLAT))
+ return round(max(min(get_correct_popcount() / antag_divisor + sec_crew,sec_crew*1.5),ANTAG_CAP_FLAT))
/// Whether events can inject more antagonists into the round
/datum/controller/subsystem/unified/proc/can_inject_antags()
@@ -175,14 +311,12 @@ SUBSYSTEM_DEF(unified)
/// Refunds and removes a scheduled event.
/datum/controller/subsystem/unified/proc/refund_scheduled_event(datum/scheduled_event/refunded)
- if(refunded.cost)
- var/track_type = refunded.event.track
- event_track_points[track_type] += refunded.cost
+ points += refunded.cost
remove_scheduled_event(refunded)
/// Schedules an event.
/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
- forced_next_events[event.track] = event
+ forced_next_event = event
/// Removes a scheduled event.
/datum/controller/subsystem/unified/proc/remove_scheduled_event(datum/scheduled_event/removed)
@@ -196,44 +330,13 @@ SUBSYSTEM_DEF(unified)
if(player.ready == PLAYER_READY_TO_PLAY)
ready_players++
-/// We roll points to be spent for roundstart events, including antagonists.
-/datum/controller/subsystem/unified/proc/roll_pre_setup_points()
- if(storyteller.disable_distribution || halted_storyteller)
- return
- /// Distribute points
- for(var/track in event_track_points)
- // BUG EDIT START
- var/calc_value = roundstart_base_points[track]
- calc_value *= storyteller.starting_point_multipliers[track]
- var/total_variance = roundstart_variance[track] * storyteller.starting_point_variance_multiplier[track]
- calc_value += rand(-total_variance, total_variance)
- event_track_points[track] = round(calc_value, EVENT_POINT_GAINED_PER_SECOND)
- // BUG EDIT END
-
- /// If the storyteller guarantees an antagonist roll, add points to make it so.
- if(storyteller.guarantees_roundstart_roleset && event_track_points[EVENT_TRACK_ROLESET] < point_thresholds[EVENT_TRACK_ROLESET])
- event_track_points[EVENT_TRACK_ROLESET] = point_thresholds[EVENT_TRACK_ROLESET]
-
- /// If we have any forced events, ensure we get enough points for them
- for(var/track in event_tracks)
- if(forced_next_events[track] && event_track_points[track] < point_thresholds[track])
- event_track_points[track] = point_thresholds[track]
-
-/// At this point we've rolled roundstart events and antags and we handle leftover points here.
-/datum/controller/subsystem/unified/proc/handle_post_setup_points()
- for(var/track in event_track_points) //Just halve the points for now.
- event_track_points[track] *= 0.5
-
/// Because roundstart events need 2 steps of firing for purposes of antags, here is the first step handled, happening before occupation division.
/datum/controller/subsystem/unified/proc/handle_pre_setup_roundstart_events()
- if(storyteller.disable_distribution)
- return
- if(halted_storyteller)
+ if(halted)
message_admins("WARNING: Didn't roll roundstart events (including antagonists) due to the storyteller being halted.")
return
- while(TRUE)
- if(!storyteller.handle_tracks())
- break
+ if(prob(roundstart_event_chance))
+ add_roundstart_event()
/// Second step of handlind roundstart events, happening after people spawn.
/datum/controller/subsystem/unified/proc/handle_post_setup_roundstart_events()
@@ -282,8 +385,9 @@ SUBSYSTEM_DEF(unified)
med_crew++
if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)
sec_crew++
- update_pop_scaling()
+ // update_pop_scaling() TODO FIX
+/* TODO FIX
/datum/controller/subsystem/unified/proc/update_pop_scaling()
for(var/track in event_tracks)
var/low_pop_bound = min_pop_thresholds[track]
@@ -303,6 +407,7 @@ SUBSYSTEM_DEF(unified)
var/calculated_multiplier = 1 - (penalty / 100)
current_pop_scale_multipliers[track] = calculated_multiplier
+*/
/datum/controller/subsystem/unified/proc/TriggerEvent(datum/round_event_control/event)
. = event.preRunEvent()
@@ -315,18 +420,6 @@ SUBSYSTEM_DEF(unified)
/datum/controller/subsystem/unified/proc/resetFrequency()
event_frequency_multiplier = 1
-/* /client/proc/forceEvent()
- set name = "Trigger Event"
- set category = "Admin.Events"
-
- if(!holder ||!check_rights(R_FUN))
- return
-
- holder.forceEvent(usr) */
-
-/* /datum/admins/forceEvent(mob/user)
- SSgamemode.event_panel(user) */
-
//////////////
// HOLIDAYS //
@@ -334,7 +427,7 @@ SUBSYSTEM_DEF(unified)
//Uncommenting ALLOW_HOLIDAYS in config.txt will enable holidays
//It's easy to add stuff. Just add a holiday datum in code/modules/holiday/holidays.dm
-//You can then check if it's a special day in any code in the game by doing if(SSgamemode.holidays["Groundhog Day"])
+//You can then check if it's a special day in any code in the game by doing if(SSunified.holidays["Groundhog Day"])
//You can also make holiday random events easily thanks to Pete/Gia's system.
//simply make a random event normally, then assign it a holidayID string which matches the holiday's name.
@@ -387,22 +480,21 @@ SUBSYSTEM_DEF(unified)
// We need to do this to prevent some niche fuckery... and make dep. orders work. Lol
SSjob.ResetOccupations()
calculate_ready_players()
- roll_pre_setup_points()
handle_pre_setup_roundstart_events()
+ cooldown_over = world.time + rand(2.5, 20) MINUTES // give 2.5 to 20 minutes before non-roundstart events start happening
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
/datum/controller/subsystem/unified/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report.
if(!report)
report = !CONFIG_GET(flag/no_intercept_report)
- addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME)
+ addtimer(CALLBACK(src, PROC_REF(display_roundstart_logout_report)), ROUNDSTART_LOGOUT_REPORT_TIME)
if(SSdbcore.Connect())
var/list/to_set = list()
var/arguments = list()
- if(storyteller)
- to_set += "game_mode = :game_mode"
- arguments["game_mode"] = storyteller.name
+ to_set += "game_mode = :game_mode"
+ arguments["game_mode"] = "Unified"
if(GLOB.revdata.originmastercommit)
to_set += "commit_hash = :commit_hash"
arguments["commit_hash"] = GLOB.revdata.originmastercommit
@@ -416,7 +508,6 @@ SUBSYSTEM_DEF(unified)
qdel(query_round_game_mode)
addtimer(CALLBACK(src, PROC_REF(send_trait_report)), rand(1 MINUTES, 5 MINUTES))
handle_post_setup_roundstart_events()
- handle_post_setup_points()
roundstart_event_view = FALSE
return TRUE
@@ -438,7 +529,7 @@ SUBSYSTEM_DEF(unified)
//////////////////////////
//Reports player logouts//
//////////////////////////
-/proc/display_roundstart_logout_report()
+/datum/controller/subsystem/unified/proc/display_roundstart_logout_report()
var/list/msg = list("[span_boldnotice("Roundstart logout report")]\n\n")
for(var/i in GLOB.mob_living_list)
var/mob/living/L = i
@@ -525,9 +616,6 @@ SUBSYSTEM_DEF(unified)
event.max_occurrences = value
if("earliest_start")
event.earliest_start = value * (1 MINUTES)
- if("track")
- if(value in event_tracks)
- event.track = value
if("cost")
event.cost = value
if("reoccurence_penalty_multiplier")
@@ -547,7 +635,7 @@ SUBSYSTEM_DEF(unified)
var/round_started = SSticker.HasRoundStarted()
var/list/dat = list()
var/active_pop = get_correct_popcount()
- dat += " HALT Storyteller Event Panel Set Storyteller Refresh"
+ dat += " HALT Unified Event Panel Set Storyteller Refresh"
dat += "
Storyteller determines points gained, event chances, and is the entity responsible for rolling events."
dat += "
Active Players: [active_pop] (Head: [head_crew], Sec: [sec_crew], Eng: [eng_crew], Med: [med_crew]) - Antag Cap: [get_antag_cap()]"
dat += "
"
@@ -570,7 +658,7 @@ SUBSYSTEM_DEF(unified)
dat += "
[track]: [roundstart_point_multipliers[track]]"
dat += "
"
*/
-
+ /* TODO FIX
dat += "Minimum Population for Tracks:"
dat += "
This are the minimum population caps for events to be able to run."
for(var/track in event_tracks)
@@ -581,7 +669,7 @@ SUBSYSTEM_DEF(unified)
dat += "
Those are thresholds the tracks require to reach with points to make an event."
for(var/track in event_tracks)
dat += "
[track]: [point_thresholds[track]]"
-
+ */
if(UNIFIED_PANEL_MAIN)
var/even = TRUE
dat += "Event Tracks:
"
@@ -594,27 +682,26 @@ SUBSYSTEM_DEF(unified)
dat += "Forced | "
dat += "Actions | "
dat += ""
- for(var/track in event_tracks)
- even = !even
- var/background_cl = even ? "#17191C" : "#23273C"
- var/lower = event_track_points[track]
- var/upper = point_thresholds[track]
- var/percent = round((lower/upper)*100)
- var/next = 0
- var/last_points = last_point_gains[track]
- if(last_points)
- next = round((upper - lower) / last_points / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
- dat += ""
- dat += "| [track] | " //Track
- dat += "[percent]% ([lower]/[upper]) | " //Progress
- dat += "~[next] m. | " //Next
- var/datum/round_event_control/forced_event = forced_next_events[track]
- var/forced = forced_event ? "[forced_event.name] X" : ""
- dat += "[forced] | " //Forced
- dat += "Set Pts. Next Event | " //Actions
- dat += "
"
+ even = !even
+ /* TODO FIX
+ var/background_cl = even ? "#17191C" : "#23273C"
+ var/lower = event_track_points[track]
+ var/upper = point_thresholds[track]
+ var/percent = round((lower/upper)*100)
+ var/next = 0
+ var/last_points = last_point_gains[track]
+ if(last_points)
+ next = round((upper - lower) / last_points / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
+ dat += ""
+ dat += "| [track] | " //Track
+ dat += "[percent]% ([lower]/[upper]) | " //Progress
+ dat += "~[next] m. | " //Next
+ var/forced = forced_next_event ? "[forced_next_event.name] X" : ""
+ dat += "[forced] | " //Forced
+ dat += "Set Pts. Next Event | " //Actions
+ dat += "
"
dat += ""
-
+ */
dat += "Scheduled Events:
"
dat += ""
dat += ""
@@ -663,26 +750,8 @@ SUBSYSTEM_DEF(unified)
/// Panel containing information and actions regarding events
/datum/controller/subsystem/unified/proc/event_panel(mob/user)
var/list/dat = list()
- if(storyteller)
- dat += "Storyteller: [storyteller.name]"
- dat += "
Repetition penalty multiplier: [storyteller.event_repetition_multiplier]"
- dat += "
Cost variance: [storyteller.cost_variance]"
- if(storyteller.tag_weight_multipliers)
- dat += "
Tag weight multipliers:"
- for(var/tag in storyteller.tag_weight_multipliers)
- dat += "[tag]:[storyteller.tag_weight_multipliers[tag]] | "
- storyteller.calculate_weights(statistics_track_page)
- else
- dat += "Storyteller: None
Weight and chance statistics will be inaccurate due to the present lack of a storyteller."
- dat += "
Roundstart Events Forced Roundstart events will use rolled points, and are guaranteed to trigger (even if the used points are not enough)"
+ dat += "
Roundstart Events"
dat += "
Avg. event intervals: "
- for(var/track in event_tracks)
- if(last_point_gains[track])
- var/est_time = round(point_thresholds[track] / last_point_gains[track] / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
- dat += "[track]: ~[est_time] m. | "
- dat += "
"
- for(var/track in EVENT_PANEL_TRACKS)
- dat += "[track]"
dat += "
"
/// Create event info and stats table
dat += ""
@@ -699,13 +768,7 @@ SUBSYSTEM_DEF(unified)
var/even = TRUE
var/total_weight = 0
var/list/event_lookup
- switch(statistics_track_page)
- if(ALL_EVENTS)
- event_lookup = control
- if(UNCATEGORIZED_EVENTS)
- event_lookup = uncategorized
- else
- event_lookup = event_pools[statistics_track_page]
+ event_lookup = control
var/list/assoc_spawn_weight = list()
var/active_pop = get_correct_popcount()
for(var/datum/round_event_control/event as anything in event_lookup)
@@ -754,8 +817,9 @@ SUBSYSTEM_DEF(unified)
if("main")
switch(href_list["action"])
if("halt_storyteller")
- halted_storyteller = !halted_storyteller
- message_admins("[key_name_admin(usr)] has [halted_storyteller ? "HALTED" : "un-halted"] the Storyteller.")
+ halted = !halted
+ message_admins("[key_name_admin(usr)] has [halted ? "HALTED" : "un-halted"] the Storyteller.")
+ /* TODO FIX
if("vars")
var/track = href_list["track"]
switch(href_list["var"])
@@ -784,6 +848,7 @@ SUBSYSTEM_DEF(unified)
return
message_admins("[key_name_admin(usr)] set point threshold of [track] track to [new_value].")
point_thresholds[track] = new_value
+ */
if("reload_config_vars")
message_admins("[key_name_admin(usr)] reloaded unified config vars.")
load_config_vars()
@@ -793,6 +858,7 @@ SUBSYSTEM_DEF(unified)
if("open_stats")
event_panel(user)
return
+ /* TODO FIX
if("track_action")
var/track = href_list["track"]
if(!(track in event_tracks))
@@ -816,6 +882,7 @@ SUBSYSTEM_DEF(unified)
event_track_points[track] = point_thresholds[track]
if(storyteller)
storyteller.handle_tracks()
+ */
admin_panel(user)
if("stats")
switch(href_list["action"])
diff --git a/tgstation.dme b/tgstation.dme
index a8d0513af9ef..f8e270d327e0 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -9269,6 +9269,7 @@
#include "modular_zubbers\master_files\skyrat\modules\cortical_borer\code\cortical_borer_antag.dm"
#include "modular_zubbers\master_files\skyrat\modules\opposing_force\code\opposing_force_subsystem.dm"
#include "modular_zubbers\master_files\skyrat\modules\verbs\code\subtle.dm"
+#include "modular_zzbug\code\__DEFINES\unified_defines.dm"
#include "modular_zzbug\code\game\objects\items\plushes.dm"
#include "modular_zzbug\code\modules\client\preferences\preferences.dm"
#include "modular_zzbug\code\modules\events\appendicitis.dm"
@@ -9276,6 +9277,9 @@
#include "modular_zzbug\code\modules\research\designs\weapon_designs.dm"
#include "modular_zzbug\code\modules\research\techweb\all_nodes.dm"
#include "modular_zzbug\code\modules\storyteller\storytellers\storyteller_tellers.dm"
+#include "modular_zzbug\code\modules\unified\_event.dm"
+#include "modular_zzbug\code\modules\unified\divergency_report.dm"
+#include "modular_zzbug\code\modules\unified\event_overrides.dm"
#include "modular_zzbug\code\modules\unified\unified.dm"
#include "modular_zzbug\master_files\code\modules\client\examine_tgui.dm"
#include "modular_zzbug\master_files\code\modules\research\techweb\all_nodes.dm"
From 9fc37220487e6ad71083fce843820478b200e0eb Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 3 Sep 2024 22:23:33 -0700
Subject: [PATCH 04/61] Successful build
---
.../code/modules/unified/event_overrides.dm | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index fb90c0574a8d..7a244bf733be 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -308,22 +308,27 @@
/datum/round_event_control/cme
track = EVENT_TRACK_MAJOR
tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
+ weight = 10
/datum/round_event_control/stray_cargo/changeling_zombie
track = EVENT_TRACK_MAJOR
tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
+ weight = 10
/datum/round_event_control/cme
track = EVENT_TRACK_MAJOR
tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
+ weight = 10
/datum/round_event_control/stray_cargo/changeling_zombie
track = EVENT_TRACK_MAJOR
tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
+ weight = 10
/datum/round_event_control/scrubber_overflow
track = EVENT_TRACK_MUNDANE
tags = list(TAG_COMMUNAL)
+ weight = 10
// ANTAGS
@@ -419,3 +424,44 @@
typepath = /datum/round_event/antagonist/team/nukie
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_NUKIEBASE)
+
+/datum/round_event_control/antagonist/obsessed
+ name = "Obsessed"
+ roundstart = TRUE
+
+ antag_flag = ROLE_OBSESSED
+ antag_datum = /datum/antagonist/obsessed
+ weight = 8
+ maximum_antags_global = 1
+
+ tags = list(TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/spy
+ name = "Spies"
+ roundstart = TRUE
+
+ antag_flag = ROLE_SPY
+ antag_datum = /datum/antagonist/spy
+ weight = 8
+ maximum_antags_global = 4
+
+ tags = list(TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/spy/midround
+ name = "Spies (Midround)"
+ roundstart = FALSE
+
+/datum/round_event_control/antagonist/solo/traitor
+ name = "Traitors"
+ roundstart = TRUE
+
+ antag_flag = ROLE_TRAITOR
+ antag_datum = /datum/antagonist/traitor
+ weight = 8
+ maximum_antags_global = 6
+
+ tags = list(TAG_CREW_ANTAG)
+
+/datum/round_event_control/antagonist/solo/traitor/midround
+ name = "Sleeper Agents (Traitors)"
+ roundstart = FALSE
From 63b9b11dd350adf7399951e968f6adde2f1d5c79 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 3 Sep 2024 22:36:27 -0700
Subject: [PATCH 05/61] Remove storyteller vote
---
code/controllers/subsystem/ticker.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm
index 8d7bdf2891e8..896648928977 100644
--- a/code/controllers/subsystem/ticker.dm
+++ b/code/controllers/subsystem/ticker.dm
@@ -172,7 +172,7 @@ SUBSYSTEM_DEF(ticker)
send2chat(new /datum/tgs_message_content("<@&[CONFIG_GET(string/game_alert_role_id)]> Round **[GLOB.round_id]** starting on [SSmapping.config.map_name], [CONFIG_GET(string/servername)]! \nIf you wish to be pinged for game related stuff, go to <#[CONFIG_GET(string/role_assign_channel_id)]> and assign yourself the roles."), CONFIG_GET(string/channel_announce_new_game)) // SKYRAT EDIT - Role ping and round ID in game-alert
// SKYRAT EDIT END
current_state = GAME_STATE_PREGAME
- SSvote.initiate_vote(/datum/vote/storyteller, "Storyteller Vote", forced = TRUE) // BUBBER EDIT ADDITION
+ // SSvote.initiate_vote(/datum/vote/storyteller, "Storyteller Vote", forced = TRUE) // BUBBER EDIT ADDITION // BUG REMOVAL
SStitle.change_title_screen() //SKYRAT EDIT ADDITION - Title screen
addtimer(CALLBACK(SStitle, TYPE_PROC_REF(/datum/controller/subsystem/title, change_title_screen)), 1 SECONDS) //SKYRAT EDIT ADDITION - Title screen
//Everyone who wants to be an observer is now spawned
From 262ad7b31ae51c8acc1d9206e7281f69645fdf68 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 3 Sep 2024 23:57:55 -0700
Subject: [PATCH 06/61] Remove storyteller desc to_chats if we're not running
storyteller vote
---
modular_zubbers/code/modules/storyteller/gamemode.dm | 2 ++
.../code/modules/storyteller/storyteller_vote.dm | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/modular_zubbers/code/modules/storyteller/gamemode.dm b/modular_zubbers/code/modules/storyteller/gamemode.dm
index e0c17c966fc6..e63e89fe8cb3 100644
--- a/modular_zubbers/code/modules/storyteller/gamemode.dm
+++ b/modular_zubbers/code/modules/storyteller/gamemode.dm
@@ -739,9 +739,11 @@ SUBSYSTEM_DEF(gamemode)
if((storyboy.population_min && storyboy.population_min > client_amount) || (storyboy.population_max && storyboy.population_max < client_amount))
continue
choices += storyboy.name
+ /* BUG REMOVAL START
///Because the vote subsystem is dumb and does not support any descriptions, we dump them into world.
to_chat(world, span_notice("[storyboy.name]"))
to_chat(world, span_notice("[storyboy.desc]"))
+ BUG REMOVAL END */
return choices
/datum/controller/subsystem/gamemode/proc/storyteller_vote_result(winner_name)
diff --git a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
index 99c3479e4a4e..6b20e4dcca98 100644
--- a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
+++ b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
@@ -21,6 +21,12 @@
/datum/vote/storyteller/create_vote()
. = ..()
+ for(var/name in choices)
+ for(var/storyteller_type in SSgamemode.storytellers)
+ var/datum/storyteller/storyboy = SSgamemode.storytellers[storyteller_type]
+ if(name == storyboy.name)
+ to_chat(world, span_notice("[storyboy.name]"))
+ to_chat(world, span_notice("[storyboy.desc]"))
if((length(choices) == 1)) // Only one choice, no need to vote. Let's just auto-rotate it to the only remaining map because it would just happen anyways.
var/de_facto_winner = choices[1]
SSgamemode.storyteller_vote_result(de_facto_winner)
From db0417c2e32d5f7eb2ef19ec433d6e12b56c3a57 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 01:07:49 -0700
Subject: [PATCH 07/61] Lots of cool work
---
.../code/__DEFINES/unified_defines.dm | 9 +
.../code/modules/unified/event_overrides.dm | 454 ++++++++----------
modular_zzbug/code/modules/unified/unified.dm | 61 +--
3 files changed, 225 insertions(+), 299 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index d4226d46f3d8..4764831d0f39 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -1,8 +1,17 @@
#define TAG_ENGINEERING "engineering"
#define TAG_MEDICAL "medical"
#define TAG_SECURITY "security"
+#define TAG_SCIENCE "science"
+#define TAG_WIZARD "wizard"
#define UNIFIED_WAIT_TIME 20 SECONDS
#define UNIFIED_PANEL_MAIN "Main"
#define UNIFIED_PANEL_VARIABLES "Variables"
+
+#define COST_MINOR 5
+#define COST_MODERATE 15
+#define COST_MAJOR 60
+
+#define WEIGHT_NORMAL 10
+#define WEIGHT_UNLIKELY 5
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 7a244bf733be..708400c5c83e 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -1,343 +1,323 @@
+// SCRUBBERS EVENTS
+
/datum/round_event_control/scrubber_overflow/threatening
- weight = 0
max_occurrences = 0
/datum/round_event_control/scrubber_overflow/catastrophic
- weight = 0
max_occurrences = 0
/datum/round_event_control/scrubber_overflow/every_vent
- weight = 0
max_occurrences = 0
/datum/round_event_control/scrubber_overflow/ices
- weight = 0
max_occurrences = 0
+// MUNDANE EVENTS
+
/datum/round_event_control/aurora_caelus
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL, TAG_POSITIVE, TAG_SPACE)
- weight = 10
+ cost = 0
+ weight = WEIGHT_NORMAL
/datum/round_event_control/camera_failure
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL, TAG_SPOOKY)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/space_dust
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_DESTRUCTIVE, TAG_SPACE)
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
max_occurrences = 0 // space dust is a nothing event
/datum/round_event_control/electrical_storm
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_SPOOKY)
+ cost = COST_MINOR
weight = 5 // it's annoying
/datum/round_event_control/fake_virus
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_TARGETED)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/falsealarm
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/market_crash
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mice_migration
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/wisdomcow
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL, TAG_POSITIVE)
- weight = 10
+ cost = 0
+ weight = WEIGHT_NORMAL
/datum/round_event_control/shuttle_loan
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mass_hallucination
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_cargo
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/grey_tide
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_DESTRUCTIVE, TAG_SPOOKY)
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/gravity_generator_blackout
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL, TAG_SPACE)
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/shuttle_insurance
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/tram_malfunction
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/grid_check
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL, TAG_SPOOKY)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/bureaucratic_error
- track = EVENT_TRACK_MUNDANE
+ cost = COST_MINOR
weight = 5 // It's annoying
/datum/round_event_control/vent_clog
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_hallucination
- track = EVENT_TRACK_MUNDANE
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav
- track = EVENT_TRACK_MUNDANE
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bioscrambler
- track = EVENT_TRACK_MUNDANE
- weight = 10
+ cost = COST_MINOR
+ tags |= list(TAG_MEDICAL, TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bluespace
- track = EVENT_TRACK_MUNDANE
+ cost = COST_MINOR
+ tags |= list(TAG_SCIENCE)
weight = 7.5 // Our stuff being teleported away is kinda annoying but not too bad
/datum/round_event_control/vent_clog/strange
- track = EVENT_TRACK_MUNDANE
+ cost = COST_MINOR
max_occurrences = 0 // none of this for now, not sure about the animals in it
+/datum/round_event_control/scrubber_overflow
+ cost = COST_MINOR
+ tags = list(TAG_COMMUNAL)
+ weight = WEIGHT_NORMAL
+
+// MODERATE EVENTS
+
/datum/round_event_control/brand_intelligence
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/carp_migration
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_COMBAT)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SECURITY, TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/communications_blackout
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_SPOOKY)
- weight = 10
+ cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/ion_storm
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_TARGETED)
- weight = 10
+ cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/processor_overload
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_DESTRUCTIVE)
+ cost = COST_MODERATE
+ tags |= list(TAG_ENGINEERING)
weight = 5 // More severe version of comms blackout
/datum/round_event_control/radiation_leak
- track = EVENT_TRACK_MODERATE
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/sandstorm
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/shuttle_catastrophe
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/spacevine
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/portal_storm_syndicate
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_COMBAT)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SECURITY, TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
// BUG EDIT START
/datum/round_event_control/radiation_storm
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL)
+ cost = COST_MODERATE
+ tags |= list(TAG_MEDICAL)
max_occurrences = 2
- weight = 10
+ weight = WEIGHT_NORMAL
/datum/round_event_control/wormholes
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL)
+ cost = COST_MODERATE
max_occurrences = 2 // BUG: more than two wormholes would be pretty annoying, like the radstorm
- weight = 10
+ tags |= list(TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/heart_attack
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_TARGETED, TAG_VERY_TARGETED)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/appendicitis
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_TARGETED, TAG_VERY_TARGETED)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/disease_outbreak
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_TARGETED)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_MEDICAL)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_dimensional
- track = EVENT_TRACK_MODERATE
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_ectoplasm
- track = EVENT_TRACK_MODERATE
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_flux
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav/high
- track = EVENT_TRACK_MODERATE
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/major
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMBAT)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_SECURITY)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/critical
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMBAT, TAG_CHAOTIC)
+ cost = COST_MODERATE
+ tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
- track = EVENT_TRACK_MODERATE
- tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MODERATE
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
+
+// MAJOR EVENTS
/datum/round_event_control/earthquake
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/blob
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_COMBAT, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/meteor_wave
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMMUNAL, TAG_SPACE, TAG_DESTRUCTIVE, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/meteor_wave/meaty
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMMUNAL, TAG_SPACE, TAG_DESTRUCTIVE)
- weight = 20 // meat meteors?? how queer
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING)
+ weight = 5 // meat meteors?? how queer
/datum/round_event_control/meteor_wave/ices
- weight = 0
+ max_occurrences = 0
/datum/round_event_control/immovable_rod
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_meteor
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_SPACE)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_vortex
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_pyro
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/spider_infestation
- track = EVENT_TRACK_MAJOR
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/revenant
min_players = 20
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_SPOOKY)
- weight = 10
+ cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/abductor
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/fugitives
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMBAT)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/voidwalker
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_SPACE)
- weight = 10
-
-/datum/round_event_control/cme
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
- weight = 10
-
-/datum/round_event_control/stray_cargo/changeling_zombie
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/cme
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_DESTRUCTIVE, TAG_COMMUNAL, TAG_CHAOTIC)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_cargo/changeling_zombie
- track = EVENT_TRACK_MAJOR
- tags = list(TAG_COMMUNAL, TAG_COMBAT, TAG_CHAOTIC, TAG_SPOOKY)
- weight = 10
-
-/datum/round_event_control/scrubber_overflow
- track = EVENT_TRACK_MUNDANE
- tags = list(TAG_COMMUNAL)
- weight = 10
+ cost = COST_MAJOR
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ weight = WEIGHT_NORMAL
-// ANTAGS
+// ANTAGS - TODO add costs
/datum/round_event_control/antagonist/solo/bloodsucker
- name = "Bloodsuckers"
- roundstart = TRUE
-
- antag_flag = ROLE_BLOODSUCKER
- antag_datum = /datum/antagonist/bloodsucker
weight = 8
min_players = 20
@@ -345,34 +325,16 @@
maximum_antags = 3
maximum_antags_global = 3
- tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
-
-/datum/round_event_control/antagonist/solo/bloodsucker/midround
- name = "Vampiric Accident"
- roundstart = FALSE
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/changeling
- name = "Changelings"
- roundstart = TRUE
-
- antag_flag = ROLE_CHANGELING
- antag_datum = /datum/antagonist/changeling
weight = 8
min_players = 20
maximum_antags_global = 4
- tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
-
-/datum/round_event_control/antagonist/solo/changeling/midround
- name = "Genome Awakening (Changelings)"
- roundstart = FALSE
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/heretic
- name = "Heretics"
- roundstart = TRUE
-
- antag_flag = ROLE_HERETIC
- antag_datum = /datum/antagonist/heretic
weight = 8
min_players = 30
@@ -380,50 +342,27 @@
maximum_antags = 2
maximum_antags_global = 2
- tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)
-
-/datum/round_event_control/antagonist/solo/heretic/midround
- name = "Midround Heretics"
- roundstart = FALSE
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/malf
- name = "Malfunctioning AI"
-
base_antags = 1
maximum_antags = 1
maximum_antags_global = 1
min_players = 20
-
- antag_datum = /datum/antagonist/malf_ai
- antag_flag = ROLE_MALF
- weight = 0
- tags = list(TAG_CREW_ANTAG, TAG_COMBAT, TAG_DESTRUCTIVE, TAG_CHAOTIC)
- restricted_roles = list()
-
-/datum/round_event_control/antagonist/solo/malf/roundstart
- roundstart = TRUE
- typepath = /datum/round_event/antagonist/solo/malf_ai/roundstart
- weight = 10
+ weight = WEIGHT_NORMAL
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/team/nuke_ops
- name = "Nuclear Operatives"
- roundstart = TRUE
-
- antag_flag = ROLE_OPERATIVE
- antag_datum = /datum/antagonist/nukeop
- antag_leader_datum = /datum/antagonist/nukeop/leader
-
- weight = 0
- tags = list(TAG_COMBAT, TAG_CHAOTIC)
+ weight = WEIGHT_UNLIKELY
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
base_antags = 2
maximum_antags = 5
maximum_antags_global = 5
- typepath = /datum/round_event/antagonist/team/nukie
-
- ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_NUKIEBASE)
+/datum/round_event_control/operative
+ // weight = 0 // shouldn't be overridden
/datum/round_event_control/antagonist/obsessed
name = "Obsessed"
@@ -434,34 +373,25 @@
weight = 8
maximum_antags_global = 1
- tags = list(TAG_CREW_ANTAG)
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
-/datum/round_event_control/antagonist/solo/spy
- name = "Spies"
- roundstart = TRUE
+/datum/round_event_control/antagonist/obsessed/midround
+ name = "Obsessed (Midround)"
+ roundstart = FALSE
- antag_flag = ROLE_SPY
- antag_datum = /datum/antagonist/spy
+/datum/round_event_control/antagonist/solo/spy
weight = 8
maximum_antags_global = 4
- tags = list(TAG_CREW_ANTAG)
-
-/datum/round_event_control/antagonist/solo/spy/midround
- name = "Spies (Midround)"
- roundstart = FALSE
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
- name = "Traitors"
- roundstart = TRUE
-
- antag_flag = ROLE_TRAITOR
- antag_datum = /datum/antagonist/traitor
weight = 8
maximum_antags_global = 6
- tags = list(TAG_CREW_ANTAG)
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
-/datum/round_event_control/antagonist/solo/traitor/midround
- name = "Sleeper Agents (Traitors)"
- roundstart = FALSE
+// WIZARD EVENTS
+
+/datum/round_event_control/wizard
+ tags = list(TAG_WIZARD)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index a9d50444ac6d..012b36a90277 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -54,6 +54,7 @@ SUBSYSTEM_DEF(unified)
var/eng_crew = 0
var/sec_crew = 0
var/med_crew = 0
+ var/sci_crew = 0
var/wizardmode = FALSE
@@ -152,6 +153,8 @@ SUBSYSTEM_DEF(unified)
job_cost *= 2
if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
job_cost *= 2
+ if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ job_cost *= 2
total_cost *= job_cost
points -= total_cost
var/cooldown // in minutes
@@ -204,6 +207,8 @@ SUBSYSTEM_DEF(unified)
job_cost *= 2
if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
job_cost *= 2
+ if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ job_cost *= 2
total_cost *= job_cost
points -= total_cost
@@ -220,6 +225,8 @@ SUBSYSTEM_DEF(unified)
job_weighting *= 0.5
if(TAG_SECURITY in event.tags && sec_crew == 0)
job_weighting *= 0.5
+ if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ job_weighting *= 0.5
if(head_crew == 0)
job_weighting = 0
weight_total *= job_weighting
@@ -365,6 +372,7 @@ SUBSYSTEM_DEF(unified)
eng_crew = 0
med_crew = 0
sec_crew = 0
+ sci_crew = 0
for(var/mob/player_mob as anything in GLOB.player_list)
if(!player_mob.client)
continue
@@ -385,6 +393,8 @@ SUBSYSTEM_DEF(unified)
med_crew++
if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)
sec_crew++
+ if(player_role.departments_bitflags & DEPARTMENT_BITFLAG_SCIENCE)
+ sci_crew++
// update_pop_scaling() TODO FIX
/* TODO FIX
@@ -482,6 +492,7 @@ SUBSYSTEM_DEF(unified)
calculate_ready_players()
handle_pre_setup_roundstart_events()
cooldown_over = world.time + rand(2.5, 20) MINUTES // give 2.5 to 20 minutes before non-roundstart events start happening
+ points = rand(100, 300)
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -635,8 +646,7 @@ SUBSYSTEM_DEF(unified)
var/round_started = SSticker.HasRoundStarted()
var/list/dat = list()
var/active_pop = get_correct_popcount()
- dat += " HALT Unified Event Panel Set Storyteller Refresh"
- dat += "
Storyteller determines points gained, event chances, and is the entity responsible for rolling events."
+ dat += " HALT Unified Event Panel Refresh"
dat += "
Active Players: [active_pop] (Head: [head_crew], Sec: [sec_crew], Eng: [eng_crew], Med: [med_crew]) - Antag Cap: [get_antag_cap()]"
dat += "
"
dat += "Main"
@@ -671,37 +681,12 @@ SUBSYSTEM_DEF(unified)
dat += "
[track]: [point_thresholds[track]]"
*/
if(UNIFIED_PANEL_MAIN)
- var/even = TRUE
- dat += "Event Tracks:
"
- dat += "Every track represents progression towards scheduling an event of it's severity"
- dat += ""
- dat += ""
- dat += "| Track | "
- dat += "Progress | "
- dat += "Next | "
- dat += "Forced | "
- dat += "Actions | "
- dat += "
"
- even = !even
- /* TODO FIX
- var/background_cl = even ? "#17191C" : "#23273C"
- var/lower = event_track_points[track]
- var/upper = point_thresholds[track]
- var/percent = round((lower/upper)*100)
- var/next = 0
- var/last_points = last_point_gains[track]
- if(last_points)
- next = round((upper - lower) / last_points / 60, 0.1) // points / (points/second) / (seconds/minute) = minutes
- dat += ""
- dat += "| [track] | " //Track
- dat += "[percent]% ([lower]/[upper]) | " //Progress
- dat += "~[next] m. | " //Next
- var/forced = forced_next_event ? "[forced_next_event.name] X" : ""
- dat += "[forced] | " //Forced
- dat += "Set Pts. Next Event | " //Actions
- dat += "
"
- dat += "
"
- */
+ var/background_cl = "#23273C"
+ dat += "Point Budget:
"
+ dat += "[points]/[initial(points)]"
+ dat += "Cooldown:
"
+ dat += "[(cooldown_over - world.time) / 600] minutes Reset Cooldown" // 600 deciseconds in one minute
+
dat += "Scheduled Events:
"
dat += ""
dat += ""
@@ -714,10 +699,10 @@ SUBSYSTEM_DEF(unified)
for(var/datum/scheduled_event/scheduled as anything in scheduled_events)
sorted_scheduled[scheduled] = scheduled.start_time
sortTim(sorted_scheduled, cmp=/proc/cmp_numeric_asc, associative = TRUE)
- even = TRUE
+ var/even = TRUE
for(var/datum/scheduled_event/scheduled as anything in sorted_scheduled)
even = !even
- var/background_cl = even ? "#17191C" : "#23273C"
+ background_cl = even ? "#17191C" : "#23273C"
dat += "
"
dat += "| [scheduled.event.name] | " //Name
dat += "[scheduled.event.track] | " //Severity
@@ -736,7 +721,7 @@ SUBSYSTEM_DEF(unified)
even = TRUE
for(var/datum/round_event/event as anything in running)
even = !even
- var/background_cl = even ? "#17191C" : "#23273C"
+ background_cl = even ? "#17191C" : "#23273C"
dat += "
"
dat += "| [event.control.name] | " //Name
dat += "-TBA- | " //Actions
@@ -816,9 +801,11 @@ SUBSYSTEM_DEF(unified)
switch(href_list["panel"])
if("main")
switch(href_list["action"])
+ if("reset_cooldown")
+ cooldown_over = world.time
if("halt_storyteller")
halted = !halted
- message_admins("[key_name_admin(usr)] has [halted ? "HALTED" : "un-halted"] the Storyteller.")
+ message_admins("[key_name_admin(usr)] has [halted ? "HALTED" : "un-halted"] Unified.")
/* TODO FIX
if("vars")
var/track = href_list["track"]
From 268f8dbd32f7470f3b71b08116860013d727da7a Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 13:14:28 -0700
Subject: [PATCH 08/61] Yet more work! It's looking pretty good!
---
.../code/__DEFINES/unified_defines.dm | 2 +
.../code/modules/unified/event_overrides.dm | 172 +++++++++++++-----
modular_zzbug/code/modules/unified/unified.dm | 18 +-
3 files changed, 145 insertions(+), 47 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 4764831d0f39..86e22cae0f0f 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -15,3 +15,5 @@
#define WEIGHT_NORMAL 10
#define WEIGHT_UNLIKELY 5
+
+#define BASE_POINTS 200
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 708400c5c83e..289cf8c0ec2b 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -24,10 +24,12 @@
/datum/round_event_control/space_dust
cost = COST_MINOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
max_occurrences = 0 // space dust is a nothing event
+/datum/round_event_control/space_dust/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/electrical_storm
cost = COST_MINOR
weight = 5 // it's annoying
@@ -46,9 +48,11 @@
/datum/round_event_control/mice_migration
cost = COST_MINOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/mice_migration/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/wisdomcow
cost = 0
weight = WEIGHT_NORMAL
@@ -67,23 +71,29 @@
/datum/round_event_control/grey_tide
cost = COST_MINOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/grey_tide/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/gravity_generator_blackout
cost = COST_MINOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/gravity_generator_blackout/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/shuttle_insurance
cost = COST_MINOR
weight = WEIGHT_NORMAL
/datum/round_event_control/tram_malfunction
cost = COST_MINOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/tram_malfunction/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/grid_check
cost = COST_MINOR
weight = WEIGHT_NORMAL
@@ -96,24 +106,28 @@
cost = COST_MINOR
weight = WEIGHT_NORMAL
+// /datum/round_event_control/anomaly
+
+/datum/round_event_control/anomaly/New()
+ tags |= list(TAG_SCIENCE)
+
/datum/round_event_control/anomaly/anomaly_hallucination
cost = COST_MINOR
- tags |= list(TAG_SCIENCE)
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav
cost = COST_MINOR
- tags |= list(TAG_SCIENCE)
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bioscrambler
cost = COST_MINOR
- tags |= list(TAG_MEDICAL, TAG_SCIENCE)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_bioscrambler/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/anomaly/anomaly_bluespace
cost = COST_MINOR
- tags |= list(TAG_SCIENCE)
weight = 7.5 // Our stuff being teleported away is kinda annoying but not too bad
/datum/round_event_control/vent_clog/strange
@@ -129,14 +143,18 @@
/datum/round_event_control/brand_intelligence
cost = COST_MODERATE
- tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/brand_intelligence/New()
+ tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
+
/datum/round_event_control/carp_migration
cost = COST_MODERATE
- tags |= list(TAG_SECURITY, TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/carp_migration/New()
+ tags |= list(TAG_SECURITY, TAG_MEDICAL)
+
/datum/round_event_control/communications_blackout
cost = COST_MODERATE
weight = WEIGHT_NORMAL
@@ -147,19 +165,25 @@
/datum/round_event_control/processor_overload
cost = COST_MODERATE
- tags |= list(TAG_ENGINEERING)
weight = 5 // More severe version of comms blackout
+/datum/round_event_control/processor_overload/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/radiation_leak
cost = COST_MODERATE
- tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/radiation_leak/New()
+ tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
+
/datum/round_event_control/sandstorm
cost = COST_MODERATE
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/sandstorm/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/shuttle_catastrophe
cost = COST_MODERATE
weight = WEIGHT_NORMAL
@@ -170,91 +194,119 @@
/datum/round_event_control/portal_storm_syndicate
cost = COST_MODERATE
- tags |= list(TAG_SECURITY, TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/portal_storm_syndicate/New()
+ tags |= list(TAG_SECURITY, TAG_MEDICAL)
+
// BUG EDIT START
/datum/round_event_control/radiation_storm
cost = COST_MODERATE
- tags |= list(TAG_MEDICAL)
max_occurrences = 2
weight = WEIGHT_NORMAL
+/datum/round_event_control/radiation_storm/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/wormholes
cost = COST_MODERATE
max_occurrences = 2 // BUG: more than two wormholes would be pretty annoying, like the radstorm
- tags |= list(TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/wormholes/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/heart_attack
cost = COST_MODERATE
- tags |= list(TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/heart_attack/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/appendicitis
cost = COST_MODERATE
- tags |= list(TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/appendicitis/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/disease_outbreak
cost = COST_MODERATE
- tags |= list(TAG_MEDICAL)
weight = WEIGHT_NORMAL
+/datum/round_event_control/disease_outbreak/New()
+ tags |= list(TAG_MEDICAL)
+
/datum/round_event_control/anomaly/anomaly_dimensional
cost = COST_MODERATE
- tags |= list(TAG_SCIENCE)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_dimensional/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/anomaly/anomaly_ectoplasm
cost = COST_MODERATE
- tags |= list(TAG_SCIENCE)
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_flux
cost = COST_MODERATE
- tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_flux/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/anomaly/anomaly_grav/high
cost = COST_MODERATE
- tags |= list(TAG_SCIENCE)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_grav/high/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/vent_clog/major
cost = COST_MODERATE
- tags |= list(TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/vent_clog/major/New()
+ tags |= list(TAG_SECURITY)
+
/datum/round_event_control/vent_clog/critical
cost = COST_MODERATE
+
+/datum/round_event_control/vent_clog/critical/New()
tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
cost = COST_MODERATE
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/mold/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
// MAJOR EVENTS
/datum/round_event_control/earthquake
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/earthquake/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/blob
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/blob/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+
/datum/round_event_control/meteor_wave
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/meteor_wave/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+
/datum/round_event_control/meteor_wave/meaty
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING)
weight = 5 // meat meteors?? how queer
/datum/round_event_control/meteor_wave/ices
@@ -262,29 +314,39 @@
/datum/round_event_control/immovable_rod
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/immovable_rod/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
+
/datum/round_event_control/stray_meteor
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/stray_meteor/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/anomaly/anomaly_vortex
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_vortex/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/anomaly/anomaly_pyro
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING)
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_pyro/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/spider_infestation
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/spider_infestation/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
/datum/round_event_control/revenant
min_players = 20
cost = COST_MAJOR
@@ -292,29 +354,40 @@
/datum/round_event_control/abductor
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/abductor/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
/datum/round_event_control/fugitives
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/fugitives/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
/datum/round_event_control/voidwalker
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/voidwalker/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
/datum/round_event_control/cme
cost = COST_MAJOR
- tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
weight = WEIGHT_NORMAL
+/datum/round_event_control/cme/New()
+ tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
+
+
/datum/round_event_control/stray_cargo/changeling_zombie
cost = COST_MAJOR
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
weight = WEIGHT_NORMAL
+/datum/round_event_control/stray_cargo/changeling_zombie/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
// ANTAGS - TODO add costs
/datum/round_event_control/antagonist/solo/bloodsucker
@@ -325,6 +398,7 @@
maximum_antags = 3
maximum_antags_global = 3
+/datum/round_event_control/antagonist/solo/bloodsucker/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/changeling
@@ -332,6 +406,7 @@
min_players = 20
maximum_antags_global = 4
+/datum/round_event_control/antagonist/solo/changeling/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/heretic
@@ -342,6 +417,7 @@
maximum_antags = 2
maximum_antags_global = 2
+/datum/round_event_control/antagonist/solo/heretic/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/malf
@@ -351,19 +427,26 @@
min_players = 20
weight = WEIGHT_NORMAL
+
+/datum/round_event_control/antagonist/solo/malf/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/team/nuke_ops
weight = WEIGHT_UNLIKELY
- tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
base_antags = 2
maximum_antags = 5
maximum_antags_global = 5
+/datum/round_event_control/antagonist/team/nuke_ops/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
/datum/round_event_control/operative
// weight = 0 // shouldn't be overridden
+/datum/round_event_control/operative/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
/datum/round_event_control/antagonist/obsessed
name = "Obsessed"
roundstart = TRUE
@@ -373,6 +456,7 @@
weight = 8
maximum_antags_global = 1
+/datum/round_event_control/antagonist/obsessed/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed/midround
@@ -383,15 +467,19 @@
weight = 8
maximum_antags_global = 4
+/datum/round_event_control/antagonist/solo/spy/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
weight = 8
maximum_antags_global = 6
+/datum/round_event_control/antagonist/solo/traitor/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
// WIZARD EVENTS
-/datum/round_event_control/wizard
+// /datum/round_event_control/wizard
+
+/datum/round_event_control/wizard/New()
tags = list(TAG_WIZARD)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 012b36a90277..dddd2137b3ef 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -10,8 +10,10 @@ SUBSYSTEM_DEF(unified)
/// Next process for our storyteller. The wait time is STORYTELLER_WAIT_TIME
var/next_process = 0
- /// Our total event point budget for the shift. Initialized in Initialize()
+ /// Our total event point budget for the shift. Initialized in pre_setup()
var/points = 0
+ /// Our starting event point budget for the shift. Initialized in pre_setup()
+ var/starting_points = 0
/// The time after which we can schedule another event
var/cooldown_over = 0
@@ -156,12 +158,17 @@ SUBSYSTEM_DEF(unified)
if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
job_cost *= 2
total_cost *= job_cost
+ if(total_cost > points)
+ message_admins("Unified tried to buy an event over its budget.")
+ log_admin("Unified tried to buy an event over its budget.")
+ return
points -= total_cost
var/cooldown // in minutes
if(picked_event.cooldown_override)
- cooldown = rand(picked_event.cooldown_override/2, picked_event.cooldown_override*1.5)
+ cooldown = rand(picked_event.cooldown_override*0.5, picked_event.cooldown_override*1.5)
else
- cooldown = rand(total_cost/2, total_cost*1.5)
+ cooldown = rand(total_cost*0.5, total_cost*1.5)
+ cooldown *= BASE_POINTS/starting_points // the higher the starting points, the lower the cooldown
cooldown_over = world.time + cooldown MINUTES // convert cooldown to deciseconds
message_admins("Unified purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
log_admin("Storyteller purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
@@ -225,7 +232,7 @@ SUBSYSTEM_DEF(unified)
job_weighting *= 0.5
if(TAG_SECURITY in event.tags && sec_crew == 0)
job_weighting *= 0.5
- if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ if(TAG_SCIENCE in event.tags && sci_crew == 0)
job_weighting *= 0.5
if(head_crew == 0)
job_weighting = 0
@@ -492,7 +499,8 @@ SUBSYSTEM_DEF(unified)
calculate_ready_players()
handle_pre_setup_roundstart_events()
cooldown_over = world.time + rand(2.5, 20) MINUTES // give 2.5 to 20 minutes before non-roundstart events start happening
- points = rand(100, 300)
+ starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
+ points = starting_points
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
From f4fc8d5bd3b5a4fa364e58226843ee55aebdac9e Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 13:35:20 -0700
Subject: [PATCH 09/61] Documentation
---
modular_zzbug/code/modules/unified/_event.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/_event.dm b/modular_zzbug/code/modules/unified/_event.dm
index 9316730a482e..2bf1a6bd925e 100644
--- a/modular_zzbug/code/modules/unified/_event.dm
+++ b/modular_zzbug/code/modules/unified/_event.dm
@@ -1,3 +1,5 @@
/datum/round_event_control
+ /// This event's cost in the Unified system. Equates to a cooldown in minutes for the event.
var/unified_cost = 5
+ /// The cooldown in minutes to use instead of the cost.
var/cooldown_override = 0
From fad1e0c40a7f1d4795fa86ce42f138927fde5cfe Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 13:35:38 -0700
Subject: [PATCH 10/61] antag costs
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 4 +++-
.../code/modules/unified/event_overrides.dm | 13 +++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 86e22cae0f0f..252a9037c5ce 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -11,9 +11,11 @@
#define COST_MINOR 5
#define COST_MODERATE 15
+#define COST_SEMIMAJOR 30
#define COST_MAJOR 60
+#define COST_SUPERMAJOR 120
#define WEIGHT_NORMAL 10
#define WEIGHT_UNLIKELY 5
-#define BASE_POINTS 200
+#define BASE_POINTS 120
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 289cf8c0ec2b..e438b66c376b 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -388,7 +388,11 @@
/datum/round_event_control/stray_cargo/changeling_zombie/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
-// ANTAGS - TODO add costs
+// ANTAGS
+
+/datum/round_event_control/antagonist
+ cost = COST_MAJOR
+ cooldown_override = 5
/datum/round_event_control/antagonist/solo/bloodsucker
weight = 8
@@ -432,6 +436,7 @@
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/team/nuke_ops
+ cost = COST_SUPERMAJOR
weight = WEIGHT_UNLIKELY
base_antags = 2
@@ -448,11 +453,7 @@
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed
- name = "Obsessed"
- roundstart = TRUE
-
- antag_flag = ROLE_OBSESSED
- antag_datum = /datum/antagonist/obsessed
+ cost = COST_SEMIMAJOR
weight = 8
maximum_antags_global = 1
From 03e46373bc731b5d7997f2f8e3f3835ad239d3bb Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 14:23:19 -0700
Subject: [PATCH 11/61] Increase event costs
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 252a9037c5ce..15e4d16a0ef8 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -9,8 +9,8 @@
#define UNIFIED_PANEL_MAIN "Main"
#define UNIFIED_PANEL_VARIABLES "Variables"
-#define COST_MINOR 5
-#define COST_MODERATE 15
+#define COST_MINOR 10
+#define COST_MODERATE 20
#define COST_SEMIMAJOR 30
#define COST_MAJOR 60
#define COST_SUPERMAJOR 120
From d4dfb2885adb4ac27aabfde3eb057c02e5dd0644 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 14:23:30 -0700
Subject: [PATCH 12/61] fix changeling meteor
---
modular_zzbug/code/modules/unified/event_overrides.dm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index e438b66c376b..544c34037fca 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -484,3 +484,11 @@
/datum/round_event_control/wizard/New()
tags = list(TAG_WIZARD)
+
+// MISC
+
+/datum/round_event_control/changeling
+ cost = COST_MAJOR
+
+/datum/round_event_control/changeling/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
From e0bbd75f90801abd3fcf8a6b68cec7d1f9f3e513 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 14:23:51 -0700
Subject: [PATCH 13/61] Make refunding event reset cooldown
---
modular_zzbug/code/modules/unified/unified.dm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index dddd2137b3ef..4580e4df5270 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -326,6 +326,7 @@ SUBSYSTEM_DEF(unified)
/// Refunds and removes a scheduled event.
/datum/controller/subsystem/unified/proc/refund_scheduled_event(datum/scheduled_event/refunded)
points += refunded.cost
+ cooldown_over = world.time
remove_scheduled_event(refunded)
/// Schedules an event.
@@ -691,7 +692,7 @@ SUBSYSTEM_DEF(unified)
if(UNIFIED_PANEL_MAIN)
var/background_cl = "#23273C"
dat += "Point Budget:
"
- dat += "[points]/[initial(points)]"
+ dat += "[points]/[starting_points]"
dat += "Cooldown:
"
dat += "[(cooldown_over - world.time) / 600] minutes Reset Cooldown" // 600 deciseconds in one minute
From fff6d0ba785039d8a14a131d642b0887cbff7842 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 15:59:30 -0700
Subject: [PATCH 14/61] Lots'a work
---
code/modules/events/_event.dm | 4 +-
.../code/__DEFINES/unified_defines.dm | 1 +
modular_zzbug/code/modules/unified/_event.dm | 2 +-
.../code/modules/unified/event_overrides.dm | 270 ++++++++++--------
modular_zzbug/code/modules/unified/unified.dm | 22 +-
5 files changed, 161 insertions(+), 138 deletions(-)
diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm
index 5c3e3013438b..d34dfc8a614e 100644
--- a/code/modules/events/_event.dm
+++ b/code/modules/events/_event.dm
@@ -44,7 +44,7 @@
/datum/round_event_control/New()
if(config && !wizardevent) // Magic is unaffected by configs
earliest_start = CEILING(earliest_start * CONFIG_GET(number/events_min_time_mul), 1)
- min_players = CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1)
+ // min_players = CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1) // BUG EDIT
if(!length(admin_setup))
return
var/list/admin_setup_types = admin_setup.Copy()
@@ -80,7 +80,7 @@
return FALSE
if(!allow_magic && wizardevent != SSevents.wizardmode)
return FALSE
- if(players_amt < min_players)
+ if(players_amt < CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1))
return FALSE
if(holidayID && !check_holidays(holidayID))
return FALSE
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 15e4d16a0ef8..85e060135b43 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -9,6 +9,7 @@
#define UNIFIED_PANEL_MAIN "Main"
#define UNIFIED_PANEL_VARIABLES "Variables"
+#define COST_VERY_MINOR 5
#define COST_MINOR 10
#define COST_MODERATE 20
#define COST_SEMIMAJOR 30
diff --git a/modular_zzbug/code/modules/unified/_event.dm b/modular_zzbug/code/modules/unified/_event.dm
index 2bf1a6bd925e..70922519e55c 100644
--- a/modular_zzbug/code/modules/unified/_event.dm
+++ b/modular_zzbug/code/modules/unified/_event.dm
@@ -1,5 +1,5 @@
/datum/round_event_control
/// This event's cost in the Unified system. Equates to a cooldown in minutes for the event.
- var/unified_cost = 5
+ var/unified_cost = 0
/// The cooldown in minutes to use instead of the cost.
var/cooldown_override = 0
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 544c34037fca..0206aa4ca1fd 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -1,3 +1,8 @@
+// GENERIC SETTINGS
+
+/datum/round_event_control/
+ weight = WEIGHT_NORMAL
+
// SCRUBBERS EVENTS
/datum/round_event_control/scrubber_overflow/threatening
@@ -14,97 +19,86 @@
// MUNDANE EVENTS
+/datum/round_event_control/bitrunning_glitch
+ unified_cost = COST_VERY_MINOR
+
+/datum/round_event_control/sentience
+ unified_cost = COST_VERY_MINOR
+
/datum/round_event_control/aurora_caelus
- cost = 0
- weight = WEIGHT_NORMAL
+ unified_cost = 0
/datum/round_event_control/camera_failure
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/space_dust
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
max_occurrences = 0 // space dust is a nothing event
/datum/round_event_control/space_dust/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/electrical_storm
- cost = COST_MINOR
+ unified_cost = COST_MINOR
weight = 5 // it's annoying
/datum/round_event_control/fake_virus
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/falsealarm
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/market_crash
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/mice_migration
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/mice_migration/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/wisdomcow
- cost = 0
- weight = WEIGHT_NORMAL
+ unified_cost = 0
/datum/round_event_control/shuttle_loan
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/mass_hallucination
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/stray_cargo
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/grey_tide
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/grey_tide/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/gravity_generator_blackout
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/gravity_generator_blackout/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_insurance
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/tram_malfunction
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/tram_malfunction/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/grid_check
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/bureaucratic_error
- cost = COST_MINOR
+ unified_cost = COST_MINOR
weight = 5 // It's annoying
/datum/round_event_control/vent_clog
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
// /datum/round_event_control/anomaly
@@ -112,278 +106,278 @@
tags |= list(TAG_SCIENCE)
/datum/round_event_control/anomaly/anomaly_hallucination
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/anomaly/anomaly_grav
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/anomaly/anomaly_bioscrambler
- cost = COST_MINOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
/datum/round_event_control/anomaly/anomaly_bioscrambler/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/anomaly/anomaly_bluespace
- cost = COST_MINOR
+ unified_cost = COST_MINOR
weight = 7.5 // Our stuff being teleported away is kinda annoying but not too bad
/datum/round_event_control/vent_clog/strange
- cost = COST_MINOR
+ unified_cost = COST_MINOR
max_occurrences = 0 // none of this for now, not sure about the animals in it
/datum/round_event_control/scrubber_overflow
- cost = COST_MINOR
- tags = list(TAG_COMMUNAL)
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MINOR
// MODERATE EVENTS
+/datum/round_event_control/brain_trauma
+ unified_cost = COST_MODERATE
+
+/datum/round_event_control/brain_trauma/New()
+ tags |= list(TAG_MEDICAL)
+
+/datum/round_event_control/supermatter_surge
+ unified_cost = COST_MODERATE
+
+/datum/round_event_control/supermatter_surge/New()
+ tags |= list(TAG_ENGINEERING)
+
+/datum/round_event_control/sentience/all
+ unified_cost = COST_MODERATE
+
/datum/round_event_control/brand_intelligence
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/brand_intelligence/New()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/carp_migration
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/carp_migration/New()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
/datum/round_event_control/communications_blackout
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/ion_storm
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/processor_overload
- cost = COST_MODERATE
+ unified_cost = COST_MODERATE
weight = 5 // More severe version of comms blackout
/datum/round_event_control/processor_overload/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/radiation_leak
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/radiation_leak/New()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/sandstorm
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/sandstorm/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_catastrophe
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/spacevine
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/portal_storm_syndicate
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/portal_storm_syndicate/New()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
// BUG EDIT START
/datum/round_event_control/radiation_storm
- cost = COST_MODERATE
+ unified_cost = COST_MODERATE
max_occurrences = 2
- weight = WEIGHT_NORMAL
/datum/round_event_control/radiation_storm/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/wormholes
- cost = COST_MODERATE
+ unified_cost = COST_MODERATE
max_occurrences = 2 // BUG: more than two wormholes would be pretty annoying, like the radstorm
- weight = WEIGHT_NORMAL
/datum/round_event_control/wormholes/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/heart_attack
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/heart_attack/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/appendicitis
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/appendicitis/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/disease_outbreak
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/disease_outbreak/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/anomaly/anomaly_dimensional
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/anomaly/anomaly_dimensional/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_ectoplasm
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/anomaly/anomaly_flux
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/anomaly/anomaly_flux/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_grav/high
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/anomaly/anomaly_grav/high/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/vent_clog/major
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/vent_clog/major/New()
tags |= list(TAG_SECURITY)
/datum/round_event_control/vent_clog/critical
- cost = COST_MODERATE
+ unified_cost = COST_MODERATE
/datum/round_event_control/vent_clog/critical/New()
tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
- cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MODERATE
/datum/round_event_control/mold/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
// MAJOR EVENTS
+/datum/round_event_control/pirates
+ unified_cost = COST_SEMIMAJOR
+
+/datum/round_event_control/pirates/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
+/datum/round_event_control/alien_infestation
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/alien_infestation/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
+/datum/round_event_control/space_dragon
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/space_dragon/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
+/datum/round_event_control/cortical_borer
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/cortical_borer/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
/datum/round_event_control/earthquake
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/earthquake/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/blob
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/blob/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/meteor_wave/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave/meaty
- cost = COST_MAJOR
- weight = 5 // meat meteors?? how queer
+ unified_cost = COST_MAJOR
+ weight = WEIGHT_UNLIKELY // meat meteors?? how queer
/datum/round_event_control/meteor_wave/ices
max_occurrences = 0
/datum/round_event_control/immovable_rod
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/immovable_rod/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/stray_meteor
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/stray_meteor/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_vortex
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/anomaly/anomaly_vortex/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_pyro
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/anomaly/anomaly_pyro/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/spider_infestation
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/spider_infestation/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/revenant
min_players = 20
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/abductor
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/abductor/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/fugitives
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/fugitives/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/voidwalker
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/voidwalker/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/cme
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/cme/New()
tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
/datum/round_event_control/stray_cargo/changeling_zombie
- cost = COST_MAJOR
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
/datum/round_event_control/stray_cargo/changeling_zombie/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -391,7 +385,7 @@
// ANTAGS
/datum/round_event_control/antagonist
- cost = COST_MAJOR
+ unified_cost = COST_MAJOR
cooldown_override = 5
/datum/round_event_control/antagonist/solo/bloodsucker
@@ -430,13 +424,13 @@
maximum_antags_global = 1
min_players = 20
- weight = WEIGHT_NORMAL
+
/datum/round_event_control/antagonist/solo/malf/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/team/nuke_ops
- cost = COST_SUPERMAJOR
+ unified_cost = COST_SUPERMAJOR
weight = WEIGHT_UNLIKELY
base_antags = 2
@@ -448,12 +442,13 @@
/datum/round_event_control/operative
// weight = 0 // shouldn't be overridden
+ unified_cost = COST_MAJOR
/datum/round_event_control/operative/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed
- cost = COST_SEMIMAJOR
+ unified_cost = COST_SEMIMAJOR
weight = 8
maximum_antags_global = 1
@@ -488,7 +483,34 @@
// MISC
/datum/round_event_control/changeling
- cost = COST_MAJOR
+ max_occurrences = 0 // TODO add an antag version of this
+ unified_cost = COST_MAJOR
+ cooldown_override = 5
/datum/round_event_control/changeling/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
+/datum/round_event_control/nightmare
+ max_occurrences = 0 // TODO add an antag version of this
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/nightmare/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
+/datum/round_event_control/wizard_dice
+ unified_cost = COST_MODERATE
+
+// /datum/round_event_control/wizard_dice/New()
+
+/datum/round_event_control/space_ninja
+ max_occurrences = 0 // TODO add an antag version of this
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/space_ninja/New()
+ tags |= list(TAG_MEDICAL, TAG_SECURITY)
+
+/datum/round_event_control/obsessed
+ max_occurrences = 0
+
+/datum/round_event_control/morph
+ max_occurrences = 0 // TODO add an antag version of this
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 4580e4df5270..e790cd77afec 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -170,8 +170,8 @@ SUBSYSTEM_DEF(unified)
cooldown = rand(total_cost*0.5, total_cost*1.5)
cooldown *= BASE_POINTS/starting_points // the higher the starting points, the lower the cooldown
cooldown_over = world.time + cooldown MINUTES // convert cooldown to deciseconds
- message_admins("Unified purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
- log_admin("Storyteller purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [cooldown] minutes.")
+ message_admins("Unified purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [round(cooldown, 0.01)] minutes.")
+ log_admin("Storyteller purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [round(cooldown, 0.01)] minutes.")
if(picked_event.roundstart)
TriggerEvent(picked_event)
else
@@ -499,9 +499,12 @@ SUBSYSTEM_DEF(unified)
SSjob.ResetOccupations()
calculate_ready_players()
handle_pre_setup_roundstart_events()
- cooldown_over = world.time + rand(2.5, 20) MINUTES // give 2.5 to 20 minutes before non-roundstart events start happening
+ var/cooldown = rand(5, 15)
+ cooldown_over = world.time + cooldown MINUTES // give 5 to 15 minutes before non-roundstart events start happening
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
+ log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
+ message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -694,13 +697,13 @@ SUBSYSTEM_DEF(unified)
dat += "Point Budget:
"
dat += "[points]/[starting_points]"
dat += "Cooldown:
"
- dat += "[(cooldown_over - world.time) / 600] minutes Reset Cooldown" // 600 deciseconds in one minute
+ dat += "[max(0, round((cooldown_over - world.time) / 600, 0.01))] minutes Reset Cooldown" // 600 deciseconds in one minute
dat += "Scheduled Events:
"
dat += ""
dat += ""
dat += "| Name | "
- dat += "Severity | "
+ dat += "Cost | "
dat += "Time | "
dat += "Actions | "
dat += "
"
@@ -714,7 +717,7 @@ SUBSYSTEM_DEF(unified)
background_cl = even ? "#17191C" : "#23273C"
dat += ""
dat += "| [scheduled.event.name] | " //Name
- dat += "[scheduled.event.track] | " //Severity
+ dat += "[scheduled.event.unified_cost] | " //Severity
var/time = (scheduled.event.roundstart && !round_started) ? "ROUNDSTART" : "[(scheduled.start_time - world.time) / (1 SECONDS)] s."
dat += "[time] | " //Time
dat += "[scheduled.get_href_actions()] | " //Actions
@@ -752,7 +755,7 @@ SUBSYSTEM_DEF(unified)
dat += "
"
dat += "| Name | "
dat += "Tags | "
- dat += "Occurences | "
+ dat += "Cost | "
dat += "M.Pop | "
dat += "M.Time | "
dat += "Can Occur | "
@@ -783,10 +786,7 @@ SUBSYSTEM_DEF(unified)
for(var/tag in event.tags)
dat += "[tag] "
dat += ""
- var/occurence_string = "[event.occurrences]"
- if(event.shared_occurence_type)
- occurence_string += " (shared: [event.get_occurences()])"
- dat += "[occurence_string] | " //Occurences
+ dat += "[event.unified_cost] | " //Cost
dat += "[event.min_players] | " //Minimum pop
dat += "[event.earliest_start / (1 MINUTES)] m. | " //Minimum time
dat += "[assoc_spawn_weight[event] ? "Yes" : "No"] | " //Can happen?
From f3b8eddd4a1f813811172e091eb2da59f3b041ae Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 16:20:50 -0700
Subject: [PATCH 15/61] work work work
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 1 +
.../code/modules/unified/event_overrides.dm | 16 ++++------------
modular_zzbug/code/modules/unified/unified.dm | 3 +--
3 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 85e060135b43..792a0b82a45f 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -17,6 +17,7 @@
#define COST_SUPERMAJOR 120
#define WEIGHT_NORMAL 10
+#define WEIGHT_LESS_LIKELY 7.5
#define WEIGHT_UNLIKELY 5
#define BASE_POINTS 120
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 0206aa4ca1fd..5f495af9004e 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -40,7 +40,7 @@
/datum/round_event_control/electrical_storm
unified_cost = COST_MINOR
- weight = 5 // it's annoying
+ weight = WEIGHT_UNLIKELY // it's annoying
/datum/round_event_control/fake_virus
unified_cost = COST_MINOR
@@ -95,7 +95,7 @@
/datum/round_event_control/bureaucratic_error
unified_cost = COST_MINOR
- weight = 5 // It's annoying
+ weight = WEIGHT_UNLIKELY // It's annoying
/datum/round_event_control/vent_clog
unified_cost = COST_MINOR
@@ -119,7 +119,7 @@
/datum/round_event_control/anomaly/anomaly_bluespace
unified_cost = COST_MINOR
- weight = 7.5 // Our stuff being teleported away is kinda annoying but not too bad
+ weight = WEIGHT_LESS_LIKELY // Our stuff being teleported away is kinda annoying but not too bad
/datum/round_event_control/vent_clog/strange
unified_cost = COST_MINOR
@@ -165,7 +165,6 @@
/datum/round_event_control/processor_overload
unified_cost = COST_MODERATE
- weight = 5 // More severe version of comms blackout
/datum/round_event_control/processor_overload/New()
tags |= list(TAG_ENGINEERING)
@@ -389,7 +388,6 @@
cooldown_override = 5
/datum/round_event_control/antagonist/solo/bloodsucker
- weight = 8
min_players = 20
base_antags = 2
@@ -400,7 +398,6 @@
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/changeling
- weight = 8
min_players = 20
maximum_antags_global = 4
@@ -408,7 +405,6 @@
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/heretic
- weight = 8
min_players = 30
base_antags = 1
@@ -425,7 +421,6 @@
min_players = 20
-
/datum/round_event_control/antagonist/solo/malf/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
@@ -441,7 +436,7 @@
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/operative
- // weight = 0 // shouldn't be overridden
+ // Don't override weight for operative!
unified_cost = COST_MAJOR
/datum/round_event_control/operative/New()
@@ -449,7 +444,6 @@
/datum/round_event_control/antagonist/obsessed
unified_cost = COST_SEMIMAJOR
- weight = 8
maximum_antags_global = 1
/datum/round_event_control/antagonist/obsessed/New()
@@ -460,14 +454,12 @@
roundstart = FALSE
/datum/round_event_control/antagonist/solo/spy
- weight = 8
maximum_antags_global = 4
/datum/round_event_control/antagonist/solo/spy/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
- weight = 8
maximum_antags_global = 6
/datum/round_event_control/antagonist/solo/traitor/New()
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index e790cd77afec..f02e7bf3cdf8 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -499,8 +499,7 @@ SUBSYSTEM_DEF(unified)
SSjob.ResetOccupations()
calculate_ready_players()
handle_pre_setup_roundstart_events()
- var/cooldown = rand(5, 15)
- cooldown_over = world.time + cooldown MINUTES // give 5 to 15 minutes before non-roundstart events start happening
+ var/cooldown = 10 * BASE_POINTS/starting_points
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
From dac1f7f256c7a06796581e8aebcba9a75d59f6b5 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 16:34:00 -0700
Subject: [PATCH 16/61] important fix
---
modular_zzbug/code/modules/unified/unified.dm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index f02e7bf3cdf8..cfc246a945e0 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -499,9 +499,10 @@ SUBSYSTEM_DEF(unified)
SSjob.ResetOccupations()
calculate_ready_players()
handle_pre_setup_roundstart_events()
- var/cooldown = 10 * BASE_POINTS/starting_points
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
+ var/cooldown = 10 * BASE_POINTS/starting_points
+ cooldown_over = world.time + cooldown MINUTES
log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
return TRUE
From 71ecb7d761969ce6769da675d4d6c8ac57f24765 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 16:50:35 -0700
Subject: [PATCH 17/61] Fix weights
---
.../code/modules/unified/event_overrides.dm | 83 +++++++++++++++++--
1 file changed, 78 insertions(+), 5 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 5f495af9004e..39588a6eba4b 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -1,8 +1,3 @@
-// GENERIC SETTINGS
-
-/datum/round_event_control/
- weight = WEIGHT_NORMAL
-
// SCRUBBERS EVENTS
/datum/round_event_control/scrubber_overflow/threatening
@@ -21,19 +16,24 @@
/datum/round_event_control/bitrunning_glitch
unified_cost = COST_VERY_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/sentience
unified_cost = COST_VERY_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/aurora_caelus
unified_cost = 0
+ weight = WEIGHT_NORMAL
/datum/round_event_control/camera_failure
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/space_dust
unified_cost = COST_MINOR
max_occurrences = 0 // space dust is a nothing event
+ weight = WEIGHT_NORMAL
/datum/round_event_control/space_dust/New()
tags |= list(TAG_ENGINEERING)
@@ -41,64 +41,80 @@
/datum/round_event_control/electrical_storm
unified_cost = COST_MINOR
weight = WEIGHT_UNLIKELY // it's annoying
+ weight = WEIGHT_NORMAL
/datum/round_event_control/fake_virus
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/falsealarm
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/market_crash
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mice_migration
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mice_migration/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/wisdomcow
unified_cost = 0
+ weight = WEIGHT_NORMAL
/datum/round_event_control/shuttle_loan
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mass_hallucination
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_cargo
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/grey_tide
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/grey_tide/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/gravity_generator_blackout
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/gravity_generator_blackout/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_insurance
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/tram_malfunction
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/tram_malfunction/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/grid_check
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/bureaucratic_error
unified_cost = COST_MINOR
weight = WEIGHT_UNLIKELY // It's annoying
+ weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
// /datum/round_event_control/anomaly
@@ -107,12 +123,15 @@
/datum/round_event_control/anomaly/anomaly_hallucination
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bioscrambler
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bioscrambler/New()
tags |= list(TAG_MEDICAL)
@@ -124,71 +143,86 @@
/datum/round_event_control/vent_clog/strange
unified_cost = COST_MINOR
max_occurrences = 0 // none of this for now, not sure about the animals in it
+ weight = WEIGHT_NORMAL
/datum/round_event_control/scrubber_overflow
unified_cost = COST_MINOR
+ weight = WEIGHT_NORMAL
// MODERATE EVENTS
/datum/round_event_control/brain_trauma
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/brain_trauma/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/supermatter_surge
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/supermatter_surge/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/sentience/all
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/brand_intelligence
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/brand_intelligence/New()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/carp_migration
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/carp_migration/New()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
/datum/round_event_control/communications_blackout
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/ion_storm
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/processor_overload
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/processor_overload/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/radiation_leak
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/radiation_leak/New()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/sandstorm
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/sandstorm/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_catastrophe
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/spacevine
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/portal_storm_syndicate
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/portal_storm_syndicate/New()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
@@ -196,6 +230,7 @@
// BUG EDIT START
/datum/round_event_control/radiation_storm
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
max_occurrences = 2
/datum/round_event_control/radiation_storm/New()
@@ -204,63 +239,74 @@
/datum/round_event_control/wormholes
unified_cost = COST_MODERATE
max_occurrences = 2 // BUG: more than two wormholes would be pretty annoying, like the radstorm
+ weight = WEIGHT_NORMAL
/datum/round_event_control/wormholes/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/heart_attack
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/heart_attack/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/appendicitis
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/appendicitis/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/disease_outbreak
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/disease_outbreak/New()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/anomaly/anomaly_dimensional
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_dimensional/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_ectoplasm
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_flux
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_flux/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_grav/high
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav/high/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/vent_clog/major
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/major/New()
tags |= list(TAG_SECURITY)
/datum/round_event_control/vent_clog/critical
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/critical/New()
tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
/datum/round_event_control/mold/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -269,42 +315,49 @@
/datum/round_event_control/pirates
unified_cost = COST_SEMIMAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/pirates/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/alien_infestation
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/alien_infestation/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/space_dragon
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/space_dragon/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/cortical_borer
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/cortical_borer/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/earthquake
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/earthquake/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/blob
unified_cost = COST_MAJOR
+ weight = WEIGHT_UNLIKELY
/datum/round_event_control/blob/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/meteor_wave/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
@@ -318,30 +371,35 @@
/datum/round_event_control/immovable_rod
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/immovable_rod/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/stray_meteor
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_meteor/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_vortex
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_vortex/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_pyro
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_pyro/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/spider_infestation
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/spider_infestation/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -349,27 +407,32 @@
/datum/round_event_control/revenant
min_players = 20
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/abductor
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/abductor/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/fugitives
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/fugitives/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/voidwalker
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/voidwalker/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/cme
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/cme/New()
tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
@@ -377,6 +440,7 @@
/datum/round_event_control/stray_cargo/changeling_zombie
unified_cost = COST_MAJOR
+ weight = WEIGHT_NORMAL
/datum/round_event_control/stray_cargo/changeling_zombie/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -393,6 +457,7 @@
base_antags = 2
maximum_antags = 3
maximum_antags_global = 3
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/bloodsucker/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -400,6 +465,7 @@
/datum/round_event_control/antagonist/solo/changeling
min_players = 20
maximum_antags_global = 4
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/changeling/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -410,6 +476,7 @@
base_antags = 1
maximum_antags = 2
maximum_antags_global = 2
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/heretic/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
@@ -418,6 +485,7 @@
base_antags = 1
maximum_antags = 1
maximum_antags_global = 1
+ weight = WEIGHT_NORMAL
min_players = 20
@@ -431,6 +499,7 @@
base_antags = 2
maximum_antags = 5
maximum_antags_global = 5
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/team/nuke_ops/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
@@ -445,6 +514,7 @@
/datum/round_event_control/antagonist/obsessed
unified_cost = COST_SEMIMAJOR
maximum_antags_global = 1
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/obsessed/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
@@ -455,12 +525,14 @@
/datum/round_event_control/antagonist/solo/spy
maximum_antags_global = 4
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/spy/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
maximum_antags_global = 6
+ weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/traitor/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
@@ -491,6 +563,7 @@
/datum/round_event_control/wizard_dice
unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
// /datum/round_event_control/wizard_dice/New()
From 3931fd4fc9cbf0788b3b44ce7ef4eb146862b290 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 16:50:47 -0700
Subject: [PATCH 18/61] Fix log names
---
modular_zzbug/code/modules/unified/unified.dm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index cfc246a945e0..46389c43d175 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -135,8 +135,8 @@ SUBSYSTEM_DEF(unified)
valid_events[event] = event.calculated_weight
///If we didn't get any events, remove the points inform admins and dont do anything
if(!length(valid_events))
- message_admins("Storyteller failed to pick an event.")
- log_admin("Storyteller failed to pick an event.")
+ message_admins("Unified failed to pick an event.")
+ log_admin("Unified failed to pick an event.")
return
picked_event = pick_weight(valid_events)
if(!picked_event)
@@ -194,8 +194,8 @@ SUBSYSTEM_DEF(unified)
valid_events[event] = event.calculated_weight
///If we didn't get any events, remove the points inform admins and dont do anything
if(!length(valid_events))
- message_admins("Storyteller failed to pick an event.")
- log_admin("Storyteller failed to pick an event.")
+ message_admins("Unified failed to pick a roundstart event.")
+ log_admin("Unified failed to pick a roundstart event.")
return
picked_event = pick_weight(valid_events)
if(!picked_event)
From 4414a4e2c4c8c30f684434d452a9b44dccd3c71c Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 16:59:38 -0700
Subject: [PATCH 19/61] Fix runtime
---
.../code/modules/storyteller/storyteller_vote.dm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
index 6b20e4dcca98..7b5b4f3ecccd 100644
--- a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
+++ b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
@@ -69,6 +69,11 @@ We then just check what the last one is in SSgamemode.storyteller_vote_choices()
/// Collects current storyteller and stores it
/datum/controller/subsystem/persistence/proc/collect_storyteller()
- rustg_file_write("[SSgamemode.storyteller.name]", STORYTELLER_LAST_FILEPATH)
+ var/storyboy_name
+ if(SSgamemode.storyteller)
+ storyboy_name = SSgamemode.storyteller.name
+ else
+ storyboy_name = "None"
+ rustg_file_write("[storyboy_name]", STORYTELLER_LAST_FILEPATH)
#undef STORYTELLER_LAST_FILEPATH
From d886178cc30651687fbb73ad9ad419875c96a212 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 20:28:34 -0700
Subject: [PATCH 20/61] Add missed events
---
modular_zzbug/code/modules/unified/event_overrides.dm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 39588a6eba4b..002752c4b4b7 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -151,6 +151,10 @@
// MODERATE EVENTS
+/datum/round_event_control/meteor_wave/dust_storm
+ unified_cost = COST_MODERATE
+ weight = WEIGHT_NORMAL
+
/datum/round_event_control/brain_trauma
unified_cost = COST_MODERATE
weight = WEIGHT_NORMAL
@@ -265,6 +269,10 @@
/datum/round_event_control/disease_outbreak/New()
tags |= list(TAG_MEDICAL)
+/datum/round_event_control/disease_outbreak/advanced
+ unified_cost = COST_MODERATE
+ weight = WEIGHT_UNLIKELY
+
/datum/round_event_control/anomaly/anomaly_dimensional
unified_cost = COST_MODERATE
weight = WEIGHT_NORMAL
From 05164102ab96ac57f505d127bbfaf09c0ee0b692 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 20:45:47 -0700
Subject: [PATCH 21/61] Fix job weighting
---
modular_zzbug/code/modules/unified/unified.dm | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 46389c43d175..bd3b9135c909 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -149,13 +149,13 @@ SUBSYSTEM_DEF(unified)
var/total_cost = picked_event.unified_cost
if(allow_job_weighting)
var/job_cost = 1
- if(TAG_ENGINEERING in picked_event.tags && eng_crew == 0)
+ if((TAG_ENGINEERING in picked_event.tags) && eng_crew == 0)
job_cost *= 2
- if(TAG_MEDICAL in picked_event.tags && med_crew == 0)
+ if((TAG_MEDICAL in picked_event.tags) && med_crew == 0)
job_cost *= 2
- if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
+ if((TAG_SECURITY in picked_event.tags) && sec_crew == 0)
job_cost *= 2
- if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ if((TAG_SCIENCE in picked_event.tags) && sci_crew == 0)
job_cost *= 2
total_cost *= job_cost
if(total_cost > points)
@@ -208,13 +208,13 @@ SUBSYSTEM_DEF(unified)
var/total_cost = picked_event.unified_cost
if(allow_job_weighting)
var/job_cost = 1
- if(TAG_ENGINEERING in picked_event.tags && eng_crew == 0)
+ if((TAG_ENGINEERING in picked_event.tags) && eng_crew == 0)
job_cost *= 2
- if(TAG_MEDICAL in picked_event.tags && med_crew == 0)
+ if((TAG_MEDICAL in picked_event.tags) && med_crew == 0)
job_cost *= 2
- if(TAG_SECURITY in picked_event.tags && sec_crew == 0)
+ if((TAG_SECURITY in picked_event.tags) && sec_crew == 0)
job_cost *= 2
- if(TAG_SCIENCE in picked_event.tags && sci_crew == 0)
+ if((TAG_SCIENCE in picked_event.tags) && sci_crew == 0)
job_cost *= 2
total_cost *= job_cost
points -= total_cost
@@ -226,13 +226,13 @@ SUBSYSTEM_DEF(unified)
var/weight_total = event.weight
if(allow_job_weighting)
var/job_weighting = 1
- if(TAG_ENGINEERING in event.tags && eng_crew == 0)
+ if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
job_weighting *= 0.5
- if(TAG_MEDICAL in event.tags && med_crew == 0)
+ if((TAG_MEDICAL in event.tags) && med_crew == 0)
job_weighting *= 0.5
- if(TAG_SECURITY in event.tags && sec_crew == 0)
+ if((TAG_SECURITY in event.tags) && sec_crew == 0)
job_weighting *= 0.5
- if(TAG_SCIENCE in event.tags && sci_crew == 0)
+ if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_weighting *= 0.5
if(head_crew == 0)
job_weighting = 0
From a0f16939028548df31ace08e2134bfb82cd1b74b Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 4 Sep 2024 21:08:03 -0700
Subject: [PATCH 22/61] Fix roundstart event job weighting
---
modular_zzbug/code/modules/unified/unified.dm | 36 +++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index bd3b9135c909..b60292dbc5da 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -69,7 +69,7 @@ SUBSYSTEM_DEF(unified)
var/antag_divisor = 8
/// % chance of having an antag created at roundstart
- var/roundstart_event_chance = 40
+ var/roundstart_event_chance = 100 // DON'T COMMIT
/// List of all datum/round_event_control with roundstart=true.
var/list/roundstart_control = list()
@@ -320,7 +320,7 @@ SUBSYSTEM_DEF(unified)
update_crew_infos()
return active_players
else
- calculate_ready_players()
+ update_ready_crew_infos()
return ready_players
/// Refunds and removes a scheduled event.
@@ -405,6 +405,38 @@ SUBSYSTEM_DEF(unified)
sci_crew++
// update_pop_scaling() TODO FIX
+/datum/controller/subsystem/unified/proc/update_ready_crew_infos()
+ // Very similar logic to `get_active_player_count()`
+ ready_players = 0
+ head_crew = 0
+ eng_crew = 0
+ med_crew = 0
+ sec_crew = 0
+ sci_crew = 0
+ var/list/players = list()
+
+ //This fills the readied players list that the job estimation panel uses.
+ for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
+ if(player.ready == PLAYER_READY_TO_PLAY)
+ players[player.key] = player
+
+ sortTim(players, GLOBAL_PROC_REF(cmp_text_asc))
+
+ for(var/ckey in players)
+ var/mob/dead/new_player/player = players[ckey]
+ var/datum/preferences/prefs = player.client?.prefs
+ var/datum/job/J = prefs?.get_highest_priority_job()
+ if(J.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND)
+ head_crew++
+ if(J.departments_bitflags & DEPARTMENT_BITFLAG_ENGINEERING)
+ eng_crew++
+ if(J.departments_bitflags & DEPARTMENT_BITFLAG_MEDICAL)
+ med_crew++
+ if(J.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)
+ sec_crew++
+ if(J.departments_bitflags & DEPARTMENT_BITFLAG_SCIENCE)
+ sci_crew++
+
/* TODO FIX
/datum/controller/subsystem/unified/proc/update_pop_scaling()
for(var/track in event_tracks)
From 9382a334cb5d2fdc2a841d4563b0035a9fb3017c Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Thu, 5 Sep 2024 01:40:01 -0700
Subject: [PATCH 23/61] Uncommit the thing that shouldn't have been committed
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index b60292dbc5da..7cadafc2083e 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -69,7 +69,7 @@ SUBSYSTEM_DEF(unified)
var/antag_divisor = 8
/// % chance of having an antag created at roundstart
- var/roundstart_event_chance = 100 // DON'T COMMIT
+ var/roundstart_event_chance = 40
/// List of all datum/round_event_control with roundstart=true.
var/list/roundstart_control = list()
From 2a6a0aaa602c7a632add2e8ca27cb298e7617660 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Thu, 5 Sep 2024 13:55:23 -0700
Subject: [PATCH 24/61] Lower antag cost, increase antag cooldown
---
.../code/modules/unified/event_overrides.dm | 26 +++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 002752c4b4b7..fe840cd72cef 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -456,8 +456,8 @@
// ANTAGS
/datum/round_event_control/antagonist
- unified_cost = COST_MAJOR
- cooldown_override = 5
+ unified_cost = COST_SEMIMAJOR
+ cooldown_override = 10
/datum/round_event_control/antagonist/solo/bloodsucker
min_players = 20
@@ -520,7 +520,7 @@
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed
- unified_cost = COST_SEMIMAJOR
+ unified_cost = COST_MODERATE
maximum_antags_global = 1
weight = WEIGHT_NORMAL
@@ -556,19 +556,19 @@
/datum/round_event_control/changeling
max_occurrences = 0 // TODO add an antag version of this
- unified_cost = COST_MAJOR
- cooldown_override = 5
-
+ //unified_cost = COST_MAJOR
+ //cooldown_override = 5
+/*
/datum/round_event_control/changeling/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
-
+*/
/datum/round_event_control/nightmare
max_occurrences = 0 // TODO add an antag version of this
- unified_cost = COST_MAJOR
-
+ //unified_cost = COST_MAJOR
+/*
/datum/round_event_control/nightmare/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
-
+*/
/datum/round_event_control/wizard_dice
unified_cost = COST_MODERATE
weight = WEIGHT_NORMAL
@@ -578,12 +578,12 @@
/datum/round_event_control/space_ninja
max_occurrences = 0 // TODO add an antag version of this
unified_cost = COST_MAJOR
-
+/*
/datum/round_event_control/space_ninja/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
-
+*/
/datum/round_event_control/obsessed
- max_occurrences = 0
+ max_occurrences = 0 // We already have an antag version of this event
/datum/round_event_control/morph
max_occurrences = 0 // TODO add an antag version of this
From b9c0558737003355f47a8e40963fd9905ab80e70 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Thu, 5 Sep 2024 13:55:39 -0700
Subject: [PATCH 25/61] Add threat level to the roundstart command report
---
.../code/modules/unified/divergency_report.dm | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/divergency_report.dm b/modular_zzbug/code/modules/unified/divergency_report.dm
index 793c32cad0d5..c4a7888b5152 100644
--- a/modular_zzbug/code/modules/unified/divergency_report.dm
+++ b/modular_zzbug/code/modules/unified/divergency_report.dm
@@ -1,15 +1,25 @@
/datum/controller/subsystem/unified/proc/send_trait_report()
. = "Central Command Status Summary
"
+
+ . += ""
+ if(starting_points < 90) // 60-90 points
+ . += "Low"
+ else if(starting_points < 150) // 90-150 points
+ . += "Moderate"
+ else // 150-180 points
+ . += "High"
+ . += " station threat detected."
+
SSstation.generate_station_goals(20)
var/list/station_goals = SSstation.get_station_goals()
if(!length(station_goals))
- . = "
No assigned goals.
"
+ . += "
No assigned goals.
"
else
. += generate_station_goal_report(station_goals)
if(!SSstation.station_traits.len)
- . = "
No identified shift divergencies.
"
+ . += "
No identified shift divergencies.
"
else
. += generate_station_trait_report()
From a19a7dc2b3277253e6900f235e3354cb6c6adefb Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 00:31:05 -0700
Subject: [PATCH 26/61] Change antag cap to take into account captaincy
---
modular_zzbug/code/modules/unified/unified.dm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 7cadafc2083e..49be64394ef7 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -247,7 +247,15 @@ SUBSYSTEM_DEF(unified)
/// Gets the number of antagonists the antagonist injection events will stop rolling after.
/datum/controller/subsystem/unified/proc/get_antag_cap()
- return round(max(min(get_correct_popcount() / antag_divisor + sec_crew,sec_crew*1.5),ANTAG_CAP_FLAT))
+ var/capable_crew
+ if(sec_crew == 0)
+ if(head_crew > 0)
+ capable_crew = 1
+ else
+ capable_crew = 0
+ else
+ capable_crew = sec_crew
+ return round(max(min(get_correct_popcount() / antag_divisor + capable_crew,capable_crew*1.5),ANTAG_CAP_FLAT))
/// Whether events can inject more antagonists into the round
/datum/controller/subsystem/unified/proc/can_inject_antags()
From 4e68151ae978047fe94ef34dff5957fa6e3de3f3 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 00:32:47 -0700
Subject: [PATCH 27/61] Revert "Change antag cap to take into account
captaincy"
This reverts commit a19a7dc2b3277253e6900f235e3354cb6c6adefb.
---
modular_zzbug/code/modules/unified/unified.dm | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 49be64394ef7..7cadafc2083e 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -247,15 +247,7 @@ SUBSYSTEM_DEF(unified)
/// Gets the number of antagonists the antagonist injection events will stop rolling after.
/datum/controller/subsystem/unified/proc/get_antag_cap()
- var/capable_crew
- if(sec_crew == 0)
- if(head_crew > 0)
- capable_crew = 1
- else
- capable_crew = 0
- else
- capable_crew = sec_crew
- return round(max(min(get_correct_popcount() / antag_divisor + capable_crew,capable_crew*1.5),ANTAG_CAP_FLAT))
+ return round(max(min(get_correct_popcount() / antag_divisor + sec_crew,sec_crew*1.5),ANTAG_CAP_FLAT))
/// Whether events can inject more antagonists into the round
/datum/controller/subsystem/unified/proc/can_inject_antags()
From 71836d8bee510a19d8b6194a10019737fcf04869 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 12:59:50 -0700
Subject: [PATCH 28/61] Fix up antag event numbers
---
.../code/modules/unified/event_overrides.dm | 60 +++++++++++--------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index fe840cd72cef..5324835c2222 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -460,39 +460,40 @@
cooldown_override = 10
/datum/round_event_control/antagonist/solo/bloodsucker
- min_players = 20
-
- base_antags = 2
- maximum_antags = 3
- maximum_antags_global = 3
+ min_players = 0
+ base_antags = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/bloodsucker/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/changeling
- min_players = 20
- maximum_antags_global = 4
+ min_players = 0
+ base_antags = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/changeling/New()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/heretic
- min_players = 30
-
+ min_players = 0
base_antags = 1
- maximum_antags = 2
- maximum_antags_global = 2
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/heretic/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/malf
+ min_players = 0
base_antags = 1
- maximum_antags = 1
- maximum_antags_global = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
min_players = 20
@@ -503,25 +504,21 @@
/datum/round_event_control/antagonist/team/nuke_ops
unified_cost = COST_SUPERMAJOR
weight = WEIGHT_UNLIKELY
-
+ min_players = 0
base_antags = 2
- maximum_antags = 5
+ maximum_antags = INFINITY
maximum_antags_global = 5
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/team/nuke_ops/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
-/datum/round_event_control/operative
- // Don't override weight for operative!
- unified_cost = COST_MAJOR
-
-/datum/round_event_control/operative/New()
- tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
-
/datum/round_event_control/antagonist/obsessed
unified_cost = COST_MODERATE
- maximum_antags_global = 1
+ min_players = 0
+ base_antags = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/obsessed/New()
@@ -532,14 +529,20 @@
roundstart = FALSE
/datum/round_event_control/antagonist/solo/spy
- maximum_antags_global = 4
+ min_players = 0
+ base_antags = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/spy/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
- maximum_antags_global = 6
+ min_players = 0
+ base_antags = 1
+ maximum_antags = INFINITY
+ maximum_antags_global = 0
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/traitor/New()
@@ -554,6 +557,13 @@
// MISC
+/datum/round_event_control/operative
+ // Don't override weight for operative!
+ unified_cost = COST_MAJOR
+
+/datum/round_event_control/operative/New()
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
+
/datum/round_event_control/changeling
max_occurrences = 0 // TODO add an antag version of this
//unified_cost = COST_MAJOR
From 25a4698f1951b96632369db8f3d69f0a842af4d2 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 13:09:30 -0700
Subject: [PATCH 29/61] Lower the costs of some events
---
.../code/modules/unified/event_overrides.dm | 34 +++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 5324835c2222..5bd5b6a8e39d 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -122,13 +122,20 @@
tags |= list(TAG_SCIENCE)
/datum/round_event_control/anomaly/anomaly_hallucination
- unified_cost = COST_MINOR
+ unified_cost = COST_VERY_MINOR
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav
+ unified_cost = COST_VERY_MINOR
+ weight = WEIGHT_NORMAL
+
+/datum/round_event_control/anomaly/anomaly_grav/high
unified_cost = COST_MINOR
weight = WEIGHT_NORMAL
+/datum/round_event_control/anomaly/anomaly_grav/high/New()
+ tags |= list(TAG_ENGINEERING)
+
/datum/round_event_control/anomaly/anomaly_bioscrambler
unified_cost = COST_MINOR
weight = WEIGHT_NORMAL
@@ -291,13 +298,6 @@
/datum/round_event_control/anomaly/anomaly_flux/New()
tags |= list(TAG_ENGINEERING)
-/datum/round_event_control/anomaly/anomaly_grav/high
- unified_cost = COST_MODERATE
- weight = WEIGHT_NORMAL
-
-/datum/round_event_control/anomaly/anomaly_grav/high/New()
- tags |= list(TAG_ENGINEERING)
-
/datum/round_event_control/vent_clog/major
unified_cost = COST_MODERATE
weight = WEIGHT_NORMAL
@@ -322,7 +322,7 @@
// MAJOR EVENTS
/datum/round_event_control/pirates
- unified_cost = COST_SEMIMAJOR
+ unified_cost = COST_MAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/pirates/New()
@@ -350,56 +350,56 @@
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/earthquake
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/earthquake/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/blob
- unified_cost = COST_MAJOR
+ unified_cost = COST_SUPERMAJOR
weight = WEIGHT_UNLIKELY
/datum/round_event_control/blob/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/meteor_wave/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave/meaty
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_UNLIKELY // meat meteors?? how queer
/datum/round_event_control/meteor_wave/ices
max_occurrences = 0
/datum/round_event_control/immovable_rod
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/immovable_rod/New()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/stray_meteor
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/stray_meteor/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_vortex
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_vortex/New()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_pyro
- unified_cost = COST_MAJOR
+ unified_cost = COST_SEMIMAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_pyro/New()
From b48648e3165762cc1c0117230ce7110fba6cd2ea Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 13:52:15 -0700
Subject: [PATCH 30/61] Move cost calculation to a new proc, make antags cost
less with higher antag cap
---
modular_zzbug/code/modules/unified/unified.dm | 40 +++++++++----------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 7cadafc2083e..2089606ed45f 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -146,18 +146,7 @@ SUBSYSTEM_DEF(unified)
return
// Calculate event cost and buy it
- var/total_cost = picked_event.unified_cost
- if(allow_job_weighting)
- var/job_cost = 1
- if((TAG_ENGINEERING in picked_event.tags) && eng_crew == 0)
- job_cost *= 2
- if((TAG_MEDICAL in picked_event.tags) && med_crew == 0)
- job_cost *= 2
- if((TAG_SECURITY in picked_event.tags) && sec_crew == 0)
- job_cost *= 2
- if((TAG_SCIENCE in picked_event.tags) && sci_crew == 0)
- job_cost *= 2
- total_cost *= job_cost
+ var/total_cost = calculate_event_cost(picked_event)
if(total_cost > points)
message_admins("Unified tried to buy an event over its budget.")
log_admin("Unified tried to buy an event over its budget.")
@@ -205,21 +194,32 @@ SUBSYSTEM_DEF(unified)
return
// Calculate event cost and buy it
- var/total_cost = picked_event.unified_cost
+ var/total_cost = calculate_event_cost(picked_event)
+ if(total_cost > points)
+ message_admins("Unified tried to buy a roundstart event over its budget.")
+ log_admin("Unified tried to buy a roundstart event over its budget.")
+ return
+ points -= total_cost
+
+
+ . = TRUE
+
+/datum/controller/subsystem/unified/proc/calculate_event_cost(datum/round_event_control/event)
+ var/total_cost = event.unified_cost
if(allow_job_weighting)
var/job_cost = 1
- if((TAG_ENGINEERING in picked_event.tags) && eng_crew == 0)
+ if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
job_cost *= 2
- if((TAG_MEDICAL in picked_event.tags) && med_crew == 0)
+ if((TAG_MEDICAL in event.tags) && med_crew == 0)
job_cost *= 2
- if((TAG_SECURITY in picked_event.tags) && sec_crew == 0)
+ if((TAG_SECURITY in event.tags) && sec_crew == 0)
job_cost *= 2
- if((TAG_SCIENCE in picked_event.tags) && sci_crew == 0)
+ if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_cost *= 2
total_cost *= job_cost
- points -= total_cost
-
- . = TRUE
+ if(istype(event, /datum/round_event_control/antagonist))
+ total_cost /= get_antag_cap()
+ return total_cost
/datum/controller/subsystem/unified/proc/calculate_weights()
for(var/datum/round_event_control/event in control)
From 191ed27ef7171c9ebc27fd5e3a75858abde4f2da Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 15:01:01 -0700
Subject: [PATCH 31/61] Events are now all bought on roundstart
---
code/modules/events/_event.dm | 9 +-
code/modules/events/ghost_role/_ghost_role.dm | 19 +--
modular_zzbug/code/modules/unified/_event.dm | 4 +
modular_zzbug/code/modules/unified/unified.dm | 133 +++++-------------
4 files changed, 58 insertions(+), 107 deletions(-)
diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm
index d34dfc8a614e..8e9266c036c0 100644
--- a/code/modules/events/_event.dm
+++ b/code/modules/events/_event.dm
@@ -74,9 +74,9 @@
SHOULD_CALL_PARENT(TRUE)
if(occurrences >= max_occurrences)
return FALSE
- if(!roundstart && !SSticker.HasRoundStarted()) // BUBBER EDIT: Roundstart checks added
+ if(roundstart != !SSticker.HasRoundStarted()) // BUBBER EDIT: Roundstart checks added // BUG EDIT
return FALSE
- if(weight == 0) // BUBBER EDIT: Weight check added
+ if(calculated_weight == 0) // BUBBER EDIT: Weight check added // BUG EDIT
return FALSE
if(!allow_magic && wizardevent != SSevents.wizardmode)
return FALSE
@@ -92,6 +92,11 @@
if (dynamic_should_hijack && SSdynamic.random_event_hijacked != HIJACKED_NOTHING)
return FALSE
+ // BUG ADDITION START
+ if(calculated_cost > SSunified.points)
+ return FALSE
+ // BUG ADDITION END
+
return TRUE
/datum/round_event_control/proc/preRunEvent()
diff --git a/code/modules/events/ghost_role/_ghost_role.dm b/code/modules/events/ghost_role/_ghost_role.dm
index 336fb4c03bbd..e390a155bd8a 100644
--- a/code/modules/events/ghost_role/_ghost_role.dm
+++ b/code/modules/events/ghost_role/_ghost_role.dm
@@ -52,15 +52,18 @@
return
switch(status)
- if(MAP_ERROR)
- message_admins("[role_name] cannot be spawned due to a map error.")
- kill()
- return
- if(NOT_ENOUGH_PLAYERS)
- message_admins("[role_name] cannot be spawned due to lack of players signing up.")
- deadchat_broadcast(" did not get enough candidates ([minimum_required]) to spawn.", "[role_name]", message_type=DEADCHAT_ANNOUNCEMENT)
- kill()
+ // BUG EDIT AND ADDITION START
+ if(MAP_ERROR || NOT_ENOUGH_PLAYERS)
+ if(MAP_ERROR)
+ message_admins("[role_name] cannot be spawned due to a map error.")
+ kill()
+ if(NOT_ENOUGH_PLAYERS)
+ message_admins("[role_name] cannot be spawned due to lack of players signing up.")
+ deadchat_broadcast(" did not get enough candidates ([minimum_required]) to spawn.", "[role_name]", message_type=DEADCHAT_ANNOUNCEMENT)
+ kill()
+ SSunified.refund_failed_event(control)
return
+ // BUG EDIT AND ADDITION END
if(SUCCESSFUL_SPAWN)
message_admins("[role_name] spawned successfully.")
if(spawned_mobs.len)
diff --git a/modular_zzbug/code/modules/unified/_event.dm b/modular_zzbug/code/modules/unified/_event.dm
index 70922519e55c..753bf3b2a2f2 100644
--- a/modular_zzbug/code/modules/unified/_event.dm
+++ b/modular_zzbug/code/modules/unified/_event.dm
@@ -1,5 +1,9 @@
/datum/round_event_control
/// This event's cost in the Unified system. Equates to a cooldown in minutes for the event.
var/unified_cost = 0
+
/// The cooldown in minutes to use instead of the cost.
var/cooldown_override = 0
+
+ /// Last calculated weight that Unified assigned this event
+ var/calculated_cost = 0
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 2089606ed45f..fc5b36f7478c 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -102,11 +102,6 @@ SUBSYSTEM_DEF(unified)
sch_event.alerted_admins = TRUE
message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
- if(!halted && cooldown_over <= world.time)
- // We update crew information here to adjust population scaling and event thresholds
- update_crew_infos()
- add_event()
-
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
@@ -120,12 +115,13 @@ SUBSYSTEM_DEF(unified)
if (MC_TICK_CHECK)
return
-/datum/controller/subsystem/unified/proc/add_event()
+/datum/controller/subsystem/unified/proc/buy_event(run_now = FALSE)
. = FALSE
var/datum/round_event_control/picked_event
var/player_pop = SSunified.get_correct_popcount()
- calculate_weights(control)
+ calculate_weights()
+ calculate_costs()
var/list/valid_events = list()
// Determine which events are valid to pick
for(var/datum/round_event_control/event as anything in SSunified.control)
@@ -133,7 +129,6 @@ SUBSYSTEM_DEF(unified)
continue
if(event.can_spawn_event(player_pop))
valid_events[event] = event.calculated_weight
- ///If we didn't get any events, remove the points inform admins and dont do anything
if(!length(valid_events))
message_admins("Unified failed to pick an event.")
log_admin("Unified failed to pick an event.")
@@ -145,81 +140,31 @@ SUBSYSTEM_DEF(unified)
stack_trace("WARNING: Unified picked a null from event pool.")
return
- // Calculate event cost and buy it
- var/total_cost = calculate_event_cost(picked_event)
- if(total_cost > points)
- message_admins("Unified tried to buy an event over its budget.")
- log_admin("Unified tried to buy an event over its budget.")
- return
- points -= total_cost
- var/cooldown // in minutes
- if(picked_event.cooldown_override)
- cooldown = rand(picked_event.cooldown_override*0.5, picked_event.cooldown_override*1.5)
- else
- cooldown = rand(total_cost*0.5, total_cost*1.5)
- cooldown *= BASE_POINTS/starting_points // the higher the starting points, the lower the cooldown
- cooldown_over = world.time + cooldown MINUTES // convert cooldown to deciseconds
- message_admins("Unified purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [round(cooldown, 0.01)] minutes.")
- log_admin("Storyteller purchased and triggered [picked_event] event for [total_cost] cost and a cooldown of [round(cooldown, 0.01)] minutes.")
- if(picked_event.roundstart)
+ points -= picked_event.calculated_cost // we already know that valid events cost less than our current points
+ if(picked_event.roundstart || run_now)
TriggerEvent(picked_event)
else
- schedule_event(picked_event, 3 MINUTES, total_cost) // We already randomize cooldown, we don't need to randomize this
+ schedule_event(picked_event, rand(10 * BASE_POINTS/starting_points, 120-picked_event.calculated_cost) MINUTES, picked_event.calculated_cost)
. = TRUE
-/datum/controller/subsystem/unified/proc/add_roundstart_event()
- . = FALSE
- var/datum/round_event_control/picked_event
-
- var/player_pop = SSunified.get_correct_popcount()
- calculate_weights(control)
- var/list/valid_events = list()
- // Determine which events are valid to pick
- for(var/datum/round_event_control/event as anything in SSunified.roundstart_control)
- if(isnull(event))
- continue
- if(event.can_spawn_event(player_pop))
- valid_events[event] = event.calculated_weight
- ///If we didn't get any events, remove the points inform admins and dont do anything
- if(!length(valid_events))
- message_admins("Unified failed to pick a roundstart event.")
- log_admin("Unified failed to pick a roundstart event.")
- return
- picked_event = pick_weight(valid_events)
- if(!picked_event)
- message_admins("WARNING: Unified picked a null from event pool. Aborting event roll.")
- log_admin("WARNING: Unified picked a null from event pool. Aborting event roll.")
- stack_trace("WARNING: Unified picked a null from event pool.")
- return
-
- // Calculate event cost and buy it
- var/total_cost = calculate_event_cost(picked_event)
- if(total_cost > points)
- message_admins("Unified tried to buy a roundstart event over its budget.")
- log_admin("Unified tried to buy a roundstart event over its budget.")
- return
- points -= total_cost
-
-
- . = TRUE
-
-/datum/controller/subsystem/unified/proc/calculate_event_cost(datum/round_event_control/event)
- var/total_cost = event.unified_cost
- if(allow_job_weighting)
- var/job_cost = 1
- if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
- job_cost *= 2
- if((TAG_MEDICAL in event.tags) && med_crew == 0)
- job_cost *= 2
- if((TAG_SECURITY in event.tags) && sec_crew == 0)
- job_cost *= 2
- if((TAG_SCIENCE in event.tags) && sci_crew == 0)
- job_cost *= 2
- total_cost *= job_cost
- if(istype(event, /datum/round_event_control/antagonist))
- total_cost /= get_antag_cap()
- return total_cost
+/datum/controller/subsystem/unified/proc/calculate_costs()
+ for(var/datum/round_event_control/event in control)
+ var/total_cost = event.unified_cost
+ if(allow_job_weighting)
+ var/job_cost = 1
+ if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
+ job_cost *= 2
+ if((TAG_MEDICAL in event.tags) && med_crew == 0)
+ job_cost *= 2
+ if((TAG_SECURITY in event.tags) && sec_crew == 0)
+ job_cost *= 2
+ if((TAG_SCIENCE in event.tags) && sci_crew == 0)
+ job_cost *= 2
+ total_cost *= job_cost
+ if(istype(event, /datum/round_event_control/antagonist))
+ total_cost /= get_antag_cap()
+ event.calculated_cost = total_cost
/datum/controller/subsystem/unified/proc/calculate_weights()
for(var/datum/round_event_control/event in control)
@@ -323,11 +268,16 @@ SUBSYSTEM_DEF(unified)
update_ready_crew_infos()
return ready_players
-/// Refunds and removes a scheduled event.
+/// Refunds and removes a scheduled event, then buys another.
/datum/controller/subsystem/unified/proc/refund_scheduled_event(datum/scheduled_event/refunded)
points += refunded.cost
- cooldown_over = world.time
remove_scheduled_event(refunded)
+ buy_event(TRUE)
+
+/// Refunds a failed event, then buys another.
+/datum/controller/subsystem/unified/proc/refund_failed_event(datum/round_event_control/failed)
+ points += failed.cost
+ buy_event(TRUE)
/// Schedules an event.
/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
@@ -338,20 +288,12 @@ SUBSYSTEM_DEF(unified)
scheduled_events -= removed
qdel(removed)
-/// We need to calculate ready players for the sake of roundstart events becoming eligible.
-/datum/controller/subsystem/unified/proc/calculate_ready_players()
- ready_players = 0
- for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
- if(player.ready == PLAYER_READY_TO_PLAY)
- ready_players++
-
/// Because roundstart events need 2 steps of firing for purposes of antags, here is the first step handled, happening before occupation division.
-/datum/controller/subsystem/unified/proc/handle_pre_setup_roundstart_events()
+/datum/controller/subsystem/unified/proc/buy_round_events()
if(halted)
- message_admins("WARNING: Didn't roll roundstart events (including antagonists) due to the storyteller being halted.")
+ message_admins("WARNING: Didn't roll any events (including antagonists) due to Unified being halted.")
return
- if(prob(roundstart_event_chance))
- add_roundstart_event()
+ while(buy_event());
/// Second step of handlind roundstart events, happening after people spawn.
/datum/controller/subsystem/unified/proc/handle_post_setup_roundstart_events()
@@ -529,14 +471,11 @@ SUBSYSTEM_DEF(unified)
/datum/controller/subsystem/unified/proc/pre_setup()
// We need to do this to prevent some niche fuckery... and make dep. orders work. Lol
SSjob.ResetOccupations()
- calculate_ready_players()
- handle_pre_setup_roundstart_events()
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
- var/cooldown = 10 * BASE_POINTS/starting_points
- cooldown_over = world.time + cooldown MINUTES
- log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
- message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
+ buy_round_events()
+ log_game("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events. Events will start in [round(10 * BASE_POINTS/starting_points, 0.01)] minutes.")
+ message_admins("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events. Events will start in [round(10 * BASE_POINTS/starting_points, 0.01)] minutes.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
From 59dc3f77e886e56dd6b02014832ae11105bfa69c Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 15:17:58 -0700
Subject: [PATCH 32/61] Fix ghost role
---
code/modules/events/ghost_role/_ghost_role.dm | 21 +++++++++----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/code/modules/events/ghost_role/_ghost_role.dm b/code/modules/events/ghost_role/_ghost_role.dm
index e390a155bd8a..a77f2bfd17e8 100644
--- a/code/modules/events/ghost_role/_ghost_role.dm
+++ b/code/modules/events/ghost_role/_ghost_role.dm
@@ -52,18 +52,17 @@
return
switch(status)
- // BUG EDIT AND ADDITION START
- if(MAP_ERROR || NOT_ENOUGH_PLAYERS)
- if(MAP_ERROR)
- message_admins("[role_name] cannot be spawned due to a map error.")
- kill()
- if(NOT_ENOUGH_PLAYERS)
- message_admins("[role_name] cannot be spawned due to lack of players signing up.")
- deadchat_broadcast(" did not get enough candidates ([minimum_required]) to spawn.", "[role_name]", message_type=DEADCHAT_ANNOUNCEMENT)
- kill()
- SSunified.refund_failed_event(control)
+ if(MAP_ERROR)
+ message_admins("[role_name] cannot be spawned due to a map error.")
+ kill()
+ SSunified.refund_failed_event(control) // BUG ADDITION
+ return
+ if(NOT_ENOUGH_PLAYERS)
+ message_admins("[role_name] cannot be spawned due to lack of players signing up.")
+ deadchat_broadcast(" did not get enough candidates ([minimum_required]) to spawn.", "[role_name]", message_type=DEADCHAT_ANNOUNCEMENT)
+ kill()
+ SSunified.refund_failed_event(control) // BUG ADDITION
return
- // BUG EDIT AND ADDITION END
if(SUCCESSFUL_SPAWN)
message_admins("[role_name] spawned successfully.")
if(spawned_mobs.len)
From bf2544f8981a75dd523f212adf5cfec02954e4aa Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 15:28:34 -0700
Subject: [PATCH 33/61] fix not getting num of ready players
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index fc5b36f7478c..05b8a6cac506 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -361,7 +361,7 @@ SUBSYSTEM_DEF(unified)
for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
if(player.ready == PLAYER_READY_TO_PLAY)
players[player.key] = player
-
+ ready_players++
sortTim(players, GLOBAL_PROC_REF(cmp_text_asc))
for(var/ckey in players)
From d37be6bbcddf7496285042bf80c996f69bfd6225 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 15:28:50 -0700
Subject: [PATCH 34/61] Fixed roundstart event checks
---
code/modules/events/_event.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm
index 8e9266c036c0..22841a66de8f 100644
--- a/code/modules/events/_event.dm
+++ b/code/modules/events/_event.dm
@@ -74,7 +74,7 @@
SHOULD_CALL_PARENT(TRUE)
if(occurrences >= max_occurrences)
return FALSE
- if(roundstart != !SSticker.HasRoundStarted()) // BUBBER EDIT: Roundstart checks added // BUG EDIT
+ if(roundstart && !SSticker.HasRoundStarted()) // BUBBER EDIT: Roundstart checks added // BUG EDIT
return FALSE
if(calculated_weight == 0) // BUBBER EDIT: Weight check added // BUG EDIT
return FALSE
From f45d72ae94f935cb46e757944e6e69a9a244d42c Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 19:07:08 -0700
Subject: [PATCH 35/61] Things are looking pretty good, probably good to
testmerge
---
code/modules/events/_event.dm | 4 +-
.../modules/storyteller/_events/_event.dm | 23 +++++--
.../modules/storyteller/scheduled_event.dm | 2 +-
.../code/__DEFINES/unified_defines.dm | 2 +
.../code/modules/unified/event_overrides.dm | 58 ++++++++++++++--
modular_zzbug/code/modules/unified/unified.dm | 69 ++++++++++---------
6 files changed, 112 insertions(+), 46 deletions(-)
diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm
index 22841a66de8f..3f645294f1b5 100644
--- a/code/modules/events/_event.dm
+++ b/code/modules/events/_event.dm
@@ -42,6 +42,8 @@
var/map_flags = NONE
/datum/round_event_control/New()
+ SHOULD_CALL_PARENT(TRUE) // BUG EDIT
+ . = ..() // BUG EDIT
if(config && !wizardevent) // Magic is unaffected by configs
earliest_start = CEILING(earliest_start * CONFIG_GET(number/events_min_time_mul), 1)
// min_players = CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1) // BUG EDIT
@@ -76,7 +78,7 @@
return FALSE
if(roundstart && !SSticker.HasRoundStarted()) // BUBBER EDIT: Roundstart checks added // BUG EDIT
return FALSE
- if(calculated_weight == 0) // BUBBER EDIT: Weight check added // BUG EDIT
+ if(calculated_weight == 0 && unified_cost != 0) // BUBBER EDIT: Weight check added // BUG EDIT
return FALSE
if(!allow_magic && wizardevent != SSevents.wizardmode)
return FALSE
diff --git a/modular_zubbers/code/modules/storyteller/_events/_event.dm b/modular_zubbers/code/modules/storyteller/_events/_event.dm
index 86ce6861db99..6e1f5c7e5293 100644
--- a/modular_zubbers/code/modules/storyteller/_events/_event.dm
+++ b/modular_zubbers/code/modules/storyteller/_events/_event.dm
@@ -58,20 +58,33 @@
if(SSticker.HasRoundStarted())
if(roundstart)
if(!can_run_post_roundstart)
- return "Fire Schedule"
+ return "Fire" // BUG EDIT
return "Fire Schedule"
else
- return "Fire Schedule Force Next"
+ return "Fire Schedule" // BUG EDIT
else
if(roundstart)
- return "Force Roundstart"
+ return "Fire" // BUG EDIT
else
- return "Fire Schedule Force Next"
+ return "Schedule" // BUG EDIT
/datum/round_event_control/Topic(href, href_list)
. = ..()
switch(href_list["action"])
+ // BUG EDIT START
+ /*
if("force_next")
message_admins("[key_name_admin(usr)] has forced scheduled event [src.name].")
log_admin_private("[key_name(usr)] has forced scheduled event [src.name].")
- SSunified.force_event(src) // BUG EDIT
+ SSgamemode.force_event(src)
+ */
+ if("fire")
+ message_admins("[key_name_admin(usr)] has fired event [src.name].")
+ log_admin_private("[key_name(usr)] has fired event [src.name].")
+ run_event(admin_forced = TRUE)
+ if("schedule")
+ var/delay = input(usr, "Enter the time in seconds to run the event in.", "Schedule Event") as null|num
+ message_admins("[key_name_admin(usr)] has scheduled event [src.name] to run in [delay] seconds.")
+ log_admin_private("[key_name(usr)] has scheduled event [src.name] to run in [delay] seconds.")
+ SSunified.schedule_event(src, delay SECONDS, calculated_cost, TRUE, FALSE)
+ // BUG EDIT END
diff --git a/modular_zubbers/code/modules/storyteller/scheduled_event.dm b/modular_zubbers/code/modules/storyteller/scheduled_event.dm
index 8c367be6c9e1..f0a38eb01b08 100644
--- a/modular_zubbers/code/modules/storyteller/scheduled_event.dm
+++ b/modular_zubbers/code/modules/storyteller/scheduled_event.dm
@@ -35,7 +35,7 @@
/// For admins who want to reschedule the event.
/datum/scheduled_event/proc/reschedule(new_time)
start_time = new_time
- alerted_admins = FALSE
+ // alerted_admins = FALSE // BUG EDIT
/datum/scheduled_event/proc/get_href_actions()
var/round_started = SSticker.HasRoundStarted()
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 792a0b82a45f..612ebd06c608 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -21,3 +21,5 @@
#define WEIGHT_UNLIKELY 5
#define BASE_POINTS 120
+
+#define STARTING_DELAY 10 * BASE_POINTS/starting_points
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 5bd5b6a8e39d..364a356d5347 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -36,6 +36,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/space_dust/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/electrical_storm
@@ -60,6 +61,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/mice_migration/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/wisdomcow
@@ -83,6 +85,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/grey_tide/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/gravity_generator_blackout
@@ -90,6 +93,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/gravity_generator_blackout/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_insurance
@@ -101,6 +105,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/tram_malfunction/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/grid_check
@@ -119,6 +124,7 @@
// /datum/round_event_control/anomaly
/datum/round_event_control/anomaly/New()
+ . = ..()
tags |= list(TAG_SCIENCE)
/datum/round_event_control/anomaly/anomaly_hallucination
@@ -134,6 +140,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_grav/high/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_bioscrambler
@@ -141,6 +148,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_bioscrambler/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/anomaly/anomaly_bluespace
@@ -167,6 +175,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/brain_trauma/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/supermatter_surge
@@ -174,17 +183,15 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/supermatter_surge/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
-/datum/round_event_control/sentience/all
- unified_cost = COST_MODERATE
- weight = WEIGHT_NORMAL
-
/datum/round_event_control/brand_intelligence
unified_cost = COST_MODERATE
weight = WEIGHT_NORMAL
/datum/round_event_control/brand_intelligence/New()
+ . = ..()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/carp_migration
@@ -192,6 +199,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/carp_migration/New()
+ . = ..()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
/datum/round_event_control/communications_blackout
@@ -207,6 +215,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/processor_overload/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/radiation_leak
@@ -214,6 +223,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/radiation_leak/New()
+ . = ..()
tags |= list(TAG_ENGINEERING, TAG_MEDICAL)
/datum/round_event_control/sandstorm
@@ -221,6 +231,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/sandstorm/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/shuttle_catastrophe
@@ -236,6 +247,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/portal_storm_syndicate/New()
+ . = ..()
tags |= list(TAG_SECURITY, TAG_MEDICAL)
// BUG EDIT START
@@ -245,6 +257,7 @@
max_occurrences = 2
/datum/round_event_control/radiation_storm/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/wormholes
@@ -253,6 +266,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/wormholes/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/heart_attack
@@ -260,6 +274,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/heart_attack/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/appendicitis
@@ -267,6 +282,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/appendicitis/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/disease_outbreak
@@ -274,6 +290,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/disease_outbreak/New()
+ . = ..()
tags |= list(TAG_MEDICAL)
/datum/round_event_control/disease_outbreak/advanced
@@ -285,6 +302,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_dimensional/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_ectoplasm
@@ -296,6 +314,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_flux/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/vent_clog/major
@@ -303,6 +322,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/major/New()
+ . = ..()
tags |= list(TAG_SECURITY)
/datum/round_event_control/vent_clog/critical
@@ -310,6 +330,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/vent_clog/critical/New()
+ . = ..()
tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
@@ -317,6 +338,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/mold/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
// MAJOR EVENTS
@@ -326,6 +348,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/pirates/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/alien_infestation
@@ -333,6 +356,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/alien_infestation/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/space_dragon
@@ -340,6 +364,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/space_dragon/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/cortical_borer
@@ -347,6 +372,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/cortical_borer/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/earthquake
@@ -354,6 +380,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/earthquake/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/blob
@@ -361,6 +388,7 @@
weight = WEIGHT_UNLIKELY
/datum/round_event_control/blob/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave
@@ -368,6 +396,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/meteor_wave/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/meteor_wave/meaty
@@ -382,6 +411,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/immovable_rod/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING)
/datum/round_event_control/stray_meteor
@@ -389,6 +419,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/stray_meteor/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_vortex
@@ -396,6 +427,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_vortex/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/anomaly/anomaly_pyro
@@ -403,6 +435,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/anomaly/anomaly_pyro/New()
+ . = ..()
tags |= list(TAG_ENGINEERING)
/datum/round_event_control/spider_infestation
@@ -410,6 +443,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/spider_infestation/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/revenant
@@ -422,6 +456,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/abductor/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/fugitives
@@ -429,6 +464,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/fugitives/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/voidwalker
@@ -436,6 +472,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/voidwalker/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/cme
@@ -443,14 +480,15 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/cme/New()
+ . = ..()
tags |= list(TAG_ENGINEERING, TAG_SCIENCE)
-
/datum/round_event_control/stray_cargo/changeling_zombie
unified_cost = COST_MAJOR
weight = WEIGHT_NORMAL
/datum/round_event_control/stray_cargo/changeling_zombie/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
// ANTAGS
@@ -467,6 +505,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/bloodsucker/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/changeling
@@ -477,6 +516,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/changeling/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/heretic
@@ -487,6 +527,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/heretic/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/malf
@@ -499,6 +540,7 @@
min_players = 20
/datum/round_event_control/antagonist/solo/malf/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/team/nuke_ops
@@ -511,6 +553,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/team/nuke_ops/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed
@@ -522,6 +565,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/obsessed/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_SECURITY)
/datum/round_event_control/antagonist/obsessed/midround
@@ -536,6 +580,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/spy/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/antagonist/solo/traitor
@@ -546,6 +591,7 @@
weight = WEIGHT_NORMAL
/datum/round_event_control/antagonist/solo/traitor/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
// WIZARD EVENTS
@@ -553,6 +599,7 @@
// /datum/round_event_control/wizard
/datum/round_event_control/wizard/New()
+ . = ..()
tags = list(TAG_WIZARD)
// MISC
@@ -562,6 +609,7 @@
unified_cost = COST_MAJOR
/datum/round_event_control/operative/New()
+ . = ..()
tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
/datum/round_event_control/changeling
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 05b8a6cac506..0400000c5ce7 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -24,9 +24,6 @@ SUBSYSTEM_DEF(unified)
/// Events that we have scheduled to run in the nearby future
var/list/scheduled_events = list()
- /// For admins to force events (though they can still invoke them freely outside of the track system)
- var/datum/round_event_control/forced_next_event
-
var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences.
var/list/running = list() //list of all existing /datum/round_event
var/list/currentrun = list()
@@ -71,23 +68,16 @@ SUBSYSTEM_DEF(unified)
/// % chance of having an antag created at roundstart
var/roundstart_event_chance = 40
- /// List of all datum/round_event_control with roundstart=true.
- var/list/roundstart_control = list()
-
/datum/controller/subsystem/unified/Initialize(time, zlevel)
for(var/type in typesof(/datum/round_event_control))
var/datum/round_event_control/event = new type()
if(!event.typepath || !event.name || !event.valid_for_map())
continue //don't want this one! leave it for the garbage collector
control += event //add it to the list of all events (controls)
- if(event.roundstart)
- roundstart_control += event
getHoliday()
load_config_vars()
load_event_config_vars()
-// return ..()
-
/datum/controller/subsystem/unified/fire(resumed = FALSE)
if(!resumed)
@@ -127,11 +117,14 @@ SUBSYSTEM_DEF(unified)
for(var/datum/round_event_control/event as anything in SSunified.control)
if(isnull(event))
continue
+ if(event.unified_cost == 0) // free events are handled in handle_free_events
+ continue
if(event.can_spawn_event(player_pop))
valid_events[event] = event.calculated_weight
if(!length(valid_events))
- message_admins("Unified failed to pick an event.")
- log_admin("Unified failed to pick an event.")
+ if(SSticker.HasRoundStarted())
+ message_admins("Unified failed to pick an event.")
+ log_admin("Unified failed to pick an event.")
return
picked_event = pick_weight(valid_events)
if(!picked_event)
@@ -144,10 +137,30 @@ SUBSYSTEM_DEF(unified)
if(picked_event.roundstart || run_now)
TriggerEvent(picked_event)
else
- schedule_event(picked_event, rand(10 * BASE_POINTS/starting_points, 120-picked_event.calculated_cost) MINUTES, picked_event.calculated_cost)
+ schedule_event(picked_event, rand(STARTING_DELAY, 120-picked_event.calculated_cost) MINUTES, picked_event.calculated_cost)
. = TRUE
+/datum/controller/subsystem/unified/proc/handle_free_events()
+ var/player_pop = SSunified.get_correct_popcount()
+ calculate_weights()
+ var/list/valid_events = list()
+ // Determine which events are valid to pick
+ for(var/datum/round_event_control/event as anything in SSunified.control)
+ if(isnull(event))
+ continue
+ if(!event.unified_cost == 0)
+ continue
+ if(event.can_spawn_event(player_pop))
+ valid_events[event] = event.calculated_weight
+ if(!length(valid_events))
+ message_admins("Unified has no valid free events.")
+ log_admin("Unified has no valid free events.")
+ return
+ for(var/datum/round_event_control/event in valid_events)
+ if(prob(event.calculated_weight))
+ schedule_event(event, rand(STARTING_DELAY, 120) MINUTES, 0)
+
/datum/controller/subsystem/unified/proc/calculate_costs()
for(var/datum/round_event_control/event in control)
var/total_cost = event.unified_cost
@@ -276,24 +289,21 @@ SUBSYSTEM_DEF(unified)
/// Refunds a failed event, then buys another.
/datum/controller/subsystem/unified/proc/refund_failed_event(datum/round_event_control/failed)
- points += failed.cost
+ points += failed.calculated_cost
buy_event(TRUE)
-/// Schedules an event.
-/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
- forced_next_event = event
-
/// Removes a scheduled event.
/datum/controller/subsystem/unified/proc/remove_scheduled_event(datum/scheduled_event/removed)
scheduled_events -= removed
qdel(removed)
/// Because roundstart events need 2 steps of firing for purposes of antags, here is the first step handled, happening before occupation division.
-/datum/controller/subsystem/unified/proc/buy_round_events()
+/datum/controller/subsystem/unified/proc/add_round_events()
if(halted)
message_admins("WARNING: Didn't roll any events (including antagonists) due to Unified being halted.")
return
while(buy_event());
+ handle_free_events()
/// Second step of handlind roundstart events, happening after people spawn.
/datum/controller/subsystem/unified/proc/handle_post_setup_roundstart_events()
@@ -303,16 +313,10 @@ SUBSYSTEM_DEF(unified)
continue
ASYNC
event.try_start()
-// INVOKE_ASYNC(event, /datum/round_event.proc/try_start)
/// Schedules an event to run later.
/datum/controller/subsystem/unified/proc/schedule_event(datum/round_event_control/passed_event, passed_time, passed_cost, passed_ignore, passed_announce)
var/datum/scheduled_event/scheduled = new (passed_event, world.time + passed_time, passed_cost, passed_ignore, passed_announce)
- var/round_started = SSticker.HasRoundStarted()
- if(round_started)
- message_admins("Event: [passed_event] has been scheduled to run in [passed_time / 10] seconds. (CANCEL) (REFUND)")
- else //Only roundstart events can be scheduled before round start
- message_admins("Event: [passed_event] has been scheduled to run on roundstart. (CANCEL)")
scheduled_events += scheduled
/datum/controller/subsystem/unified/proc/update_crew_infos()
@@ -473,9 +477,9 @@ SUBSYSTEM_DEF(unified)
SSjob.ResetOccupations()
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
- buy_round_events()
- log_game("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events. Events will start in [round(10 * BASE_POINTS/starting_points, 0.01)] minutes.")
- message_admins("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events. Events will start in [round(10 * BASE_POINTS/starting_points, 0.01)] minutes.")
+ add_round_events()
+ log_game("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events.")
+ message_admins("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -626,7 +630,6 @@ SUBSYSTEM_DEF(unified)
/// Panel containing information, variables and controls about the gamemode and scheduled event
/datum/controller/subsystem/unified/proc/admin_panel(mob/user)
update_crew_infos()
- var/round_started = SSticker.HasRoundStarted()
var/list/dat = list()
var/active_pop = get_correct_popcount()
dat += " HALT Unified Event Panel Refresh"
@@ -667,8 +670,6 @@ SUBSYSTEM_DEF(unified)
var/background_cl = "#23273C"
dat += "Point Budget:
"
dat += "[points]/[starting_points]"
- dat += "Cooldown:
"
- dat += "[max(0, round((cooldown_over - world.time) / 600, 0.01))] minutes Reset Cooldown" // 600 deciseconds in one minute
dat += "Scheduled Events:
"
dat += ""
@@ -688,8 +689,8 @@ SUBSYSTEM_DEF(unified)
background_cl = even ? "#17191C" : "#23273C"
dat += ""
dat += "| [scheduled.event.name] | " //Name
- dat += "[scheduled.event.unified_cost] | " //Severity
- var/time = (scheduled.event.roundstart && !round_started) ? "ROUNDSTART" : "[(scheduled.start_time - world.time) / (1 SECONDS)] s."
+ dat += "[scheduled.event.calculated_cost] | " //Cost
+ var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
dat += "[time] | " //Time
dat += "[scheduled.get_href_actions()] | " //Actions
dat += "
"
@@ -757,7 +758,7 @@ SUBSYSTEM_DEF(unified)
for(var/tag in event.tags)
dat += "[tag] "
dat += ""
- dat += "[event.unified_cost] | " //Cost
+ dat += "[event.calculated_cost] | " //Cost
dat += "[event.min_players] | " //Minimum pop
dat += "[event.earliest_start / (1 MINUTES)] m. | " //Minimum time
dat += "[assoc_spawn_weight[event] ? "Yes" : "No"] | " //Can happen?
From b632c9ea5d2f7619561ab023c1a5ad4f9d22d894 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 19:31:20 -0700
Subject: [PATCH 36/61] Fix event weighting with no heads
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 0400000c5ce7..bdc0799756dd 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -192,7 +192,7 @@ SUBSYSTEM_DEF(unified)
job_weighting *= 0.5
if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_weighting *= 0.5
- if(head_crew == 0)
+ if(job_weighting != 1 && head_crew == 0)
job_weighting = 0
weight_total *= job_weighting
/// Apply occurence multipliers if able
From 1c1fcb7f91ea770c8519ba09b03d19ccd526009b Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sat, 7 Sep 2024 21:08:31 -0700
Subject: [PATCH 37/61] Increase base points
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 612ebd06c608..3a3949ac726c 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -20,6 +20,7 @@
#define WEIGHT_LESS_LIKELY 7.5
#define WEIGHT_UNLIKELY 5
-#define BASE_POINTS 120
+// TODO add to config
+#define BASE_POINTS 240
#define STARTING_DELAY 10 * BASE_POINTS/starting_points
From 80ab2ac575ddc3cf39ff20f65d54772abc6aa3f2 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 12:01:02 -0700
Subject: [PATCH 38/61] Increase nukeops and blob cost, fix divergence report
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 2 +-
modular_zzbug/code/modules/unified/divergency_report.dm | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index 3a3949ac726c..bfd2609b7bf4 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -14,7 +14,7 @@
#define COST_MODERATE 20
#define COST_SEMIMAJOR 30
#define COST_MAJOR 60
-#define COST_SUPERMAJOR 120
+#define COST_SUPERMAJOR BASE_POINTS * 1.25
#define WEIGHT_NORMAL 10
#define WEIGHT_LESS_LIKELY 7.5
diff --git a/modular_zzbug/code/modules/unified/divergency_report.dm b/modular_zzbug/code/modules/unified/divergency_report.dm
index c4a7888b5152..104c794e0aee 100644
--- a/modular_zzbug/code/modules/unified/divergency_report.dm
+++ b/modular_zzbug/code/modules/unified/divergency_report.dm
@@ -2,11 +2,11 @@
. = "Central Command Status Summary
"
. += ""
- if(starting_points < 90) // 60-90 points
+ if(starting_points < BASE_POINTS * .75)
. += "Low"
- else if(starting_points < 150) // 90-150 points
+ else if(starting_points < BASE_POINTS * 1.25)
. += "Moderate"
- else // 150-180 points
+ else
. += "High"
. += " station threat detected."
From 2299e4d6ba5fe50411b1204beaae95135c4387b7 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 12:11:37 -0700
Subject: [PATCH 39/61] Fix missing 0
---
modular_zzbug/code/modules/unified/divergency_report.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/divergency_report.dm b/modular_zzbug/code/modules/unified/divergency_report.dm
index 104c794e0aee..f85f038eda5d 100644
--- a/modular_zzbug/code/modules/unified/divergency_report.dm
+++ b/modular_zzbug/code/modules/unified/divergency_report.dm
@@ -2,7 +2,7 @@
. = "Central Command Status Summary
"
. += ""
- if(starting_points < BASE_POINTS * .75)
+ if(starting_points < BASE_POINTS * 0.75)
. += "Low"
else if(starting_points < BASE_POINTS * 1.25)
. += "Moderate"
From 7882e1905231595191901d61569f1966be931d7e Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 16:11:41 -0700
Subject: [PATCH 40/61] Definitely good changes from the future
---
.../modules/storyteller/_events/_event.dm | 2 --
modular_zzbug/code/modules/unified/unified.dm | 29 ++++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/modular_zubbers/code/modules/storyteller/_events/_event.dm b/modular_zubbers/code/modules/storyteller/_events/_event.dm
index 6e1f5c7e5293..2bbc83f7fd2b 100644
--- a/modular_zubbers/code/modules/storyteller/_events/_event.dm
+++ b/modular_zubbers/code/modules/storyteller/_events/_event.dm
@@ -72,12 +72,10 @@
. = ..()
switch(href_list["action"])
// BUG EDIT START
- /*
if("force_next")
message_admins("[key_name_admin(usr)] has forced scheduled event [src.name].")
log_admin_private("[key_name(usr)] has forced scheduled event [src.name].")
SSgamemode.force_event(src)
- */
if("fire")
message_admins("[key_name_admin(usr)] has fired event [src.name].")
log_admin_private("[key_name(usr)] has fired event [src.name].")
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index bdc0799756dd..44baec46e940 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -105,6 +105,7 @@ SUBSYSTEM_DEF(unified)
if (MC_TICK_CHECK)
return
+/datum/controller/subsystem/unified/proc/buy_event(run_now = FALSE)
/datum/controller/subsystem/unified/proc/buy_event(run_now = FALSE)
. = FALSE
var/datum/round_event_control/picked_event
@@ -112,6 +113,8 @@ SUBSYSTEM_DEF(unified)
var/player_pop = SSunified.get_correct_popcount()
calculate_weights()
calculate_costs()
+ calculate_weights()
+ calculate_costs()
var/list/valid_events = list()
// Determine which events are valid to pick
for(var/datum/round_event_control/event as anything in SSunified.control)
@@ -133,11 +136,13 @@ SUBSYSTEM_DEF(unified)
stack_trace("WARNING: Unified picked a null from event pool.")
return
+ points -= picked_event.calculated_cost // we already know that valid events cost less than our current points
+ if(picked_event.roundstart || run_now)
points -= picked_event.calculated_cost // we already know that valid events cost less than our current points
if(picked_event.roundstart || run_now)
TriggerEvent(picked_event)
else
- schedule_event(picked_event, rand(STARTING_DELAY, 120-picked_event.calculated_cost) MINUTES, picked_event.calculated_cost)
+ schedule_event(picked_event, 3 MINUTES, picked_event.calculated_cost) // We already randomize cooldown, we don't need to randomize this
. = TRUE
@@ -161,6 +166,23 @@ SUBSYSTEM_DEF(unified)
if(prob(event.calculated_weight))
schedule_event(event, rand(STARTING_DELAY, 120) MINUTES, 0)
+/datum/controller/subsystem/unified/proc/calculate_costs()
+ for(var/datum/round_event_control/event in control)
+ var/total_cost = event.unified_cost
+ if(allow_job_weighting)
+ var/job_cost = 1
+ if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
+ job_cost *= 2
+ if((TAG_MEDICAL in event.tags) && med_crew == 0)
+ job_cost *= 2
+ if((TAG_SECURITY in event.tags) && sec_crew == 0)
+ job_cost *= 2
+ if((TAG_SCIENCE in event.tags) && sci_crew == 0)
+ job_cost *= 2
+ total_cost *= job_cost
+ if(istype(event, /datum/round_event_control/antagonist))
+ total_cost /= get_antag_cap()
+ event.calculated_cost = total_cost
/datum/controller/subsystem/unified/proc/calculate_costs()
for(var/datum/round_event_control/event in control)
var/total_cost = event.unified_cost
@@ -192,6 +214,7 @@ SUBSYSTEM_DEF(unified)
job_weighting *= 0.5
if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_weighting *= 0.5
+ if(job_weighting != 1 && head_crew == 0)
if(job_weighting != 1 && head_crew == 0)
job_weighting = 0
weight_total *= job_weighting
@@ -366,6 +389,7 @@ SUBSYSTEM_DEF(unified)
if(player.ready == PLAYER_READY_TO_PLAY)
players[player.key] = player
ready_players++
+ ready_players++
sortTim(players, GLOBAL_PROC_REF(cmp_text_asc))
for(var/ckey in players)
@@ -691,6 +715,8 @@ SUBSYSTEM_DEF(unified)
dat += "[scheduled.event.name] | " //Name
dat += "[scheduled.event.calculated_cost] | " //Cost
var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
+ dat += "[scheduled.event.calculated_cost] | " //Cost
+ var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
dat += "[time] | " //Time
dat += "[scheduled.get_href_actions()] | " //Actions
dat += ""
@@ -759,6 +785,7 @@ SUBSYSTEM_DEF(unified)
dat += "[tag] "
dat += ""
dat += "[event.calculated_cost] | " //Cost
+ dat += "[event.calculated_cost] | " //Cost
dat += "[event.min_players] | " //Minimum pop
dat += "[event.earliest_start / (1 MINUTES)] m. | " //Minimum time
dat += "[assoc_spawn_weight[event] ? "Yes" : "No"] | " //Can happen?
From 00d9bf3b74da20de1fbd19e3362e19d8f889d12d Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 16:58:41 -0700
Subject: [PATCH 41/61] All reverting done
---
modular_zzbug/code/modules/unified/unified.dm | 116 ++++++++----------
1 file changed, 50 insertions(+), 66 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 44baec46e940..48c26bf41df1 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -15,8 +15,8 @@ SUBSYSTEM_DEF(unified)
/// Our starting event point budget for the shift. Initialized in pre_setup()
var/starting_points = 0
- /// The time after which we can schedule another event
- var/cooldown_over = 0
+ /// The times after which we can schedule another event
+ var/list/cooldown_dates = [0, 0]
/// Whether we allow pop scaling. This is configured by config, or the storyteller UI
var/allow_pop_scaling = TRUE
@@ -73,7 +73,10 @@ SUBSYSTEM_DEF(unified)
var/datum/round_event_control/event = new type()
if(!event.typepath || !event.name || !event.valid_for_map())
continue //don't want this one! leave it for the garbage collector
- control += event //add it to the list of all events (controls)
+ if(event.roundstart)
+ roundstart_control += event
+ else
+ control += event //add it to the list of all events (controls)
getHoliday()
load_config_vars()
@@ -92,6 +95,15 @@ SUBSYSTEM_DEF(unified)
sch_event.alerted_admins = TRUE
message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
+ var/crew_info_updated = FALSE
+ if(!halted)
+ for(var/cooldown_date in cooldowns)
+ if(cooldown_date <= world.time)
+ if(!crew_info_updated)
+ update_crew_infos()
+ crew_info_updated = TRUE
+ add_event()
+
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
@@ -105,19 +117,18 @@ SUBSYSTEM_DEF(unified)
if (MC_TICK_CHECK)
return
-/datum/controller/subsystem/unified/proc/buy_event(run_now = FALSE)
-/datum/controller/subsystem/unified/proc/buy_event(run_now = FALSE)
+/datum/controller/subsystem/unified/proc/buy_event(list/events, run_now = FALSE)
. = FALSE
- var/datum/round_event_control/picked_event
+ var/datum/round_event_control/picked_event
+ var/candidate_events = events
var/player_pop = SSunified.get_correct_popcount()
- calculate_weights()
- calculate_costs()
- calculate_weights()
- calculate_costs()
+ calculate_weights(candidate_events)
+ calculate_costs(candidate_events)
var/list/valid_events = list()
// Determine which events are valid to pick
- for(var/datum/round_event_control/event as anything in SSunified.control)
+
+ for(var/datum/round_event_control/event as anything in candidate_events)
if(isnull(event))
continue
if(event.unified_cost == 0) // free events are handled in handle_free_events
@@ -137,8 +148,8 @@ SUBSYSTEM_DEF(unified)
return
points -= picked_event.calculated_cost // we already know that valid events cost less than our current points
- if(picked_event.roundstart || run_now)
- points -= picked_event.calculated_cost // we already know that valid events cost less than our current points
+ message_admins("Unified purchased and triggered [picked_event] event for [picked_event.calculated_cost] cost.")
+ log_admin("Unified purchased and triggered [picked_event] event for [picked_event.calculated_cost] cost.")
if(picked_event.roundstart || run_now)
TriggerEvent(picked_event)
else
@@ -146,45 +157,8 @@ SUBSYSTEM_DEF(unified)
. = TRUE
-/datum/controller/subsystem/unified/proc/handle_free_events()
- var/player_pop = SSunified.get_correct_popcount()
- calculate_weights()
- var/list/valid_events = list()
- // Determine which events are valid to pick
- for(var/datum/round_event_control/event as anything in SSunified.control)
- if(isnull(event))
- continue
- if(!event.unified_cost == 0)
- continue
- if(event.can_spawn_event(player_pop))
- valid_events[event] = event.calculated_weight
- if(!length(valid_events))
- message_admins("Unified has no valid free events.")
- log_admin("Unified has no valid free events.")
- return
- for(var/datum/round_event_control/event in valid_events)
- if(prob(event.calculated_weight))
- schedule_event(event, rand(STARTING_DELAY, 120) MINUTES, 0)
-
-/datum/controller/subsystem/unified/proc/calculate_costs()
- for(var/datum/round_event_control/event in control)
- var/total_cost = event.unified_cost
- if(allow_job_weighting)
- var/job_cost = 1
- if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
- job_cost *= 2
- if((TAG_MEDICAL in event.tags) && med_crew == 0)
- job_cost *= 2
- if((TAG_SECURITY in event.tags) && sec_crew == 0)
- job_cost *= 2
- if((TAG_SCIENCE in event.tags) && sci_crew == 0)
- job_cost *= 2
- total_cost *= job_cost
- if(istype(event, /datum/round_event_control/antagonist))
- total_cost /= get_antag_cap()
- event.calculated_cost = total_cost
-/datum/controller/subsystem/unified/proc/calculate_costs()
- for(var/datum/round_event_control/event in control)
+/datum/controller/subsystem/unified/proc/calculate_costs(list/events)
+ for(var/datum/round_event_control/event in events)
var/total_cost = event.unified_cost
if(allow_job_weighting)
var/job_cost = 1
@@ -201,8 +175,8 @@ SUBSYSTEM_DEF(unified)
total_cost /= get_antag_cap()
event.calculated_cost = total_cost
-/datum/controller/subsystem/unified/proc/calculate_weights()
- for(var/datum/round_event_control/event in control)
+/datum/controller/subsystem/unified/proc/calculate_weights(list/events)
+ for(var/datum/round_event_control/event in events)
var/weight_total = event.weight
if(allow_job_weighting)
var/job_weighting = 1
@@ -313,7 +287,11 @@ SUBSYSTEM_DEF(unified)
/// Refunds a failed event, then buys another.
/datum/controller/subsystem/unified/proc/refund_failed_event(datum/round_event_control/failed)
points += failed.calculated_cost
- buy_event(TRUE)
+ // TODO change cooldown
+
+/// Schedules an event.
+/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
+ forced_next_event = event
/// Removes a scheduled event.
/datum/controller/subsystem/unified/proc/remove_scheduled_event(datum/scheduled_event/removed)
@@ -325,8 +303,13 @@ SUBSYSTEM_DEF(unified)
if(halted)
message_admins("WARNING: Didn't roll any events (including antagonists) due to Unified being halted.")
return
- while(buy_event());
- handle_free_events()
+ var/crew_info_updated = FALSE
+ for(var/i in 1 to get_antag_cap())
+ if(prob(roundstart_event_chance))
+ if(!crew_info_updated)
+ update_crew_info()
+ crew_info_updated = TRUE
+ buy_event(roundstart_control)
/// Second step of handlind roundstart events, happening after people spawn.
/datum/controller/subsystem/unified/proc/handle_post_setup_roundstart_events()
@@ -340,6 +323,7 @@ SUBSYSTEM_DEF(unified)
/// Schedules an event to run later.
/datum/controller/subsystem/unified/proc/schedule_event(datum/round_event_control/passed_event, passed_time, passed_cost, passed_ignore, passed_announce)
var/datum/scheduled_event/scheduled = new (passed_event, world.time + passed_time, passed_cost, passed_ignore, passed_announce)
+ message_admins("Event: [passed_event] has been scheduled to run in [passed_time / 10] seconds. (CANCEL) (REFUND)")
scheduled_events += scheduled
/datum/controller/subsystem/unified/proc/update_crew_infos()
@@ -499,11 +483,14 @@ SUBSYSTEM_DEF(unified)
/datum/controller/subsystem/unified/proc/pre_setup()
// We need to do this to prevent some niche fuckery... and make dep. orders work. Lol
SSjob.ResetOccupations()
+ handle_pre_setup_roundstart_events()
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
- add_round_events()
- log_game("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events.")
- message_admins("Unified: Point budget is [starting_points] points, [starting_points - points] points were used to buy [scheduled_events.len + running.len] events.")
+ cooldown_dates[1] = world.time + STARTING_DELAY
+ for(var/i in 2 to cooldown_dates.len)
+ cooldown_dates[i] = cooldown_dates[i-1] + rand(0, STARTING_DELAY)
+ log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
+ message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -753,7 +740,7 @@ SUBSYSTEM_DEF(unified)
dat += ""
dat += "| Name | "
dat += "Tags | "
- dat += "Cost | "
+ dat += "Base Cost | "
dat += "M.Pop | "
dat += "M.Time | "
dat += "Can Occur | "
@@ -762,11 +749,9 @@ SUBSYSTEM_DEF(unified)
dat += "
"
var/even = TRUE
var/total_weight = 0
- var/list/event_lookup
- event_lookup = control
var/list/assoc_spawn_weight = list()
var/active_pop = get_correct_popcount()
- for(var/datum/round_event_control/event as anything in event_lookup)
+ for(var/datum/round_event_control/event as anything in (control + roundstart_control))
if(event.roundstart != roundstart_event_view)
continue
if(event.can_spawn_event(active_pop))
@@ -784,8 +769,7 @@ SUBSYSTEM_DEF(unified)
for(var/tag in event.tags)
dat += "[tag] "
dat += ""
- dat += "[event.calculated_cost] | " //Cost
- dat += "[event.calculated_cost] | " //Cost
+ dat += "[event.unified_cost] | " //Cost
dat += "[event.min_players] | " //Minimum pop
dat += "[event.earliest_start / (1 MINUTES)] m. | " //Minimum time
dat += "[assoc_spawn_weight[event] ? "Yes" : "No"] | " //Can happen?
From 715ddb4c6aa1960d080c9daddb4eb5cb3997a472 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:04:37 -0700
Subject: [PATCH 42/61] Re-add roundstart_control
---
modular_zzbug/code/modules/unified/unified.dm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 48c26bf41df1..41655904532f 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -16,7 +16,7 @@ SUBSYSTEM_DEF(unified)
var/starting_points = 0
/// The times after which we can schedule another event
- var/list/cooldown_dates = [0, 0]
+ var/list/cooldown_dates = list(0, 0)
/// Whether we allow pop scaling. This is configured by config, or the storyteller UI
var/allow_pop_scaling = TRUE
@@ -68,6 +68,9 @@ SUBSYSTEM_DEF(unified)
/// % chance of having an antag created at roundstart
var/roundstart_event_chance = 40
+ /// List of all datum/round_event_control with roundstart=true.
+ var/list/roundstart_control = list()
+
/datum/controller/subsystem/unified/Initialize(time, zlevel)
for(var/type in typesof(/datum/round_event_control))
var/datum/round_event_control/event = new type()
From 75915bb1aac19254e22865fd5a6ec1a37a441af7 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:30:54 -0700
Subject: [PATCH 43/61] Fix dupes
---
modular_zzbug/code/modules/unified/unified.dm | 3 ---
1 file changed, 3 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 41655904532f..9cce7c6887de 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -191,7 +191,6 @@ SUBSYSTEM_DEF(unified)
job_weighting *= 0.5
if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_weighting *= 0.5
- if(job_weighting != 1 && head_crew == 0)
if(job_weighting != 1 && head_crew == 0)
job_weighting = 0
weight_total *= job_weighting
@@ -705,8 +704,6 @@ SUBSYSTEM_DEF(unified)
dat += "[scheduled.event.name] | " //Name
dat += "[scheduled.event.calculated_cost] | " //Cost
var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
- dat += "[scheduled.event.calculated_cost] | " //Cost
- var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
dat += "[time] | " //Time
dat += "[scheduled.get_href_actions()] | " //Actions
dat += ""
From c75f42a7b44e41a7e16cf7af7df73dcdf371c0d4 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:36:34 -0700
Subject: [PATCH 44/61] Readd forced next event
---
modular_zzbug/code/modules/unified/unified.dm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 9cce7c6887de..f41935593729 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -24,6 +24,9 @@ SUBSYSTEM_DEF(unified)
/// Events that we have scheduled to run in the nearby future
var/list/scheduled_events = list()
+ /// For admins to force events (though they can still invoke them freely outside of the track system)
+ var/datum/round_event_control/forced_next_event
+
var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences.
var/list/running = list() //list of all existing /datum/round_event
var/list/currentrun = list()
From 214fb144272d055fe52fad2fac3d5410b77ede46 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:58:46 -0700
Subject: [PATCH 45/61] Cool work
---
modular_zzbug/code/modules/unified/unified.dm | 27 +++++++------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index f41935593729..eb50bf18fe0d 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -101,14 +101,10 @@ SUBSYSTEM_DEF(unified)
sch_event.alerted_admins = TRUE
message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
- var/crew_info_updated = FALSE
if(!halted)
for(var/cooldown_date in cooldowns)
if(cooldown_date <= world.time)
- if(!crew_info_updated)
- update_crew_infos()
- crew_info_updated = TRUE
- add_event()
+ buy_event(control)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
@@ -283,16 +279,14 @@ SUBSYSTEM_DEF(unified)
update_ready_crew_infos()
return ready_players
-/// Refunds and removes a scheduled event, then buys another.
+/// Refunds and removes a scheduled event
/datum/controller/subsystem/unified/proc/refund_scheduled_event(datum/scheduled_event/refunded)
points += refunded.cost
remove_scheduled_event(refunded)
- buy_event(TRUE)
-/// Refunds a failed event, then buys another.
+/// Refunds a failed event
/datum/controller/subsystem/unified/proc/refund_failed_event(datum/round_event_control/failed)
points += failed.calculated_cost
- // TODO change cooldown
/// Schedules an event.
/datum/controller/subsystem/unified/proc/force_event(datum/round_event_control/event)
@@ -304,16 +298,12 @@ SUBSYSTEM_DEF(unified)
qdel(removed)
/// Because roundstart events need 2 steps of firing for purposes of antags, here is the first step handled, happening before occupation division.
-/datum/controller/subsystem/unified/proc/add_round_events()
+/datum/controller/subsystem/unified/proc/handle_pre_setup_roundstart_events()
if(halted)
message_admins("WARNING: Didn't roll any events (including antagonists) due to Unified being halted.")
return
- var/crew_info_updated = FALSE
for(var/i in 1 to get_antag_cap())
if(prob(roundstart_event_chance))
- if(!crew_info_updated)
- update_crew_info()
- crew_info_updated = TRUE
buy_event(roundstart_control)
/// Second step of handlind roundstart events, happening after people spawn.
@@ -494,8 +484,8 @@ SUBSYSTEM_DEF(unified)
cooldown_dates[1] = world.time + STARTING_DELAY
for(var/i in 2 to cooldown_dates.len)
cooldown_dates[i] = cooldown_dates[i-1] + rand(0, STARTING_DELAY)
- log_game("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
- message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(cooldown, 0.01)] minutes.")
+ log_game("Unified: Point budget is [starting_points], starting cooldown is [round(STARTING_DELAY, 0.01)] minutes.")
+ message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(STARTING_DELAY, 0.01)] minutes.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -686,6 +676,9 @@ SUBSYSTEM_DEF(unified)
var/background_cl = "#23273C"
dat += "Point Budget:
"
dat += "[points]/[starting_points]"
+ dat += "Cooldowns:
"
+ for(var/i in 1 to cooldown_dates.len)
+ dat += "[max(0, round((cooldown_dates[i] - world.time) / (1 MINUTES), 0.01))] minutes Reset Cooldown"
dat += "Scheduled Events:
"
dat += ""
@@ -797,7 +790,7 @@ SUBSYSTEM_DEF(unified)
if("main")
switch(href_list["action"])
if("reset_cooldown")
- cooldown_over = world.time
+ cooldown_dates[href_list["number"]] = world.time
if("halt_storyteller")
halted = !halted
message_admins("[key_name_admin(usr)] has [halted ? "HALTED" : "un-halted"] Unified.")
From 3fca0ddb39da9733f582ab241ec9741be2998617 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 18:21:00 -0700
Subject: [PATCH 46/61] Very cool work
---
.../code/__DEFINES/unified_defines.dm | 3 +++
modular_zzbug/code/modules/unified/unified.dm | 18 +++++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index bfd2609b7bf4..c90e462232bc 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -24,3 +24,6 @@
#define BASE_POINTS 240
#define STARTING_DELAY 10 * BASE_POINTS/starting_points
+#define SCHEDULE_DELAY 3 MINUTES
+
+#define COOLDOWN_MULT (120/BASE_POINTS) * (BASE_POINTS/starting_points)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index eb50bf18fe0d..8815117ad259 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -102,9 +102,9 @@ SUBSYSTEM_DEF(unified)
message_admins("Scheduled Event: [sch_event.event] will run in [(sch_event.start_time - world.time) / 10] seconds. (CANCEL) (REFUND)")
if(!halted)
- for(var/cooldown_date in cooldowns)
- if(cooldown_date <= world.time)
- buy_event(control)
+ for(var/i in 1 to cooldown_dates.len)
+ if(cooldown_dates[i] <= world.time)
+ buy_event(control, i)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
@@ -119,7 +119,7 @@ SUBSYSTEM_DEF(unified)
if (MC_TICK_CHECK)
return
-/datum/controller/subsystem/unified/proc/buy_event(list/events, run_now = FALSE)
+/datum/controller/subsystem/unified/proc/buy_event(list/events, cooldown_num = 0, run_now = FALSE)
. = FALSE
var/datum/round_event_control/picked_event
@@ -156,6 +156,14 @@ SUBSYSTEM_DEF(unified)
TriggerEvent(picked_event)
else
schedule_event(picked_event, 3 MINUTES, picked_event.calculated_cost) // We already randomize cooldown, we don't need to randomize this
+ if(cooldown_num)
+ var/cooldown // in minutes
+ if(picked_event.cooldown_override)
+ cooldown = rand(picked_event.cooldown_override*0.5, picked_event.cooldown_override*1.5)
+ else
+ cooldown = rand(picked_event.calculated_cost*0.5, picked_event.calculated_cost*1.5)
+ cooldown *= COOLDOWN_MULT // the higher the starting points, the lower the cooldown
+ cooldown_dates[cooldown_num] = world.time + cooldown MINUTES // convert cooldown to deciseconds
. = TRUE
@@ -481,7 +489,7 @@ SUBSYSTEM_DEF(unified)
handle_pre_setup_roundstart_events()
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
- cooldown_dates[1] = world.time + STARTING_DELAY
+ cooldown_dates[1] = world.time + STARTING_DELAY - SCHEDULE_DELAY
for(var/i in 2 to cooldown_dates.len)
cooldown_dates[i] = cooldown_dates[i-1] + rand(0, STARTING_DELAY)
log_game("Unified: Point budget is [starting_points], starting cooldown is [round(STARTING_DELAY, 0.01)] minutes.")
From 4e249f839a6b98b4078d577f0eaa6d0ee687b138 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 18:37:19 -0700
Subject: [PATCH 47/61] Add missing minutes def
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index c90e462232bc..a75ee99ce11b 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -23,7 +23,7 @@
// TODO add to config
#define BASE_POINTS 240
-#define STARTING_DELAY 10 * BASE_POINTS/starting_points
+#define STARTING_DELAY 10 * BASE_POINTS/starting_points MINUTES
#define SCHEDULE_DELAY 3 MINUTES
#define COOLDOWN_MULT (120/BASE_POINTS) * (BASE_POINTS/starting_points)
From bf7e7c396d364ee3eab901cc142ddcb1b491d6a9 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 18:37:34 -0700
Subject: [PATCH 48/61] make syndie pod less likely
---
modular_zzbug/code/modules/unified/event_overrides.dm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 364a356d5347..43cb48dfe390 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -80,6 +80,9 @@
unified_cost = COST_MINOR
weight = WEIGHT_NORMAL
+/datum/round_event_control/stray_cargo/syndicate
+ weight = WEIGHT_LESS_LIKELY
+
/datum/round_event_control/grey_tide
unified_cost = COST_MINOR
weight = WEIGHT_NORMAL
From 1c49365c4c4d4d12d7d5e0b848c7eafea4be1381 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 18:48:18 -0700
Subject: [PATCH 49/61] Fix communicating cooldown
---
modular_zzbug/code/modules/unified/unified.dm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 8815117ad259..aa22fe93d790 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -492,8 +492,8 @@ SUBSYSTEM_DEF(unified)
cooldown_dates[1] = world.time + STARTING_DELAY - SCHEDULE_DELAY
for(var/i in 2 to cooldown_dates.len)
cooldown_dates[i] = cooldown_dates[i-1] + rand(0, STARTING_DELAY)
- log_game("Unified: Point budget is [starting_points], starting cooldown is [round(STARTING_DELAY, 0.01)] minutes.")
- message_admins("Unified: Point budget is [starting_points], starting cooldown is [round(STARTING_DELAY, 0.01)] minutes.")
+ log_game("Unified: Point budget is [starting_points], starting cooldown is [round((STARTING_DELAY - SCHEDULE_DELAY) / (1 MINUTES), 0.01)] minutes.")
+ message_admins("Unified: Point budget is [starting_points], starting cooldown is [round((STARTING_DELAY - SCHEDULE_DELAY) / (1 MINUTES), 0.01)] minutes.")
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
@@ -686,7 +686,7 @@ SUBSYSTEM_DEF(unified)
dat += "[points]/[starting_points]"
dat += "Cooldowns:
"
for(var/i in 1 to cooldown_dates.len)
- dat += "[max(0, round((cooldown_dates[i] - world.time) / (1 MINUTES), 0.01))] minutes Reset Cooldown"
+ dat += "[max(0, round((cooldown_dates[i] - world.time) / (1 MINUTES), 0.01))] minutes Reset Cooldown
"
dat += "Scheduled Events:
"
dat += ""
From 07ce8e950a5fa8535638cf8fb44e16f2e2df4ee8 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 19:13:49 -0700
Subject: [PATCH 50/61] Fix unconverted string
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index aa22fe93d790..9513648d2a38 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -798,7 +798,7 @@ SUBSYSTEM_DEF(unified)
if("main")
switch(href_list["action"])
if("reset_cooldown")
- cooldown_dates[href_list["number"]] = world.time
+ cooldown_dates[text2num(href_list["number"])] = world.time
if("halt_storyteller")
halted = !halted
message_admins("[key_name_admin(usr)] has [halted ? "HALTED" : "un-halted"] Unified.")
From 5db08e7fa10530716cffa43fd20f742d8214cac6 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 19:23:44 -0700
Subject: [PATCH 51/61] Change scheduled event time to show seconds
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 9513648d2a38..862b5c284f2f 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -707,7 +707,7 @@ SUBSYSTEM_DEF(unified)
dat += ""
dat += "| [scheduled.event.name] | " //Name
dat += "[scheduled.event.calculated_cost] | " //Cost
- var/time = "[round((scheduled.start_time - world.time) / (1 MINUTES), 0.01)] min."
+ var/time = "[(scheduled.start_time - world.time) / (1 SECONDS)] s."
dat += "[time] | " //Time
dat += "[scheduled.get_href_actions()] | " //Actions
dat += "
"
From ba6346e0aa4612ba96e9b81e4381ad5ce22e994b Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Sep 2024 20:36:37 -0700
Subject: [PATCH 52/61] Add changing point values
---
modular_zzbug/code/modules/unified/unified.dm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 862b5c284f2f..55bf1304af0e 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -683,7 +683,7 @@ SUBSYSTEM_DEF(unified)
if(UNIFIED_PANEL_MAIN)
var/background_cl = "#23273C"
dat += "Point Budget:
"
- dat += "[points]/[starting_points]"
+ dat += "[points]/[starting_points]"
dat += "Cooldowns:
"
for(var/i in 1 to cooldown_dates.len)
dat += "[max(0, round((cooldown_dates[i] - world.time) / (1 MINUTES), 0.01))] minutes Reset Cooldown
"
@@ -841,6 +841,16 @@ SUBSYSTEM_DEF(unified)
if("open_stats")
event_panel(user)
return
+ if("change_points")
+ var/new_points = input(usr, "New point budget:", "Change Points") as num|null
+ if(isnull(new_points))
+ return
+ points = new_points
+ if("change_starting_points")
+ var/new_starting_points = input(usr, "New starting point budget:", "Change Starting Points") as num|null
+ if(isnull(new_starting_points))
+ return
+ starting_points = new_starting_points
/* TODO FIX
if("track_action")
var/track = href_list["track"]
From 7442f05e1ebce6da88e91f9685ac5f713a507a7b Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 11 Sep 2024 13:55:11 -0700
Subject: [PATCH 53/61] Increase cost and lower likeliness of moldies
---
modular_zzbug/code/modules/unified/event_overrides.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 43cb48dfe390..73af5ea418e0 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -337,8 +337,8 @@
tags |= list(TAG_SECURITY)
/datum/round_event_control/mold
- unified_cost = COST_MODERATE
- weight = WEIGHT_NORMAL
+ unified_cost = COST_MAJOR
+ weight = WEIGHT_UNLIKELY
/datum/round_event_control/mold/New()
. = ..()
From 77ed20c5da5cd41989a265ea1e054a965da7919b Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Wed, 11 Sep 2024 13:57:01 -0700
Subject: [PATCH 54/61] Moldies need engineering
---
modular_zzbug/code/modules/unified/event_overrides.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/event_overrides.dm b/modular_zzbug/code/modules/unified/event_overrides.dm
index 73af5ea418e0..2268de5b00e1 100644
--- a/modular_zzbug/code/modules/unified/event_overrides.dm
+++ b/modular_zzbug/code/modules/unified/event_overrides.dm
@@ -342,7 +342,7 @@
/datum/round_event_control/mold/New()
. = ..()
- tags |= list(TAG_MEDICAL, TAG_SECURITY)
+ tags |= list(TAG_MEDICAL, TAG_ENGINEERING, TAG_SECURITY)
// MAJOR EVENTS
From 68475842d9b9b0d4594b5fe7a017c4a01d7bf660 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Mon, 16 Sep 2024 13:07:14 -0700
Subject: [PATCH 55/61] Reset a bit to upstream
---
.../modules/storyteller/event_defines/major/major_overrides.dm | 1 -
1 file changed, 1 deletion(-)
diff --git a/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm b/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
index c3d7597129b0..21a0811d6a07 100644
--- a/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
+++ b/modular_zubbers/code/modules/storyteller/event_defines/major/major_overrides.dm
@@ -73,7 +73,6 @@
/datum/round_event_control/voidwalker
track = EVENT_TRACK_MAJOR
tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_SPACE)
- weight = 10
/datum/round_event_control/cme
track = EVENT_TRACK_MAJOR
From 36d63ccfbb67cc5ffc9053ea10f9de7d8cd7fd53 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Mon, 16 Sep 2024 13:29:14 -0700
Subject: [PATCH 56/61] Add bug edit commend
---
code/modules/events/_event.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm
index 3f645294f1b5..f579c3edfc0e 100644
--- a/code/modules/events/_event.dm
+++ b/code/modules/events/_event.dm
@@ -82,7 +82,7 @@
return FALSE
if(!allow_magic && wizardevent != SSevents.wizardmode)
return FALSE
- if(players_amt < CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1))
+ if(players_amt < CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1)) // BUG EDIT
return FALSE
if(holidayID && !check_holidays(holidayID))
return FALSE
From 2511a49e5ba1ac665c0158b220f2a5211b9f6de3 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Thu, 26 Sep 2024 13:18:39 -0700
Subject: [PATCH 57/61] Lower base points
---
modular_zzbug/code/__DEFINES/unified_defines.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/__DEFINES/unified_defines.dm b/modular_zzbug/code/__DEFINES/unified_defines.dm
index a75ee99ce11b..4e004757387d 100644
--- a/modular_zzbug/code/__DEFINES/unified_defines.dm
+++ b/modular_zzbug/code/__DEFINES/unified_defines.dm
@@ -21,7 +21,7 @@
#define WEIGHT_UNLIKELY 5
// TODO add to config
-#define BASE_POINTS 240
+#define BASE_POINTS 120
#define STARTING_DELAY 10 * BASE_POINTS/starting_points MINUTES
#define SCHEDULE_DELAY 3 MINUTES
From d03be8136b7f002ef1d83cbd3e393973120a948a Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Tue, 1 Oct 2024 13:16:58 -0700
Subject: [PATCH 58/61] don't count heads as able to deal with nondepartmental
events
---
modular_zzbug/code/modules/unified/unified.dm | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 55bf1304af0e..50bba11e33f2 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -170,6 +170,7 @@ SUBSYSTEM_DEF(unified)
/datum/controller/subsystem/unified/proc/calculate_costs(list/events)
for(var/datum/round_event_control/event in events)
var/total_cost = event.unified_cost
+ /*
if(allow_job_weighting)
var/job_cost = 1
if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
@@ -181,6 +182,7 @@ SUBSYSTEM_DEF(unified)
if((TAG_SCIENCE in event.tags) && sci_crew == 0)
job_cost *= 2
total_cost *= job_cost
+ */
if(istype(event, /datum/round_event_control/antagonist))
total_cost /= get_antag_cap()
event.calculated_cost = total_cost
@@ -189,18 +191,14 @@ SUBSYSTEM_DEF(unified)
for(var/datum/round_event_control/event in events)
var/weight_total = event.weight
if(allow_job_weighting)
- var/job_weighting = 1
if((TAG_ENGINEERING in event.tags) && eng_crew == 0)
- job_weighting *= 0.5
- if((TAG_MEDICAL in event.tags) && med_crew == 0)
- job_weighting *= 0.5
- if((TAG_SECURITY in event.tags) && sec_crew == 0)
- job_weighting *= 0.5
- if((TAG_SCIENCE in event.tags) && sci_crew == 0)
- job_weighting *= 0.5
- if(job_weighting != 1 && head_crew == 0)
- job_weighting = 0
- weight_total *= job_weighting
+ weight_total = 0
+ else if((TAG_MEDICAL in event.tags) && med_crew == 0)
+ weight_total = 0
+ else if((TAG_SECURITY in event.tags) && sec_crew == 0)
+ weight_total = 0
+ else if((TAG_SCIENCE in event.tags) && sci_crew == 0)
+ weight_total = 0
/// Apply occurence multipliers if able
var/occurences = event.get_occurences()
if(occurences)
From abebdb408f822f243e5ed2736380be913d677158 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Dec 2024 16:09:19 -0800
Subject: [PATCH 59/61] Suspends when there are no valid events
---
modular_zzbug/code/modules/unified/unified.dm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index 50bba11e33f2..eb5b1cd333a5 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -139,8 +139,9 @@ SUBSYSTEM_DEF(unified)
valid_events[event] = event.calculated_weight
if(!length(valid_events))
if(SSticker.HasRoundStarted())
- message_admins("Unified failed to pick an event.")
- log_admin("Unified failed to pick an event.")
+ message_admins("Unified failed to pick an event. Suspending.")
+ log_admin("Unified failed to pick an event. Suspending.")
+ halted = TRUE;
return
picked_event = pick_weight(valid_events)
if(!picked_event)
From 370f2a45ac5cbd955095e1acf5d82a6cab285f19 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Dec 2024 16:25:06 -0800
Subject: [PATCH 60/61] Fix proc rename
---
modular_zzbug/code/modules/unified/unified.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modular_zzbug/code/modules/unified/unified.dm b/modular_zzbug/code/modules/unified/unified.dm
index eb5b1cd333a5..860ec6ae4443 100644
--- a/modular_zzbug/code/modules/unified/unified.dm
+++ b/modular_zzbug/code/modules/unified/unified.dm
@@ -484,7 +484,7 @@ SUBSYSTEM_DEF(unified)
///Attempts to select players for special roles the mode might have.
/datum/controller/subsystem/unified/proc/pre_setup()
// We need to do this to prevent some niche fuckery... and make dep. orders work. Lol
- SSjob.ResetOccupations()
+ SSjob.reset_occupations()
handle_pre_setup_roundstart_events()
starting_points = rand(BASE_POINTS*0.5, BASE_POINTS*1.5)
points = starting_points
From f96a3ed0cf04ea77482647ea63c7dd316eb5cfd1 Mon Sep 17 00:00:00 2001
From: Shroopy <46693163+Shroopy@users.noreply.github.com>
Date: Sun, 8 Dec 2024 16:57:50 -0800
Subject: [PATCH 61/61] Don't save/load persistence stuff
---
code/controllers/subsystem/persistence/_persistence.dm | 2 +-
modular_zubbers/code/modules/storyteller/storyteller_vote.dm | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/code/controllers/subsystem/persistence/_persistence.dm b/code/controllers/subsystem/persistence/_persistence.dm
index df225210f02e..fb8d74ac0a6f 100644
--- a/code/controllers/subsystem/persistence/_persistence.dm
+++ b/code/controllers/subsystem/persistence/_persistence.dm
@@ -73,7 +73,7 @@ SUBSYSTEM_DEF(persistence)
load_panic_bunker() //SKYRAT EDIT ADDITION - PANICBUNKER
load_tram_counter()
load_adventures()
- load_storyteller_type() //BUBBER EDIT ADD - Storyteller
+ // load_storyteller_type() //BUBBER EDIT ADD - Storyteller // BUG EDIT - Unified
return SS_INIT_SUCCESS
///Collects all data to persist.
diff --git a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
index 42a4ca665e32..85606cec71a0 100644
--- a/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
+++ b/modular_zubbers/code/modules/storyteller/storyteller_vote.dm
@@ -51,10 +51,12 @@ We then just check what the last one is in SSgamemode.storyteller_vote_choices()
#define STORYTELLER_LAST_FILEPATH "data/storyteller_last_round.txt"
+/* BUG REMOVAL START - unified
/// Extends collect_data
/datum/controller/subsystem/persistence/collect_data()
. = ..()
collect_storyteller_type()
+BUG REMOVAL END */
/// Loads last storyteller into last_storyteller_type
/datum/controller/subsystem/persistence/proc/load_storyteller_type()