Skip to content

Commit

Permalink
Merge branch 'master' into aid_resprite
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCastmer authored Feb 26, 2024
2 parents 89e2820 + 92cd358 commit 72b9856
Show file tree
Hide file tree
Showing 234 changed files with 3,118 additions and 1,432 deletions.
6 changes: 3 additions & 3 deletions _maps/map_files/generic/CentCom.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -12624,7 +12624,7 @@
/obj/effect/portal/permanent/one_way/multi/entry{
alpha = 55;
color = "7D7D7D";
desc = "for when the clock hits one thirty and keeps ticking...";
desc = "For when the clock hits one thirty and keeps ticking...";
id = "testchamber";
name = "Test Chamber Portal";
teleport_channel = "quantum"
Expand Down Expand Up @@ -21648,7 +21648,7 @@
/obj/effect/portal/permanent/one_way/multi/entry{
alpha = 55;
color = "7D7D7D";
desc = "for when the clock hits one thirty and keeps ticking...";
desc = "For when the clock hits one thirty and keeps ticking...";
id = "testchamber";
name = "Test Chamber Portal";
teleport_channel = "quantum"
Expand Down Expand Up @@ -23483,7 +23483,7 @@
/obj/effect/portal/permanent/one_way/multi/entry{
alpha = 55;
color = "7D7D7D";
desc = "for when the clock hits one thirty and keeps ticking...";
desc = "For when the clock hits one thirty and keeps ticking...";
id = "testchamber";
name = "Test Chamber Portal";
teleport_channel = "quantum"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/construction/material.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/// The maximum size of a stack object.
#define MAX_STACK_SIZE 50
/// Maximum amount of cable in a coil
#define MAXCOIL 30
#define MAXCOIL 40

//Category of materials
/// Is the material from an ore? currently unused but exists atm for categorizations sake
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
/// from cosmetic items to restyle certain mobs, objects or organs: (atom/source, mob/living/trimmer, atom/movable/original_target, body_zone, restyle_type, style_speed)
#define COMSIG_ATOM_RESTYLE "atom_restyle"

/// Called on [/atom/SpinAnimation()] : (speed, loops, segments, angle)
#define COMSIG_ATOM_SPIN_ANIMATION "atom_spin_animation"

///! from proc/get_rad_contents(): ()
#define COMSIG_ATOM_RAD_PROBE "atom_rad_probe"
#define COMPONENT_BLOCK_RADIATION 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
/// from base of atom/movable/Process_Spacemove(): (movement_dir, continuous_move)
#define COMSIG_MOVABLE_SPACEMOVE "spacemove"
#define COMSIG_MOVABLE_STOP_SPACEMOVE (1<<0)
#define COMSIG_MOVABLE_ALLOW_SPACEMOVE (1<<1)

/// Sent from /obj/item/radio/talk_into(): (obj/item/radio/used_radio)
#define COMSIG_MOVABLE_USING_RADIO "movable_radio"
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@
//#define OBJ_LAYER 3 //For easy recordkeeping; this is a byond define
#define CLOSED_DOOR_LAYER 3.1
#define CLOSED_FIREDOOR_LAYER 3.11
#define SHUTTER_LAYER 3.12 // HERE BE DRAGONS
#define CLOSED_BLASTDOOR_LAYER 3.13 // ABOVE DOORS
#define ABOVE_OBJ_LAYER 3.2
#define CLOSED_BLASTDOOR_LAYER 3.3 // ABOVE WINDOWS AND DOORS
#define SHUTTER_LAYER 3.3 // HERE BE DRAGONS
#define ABOVE_WINDOW_LAYER 3.3
#define SIGN_LAYER 3.4
#define CORGI_ASS_PIN_LAYER 3.41
Expand Down
29 changes: 29 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@
#define REAGENTS_METABOLISM 0.4 //How many units of reagent are consumed per tick, by default.
#define REAGENTS_EFFECT_MULTIPLIER (REAGENTS_METABOLISM / 0.4) // By defining the effect multiplier this way, it'll exactly adjust all effects according to how they originally were with the 0.4 metabolism

// Eye protection
#define FLASH_PROTECTION_HYPER_SENSITIVE -2
#define FLASH_PROTECTION_SENSITIVE -1
#define FLASH_PROTECTION_NONE 0
#define FLASH_PROTECTION_FLASH 1
#define FLASH_PROTECTION_WELDER 2

// Roundstart trait system

#define MAX_QUIRKS 6 //The maximum amount of quirks one character can have at roundstart
Expand Down Expand Up @@ -392,3 +399,25 @@

/// Possible value of [/atom/movable/buckle_lying]. If set to a different (positive-or-zero) value than this, the buckling thing will force a lying angle on the buckled.
#define NO_BUCKLE_LYING -1

/// Squashing will not occur if the mob is not lying down (bodyposition is LYING_DOWN)
#define SQUASHED_SHOULD_BE_DOWN (1<<0)
/// If present, outright gibs the squashed mob instead of just dealing damage
#define SQUASHED_SHOULD_BE_GIBBED (1<<1)
/// If squashing always passes if the mob is dead
#define SQUASHED_ALWAYS_IF_DEAD (1<<2)
/// Don't squash our mob if its not located in a turf
#define SQUASHED_DONT_SQUASH_IN_CONTENTS (1<<3)

// Bitflags for mob dismemberment and gibbing
/// Mobs will drop a brain
#define DROP_BRAIN (1<<0)
/// Mobs will drop organs
#define DROP_ORGANS (1<<1)
/// Mobs will drop bodyparts (arms, legs, etc.)
#define DROP_BODYPARTS (1<<2)
/// Mobs will drop items
#define DROP_ITEMS (1<<3)

/// Mobs will drop everything
#define DROP_ALL_REMAINS (DROP_BRAIN | DROP_ORGANS | DROP_BODYPARTS | DROP_ITEMS)
2 changes: 2 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@

#define STATUS_EFFECT_EXPOSED /datum/status_effect/exposed //increases incoming damage

#define STATUS_EFFECT_EXPOSED_HARPOONED /datum/status_effect/exposed/harpooned //increases incoming damage when hit by a gasharpoon

#define STATUS_EFFECT_TAMING /datum/status_effect/taming //tames the target after enough tame stacks

#define STATUS_EFFECT_NECROPOLIS_CURSE /datum/status_effect/necropolis_curse
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
#define INIT_ORDER_PATH -50
#define INIT_ORDER_DISCORD -60
#define INIT_ORDER_EXPLOSIONS -69
#define INIT_ORDER_STATPANELS -98
#define INIT_ORDER_STATPANELS -97
#define INIT_ORDER_INIT_PROFILER -98 //Near the end, logs the costs of initialize
#define INIT_ORDER_DEMO -99 // To avoid a bunch of changes related to initialization being written, do this last
#define INIT_ORDER_CHAT -100 //Should be last to ensure chat remains smooth during init.

Expand Down
50 changes: 50 additions & 0 deletions code/__HELPERS/animations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,53 @@
animate(transform = transforms[2], time = 0.1)
animate(transform = transforms[3], time = 0.2)
animate(transform = transforms[4], time = 0.3)


/**
* Proc called when you want the atom to spin around the center of its icon (or where it would be if its transform var is translated)
* By default, it makes the atom spin forever and ever at a speed of 60 rpm.
*
* Arguments:
* * speed: how much it takes for the atom to complete one 360° rotation
* * loops: how many times do we want the atom to rotate
* * clockwise: whether the atom ought to spin clockwise or counter-clockwise
* * segments: in how many animate calls the rotation is split. Probably unnecessary, but you shouldn't set it lower than 3 anyway.
* * parallel: whether the animation calls have the ANIMATION_PARALLEL flag, necessary for it to run alongside concurrent animations.
*/
/atom/proc/SpinAnimation(speed = 1 SECONDS, loops = -1, clockwise = TRUE, segments = 3, parallel = TRUE)
if(!segments)
return
var/segment = 360/segments
if(!clockwise)
segment = -segment
SEND_SIGNAL(src, COMSIG_ATOM_SPIN_ANIMATION, speed, loops, segments, segment)
do_spin_animation(speed, loops, segments, segment, parallel)

/atom/proc/DabAnimation(speed = 1, loops = 1, direction = 1 , hold_seconds = 0 , angle = 1 , stay = FALSE) // Hopek 2019
// By making this in atom/proc everything in the game can potentially dab. You have been warned.
if(hold_seconds > 9999) // if you need to hold a dab for more than 2 hours intentionally let me know.
return
if(hold_seconds > 0)
hold_seconds = hold_seconds * 10 // Converts seconds to deciseconds
if(angle == 1) //if angle is 1: random angle. Else take angle
angle = rand(25,50)
if(direction == 1) // direciton:: 1 for random pick, 2 for clockwise , 3 for anti-clockwise
direction = pick(2,3)
if(direction == 3) // if 3 then counter clockwise
angle = angle * -1
if(speed == 1) // if speed is 1 choose random speed from list
speed = rand(3,5)

// dab matrix here
var/matrix/DAB_COMMENCE = matrix(transform)
var/matrix/DAB_RETURN = matrix(transform)
DAB_COMMENCE.Turn(angle) // dab angle to matrix

// Dab animation
animate(src, transform = DAB_COMMENCE, time = speed, loops ) // dab to hold angle
if(hold_seconds > 0)
sleep(hold_seconds) // time to hold the dab before going back
if(!stay) // if stay param is true dab doesn't return
animate(transform = DAB_RETURN, time = speed * 1.5, loops ) // reverse dab to starting position , slower
//doesn't have an object argument because this is "Stacking" with the animate call above
//3 billion% intentional
4 changes: 4 additions & 0 deletions code/__HELPERS/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
/// But paired down and modified to work for our color range
/// Accepts the color cutoffs as two 3 length list(0-100,...) arguments
/proc/blend_cutoff_colors(list/first_color, list/second_color)
// These runtimes usually mean that either the eye or the glasses have an incorrect color_cutoffs
ASSERT(first_color?.len == 3, "First color must be a 3 length list, received [json_encode(first_color)]")
ASSERT(second_color?.len == 3, "Second color must be a 3 length list, received [json_encode(second_color)]")

var/list/output = new /list(3)

// Invert the colors, multiply to "darken" (actually lights), then uninvert to get back to what we want
Expand Down
54 changes: 0 additions & 54 deletions code/__HELPERS/matrices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,6 @@
. = new_angle - old_angle
Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT

/atom/proc/SpinAnimation(speed = 1 SECONDS, loops = -1, clockwise = 1, segments = 3, parallel = TRUE)
if(!segments)
return
var/segment = 360/segments
if(!clockwise)
segment = -segment
var/list/matrices = list()
for(var/i in 1 to segments-1)
var/matrix/M = matrix(transform)
M.Turn(segment*i)
matrices += M
var/matrix/last = matrix(transform)
matrices += last

speed /= segments

if(parallel)
animate(src, transform = matrices[1], time = speed, loops , flags = ANIMATION_PARALLEL)
else
animate(src, transform = matrices[1], time = speed, loops)
for(var/i in 2 to segments) //2 because 1 is covered above
animate(transform = matrices[i], time = speed)
//doesn't have an object argument because this is "Stacking" with the animate call above
//3 billion% intentional

/atom/proc/DabAnimation(speed = 1, loops = 1, direction = 1 , hold_seconds = 0 , angle = 1 , stay = FALSE) // Hopek 2019
// By making this in atom/proc everything in the game can potentially dab. You have been warned.
if(hold_seconds > 9999) // if you need to hold a dab for more than 2 hours intentionally let me know.
return
if(hold_seconds > 0)
hold_seconds = hold_seconds * 10 // Converts seconds to deciseconds
if(angle == 1) //if angle is 1: random angle. Else take angle
angle = rand(25,50)
if(direction == 1) // direciton:: 1 for random pick, 2 for clockwise , 3 for anti-clockwise
direction = pick(2,3)
if(direction == 3) // if 3 then counter clockwise
angle = angle * -1
if(speed == 1) // if speed is 1 choose random speed from list
speed = rand(3,5)

// dab matrix here
var/matrix/DAB_COMMENCE = matrix(transform)
var/matrix/DAB_RETURN = matrix(transform)
DAB_COMMENCE.Turn(angle) // dab angle to matrix

// Dab animation
animate(src, transform = DAB_COMMENCE, time = speed, loops ) // dab to hold angle
if(hold_seconds > 0)
sleep(hold_seconds) // time to hold the dab before going back
if(!stay) // if stay param is true dab doesn't return
animate(transform = DAB_RETURN, time = speed * 1.5, loops ) // reverse dab to starting position , slower
//doesn't have an object argument because this is "Stacking" with the animate call above
//3 billion% intentional

//Dumps the matrix data in format a-f
/matrix/proc/tolist()
. = list()
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
var/newdrift = ((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag
tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, newdrift))
var/starting_tick_usage = TICK_USAGE

if(newdrift - olddrift >= CONFIG_GET(number/drift_dump_threshold))
//Yog: profile dumping was throttling lower performance computers, so we're going to have it disabled by default but you can enable it via config flags
if(newdrift - olddrift >= CONFIG_GET(number/drift_dump_threshold) && CONFIG_GET(flag/auto_profile))
AttemptProfileDump(CONFIG_GET(number/drift_profile_delay))
olddrift = newdrift

Expand Down
42 changes: 30 additions & 12 deletions code/controllers/subsystem/atoms.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define SUBSYSTEM_INIT_SOURCE "subsystem init"
SUBSYSTEM_DEF(atoms)
name = "Atoms"
init_order = INIT_ORDER_ATOMS
Expand Down Expand Up @@ -43,11 +42,16 @@ SUBSYSTEM_DEF(atoms)
if(initialized == INITIALIZATION_INSSATOMS)
return

set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, SUBSYSTEM_INIT_SOURCE)
// Generate a unique mapload source for this run of InitializeAtoms
var/static/uid = 0
uid = (uid + 1) % (SHORT_REAL_LIMIT - 1)
var/source = "subsystem init [uid]"
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, source)

// This may look a bit odd, but if the actual atom creation runtimes for some reason, we absolutely need to set initialized BACK
CreateAtoms(atoms, atoms_to_return)
clear_tracked_initalize(SUBSYSTEM_INIT_SOURCE)
CreateAtoms(atoms, atoms_to_return, source)
clear_tracked_initalize(source)
SSicon_smooth.free_deferred(source)

if(late_loaders.len)
for(var/I in 1 to late_loaders.len)
Expand All @@ -68,12 +72,13 @@ SUBSYSTEM_DEF(atoms)

testing("[queued_deletions.len] atoms were queued for deletion.")
queued_deletions.Cut()

// #ifdef PROFILE_MAPLOAD_INIT_ATOM
// rustg_file_write(json_encode(mapload_init_times), "[GLOB.log_directory]/init_times.json")
// #endif

/// Actually creates the list of atoms. Exists soley so a runtime in the creation logic doesn't cause initalized to totally break
/datum/controller/subsystem/atoms/proc/CreateAtoms(list/atoms, list/atoms_to_return = null)
/datum/controller/subsystem/atoms/proc/CreateAtoms(list/atoms, list/atoms_to_return = null, mapload_source = null)
if (atoms_to_return)
LAZYINITLIST(created_atoms)

Expand All @@ -91,7 +96,12 @@ SUBSYSTEM_DEF(atoms)
for(var/I in 1 to atoms.len)
var/atom/A = atoms[I]
if(!(A.flags_1 & INITIALIZED_1))
CHECK_TICK
// Unrolled CHECK_TICK setup to let us enable/disable mapload based off source
if(TICK_CHECK)
clear_tracked_initalize(mapload_source)
stoplag()
if(mapload_source)
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, mapload_source)
PROFILE_INIT_ATOM_BEGIN()
InitAtom(A, TRUE, mapload_arg)
PROFILE_INIT_ATOM_END(A)
Expand All @@ -108,7 +118,11 @@ SUBSYSTEM_DEF(atoms)
#ifdef TESTING
++count
#endif
CHECK_TICK
if(TICK_CHECK)
clear_tracked_initalize(mapload_source)
stoplag()
if(mapload_source)
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, mapload_source)

