mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-02-08 23:39:32 +00:00
## About The Pull Request Most calls of runEvent() now provide a cause that is read out to deadchat. announce_deadchat() has been slightly adjusted to accommodate this. Previously, everything that wasn't a truly random event would broadcast with the same generic "XYZ has just been triggered!" message. Now, you get a little bit more detail as to why/what triggered the event. Some helpers in the __HELPERS/events.dm file have been made, for forcing events normally/async/after a delay (using an addtimer). This also moves a lot (but not all) instances of events being forced to these helpers. Some samples:  Traitors using uplink viruses to turn off the power/comms.  Beer nuke!  For when a traitor takes an Space Dragon final objective, which summons a carp migration event.  Wizard ritual events!  Even this one! This also changes runEvent() to run_event(), because I figured I'd be touching every single instance of the proc anyways. ## Why It's Good For The Game Better feedback, less confusion amongst deadchat's constituents. Some of them may be a bit self-explanatory, but in some cases (especially the apocalypse rune) it's beneficial to know that an admin isn't the one behind it. <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Changelog 🆑 Rhials qol: Deadchat now gets more juicy details on what has triggered a non-randomly occurring random event. code: There are now helpers for forcing events in a variety of ways. More events! More events!!!!!!! /🆑
71 lines
2.7 KiB
Plaintext
71 lines
2.7 KiB
Plaintext
#define UNLIT_AREA_BRIGHTNESS 0.2
|
|
|
|
/**
|
|
* Finds us a generic maintenance spawn location.
|
|
*
|
|
* Goes through the list of the generic mainteance landmark locations, checking for atmos safety if required, and returns
|
|
* a valid turf. Returns MAP_ERROR if no valid locations are present.
|
|
* Returns nothing and alerts admins if no valid points are found. Keep this in mind
|
|
* when using this helper.
|
|
*/
|
|
|
|
/proc/find_maintenance_spawn(atmos_sensitive = FALSE, require_darkness = FALSE)
|
|
var/list/possible_spawns = list()
|
|
for(var/spawn_location in GLOB.generic_maintenance_landmarks)
|
|
var/turf/spawn_turf = get_turf(spawn_location)
|
|
|
|
if(atmos_sensitive && !is_safe_turf(spawn_turf))
|
|
continue
|
|
|
|
if(require_darkness && spawn_turf.get_lumcount() > UNLIT_AREA_BRIGHTNESS)
|
|
continue
|
|
|
|
possible_spawns += spawn_turf
|
|
|
|
if(!length(possible_spawns))
|
|
message_admins("No valid generic_maintenance_landmark landmarks found, aborting...")
|
|
return null
|
|
|
|
return pick(possible_spawns)
|
|
|
|
/**
|
|
* Finds us a generic spawn location in space.
|
|
*
|
|
* Goes through the list of the space carp spawn locations, picks from the list, and
|
|
* returns that turf. Returns MAP_ERROR if no landmarks are found.
|
|
*/
|
|
|
|
/proc/find_space_spawn()
|
|
var/list/possible_spawns = list()
|
|
for(var/obj/effect/landmark/carpspawn/spawn_location in GLOB.landmarks_list)
|
|
if(!isturf(spawn_location.loc))
|
|
stack_trace("Carp spawn found not on a turf: [spawn_location.type] on [isnull(spawn_location.loc) ? "null" : spawn_location.loc.type]")
|
|
continue
|
|
possible_spawns += get_turf(spawn_location)
|
|
|
|
if(!length(possible_spawns))
|
|
message_admins("No valid carpspawn landmarks found, aborting...")
|
|
return null
|
|
|
|
return pick(possible_spawns)
|
|
|
|
/proc/force_event(event_typepath, cause)
|
|
var/datum/round_event_control/our_event = locate(event_typepath) in SSevents.control
|
|
if(!our_event)
|
|
CRASH("Attempted to force event [event_typepath], but the event path could not be found!")
|
|
our_event.run_event(event_cause = cause)
|
|
|
|
/proc/force_event_async(event_typepath, cause)
|
|
var/datum/round_event_control/our_event = locate(event_typepath) in SSevents.control
|
|
if(!our_event)
|
|
CRASH("Attempted to force event [event_typepath], but the event path could not be found!")
|
|
INVOKE_ASYNC(our_event, TYPE_PROC_REF(/datum/round_event_control, run_event), event_cause = cause)
|
|
|
|
/proc/force_event_after(event_typepath, cause, duration)
|
|
var/datum/round_event_control/our_event = locate(event_typepath) in SSevents.control
|
|
if(!our_event)
|
|
CRASH("Attempted to force event [event_typepath], but the event path could not be found!")
|
|
addtimer(CALLBACK(our_event, TYPE_PROC_REF(/datum/round_event_control, run_event), FALSE, null, FALSE, cause), duration)
|
|
|
|
#undef UNLIT_AREA_BRIGHTNESS
|