Skip to content

Commit

Permalink
Merge branch 'dev-sierra' into upstream-pr-34754
Browse files Browse the repository at this point in the history
  • Loading branch information
UEDCommander authored Oct 21, 2024
2 parents 03a2322 + 0878099 commit 9e8b806
Show file tree
Hide file tree
Showing 607 changed files with 35,192 additions and 2,598 deletions.
19 changes: 10 additions & 9 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"recommendations": [
"gbasood.byond-dm-language-support",
"platymuus.dm-langclient",
"biomejs.biome",
"eamodio.gitlens",
"anturk.dmi-editor"
]
}
{
"recommendations": [
"stylemistake.auto-comment-blocks",
"biomejs.biome",
"platymuus.dm-langclient",
"anturk.dmi-editor",
"eamodio.gitlens",
"oderwat.indent-rainbow"
]
}
9 changes: 9 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@
#include "code\game\machinery\doors\blast_door.dm"
#include "code\game\machinery\doors\braces.dm"
#include "code\game\machinery\doors\brigdoors.dm"
#include "code\game\machinery\doors\broken_door.dm"
#include "code\game\machinery\doors\checkForMultipleDoors.dm"
#include "code\game\machinery\doors\door.dm"
#include "code\game\machinery\doors\firedoor.dm"
Expand Down Expand Up @@ -939,6 +940,8 @@
#include "code\game\objects\effects\decals\posters\bs12.dm"
#include "code\game\objects\effects\decals\posters\posters.dm"
#include "code\game\objects\effects\fire\fire.dm"
#include "code\game\objects\effects\map\map_effects.dm"
#include "code\game\objects\effects\map\portal.dm"
#include "code\game\objects\effects\particles\particles.dm"
#include "code\game\objects\effects\spawners\bombspawner.dm"
#include "code\game\objects\effects\spawners\gibspawner.dm"
Expand Down Expand Up @@ -1365,6 +1368,7 @@
#include "code\modules\admin\buildmode\room_builder.dm"
#include "code\modules\admin\buildmode\throw_at.dm"
#include "code\modules\admin\buildmode\turret.dm"
#include "code\modules\admin\buildmode\visible_portal.dm"
#include "code\modules\admin\buildmode\_datums\mob_spawner.dm"
#include "code\modules\admin\callproc\callproc.dm"
#include "code\modules\admin\connectioncheck\bancheck_functions.dm"
Expand Down Expand Up @@ -3367,12 +3371,17 @@
#include "mods\_master_files\code\modules\culture_descriptor\religion\religions_vox.dm"
#include "mods\_master_files\code\modules\events\gravity.dm"
#include "mods\_master_files\code\modules\mob\new_player\new_player.dm"
#include "mods\_master_files\code\modules\overmap\distress.dm"
#include "mods\_master_files\code\modules\overmap\panicbutton.dm"
#include "mods\_master_files\code\modules\power\gravitygenerator.dm"
#include "mods\_master_files\code\modules\projectiles\projectile\bullets.dm"
#include "mods\_master_files\code\modules\species\species.dm"
#include "mods\_master_files\code\modules\species\station\adherent.dm"
#include "mods\_master_files\code\modules\species\station\human_subspecies.dm"
#include "mods\_master_files\code\modules\species\station\machine.dm"
#include "mods\_master_files\maps\mapsystem\maps.dm"
#include "mods\_master_files\maps\sierra\sierra_ranks.dm"
#include "mods\_master_files\maps\sierra\items\rigs.dm"
#include "packs\legion\_pack.dm"
#include "~code\global_init.dm"
// END_INCLUDE
18 changes: 14 additions & 4 deletions code/__datastructures/globals.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* *
* Managed Globals
*/

/**
* Managed Globals datum. Any defined global vars can be accessed via `GLOB.varname`.
*
* New globals can be defined on the global scope (Outside of any class definitions) via the various `GLOBAL_*()`
* defines listed at the end of `code\__datastructures\globals.dm`.
*/
var/global/datum/globals/GLOB