testing("Initialized [count] atoms")

Expand All @@ -118,12 +132,18 @@ SUBSYSTEM_DEF(atoms)
/datum/controller/subsystem/atoms/proc/map_loader_stop(source)
clear_tracked_initalize(source)

/// Returns the source currently modifying SSatom's init behavior
/datum/controller/subsystem/atoms/proc/get_initialized_source()
var/state_length = length(initialized_state)
if(!state_length)
return null
return initialized_state[state_length][1]

/// Use this to set initialized to prevent error states where the old initialized is overriden, and we end up losing all context
/// Accepts a state and a source, the most recent state is used, sources exist to prevent overriding old values accidentially
/datum/controller/subsystem/atoms/proc/set_tracked_initalized(state, source)
if(!length(initialized_state))
base_initialized = initialized

initialized_state += list(list(source, state))
initialized = state

Expand All @@ -141,9 +161,9 @@ SUBSYSTEM_DEF(atoms)
return
initialized = initialized_state[length(initialized_state)][2]

/// Returns TRUE if anything is currently being initialized or needing to be deleted
/// Returns TRUE if anything is currently being initialized
/datum/controller/subsystem/atoms/proc/initializing_something()
return length(initialized_state)
return length(initialized_state) > 1

/datum/controller/subsystem/atoms/Recover()
initialized = SSatoms.initialized
Expand Down Expand Up @@ -201,5 +221,3 @@ SUBSYSTEM_DEF(atoms)
var/initlog = InitLog()
if(initlog)
text2file(initlog, "[GLOB.log_directory]/initialize.log")

#undef SUBSYSTEM_INIT_SOURCE
Loading

0 comments on commit 72b9856

Please sign in to comment.