Skip to content

Commit

Permalink
Merge pull request #129 from Baystation12/dev
Browse files Browse the repository at this point in the history
[pull] dev from Baystation12:dev
  • Loading branch information
Exapsters authored Sep 27, 2024
2 parents ca3bf2b + 7d63584 commit 6a62adc
Show file tree
Hide file tree
Showing 288 changed files with 5,453 additions and 2,058 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
ref: dev
token: ${{ secrets.BOT_TOKEN }}
- name: Python setup
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
with:
python-version: '3.x'
- name: Install depends
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch: # allows this workflow to be manually triggered

env:
SPACEMAN_DMM_VERSION: suite-1.7.3
SPACEMAN_DMM_VERSION: suite-1.9

jobs:
PreFlight:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
run: |
~/dmdoc
- name: Deploy
uses: JamesIves/github-pages-deploy-action@5c6e9e9f3672ce8fd37b9856193d2a537941e66c
uses: JamesIves/github-pages-deploy-action@920cbb300dcd3f0568dbc42700c61e2fd9e6139c
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 25
- name: Python setup
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
with:
python-version: '3.x'
- name: Install depends
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
env:
BYOND_MAJOR: "514"
BYOND_MINOR: "1589"
SPACEMAN_DMM_VERSION: suite-1.7.3
SPACEMAN_DMM_VERSION: suite-1.9

jobs:
PreFlight:
Expand Down
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"
]
}
11 changes: 9 additions & 2 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include "code\__defines\subsystems.dm"
#include "code\__defines\targeting.dm"
#include "code\__defines\temperature.dm"
#include "code\__defines\time.dm"
#include "code\__defines\topic.dm"
#include "code\__defines\turfs.dm"
#include "code\__defines\webhooks.dm"
Expand Down Expand Up @@ -125,6 +126,7 @@
#include "code\_helpers\spawn_sync.dm"
#include "code\_helpers\species.dm"
#include "code\_helpers\storage.dm"
#include "code\_helpers\system.dm"
#include "code\_helpers\text.dm"
#include "code\_helpers\time.dm"
#include "code\_helpers\tools.dm"
Expand Down Expand Up @@ -319,7 +321,6 @@
#include "code\datums\extensions\multitool\store.dm"
#include "code\datums\extensions\multitool\circuitboards\buildtype_select.dm"
#include "code\datums\extensions\multitool\circuitboards\circuitboards.dm"
#include "code\datums\extensions\multitool\circuitboards\shuttle_console.dm"
#include "code\datums\extensions\multitool\circuitboards\stationalert.dm"
#include "code\datums\extensions\multitool\items\clothing.dm"
#include "code\datums\extensions\multitool\items\items.dm"
Expand Down Expand Up @@ -796,6 +797,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 @@ -934,6 +936,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 @@ -1212,7 +1216,6 @@
#include "code\game\objects\structures\extinguisher.dm"
#include "code\game\objects\structures\fireaxe_cabinet.dm"
#include "code\game\objects\structures\fitness.dm"
#include "code\game\objects\structures\flora.dm"
#include "code\game\objects\structures\fountain.dm"
#include "code\game\objects\structures\girders.dm"
#include "code\game\objects\structures\grille.dm"
Expand Down Expand Up @@ -1275,6 +1278,8 @@
#include "code\game\objects\structures\crates_lockers\closets\secure\scientist.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\security.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\service.dm"
#include "code\game\objects\structures\flora\flora.dm"
#include "code\game\objects\structures\flora\tree.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\bed.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\chairs.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\stools.dm"
Expand Down Expand Up @@ -1360,6 +1365,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 @@ -3321,5 +3327,6 @@
#include "interface\skin.dmf"
#include "maps\_map_include.dm"
#include "maps\_maps.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
6 changes: 0 additions & 6 deletions code/__defines/MC.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,3 @@ if(Datum.is_processing) {\
****/

#define addtimer(args...) _addtimer(args, source ="[__FILE__]#[__LINE__]")

/****
* Helper for waits
****/

#define UNTIL(X) while(!(X)) stoplag()
Loading

0 comments on commit 6a62adc

Please sign in to comment.