Expand Down Expand Up @@ -62,20 +64,28 @@ var/global/datum/globals/GLOB
##X = V; \
}

/// Initializes the global constant `GLOB.[X]` with the value `[V]` as a managed global.
#define GLOBAL_VAR_CONST(X, V) /datum/globals/var/const/##X = V;

/// Initializes the global variable `GLOB.[X]` with no value (`null`) as a managed global.
#define GLOBAL_VAR(X) /datum/globals/var/static/##X;

/// Initializes the global variable `GLOB.[X]` with the value `[V]` as a managed global.
#define GLOBAL_VAR_INIT(X, V) GLOBAL_VAR(X) GLOBAL_INIT(X, V)

/// Initializes the global variable `GLOB.[X]` as an instance of `/static[P]` with no value (`null`) as a managed global.
#define GLOBAL_DATUM(X, P) /datum/globals/var/static##P/##X;

/// Initializes the global variable `GLOB.[X]` as an instance of `/static[P]` with the value `[V]` as a managed global.
#define GLOBAL_DATUM_INIT(X, P, V) GLOBAL_DATUM(X, P) GLOBAL_INIT(X, V)

/// Initializes the global variable `GLOB[X]` as a list with no value (`null`) as a managed global.
#define GLOBAL_LIST(X) /datum/globals/var/static/list/##X;

/// Initializes the global variable `GLOB[X]` as a list with value `[V]` as a managed global.
#define GLOBAL_LIST_INIT(X, V) GLOBAL_LIST(X) GLOBAL_INIT(X, V)

/// Initializes the global variable `GLOB[X]` as an empty list (`list()`) as a managed global.
#define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list())

/// Prevents the GLOB member from being shown in View Variables.
Expand Down
40 changes: 27 additions & 13 deletions code/__datastructures/priority_queue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,66 @@

//an ordered list, using the cmp proc to weight the list elements
/PriorityQueue
var/list/L //the actual queue
var/cmp //the weight function used to order the queue
/// List. The actual queue.
var/list/L
/// Proc path. The weight function used to order the queue.
var/cmp

/PriorityQueue/New(compare)
L = new()
cmp = compare

/// Checks if the queue is currently empty. Returns boolean. Mirrors to `!length(L)`
/PriorityQueue/proc/IsEmpty()
SHOULD_BE_PURE(TRUE)
return !length(L)

//add an element in the list,
//immediatly ordering it to its position using dichotomic search
/// Adds an element to the queue, immediately ordering it to its position using the function defined in `cmp`.
/PriorityQueue/proc/Enqueue(atom/A)
ADD_SORTED(L, A, cmp)

//removes and returns the first element in the queue
/// Removes and returns the first element in the queue, or `FALSE` if the queue is empty.
/PriorityQueue/proc/Dequeue()
if(!length(L))
return 0
return FALSE
. = L[1]

Remove(.)

//removes an element
/// Removes an element from the queue. Returns boolean, indicating whether an item was removed or not. Mirrors to `L.Remove(A)`
/PriorityQueue/proc/Remove(atom/A)
. = L.Remove(A)

//returns a copy of the elements list
/// Returns a copy of the queue as a list. Mirrors to `L.Copy()`
/PriorityQueue/proc/List()
RETURN_TYPE(/list)
SHOULD_BE_PURE(TRUE)
. = L.Copy()

//return the position of an element or 0 if not found
/// Returns the position of an element or `FALSE` if not found. Mirrors to `L.Find(A)`
/PriorityQueue/proc/Seek(atom/A)
SHOULD_BE_PURE(TRUE)
. = L.Find(A)

//return the element at the i_th position
/// Returns the element at position `i` (1-indexed), or `FALSE` if the position does not exist.
/PriorityQueue/proc/Get(i)
SHOULD_BE_PURE(TRUE)
if(i > length(L) || i < 1)
return 0
return FALSE
return L[i]

//return the length of the queue
/// Returns the length of the queue. Mirrors to `length(L)`
/PriorityQueue/proc/Length()
SHOULD_BE_PURE(TRUE)
. = length(L)

