mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[MIRROR] (code bounty) The tram is now unstoppably powerful. it cannot be stopped, it cannot be slowed, it cannot be reasoned with. YOU HAVE NO IDEA HOW READY YOU ARE [MDB IGNORE] (#14477)
* (code bounty) The tram is now unstoppably powerful. it cannot be stopped, it cannot be slowed, it cannot be reasoned with. YOU HAVE NO IDEA HOW READY YOU ARE * fex * fex Co-authored-by: Kylerace <kylerlumpkin1@gmail.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
co-authored by
Kylerace
Gandalf
parent
1e8579d2a8
commit
18a56ffeeb
@@ -549,18 +549,18 @@ SUBSYSTEM_DEF(explosions)
|
||||
var/base_shake_amount = sqrt(near_distance / (distance + 1))
|
||||
|
||||
if(distance <= round(near_distance + world.view - 2, 1)) // If you are close enough to see the effects of the explosion first-hand (ignoring walls)
|
||||
listener.playsound_local(epicenter, null, 100, TRUE, frequency, S = near_sound)
|
||||
listener.playsound_local(epicenter, null, 100, TRUE, frequency, sound_to_use = near_sound)
|
||||
if(base_shake_amount > 0)
|
||||
shake_camera(listener, NEAR_SHAKE_DURATION, clamp(base_shake_amount, 0, NEAR_SHAKE_CAP))
|
||||
|
||||
else if(distance < far_distance) // You can hear a far explosion if you are outside the blast radius. Small explosions shouldn't be heard throughout the station.
|
||||
var/far_volume = clamp(far_distance / 2, FAR_LOWER, FAR_UPPER)
|
||||
if(creaking)
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, S = creaking_sound, distance_multiplier = 0)
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, sound_to_use = creaking_sound, distance_multiplier = 0)
|
||||
else if(prob(FAR_SOUND_PROB)) // Sound variety during meteor storm/tesloose/other bad event
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, S = far_sound, distance_multiplier = 0)
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, sound_to_use = far_sound, distance_multiplier = 0)
|
||||
else
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, S = echo_sound, distance_multiplier = 0)
|
||||
listener.playsound_local(epicenter, null, far_volume, TRUE, frequency, sound_to_use = echo_sound, distance_multiplier = 0)
|
||||
|
||||
if(base_shake_amount || quake_factor)
|
||||
base_shake_amount = max(base_shake_amount, quake_factor * 3, 0) // Devastating explosions rock the station and ground
|
||||
@@ -573,7 +573,7 @@ SUBSYSTEM_DEF(explosions)
|
||||
shake_camera(listener, FAR_SHAKE_DURATION, clamp(quake_factor / 4, 0, FAR_SHAKE_CAP))
|
||||
else
|
||||
echo_volume = 40
|
||||
listener.playsound_local(epicenter, null, echo_volume, TRUE, frequency, S = echo_sound, distance_multiplier = 0)
|
||||
listener.playsound_local(epicenter, null, echo_volume, TRUE, frequency, sound_to_use = echo_sound, distance_multiplier = 0)
|
||||
|
||||
if(creaking) // 5 seconds after the bang, the station begins to creak
|
||||
addtimer(CALLBACK(listener, /mob/proc/playsound_local, epicenter, null, rand(FREQ_LOWER, FREQ_UPPER), TRUE, frequency, null, null, FALSE, hull_creaking_sound, 0), CREAK_DELAY)
|
||||
|
||||
@@ -40,14 +40,21 @@ SUBSYSTEM_DEF(mapping)
|
||||
// Z-manager stuff
|
||||
var/station_start // should only be used for maploading-related tasks
|
||||
var/space_levels_so_far = 0
|
||||
///list of all the z level datums created representing the z levels in the world
|
||||
var/list/z_list
|
||||
///list of all z level datums in the order of their z (z level 1 is at index 1, etc.)
|
||||
var/list/datum/space_level/z_list
|
||||
///list of all z level indices that form multiz connections and whether theyre linked up or down
|
||||
///list of lists, inner lists are of the form: list("up or down link direction" = TRUE)
|
||||
var/list/multiz_levels = list()
|
||||
var/datum/space_level/transit
|
||||
var/datum/space_level/empty_space
|
||||
var/num_of_res_levels = 1
|
||||
/// True when in the process of adding a new Z-level, global locking
|
||||
var/adding_new_zlevel = FALSE
|
||||
|
||||
///shows the default gravity value for each z level. recalculated when gravity generators change.
|
||||
///associative list of the form: list("[z level num]" = max generator gravity in that z level OR the gravity level trait)
|
||||
var/list/gravity_by_z_level = list()
|
||||
|
||||
/datum/controller/subsystem/mapping/New()
|
||||
..()
|
||||
#ifdef FORCE_MAP
|
||||
@@ -101,8 +108,48 @@ SUBSYSTEM_DEF(mapping)
|
||||
generate_station_area_list()
|
||||
initialize_reserved_level(transit.z_value)
|
||||
SSticker.OnRoundstart(CALLBACK(src, .proc/spawn_maintenance_loot))
|
||||
generate_z_level_linkages()
|
||||
calculate_default_z_level_gravities()
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/calculate_default_z_level_gravities()
|
||||
for(var/z_level in 1 to length(z_list))
|
||||
calculate_z_level_gravity(z_level)
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/generate_z_level_linkages()
|
||||
for(var/z_level in 1 to length(z_list))
|
||||
generate_linkages_for_z_level(z_level)
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/generate_linkages_for_z_level(z_level)
|
||||
if(!isnum(z_level) || z_level <= 0)
|
||||
return FALSE
|
||||
|
||||
if(multiz_levels.len < z_level)
|
||||
multiz_levels.len = z_level
|
||||
|
||||
var/linked_down = level_trait(z_level, ZTRAIT_DOWN)
|
||||
var/linked_up = level_trait(z_level, ZTRAIT_UP)
|
||||
multiz_levels[z_level] = list()
|
||||
if(linked_down)
|
||||
multiz_levels[z_level]["[DOWN]"] = TRUE
|
||||
if(linked_up)
|
||||
multiz_levels[z_level]["[UP]"] = TRUE
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/calculate_z_level_gravity(z_level_number)
|
||||
if(!isnum(z_level_number) || z_level_number < 1)
|
||||
return FALSE
|
||||
|
||||
var/max_gravity = 0
|
||||
|
||||
for(var/obj/machinery/gravity_generator/main/grav_gen as anything in GLOB.gravity_generators["[z_level_number]"])
|
||||
max_gravity = max(grav_gen.setting, max_gravity)
|
||||
|
||||
max_gravity = max_gravity || level_trait(z_level_number, ZTRAIT_GRAVITY) || 0//just to make sure no nulls
|
||||
gravity_by_z_level["[z_level_number]"] = max_gravity
|
||||
return max_gravity
|
||||
|
||||
|
||||
/**
|
||||
* ##setup_ruins
|
||||
*
|
||||
@@ -215,6 +262,7 @@ Used by the AI doomsday and the self-destruct nuke.
|
||||
clearing_reserved_turfs = SSmapping.clearing_reserved_turfs
|
||||
|
||||
z_list = SSmapping.z_list
|
||||
multiz_levels = SSmapping.multiz_levels
|
||||
|
||||
#define INIT_ANNOUNCE(X) to_chat(world, span_boldannounce("[X]")); log_world(X)
|
||||
/datum/controller/subsystem/mapping/proc/LoadGroup(list/errorList, name, path, files, list/traits, list/default_traits, silent = FALSE)
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
PROCESSING_SUBSYSTEM_DEF(tramprocess)
|
||||
name = "Tram Process"
|
||||
wait = 1
|
||||
wait = 0.5
|
||||
/// only used on maps with trams, so only enabled by such.
|
||||
can_fire = FALSE
|
||||
|
||||
///how much time a tram can take per movement before we notify admins and slow down the tram. in milliseconds
|
||||
var/max_time = 15
|
||||
|
||||
///how many times the tram can move costing over max_time milliseconds before it gets slowed down
|
||||
var/max_exceeding_moves = 5
|
||||
|
||||
///how many times the tram can move costing less than half max_time milliseconds before we speed it back up again.
|
||||
///is only used if the tram has been slowed down for exceeding max_time
|
||||
var/max_cheap_moves = 5
|
||||
|
||||
@@ -171,53 +171,6 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
var/datum/spatial_grid_cell/cell = new(x, y, z_level.z_value)
|
||||
new_cell_grid[y] += cell
|
||||
|
||||
///creates number_to_generate new oranges_ear's and adds them to the subsystems list of ears.
|
||||
///i really fucking hope this never gets called after init :clueless:
|
||||
/datum/controller/subsystem/spatial_grid/proc/pregenerate_more_oranges_ears(number_to_generate)
|
||||
for(var/new_ear in 1 to number_to_generate)
|
||||
pregenerated_oranges_ears += new/mob/oranges_ear(null)
|
||||
|
||||
number_of_oranges_ears = length(pregenerated_oranges_ears)
|
||||
|
||||
///allocate one [/mob/oranges_ear] mob per turf containing atoms_that_need_ears and give them a reference to every listed atom in their turf.
|
||||
///if an oranges_ear is allocated to a turf that already has an oranges_ear then the second one fails to allocate (and gives the existing one the atom it was assigned to)
|
||||
/datum/controller/subsystem/spatial_grid/proc/assign_oranges_ears(list/atoms_that_need_ears)
|
||||
var/input_length = length(atoms_that_need_ears)
|
||||
|
||||
if(input_length > number_of_oranges_ears)
|
||||
stack_trace("somehow, for some reason, more than the preset generated number of oranges ears was requested. thats fucking [number_of_oranges_ears]. this is not good that should literally never happen")
|
||||
pregenerate_more_oranges_ears(input_length - number_of_oranges_ears)//im still gonna DO IT but ill complain about it
|
||||
|
||||
. = list()
|
||||
|
||||
///the next unallocated /mob/oranges_ear that we try to allocate to assigned_atom's turf
|
||||
var/mob/oranges_ear/current_ear
|
||||
///the next atom in atoms_that_need_ears an ear assigned to it
|
||||
var/atom/assigned_atom
|
||||
///the turf loc of the current assigned_atom. turfs are used to track oranges_ears already assigned to one location so we dont allocate more than one
|
||||
///because allocating more than one oranges_ear to a given loc wastes view iterations
|
||||
var/turf/turf_loc
|
||||
|
||||
for(var/current_ear_index in 1 to input_length)
|
||||
assigned_atom = atoms_that_need_ears[current_ear_index]
|
||||
|
||||
turf_loc = get_turf(assigned_atom)
|
||||
if(!turf_loc)
|
||||
continue
|
||||
|
||||
current_ear = pregenerated_oranges_ears[current_ear_index]
|
||||
|
||||
if(turf_loc.assigned_oranges_ear)
|
||||
turf_loc.assigned_oranges_ear.references += assigned_atom
|
||||
continue //if theres already an oranges_ear mob at assigned_movable's turf we give assigned_movable to it instead and dont allocate ourselves
|
||||
|
||||
current_ear.references += assigned_atom
|
||||
|
||||
current_ear.loc = turf_loc //normally this is bad, but since this is meant to be as fast as possible we literally just need to exist there for view() to see us
|
||||
turf_loc.assigned_oranges_ear = current_ear
|
||||
|
||||
. += current_ear
|
||||
|
||||
///adds cells to the grid for every z level when world.maxx or world.maxy is expanded after this subsystem is initialized. hopefully this is never needed.
|
||||
///because i never tested this.
|
||||
/datum/controller/subsystem/spatial_grid/proc/after_world_bounds_expanded(datum/controller/subsystem/processing/dcs/fucking_dcs, has_expanded_world_maxx, has_expanded_world_maxy)
|
||||
@@ -278,10 +231,6 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
|
||||
. = list()
|
||||
|
||||
//cache for sanic speeds
|
||||
var/cells_on_y_axis = src.cells_on_y_axis
|
||||
var/cells_on_x_axis = src.cells_on_x_axis
|
||||
|
||||
//technically THIS list only contains lists, but inside those lists are grid cell datums and we can go without a SINGLE var init if we do this
|
||||
var/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z]
|
||||
|
||||
@@ -458,6 +407,8 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
GRID_CELL_SET(intersecting_cell.atmos_contents, new_target)
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(SPATIAL_GRID_CONTENTS_TYPE_ATMOS), new_target)
|
||||
|
||||
return intersecting_cell
|
||||
|
||||
/**
|
||||
* find the spatial map cell that target used to belong to, then remove the target (and sometimes it's important_recusive_contents) from it.
|
||||
* make sure to provide the turf old_target used to be "in"
|
||||
@@ -584,6 +535,53 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
message_admins(cell_coords)
|
||||
message_admins("[src] is supposed to only be contained in the cell at indexes ([real_cell.cell_x], [real_cell.cell_y], [real_cell.cell_z]). but is contained at the cells at [cell_coords]")
|
||||
|
||||
///creates number_to_generate new oranges_ear's and adds them to the subsystems list of ears.
|
||||
///i really fucking hope this never gets called after init :clueless:
|
||||
/datum/controller/subsystem/spatial_grid/proc/pregenerate_more_oranges_ears(number_to_generate)
|
||||
for(var/new_ear in 1 to number_to_generate)
|
||||
pregenerated_oranges_ears += new/mob/oranges_ear(null)
|
||||
|
||||
number_of_oranges_ears = length(pregenerated_oranges_ears)
|
||||
|
||||
///allocate one [/mob/oranges_ear] mob per turf containing atoms_that_need_ears and give them a reference to every listed atom in their turf.
|
||||
///if an oranges_ear is allocated to a turf that already has an oranges_ear then the second one fails to allocate (and gives the existing one the atom it was assigned to)
|
||||
/datum/controller/subsystem/spatial_grid/proc/assign_oranges_ears(list/atoms_that_need_ears)
|
||||
var/input_length = length(atoms_that_need_ears)
|
||||
|
||||
if(input_length > number_of_oranges_ears)
|
||||
stack_trace("somehow, for some reason, more than the preset generated number of oranges ears was requested. thats fucking [number_of_oranges_ears]. this is not good that should literally never happen")
|
||||
pregenerate_more_oranges_ears(input_length - number_of_oranges_ears)//im still gonna DO IT but ill complain about it
|
||||
|
||||
. = list()
|
||||
|
||||
///the next unallocated /mob/oranges_ear that we try to allocate to assigned_atom's turf
|
||||
var/mob/oranges_ear/current_ear
|
||||
///the next atom in atoms_that_need_ears an ear assigned to it
|
||||
var/atom/assigned_atom
|
||||
///the turf loc of the current assigned_atom. turfs are used to track oranges_ears already assigned to one location so we dont allocate more than one
|
||||
///because allocating more than one oranges_ear to a given loc wastes view iterations
|
||||
var/turf/turf_loc
|
||||
|
||||
for(var/current_ear_index in 1 to input_length)
|
||||
assigned_atom = atoms_that_need_ears[current_ear_index]
|
||||
|
||||
turf_loc = get_turf(assigned_atom)
|
||||
if(!turf_loc)
|
||||
continue
|
||||
|
||||
current_ear = pregenerated_oranges_ears[current_ear_index]
|
||||
|
||||
if(turf_loc.assigned_oranges_ear)
|
||||
turf_loc.assigned_oranges_ear.references += assigned_atom
|
||||
continue //if theres already an oranges_ear mob at assigned_movable's turf we give assigned_movable to it instead and dont allocate ourselves
|
||||
|
||||
current_ear.references += assigned_atom
|
||||
|
||||
current_ear.loc = turf_loc //normally this is bad, but since this is meant to be as fast as possible we literally just need to exist there for view() to see us
|
||||
turf_loc.assigned_oranges_ear = current_ear
|
||||
|
||||
. += current_ear
|
||||
|
||||
///debug proc for finding how full the cells of src's z level are
|
||||
/atom/proc/find_grid_statistics_for_z_level(insert_clients = 0)
|
||||
var/raw_clients = 0
|
||||
|
||||
Reference in New Issue
Block a user