mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 14:31:59 +01:00
Comet expulsion event (#20205)
Added a comet expulsion event, coming towards the main map, if not dodged causes some meteors that then explode, the explosion power can be reduced by shields. Some DMDocs, code cleanups and other things noone else cares about.
This commit is contained in:
@@ -2179,6 +2179,7 @@
|
||||
#include "code\modules\events\camera_damage.dm"
|
||||
#include "code\modules\events\carp_migration.dm"
|
||||
#include "code\modules\events\ccia_general_notice.dm"
|
||||
#include "code\modules\events\comet_expulsion.dm"
|
||||
#include "code\modules\events\comms_blackout.dm"
|
||||
#include "code\modules\events\communications_blackout.dm"
|
||||
#include "code\modules\events\electrical_storm.dm"
|
||||
|
||||
+52
-51
@@ -2,8 +2,8 @@
|
||||
/proc/get_angle(atom/movable/start, atom/movable/end)//For beams.
|
||||
if(!start || !end)
|
||||
return 0
|
||||
var/dy =(32 * end.y + end.pixel_y) - (32 * start.y + start.pixel_y)
|
||||
var/dx =(32 * end.x + end.pixel_x) - (32 * start.x + start.pixel_x)
|
||||
var/dy =(ICON_SIZE_Y * end.y + end.pixel_y) - (ICON_SIZE_Y * start.y + start.pixel_y)
|
||||
var/dx =(ICON_SIZE_X * end.x + end.pixel_x) - (ICON_SIZE_X * start.x + start.pixel_x)
|
||||
return delta_to_angle(dx, dy)
|
||||
|
||||
/// Calculate the angle produced by a pair of x and y deltas
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
/// Angle between two arbitrary points and horizontal line same as [/proc/get_angle]
|
||||
/proc/get_angle_raw(start_x, start_y, start_pixel_x, start_pixel_y, end_x, end_y, end_pixel_x, end_pixel_y)
|
||||
var/dy = (32 * end_y + end_pixel_y) - (32 * start_y + start_pixel_y)
|
||||
var/dx = (32 * end_x + end_pixel_x) - (32 * start_x + start_pixel_x)
|
||||
var/dy = (ICON_SIZE_Y * end_y + end_pixel_y) - (ICON_SIZE_Y * start_y + start_pixel_y)
|
||||
var/dx = (ICON_SIZE_X * end_x + end_pixel_x) - (ICON_SIZE_X * start_x + start_pixel_x)
|
||||
if(!dy)
|
||||
return (dx >= 0) ? 90 : 270
|
||||
. = arctan(dx/dy)
|
||||
@@ -38,9 +38,56 @@
|
||||
else if(x < 0)
|
||||
. += 360
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of turfs in a line from `starting_atom` to `ending_atom`.
|
||||
*
|
||||
* Uses the ultra-fast [Bresenham Line-Drawing Algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
|
||||
*/
|
||||
/proc/get_line(atom/starting_atom, atom/ending_atom)
|
||||
var/current_x_step = starting_atom.x//start at x and y, then add 1 or -1 to these to get every turf from starting_atom to ending_atom
|
||||
var/current_y_step = starting_atom.y
|
||||
var/starting_z = starting_atom.z
|
||||
|
||||
var/list/line = list(get_turf(starting_atom))//get_turf(atom) is faster than locate(x, y, z)
|
||||
|
||||
var/x_distance = ending_atom.x - current_x_step //x distance
|
||||
var/y_distance = ending_atom.y - current_y_step
|
||||
|
||||
var/abs_x_distance = abs(x_distance)//Absolute value of x distance
|
||||
var/abs_y_distance = abs(y_distance)
|
||||
|
||||
var/x_distance_sign = SIGN(x_distance) //Sign of x distance (+ or -)
|
||||
var/y_distance_sign = SIGN(y_distance)
|
||||
|
||||
var/x = abs_x_distance >> 1 //Counters for steps taken, setting to distance/2
|
||||
var/y = abs_y_distance >> 1 //Bit-shifting makes me l33t. It also makes get_line() unnecessarily fast.
|
||||
|
||||
if(abs_x_distance >= abs_y_distance) //x distance is greater than y
|
||||
for(var/distance_counter in 0 to (abs_x_distance - 1))//It'll take abs_x_distance steps to get there
|
||||
y += abs_y_distance
|
||||
|
||||
if(y >= abs_x_distance) //Every abs_y_distance steps, step once in y direction
|
||||
y -= abs_x_distance
|
||||
current_y_step += y_distance_sign
|
||||
|
||||
current_x_step += x_distance_sign //Step on in x direction
|
||||
line += locate(current_x_step, current_y_step, starting_z)//Add the turf to the list
|
||||
else
|
||||
for(var/distance_counter in 0 to (abs_y_distance - 1))
|
||||
x += abs_x_distance
|
||||
|
||||
if(x >= abs_y_distance)
|
||||
x -= abs_y_distance
|
||||
current_x_step += x_distance_sign
|
||||
|
||||
current_y_step += y_distance_sign
|
||||
line += locate(current_x_step, current_y_step, starting_z)
|
||||
return line
|
||||
|
||||
/**
|
||||
* Get a list of turfs in a perimeter given the `center_atom` and `radius`.
|
||||
* Automatically rounds down decimals and does not accept values less than positive 1 as they dont play well with it.
|
||||
* Automatically rounds down decimals and does not accept values less than positive 1 as they don't play well with it.
|
||||
* Is efficient on large circles but ugly on small ones
|
||||
* Uses [Jesko`s method to the midpoint circle Algorithm](https://en.wikipedia.org/wiki/Midpoint_circle_algorithm).
|
||||
*/
|
||||
@@ -73,52 +120,6 @@
|
||||
dx -= 1
|
||||
return perimeter
|
||||
|
||||
/**
|
||||
* Get a list of turfs in a line from `starting_atom` to `ending_atom`.
|
||||
*
|
||||
* Uses the ultra-fast [Bresenham Line-Drawing Algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
|
||||
*/
|
||||
/proc/get_line(atom/starting_atom, atom/ending_atom)
|
||||
var/current_x_step = starting_atom.x//start at x and y, then add 1 or -1 to these to get every turf from starting_atom to ending_atom
|
||||
var/current_y_step = starting_atom.y
|
||||
var/starting_z = starting_atom.z
|
||||
|
||||
var/list/line = list(get_turf(starting_atom))//get_turf(atom) is faster than locate(x, y, z)
|
||||
|
||||
var/x_distance = ending_atom.x - current_x_step //x distance
|
||||
var/y_distance = ending_atom.y - current_y_step
|
||||
|
||||
var/abs_x_distance = abs(x_distance)//Absolute value of x distance
|
||||
var/abs_y_distance = abs(y_distance)
|
||||
|
||||
var/x_distance_sign = SIGN(x_distance) //Sign of x distance (+ or -)
|
||||
var/y_distance_sign = SIGN(y_distance)
|
||||
|
||||
var/x = abs_x_distance >> 1 //Counters for steps taken, setting to distance/2
|
||||
var/y = abs_y_distance >> 1 //Bit-shifting makes me l33t. It also makes get_line() unnessecarrily fast.
|
||||
|
||||
if(abs_x_distance >= abs_y_distance) //x distance is greater than y
|
||||
for(var/distance_counter in 0 to (abs_x_distance - 1))//It'll take abs_x_distance steps to get there
|
||||
y += abs_y_distance
|
||||
|
||||
if(y >= abs_x_distance) //Every abs_y_distance steps, step once in y direction
|
||||
y -= abs_x_distance
|
||||
current_y_step += y_distance_sign
|
||||
|
||||
current_x_step += x_distance_sign //Step on in x direction
|
||||
line += locate(current_x_step, current_y_step, starting_z)//Add the turf to the list
|
||||
else
|
||||
for(var/distance_counter in 0 to (abs_y_distance - 1))
|
||||
x += abs_x_distance
|
||||
|
||||
if(x >= abs_y_distance)
|
||||
x -= abs_y_distance
|
||||
current_x_step += x_distance_sign
|
||||
|
||||
current_y_step += y_distance_sign
|
||||
line += locate(current_x_step, current_y_step, starting_z)
|
||||
return line
|
||||
|
||||
/*#####################
|
||||
AURORA SNOWFLAKE
|
||||
#####################*/
|
||||
|
||||
@@ -59,16 +59,27 @@
|
||||
icon_state = "large"
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
pass_flags = PASSTABLE | PASSRAILING
|
||||
pass_flags = PASSTABLE
|
||||
|
||||
///The resilience of our meteor
|
||||
var/hits = 4
|
||||
var/hitpwr = 2 //Level of ex_act to be called on hit.
|
||||
var/dest
|
||||
///Level of ex_act to be called on hit
|
||||
var/hitpwr = 2
|
||||
//Should we shake people's screens on impact
|
||||
var/heavy = FALSE
|
||||
///Our starting z level, prevents infinite meteors
|
||||
var/z_original
|
||||
|
||||
var/meteor_loot = list(/obj/item/ore/iron) //the thing that the meteors will drop when it explodes
|
||||
var/dropamt = 3 //amount of said thing
|
||||
//Potential items to spawn when you die
|
||||
var/meteordrop = list(/obj/item/ore/iron)
|
||||
///How much stuff to spawn when you die
|
||||
var/dropamt = 3
|
||||
|
||||
///The thing we're moving towards, usually a turf
|
||||
var/atom/dest
|
||||
|
||||
///If TRUE, this meteor will not be destroyed by shield collisions
|
||||
var/ignore_shield_destruction = FALSE
|
||||
|
||||
|
||||
/obj/effect/meteor/Destroy()
|
||||
@@ -77,7 +88,7 @@
|
||||
|
||||
/obj/effect/meteor/Collide(atom/A)
|
||||
..()
|
||||
if(istype(A, /obj/effect/energy_field))
|
||||
if(!ignore_shield_destruction && istype(A, /obj/effect/energy_field))
|
||||
hitpwr *= 0.5
|
||||
A.ex_act(hitpwr)
|
||||
visible_message(SPAN_DANGER("\The [src] breaks into dust!"))
|
||||
@@ -128,7 +139,7 @@
|
||||
|
||||
/obj/effect/meteor/proc/make_debris()
|
||||
for(var/throws = dropamt, throws > 0, throws--)
|
||||
var/loot_path = pickweight(meteor_loot)
|
||||
var/loot_path = pickweight(meteordrop)
|
||||
var/obj/O = new loot_path(get_turf(src))
|
||||
if(istype(O, /obj/item/stack))
|
||||
var/obj/item/stack/S = O
|
||||
@@ -139,6 +150,15 @@
|
||||
/obj/effect/meteor/touch_map_edge()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/meteor/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
|
||||
return TRUE //Keeps us from drifting for no reason
|
||||
|
||||
|
||||
|
||||
/*#####################
|
||||
METEOR SUBTYPES
|
||||
#####################*/
|
||||
|
||||
/obj/effect/meteor/medium
|
||||
name = "meteor"
|
||||
dropamt = 2
|
||||
@@ -164,7 +184,7 @@
|
||||
name = "space dust"
|
||||
icon_state = "dust"
|
||||
pass_flags = PASSTABLE | PASSGRILLE | PASSRAILING
|
||||
meteor_loot = list(/obj/item/ore/glass)
|
||||
meteordrop = list(/obj/item/ore/glass)
|
||||
dropamt = 1
|
||||
|
||||
hits = 1
|
||||
@@ -174,7 +194,7 @@
|
||||
name = "flaming meteor"
|
||||
icon_state = "flaming"
|
||||
hits = 3
|
||||
meteor_loot = list(/obj/item/ore/phoron)
|
||||
meteordrop = list(/obj/item/ore/phoron)
|
||||
|
||||
/obj/effect/meteor/flaming/meteor_effect()
|
||||
..()
|
||||
@@ -184,7 +204,7 @@
|
||||
/obj/effect/meteor/irradiated
|
||||
name = "glowing meteor"
|
||||
icon_state = "glowing"
|
||||
meteor_loot = list(/obj/item/ore/uranium)
|
||||
meteordrop = list(/obj/item/ore/uranium)
|
||||
|
||||
/obj/effect/meteor/irradiated/meteor_effect()
|
||||
explosion(src.loc, 0, 0, 4, 3, 0)
|
||||
@@ -194,22 +214,22 @@
|
||||
/obj/effect/meteor/golden
|
||||
name = "golden meteor"
|
||||
icon_state = "sharp"
|
||||
meteor_loot = list(/obj/item/ore/gold)
|
||||
meteordrop = list(/obj/item/ore/gold)
|
||||
|
||||
/obj/effect/meteor/silver
|
||||
name = "silver meteor"
|
||||
icon_state = "glowing_blue"
|
||||
meteor_loot = list(/obj/item/ore/silver)
|
||||
meteordrop = list(/obj/item/ore/silver)
|
||||
|
||||
/obj/effect/meteor/diamond
|
||||
name = "diamond meteor"
|
||||
icon_state = "glowing_blue"
|
||||
meteor_loot = list(/obj/item/ore/diamond)
|
||||
meteordrop = list(/obj/item/ore/diamond)
|
||||
|
||||
/obj/effect/meteor/emp
|
||||
name = "conducting meteor"
|
||||
icon_state = "glowing_blue"
|
||||
meteor_loot = list(/obj/item/ore/osmium)
|
||||
meteordrop = list(/obj/item/ore/osmium)
|
||||
dropamt = 2
|
||||
|
||||
/obj/effect/meteor/emp/meteor_effect()
|
||||
@@ -217,7 +237,7 @@
|
||||
|
||||
/obj/effect/meteor/artifact
|
||||
icon_state = "sharp"
|
||||
meteor_loot = list(/obj/item/archaeological_find)
|
||||
meteordrop = list(/obj/item/archaeological_find)
|
||||
dropamt = 1
|
||||
|
||||
/obj/effect/meteor/supermatter
|
||||
@@ -228,7 +248,7 @@
|
||||
/obj/effect/meteor/supermatter/New()
|
||||
..()
|
||||
if(prob(5))
|
||||
meteor_loot = list(/obj/machinery/power/supermatter/shard)
|
||||
meteordrop = list(/obj/machinery/power/supermatter/shard)
|
||||
dropamt = 1
|
||||
|
||||
/obj/effect/meteor/supermatter/meteor_effect()
|
||||
@@ -240,7 +260,7 @@
|
||||
/obj/effect/meteor/meaty
|
||||
name = "meaty ore"
|
||||
icon_state = "meateor"
|
||||
meteor_loot = list(/obj/item/reagent_containers/food/snacks/meat/monkey)
|
||||
meteordrop = list(/obj/item/reagent_containers/food/snacks/meat/monkey)
|
||||
dropamt = 10
|
||||
|
||||
/obj/effect/meteor/meaty/meteor_effect()
|
||||
@@ -249,7 +269,7 @@
|
||||
/obj/effect/meteor/ship_debris
|
||||
name = "ship debris"
|
||||
icon_state = "dust"
|
||||
meteor_loot = list(
|
||||
meteordrop = list(
|
||||
/obj/item/stack/material/plasteel = 19,
|
||||
/obj/item/stack/material/steel = 19,
|
||||
/obj/item/material/shard = 20,
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/// The minimum strength of a shield to reduce the explosion power of the comet expulsion
|
||||
#define SHIELD_MINIMUM_STRENGTH_TO_REDUCE_EXPLOSION_POWER 5
|
||||
|
||||
/*###############################################
|
||||
PROJECTILE OF THE COMET EXPULSION EVENT
|
||||
###############################################*/
|
||||
|
||||
/obj/projectile/comet_expulsion
|
||||
name = "Comet Expulsion"
|
||||
icon = 'icons/obj/guns/ship/overmap_projectiles.dmi'
|
||||
icon_state = "med_xray_salvo" //Eventually a spriter will make a sprite specific for this
|
||||
speed = 1
|
||||
pixel_speed_multiplier = 0.01
|
||||
range = INFINITY
|
||||
|
||||
/obj/projectile/comet_expulsion/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
|
||||
if(istype(get_turf(src), /turf/unsimulated/map/edge) && istype(target, /turf/unsimulated/map/edge))
|
||||
return FALSE
|
||||
|
||||
if(!istype(target, /obj/effect/overmap/visitable))
|
||||
return FALSE
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/projectile/comet_expulsion/on_hit(atom/target, blocked, def_zone)
|
||||
. = ..()
|
||||
if(. != BULLET_ACT_HIT)
|
||||
return
|
||||
|
||||
//If we hit the ship, spawn meteors for the various zlevels
|
||||
if(target == original)
|
||||
//The direction we are hitting the overmap object from, the true one
|
||||
var/hit_direction = angle2dir(get_angle(src, target))
|
||||
|
||||
for(var/zlevel in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
||||
//Pick a cardinal direction to spawn the meteor from
|
||||
var/meteor_source_dir = hit_direction
|
||||
//If it's not a cardinal already, since the meteor code only supports cardinal directions, make it cardinal
|
||||
switch(meteor_source_dir)
|
||||
if(NORTHEAST)
|
||||
meteor_source_dir = pick(EAST, NORTH)
|
||||
if(NORTHWEST)
|
||||
meteor_source_dir = pick(WEST, NORTH)
|
||||
if(SOUTHEAST)
|
||||
meteor_source_dir = pick(EAST, SOUTH)
|
||||
if(SOUTHWEST)
|
||||
meteor_source_dir = pick(WEST, SOUTH)
|
||||
|
||||
//Calculate how many meteors to spawn based on the direction of the hit
|
||||
//getting hit broadside (cardinal direction) is worse than hitting it diagonally
|
||||
var/meteors_to_spawn = 5
|
||||
if(hit_direction in GLOB.cardinals)
|
||||
meteors_to_spawn = 3
|
||||
|
||||
spawn_meteors(meteors_to_spawn, list(/obj/effect/meteor/comet_expulsion), meteor_source_dir, zlevel)
|
||||
|
||||
|
||||
/*#############################################
|
||||
METEORS OF THE COMET EXPULSION EVENT
|
||||
#############################################*/
|
||||
|
||||
/obj/effect/meteor/comet_expulsion
|
||||
heavy = TRUE
|
||||
ignore_shield_destruction = TRUE
|
||||
hitpwr = 2
|
||||
|
||||
/obj/effect/meteor/comet_expulsion/Collide(atom/A)
|
||||
//If there's shields and it's strong enough, the power of the explosion is reduced, but it won't stop it
|
||||
if(istype(A, /obj/effect/energy_field))
|
||||
var/obj/effect/energy_field/impacted_energy_field = A
|
||||
if(impacted_energy_field.strength > SHIELD_MINIMUM_STRENGTH_TO_REDUCE_EXPLOSION_POWER)
|
||||
hitpwr *= 0.5
|
||||
qdel(impacted_energy_field)
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/effect/meteor/comet_expulsion/meteor_effect()
|
||||
. = ..()
|
||||
|
||||
explosion(get_turf(src), ROUND_UP(hitpwr), ROUND_UP(hitpwr*1.2), ROUND_UP(hitpwr*1.4))
|
||||
|
||||
|
||||
/*#############################
|
||||
COMET EXPULSION EVENT
|
||||
#############################*/
|
||||
|
||||
/datum/event/comet_expulsion
|
||||
severity = EVENT_LEVEL_MAJOR
|
||||
startWhen = 30
|
||||
|
||||
/datum/event/comet_expulsion/setup()
|
||||
if(!SSatlas.current_map.use_overmap)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
/datum/event/comet_expulsion/start()
|
||||
. = ..()
|
||||
|
||||
var/list/possible_station_levels = SSmapping.levels_by_all_traits(list(ZTRAIT_STATION))
|
||||
if(!length(possible_station_levels))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
var/obj/effect/overmap/visitable/target = GLOB.map_sectors["[pick(possible_station_levels)]"]
|
||||
|
||||
if(!istype(target))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
var/list/turf/unsimulated/map/edge/overmap_edges = list()
|
||||
|
||||
for(var/turf/unsimulated/map/edge/E in block(locate(1,1,SSatlas.current_map.overmap_z), locate(SSatlas.current_map.overmap_size,SSatlas.current_map.overmap_size,SSatlas.current_map.overmap_z)))
|
||||
overmap_edges += E
|
||||
|
||||
var/turf/unsimulated/map/edge/source = pick(overmap_edges)
|
||||
if(!istype(source))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
var/obj/projectile/comet_expulsion/our_comet = new(source)
|
||||
our_comet.preparePixelProjectile(target, source)
|
||||
our_comet.original = target
|
||||
our_comet.fire(get_angle(source, target))
|
||||
|
||||
|
||||
/datum/event/comet_expulsion/announce_start()
|
||||
. = ..()
|
||||
command_announcement.Announce("Warning, long range field scanners have detected an unforseen comet mass expulsion in collision route with [location_name()].\n\
|
||||
All hands, assume defense condition, perform evasive maneuvers to avoid collision with the debris cloud. Damage control teams prepare to respond to breaches of the \
|
||||
vessel perimeter.",
|
||||
"[location_name()] Long Range Field Objects Sensor Array", new_sound = 'sound/effects/Evacuation.ogg', zlevels = affecting_z)
|
||||
|
||||
#undef SHIELD_MINIMUM_STRENGTH_TO_REDUCE_EXPLOSION_POWER
|
||||
+101
-58
@@ -1,19 +1,44 @@
|
||||
/datum/event_meta
|
||||
var/name = ""
|
||||
var/enabled = 1 // Whether or not the event is available for random selection at all
|
||||
var/weight = 0 // The base weight of this event. A zero means it may never fire, but see get_weight()
|
||||
var/min_weight = 0 // The minimum weight that this event will have. Only used if non-zero.
|
||||
var/max_weight = 0 // The maximum weight that this event will have. Only use if non-zero.
|
||||
var/severity = 0 // The current severity of this event
|
||||
var/one_shot = 0 // If true, then the event will not be re-added to the list of available events
|
||||
var/add_to_queue= 1 // If true, add back to the queue of events upon finishing.
|
||||
|
||||
///Whether or not the event is available for random selection at all
|
||||
var/enabled = TRUE
|
||||
|
||||
///The base weight of this event. A zero means it may never fire, but see get_weight()
|
||||
var/weight = 0
|
||||
|
||||
///The minimum weight that this event will have. Only used if non-zero
|
||||
var/min_weight = 0
|
||||
|
||||
///The maximum weight that this event will have. Only use if non-zero
|
||||
var/max_weight = 0
|
||||
|
||||
///The current severity of this event
|
||||
var/severity = 0
|
||||
|
||||
///If TRUE, then the event will not be re-added to the list of available events
|
||||
var/one_shot = FALSE
|
||||
|
||||
///If TRUE, add back to the queue of events upon finishing
|
||||
var/add_to_queue = TRUE
|
||||
|
||||
var/list/role_weights = list()
|
||||
var/list/minimum_job_requirement = list() //Minimum amount of jobs required for the event to fire.
|
||||
var/pop_requirement = 0 //Minimum amount of player_list mobs for this to fire.
|
||||
var/list/excluded_gamemodes // A lazylist of gamemodes during which this event won't fire.
|
||||
|
||||
///Minimum amount of jobs required for the event to fire
|
||||
var/list/minimum_job_requirement = list()
|
||||
|
||||
///Minimum amount of player_list mobs for this to fire
|
||||
var/pop_requirement = 0
|
||||
|
||||
/// A lazylist of gamemodes during which this event won't fire
|
||||
var/list/excluded_gamemodes
|
||||
|
||||
var/datum/event/event_type
|
||||
|
||||
/datum/event_meta/New(var/event_severity, var/event_name, var/datum/event/type, var/event_weight, var/list/job_weights, var/is_one_shot = 0, var/min_event_weight = 0, var/max_event_weight = 0, var/list/excluded_roundtypes, var/add_to_queue = TRUE, var/list/minimum_job_requirement_list, var/pop_needed = 0)
|
||||
/datum/event_meta/New(event_severity, event_name, datum/event/type, event_weight, list/job_weights,
|
||||
is_one_shot = FALSE, min_event_weight = 0, max_event_weight = 0, list/excluded_roundtypes,
|
||||
add_to_queue = TRUE, list/minimum_job_requirement_list, pop_needed = 0)
|
||||
|
||||
name = event_name
|
||||
severity = event_severity
|
||||
event_type = type
|
||||
@@ -30,7 +55,7 @@
|
||||
if(excluded_roundtypes)
|
||||
excluded_gamemodes = excluded_roundtypes
|
||||
|
||||
/datum/event_meta/proc/get_weight(var/list/active_with_role)
|
||||
/datum/event_meta/proc/get_weight(list/active_with_role)
|
||||
if(!enabled)
|
||||
return 0
|
||||
|
||||
@@ -64,30 +89,46 @@
|
||||
return total_weight
|
||||
|
||||
/datum/event //NOTE: Times are measured in master controller ticks!
|
||||
var/startWhen = 0 //When in the lifetime to call start().
|
||||
var/announceWhen = 0 //When in the lifetime to call announce().
|
||||
var/endWhen = 0 //When in the lifetime the event should end.
|
||||
|
||||
var/severity = 0 //Severity. Lower means less severe, higher means more severe. Does not have to be supported. Is set on New().
|
||||
var/activeFor = 0 //How long the event has existed. You don't need to change this.
|
||||
var/isRunning = 1 //If this event is currently running. You should not change this.
|
||||
var/startedAt = 0 //When this event started.
|
||||
var/endedAt = 0 //When this event ended.
|
||||
///When in the lifetime to call start()
|
||||
var/startWhen = 0
|
||||
|
||||
///When in the lifetime to call announce()
|
||||
var/announceWhen = 0
|
||||
|
||||
///When in the lifetime the event should end
|
||||
var/endWhen = 0
|
||||
|
||||
///Severity. Lower means less severe, higher means more severe. Does not have to be supported. Is set on New()
|
||||
var/severity = 0
|
||||
|
||||
///How long the event has existed. You don't need to change this
|
||||
var/activeFor = 0
|
||||
|
||||
///If this event is currently running. You should not change this
|
||||
var/isRunning = TRUE
|
||||
|
||||
///When this event started
|
||||
var/startedAt = 0
|
||||
|
||||
///When this event ended
|
||||
var/endedAt = 0
|
||||
|
||||
var/datum/event_meta/event_meta = null
|
||||
var/list/affecting_z
|
||||
|
||||
var/no_fake = 0
|
||||
//If set to 1, this event will not be picked for false announcements
|
||||
//This should really only be used for events that have no announcement
|
||||
///If set to TRUE, this event will not be picked for false announcements
|
||||
///This should really only be used for events that have no announcement
|
||||
var/no_fake = FALSE
|
||||
|
||||
var/ic_name = null
|
||||
//A lore-suitable name that maintains the mystery, used for faking events
|
||||
///A lore-suitable name that maintains the mystery, used for faking events
|
||||
var/ic_name = null
|
||||
|
||||
var/dummy = 0
|
||||
//If 1, this event is a dummy instance used for retrieving values, it should not run or add/remove itself from any lists
|
||||
///If TRUE, this event is a dummy instance used for retrieving values, it should not run or add/remove itself from any lists
|
||||
var/dummy = FALSE
|
||||
|
||||
var/two_part = 0
|
||||
//used for events that run secondary announcements, like releasing maint access.
|
||||
///used for events that run secondary announcements, like releasing maint access
|
||||
var/two_part = FALSE
|
||||
|
||||
var/has_skybox_image = FALSE
|
||||
var/obj/effect/overmap/visitable/ship/affected_ship
|
||||
@@ -96,25 +137,25 @@
|
||||
/datum/event/nothing
|
||||
no_fake = 1
|
||||
|
||||
//Called first before processing.
|
||||
//Allows you to setup your event, such as randomly
|
||||
//setting the startWhen and or announceWhen variables.
|
||||
//Only called once.
|
||||
///Called first before processing.
|
||||
///Allows you to setup your event, such as randomly
|
||||
///setting the startWhen and or announceWhen variables.
|
||||
///Only called once.
|
||||
/datum/event/proc/setup()
|
||||
return
|
||||
|
||||
//Called when the tick is equal to the startWhen variable.
|
||||
//Allows you to start before announcing or vice versa.
|
||||
//Only called once.
|
||||
///Called when the tick is equal to the startWhen variable.
|
||||
///Allows you to start before announcing or vice versa.
|
||||
///Only called once.
|
||||
/datum/event/proc/start()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
if(has_skybox_image)
|
||||
SSskybox.rebuild_skyboxes(affecting_z)
|
||||
announce_start()
|
||||
|
||||
//Called when the tick is equal to the announceWhen variable.
|
||||
//Allows you to announce before starting or vice versa.
|
||||
//Only called once.
|
||||
///Called when the tick is equal to the announceWhen variable.
|
||||
///Allows you to announce before starting or vice versa.
|
||||
///Only called once.
|
||||
/datum/event/proc/announce()
|
||||
return
|
||||
|
||||
@@ -130,31 +171,33 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//Called on or after the tick counter is equal to startWhen.
|
||||
//You can include code related to your event or add your own
|
||||
//time stamped events.
|
||||
//Called more than once.
|
||||
///Called on or after the tick counter is equal to startWhen.
|
||||
///You can include code related to your event or add your own
|
||||
///time stamped events.
|
||||
///Called more than once.
|
||||
/datum/event/proc/tick()
|
||||
return
|
||||
|
||||
//Called on or after the tick is equal or more than endWhen
|
||||
//You can include code related to the event ending.
|
||||
//Do not place spawn() in here, instead use tick() to check for
|
||||
//the activeFor variable.
|
||||
//For example: if(activeFor == myOwnVariable + 30) doStuff()
|
||||
//Only called once.
|
||||
//faked indicates this is a false alarm. Used to prevent announcements and other things from happening during false alarms.
|
||||
///Called on or after the tick is equal or more than endWhen
|
||||
///You can include code related to the event ending.
|
||||
///Do not place spawn() in here, instead use tick() to check for
|
||||
///the activeFor variable.
|
||||
///For example: if(activeFor == myOwnVariable + 30) doStuff()
|
||||
///Only called once.
|
||||
///faked indicates this is a false alarm. Used to prevent announcements and other things from happening during false alarms.
|
||||
/datum/event/proc/end(var/faked)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
announce_end(faked)
|
||||
|
||||
//Returns the latest point of event processing.
|
||||
///Returns the latest point of event processing
|
||||
/datum/event/proc/lastProcessAt()
|
||||
return max(startWhen, max(announceWhen, endWhen))
|
||||
|
||||
//Do not override this proc, instead use the appropiate procs.
|
||||
//This proc will handle the calls to the appropiate procs.
|
||||
///Do not override this proc, instead use the appropiate procs
|
||||
///This proc will handle the calls to the appropiate procs
|
||||
/datum/event/process()
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
if(activeFor > startWhen && activeFor < endWhen)
|
||||
tick()
|
||||
|
||||
@@ -175,8 +218,8 @@
|
||||
|
||||
activeFor++
|
||||
|
||||
//Called when start(), announce() and end() has all been called.
|
||||
/datum/event/proc/kill(var/failed_to_spawn = FALSE)
|
||||
///Called when start(), announce() and end() has all been called
|
||||
/datum/event/proc/kill(failed_to_spawn = FALSE)
|
||||
// If this event was forcefully killed run end() for individual cleanup
|
||||
|
||||
if(!dummy && isRunning)
|
||||
@@ -197,7 +240,7 @@
|
||||
SSevents.event_complete(src)
|
||||
|
||||
|
||||
/datum/event/New(var/datum/event_meta/EM = null, var/is_dummy = 0, var/obj/effect/overmap/visitable/ship/overmap_ship, var/obj/effect/overmap/event/overmap_hazard)
|
||||
/datum/event/New(datum/event_meta/EM = null, is_dummy = 0, obj/effect/overmap/visitable/ship/overmap_ship, obj/effect/overmap/event/overmap_hazard)
|
||||
dummy = is_dummy
|
||||
event_meta = EM
|
||||
if (event_meta)
|
||||
@@ -233,7 +276,7 @@
|
||||
/datum/event/proc/get_skybox_image()
|
||||
return
|
||||
|
||||
/datum/event/proc/setup_for_overmap(var/obj/effect/overmap/visitable/ship/ship, var/obj/effect/overmap/event/hazard)
|
||||
/datum/event/proc/setup_for_overmap(obj/effect/overmap/visitable/ship/ship, obj/effect/overmap/event/hazard)
|
||||
startWhen = 0
|
||||
endWhen = INFINITY
|
||||
affecting_z = ship.map_z
|
||||
@@ -243,6 +286,6 @@
|
||||
announceWhen = -1
|
||||
ic_name = hazard.name
|
||||
|
||||
/datum/event/proc/send_sensor_message(var/message)
|
||||
/datum/event/proc/send_sensor_message(message)
|
||||
for(var/obj/machinery/computer/ship/sensors/console in affected_ship.consoles)
|
||||
console.display_message(message)
|
||||
|
||||
@@ -240,7 +240,8 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Space Vines", /datum/event/spacevine, 0, list(ASSIGNMENT_ANY = 1, ASSIGNMENT_ENGINEER = 10, ASSIGNMENT_GARDENER = 20), TRUE),
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Spider Infestation", /datum/event/spider_infestation, 25, list(ASSIGNMENT_SECURITY = 10, ASSIGNMENT_MEDICAL = 5), TRUE),
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Major Vermin Infestation", /datum/event/infestation/major, 15, list(ASSIGNMENT_SECURITY = 15, ASSIGNMENT_MEDICAL = 5)),
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Drone Revolution", /datum/event/rogue_maint_drones, 0, list(ASSIGNMENT_ENGINEER = 10, ASSIGNMENT_MEDICAL = 5, ASSIGNMENT_SECURITY = 5))
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Drone Revolution", /datum/event/rogue_maint_drones, 0, list(ASSIGNMENT_ENGINEER = 10, ASSIGNMENT_MEDICAL = 5, ASSIGNMENT_SECURITY = 5)),
|
||||
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Comet Expulsion", /datum/event/comet_expulsion, 0, is_one_shot = TRUE, pop_needed = 8),
|
||||
)
|
||||
|
||||
#undef ASSIGNMENT_ANY
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# - (fixes bugs)
|
||||
# wip
|
||||
# - (work in progress)
|
||||
# qol
|
||||
# - (quality of life)
|
||||
# soundadd
|
||||
# - (adds a sound)
|
||||
# sounddel
|
||||
# - (removes a sound)
|
||||
# rscadd
|
||||
# - (adds a feature)
|
||||
# rscdel
|
||||
# - (removes a feature)
|
||||
# imageadd
|
||||
# - (adds an image or sprite)
|
||||
# imagedel
|
||||
# - (removes an image or sprite)
|
||||
# spellcheck
|
||||
# - (fixes spelling or grammar)
|
||||
# experiment
|
||||
# - (experimental change)
|
||||
# balance
|
||||
# - (balance changes)
|
||||
# code_imp
|
||||
# - (misc internal code change)
|
||||
# refactor
|
||||
# - (refactors code)
|
||||
# config
|
||||
# - (makes a change to the config files)
|
||||
# admin
|
||||
# - (makes changes to administrator tools)
|
||||
# server
|
||||
# - (miscellaneous changes to server)
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: FluffyGhost
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
|
||||
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- rscadd: "Added a comet expulsion event, coming towards the main map, if not dodged causes some meteors that then explode, the explosion power can be reduced by shields."
|
||||
- code_imp: "Some DMDocs, code cleanups and other things noone else cares about."
|
||||
Reference in New Issue
Block a user