//replace the passed element at it's right position using the cmp proc
/**
* Repositions the given element to the correct position in the queue using the function defined in `cmp`.
*
* The element must already exist in the queue to be resorted.
*
* Has no return value.
*/
/PriorityQueue/proc/ReSort(atom/A)
var/i = Seek(A)
if(i == 0)
Expand Down
76 changes: 56 additions & 20 deletions code/__datastructures/stack.dm
Original file line number Diff line number Diff line change
@@ -1,65 +1,101 @@
/datum/stack
/**
* List. Items within the stack. Initially defined during `New()`.
*
* Not intended to reference directly. Instead, see the various procs under `/datum/stack`.
*/
var/list/stack

/// Integer. Maximum number of elements the stack can contain. If `0`, has no limit. Defined during `New()`.
var/max_elements = 0

/datum/stack/New(list/elements, max)
..()
stack = elements ? elements.Copy() : list()
if(max)
if (max)
max_elements = max

/datum/stack/Destroy()
Clear()
. = ..()

/**
* Returns then removes the rightmost/last element in the stack.
*/
/datum/stack/proc/Pop()
if(is_empty())
return null
if (is_empty())
return
. = stack[length(stack)]
stack.Cut(length(stack),0)
stack.Cut(length(stack), 0)

/**
* Adds `element` to the stack, unless the stack is already at the limit defined by `max_elements`.
*/
/datum/stack/proc/Push(element)
if(max_elements && (length(stack)+1 > max_elements))
return null
if (max_elements && length(stack) >= max_elements)
return
stack += element

/**
* Returns the rightmost/last element in the stack.
*/
/datum/stack/proc/Top()
if(is_empty())
return null
. = stack[length(stack)]

/**
* Removes `element` from the stack, if present.
*/
/datum/stack/proc/Remove(element)
stack -= element

/**
* Checks if the stack is currently empty. Returns boolean.
*/
/datum/stack/proc/is_empty()
. = length(stack) ? 0 : 1
. = length(stack) ? FALSE : TRUE

//Rotate entire stack left with the leftmost looping around to the right
/**
* Rotates the entire stack left/backward with the leftmost/first element looping around to the right/end.
*
* Returns `FALSE` is the stack is empty.
*/
/datum/stack/proc/RotateLeft()
if(is_empty())
return 0
if (is_empty())
return FALSE
. = stack[1]
stack.Cut(1,2)
stack.Cut(1, 2)
Push(.)

//Rotate entire stack to the right with the rightmost looping around to the left
/**
* Rotates the entire stack right/forward with the rightmost/last element looping around to the left/beginning.
*
* Returns `FALSE` is the stack is empty.
*/
/datum/stack/proc/RotateRight()
if(is_empty())
return 0
if (is_empty())
return FALSE
. = stack[length(stack)]
stack.Cut(length(stack),0)
stack.Insert(1,.)
stack.Cut(length(stack), 0)
stack.Insert(1, .)


/**
* Returns a copy of the stack as a new instance of `/datum/stack`.
*/
/datum/stack/proc/Copy()
var/datum/stack/S=new()
S.stack = stack.Copy()
S.max_elements = max_elements
return S
return new /datum/stack(stack.Copy(), max_elements)

/**
* Clears the stack of all entries.
*/
/datum/stack/proc/Clear()
stack.Cut()

/**
* `qdel()`s every entry in the stack, then clears the stack.
*/
/datum/stack/proc/QdelClear()
for(var/entry in stack)
qdel(entry)
Expand Down
1 change: 1 addition & 0 deletions code/__defines/__renderer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#define MOUSETRAP_LAYER 2.12
#define PLANT_LAYER 2.13
#define AO_LAYER 2.14
#define ABOVE_AO_LAYER 2.141
//HIDING MOB
#define HIDING_MOB_LAYER 2.15
#define SHALLOW_FLUID_LAYER 2.16
Expand Down
Loading

0 comments on commit 9e8b806

Please sign in to comment.