Skip to content

Commit

Permalink
adds tgui (now real!) (discordia-space#7685)
Browse files Browse the repository at this point in the history
* tgui files

* make tgui build

* well it's tgui (base)

* make tgui functional + changelog is tgooey now

* #warn Building with Dream Maker is no longer supported and will result in errors (tgui not exist etc...).
#warn In order to build, run BUILD.bat in the root directory.
#warn Consider switching to VSCode editor instead, where you can press Ctrl+Shift+B to build.

* screenshot test

* surely this is chmod by git right

* make image test work properly

* fix prettier

* allow critical verbs to run even if the serv is laggin

* no deleted timers in buckets

* incoming merge conflict hell :D
  • Loading branch information
LetterN authored Oct 21, 2022
1 parent a78f3f7 commit 13c3e58
Show file tree
Hide file tree
Showing 1,014 changed files with 125,333 additions and 9,505 deletions.
63 changes: 54 additions & 9 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
with:
path: ~/SpacemanDMM
key: ${{ runner.os }}-spacemandmm-${{ secrets.CACHE_PURGE_KEY }}
# - name: Restore Yarn cache
# uses: actions/cache@v3
# with:
# path: tgui/.yarn/cache
# key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}-${{ hashFiles('tgui/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ secrets.CACHE_PURGE_KEY }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-
- name: Restore Yarn cache
uses: actions/cache@v3
with:
path: tgui/.yarn/cache
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}-${{ hashFiles('tgui/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ secrets.CACHE_PURGE_KEY }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Tools
run: |
pip3 install setuptools
Expand All @@ -36,8 +36,11 @@ jobs:
- name: Run Linters
run: |
bash tools/ci/check_filedirs.sh cev_eris.dme
bash tools/ci/check_changelogs.sh
bash tools/ci/check_grep.sh
bash tools/ci/check_misc.sh
tools/bootstrap/python tools/validate_dme.py <cev_eris.dme
tools/build/build --ci lint tgui-test
tools/bootstrap/python -m dmi.test
tools/bootstrap/python -m mapmerge2.dmm_test
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
Expand Down Expand Up @@ -103,6 +106,48 @@ jobs:
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh ${{ matrix.map }}
- name: Upload screenshot tests
if: always()
uses: actions/upload-artifact@v3
with:
name: test_artifacts_${{ matrix.map }}
path: data/screenshots_new/
retention-days: 1

compare_screenshots:
if: "!contains(github.event.head_commit.message, '[ci skip]') && always()"
needs: [run_all_tests]
name: Compare Screenshot Tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
# If we ever add more artifacts, this is going to break, but it'll be obvious.
- name: Download screenshot tests
uses: actions/download-artifact@v3
with:
path: artifacts
- name: ls -R
run: ls -R artifacts
- name: Setup screenshot comparison
run: npm i
working-directory: tools/screenshot-test-comparison
- name: Run screenshot comparison
run: node tools/screenshot-test-comparison/index.js artifacts code/modules/unit_tests/screenshots artifacts/screenshot_comparisons
# workflow_run does not give you the PR it ran on,
# even through the thing literally named "matching pull requests".
# However, in GraphQL, you can check if the check suite was ran
# by a specific PR, so trusting the (user controlled) action here is okay,
# as long as we check it later in show_screenshot_test_results
- name: Save PR ID
if: failure() && github.event.pull_request
run: |
echo ${{ github.event.pull_request.number }} > artifacts/screenshot_comparisons/pull_request_number.txt
- name: Upload bad screenshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: bad-screenshots
path: artifacts/screenshot_comparisons

test_windows:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Compile changelogs
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
compile:
Expand All @@ -12,41 +13,42 @@ jobs:
- name: "Check for CHANGELOG_ENABLER secret and pass true to output if it exists to be checked by later steps"
id: value_holder
env:
CHANGELOG_ENABLER: ${{ secrets.CHANGELOG_ENABLER }}
ENABLER_SECRET: ${{ secrets.CHANGELOG_ENABLER }}
run: |
unset SECRET_EXISTS
if [ -n $CHANGELOG_ENABLER ]; then SECRET_EXISTS='true' ; fi
echo ::set-output name=CL_ENABLED::${SECRET_EXISTS}
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS"
- name: "Setup python"
if: steps.value_holder.outputs.CL_ENABLED
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: "Install deps"
if: steps.value_holder.outputs.CL_ENABLED
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml bs4
python -m pip install pyyaml
sudo apt-get install dos2unix
- name: "Checkout"
if: steps.value_holder.outputs.CL_ENABLED
uses: actions/checkout@v1
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: actions/checkout@v3
with:
fetch-depth: 25
persist-credentials: false
- name: "Compile"
if: steps.value_holder.outputs.CL_ENABLED
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
python tools/changelog/ss13_genchangelog.py html/changelog.html html/changelogs
python tools/ss13_genchangelog.py html/changelogs
- name: Commit
if: steps.value_holder.outputs.CL_ENABLED
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
git config --local user.email "[email protected]"
git config --local user.name "Changelogs"
git pull origin master
git add html/changelogs
git commit -m "Automatic changelog compile [ci skip]" -a || true
- name: "Push"
if: steps.value_holder.outputs.CL_ENABLED
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.COMFY_ORANGE_PAT || secrets.GITHUB_TOKEN }}
29 changes: 0 additions & 29 deletions .github/workflows/make_changelogs.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
/sound/tts_cache/**/*
/sound/tts_scrambled/**/*

#Ignore IDE files we don't need in the repo.
/.vs/**/*
/tgstation/FileContentIndex/**/*
/FileContentIndex/**/*
/v17/**/*
/v18/**/*
/v19/**/*
/v20/**/*
/v21/**/*
/v22/**/*

# Ignore compiled linux libs in the root folder, e.g. librust_g.so
/*.so

Expand Down Expand Up @@ -200,3 +211,14 @@ Temporary Items
/tools/LinuxOneShot/TGS_Config
/tools/LinuxOneShot/TGS_Instances
/tools/LinuxOneShot/TGS_Logs

# Built auxtools libraries and intermediate files
aux*.dll
libaux*.so
aux*.pdb

# JavaScript tools
**/node_modules

# Screenshot tests
/artifacts
13 changes: 13 additions & 0 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "code\__DEFINES\colors.dm"
#include "code\__DEFINES\components.dm"
#include "code\__DEFINES\construction.dm"
#include "code\__DEFINES\cooldowns.dm"
#include "code\__DEFINES\craft.dm"
#include "code\__DEFINES\cyborg_traits.dm"
#include "code\__DEFINES\damage_organs.dm"
Expand Down Expand Up @@ -81,6 +82,7 @@
#include "code\__DEFINES\trade.dm"
#include "code\__DEFINES\turfs.dm"
#include "code\__DEFINES\typeids.dm"
#include "code\__DEFINES\verb_manager.dm"
#include "code\__DEFINES\weapons.dm"
#include "code\__DEFINES\ZAS.dm"
#include "code\__DEFINES\spawner\_spawner.dm"
Expand Down Expand Up @@ -244,10 +246,12 @@
#include "code\controllers\subsystems\staverbs.dm"
#include "code\controllers\subsystems\sun.dm"
#include "code\controllers\subsystems\supply.dm"
#include "code\controllers\subsystems\tgui.dm"
#include "code\controllers\subsystems\ticker.dm"
#include "code\controllers\subsystems\timer.dm"
#include "code\controllers\subsystems\tips_manager.dm"
#include "code\controllers\subsystems\trade.dm"
#include "code\controllers\subsystems\verb_manager.dm"
#include "code\controllers\subsystems\vote.dm"
#include "code\controllers\subsystems\wireless.dm"
#include "code\controllers\subsystems\xenoarch.dm"
Expand Down Expand Up @@ -290,6 +294,7 @@
#include "code\datums\recoil.dm"
#include "code\datums\security_state.dm"
#include "code\datums\sound_player.dm"
#include "code\datums\verb_callbacks.dm"
#include "code\datums\weakref.dm"
#include "code\datums\autolathe\ammo.dm"
#include "code\datums\autolathe\autolathe_datums.dm"
Expand All @@ -308,6 +313,7 @@
#include "code\datums\autolathe\prostheses.dm"
#include "code\datums\autolathe\security.dm"
#include "code\datums\autolathe\tools.dm"
#include "code\datums\changelog\changelog.dm"
#include "code\datums\components\_component.dm"
#include "code\datums\components\clothing_sanity_protection.dm"
#include "code\datums\components\fabric.dm"
Expand Down Expand Up @@ -345,6 +351,7 @@
#include "code\datums\helper_datums\topic_input.dm"
#include "code\datums\mob_modifications\mob_modifications.dm"
#include "code\datums\mob_modifications\modification_types.dm"
#include "code\datums\mocking\client.dm"
#include "code\datums\movement\_defines.dm"
#include "code\datums\movement\atom_movable.dm"
#include "code\datums\movement\mob.dm"
Expand Down Expand Up @@ -2796,6 +2803,12 @@
#include "code\modules\telesci\telesci_computer.dm"
#include "code\modules\text_to_speech\tts_html.dm"
#include "code\modules\text_to_speech\tts_main.dm"
#include "code\modules\tgui\external.dm"
#include "code\modules\tgui\states.dm"
#include "code\modules\tgui\status_composers.dm"
#include "code\modules\tgui\tgui.dm"
#include "code\modules\tgui\tgui_window.dm"
#include "code\modules\tgui\states\always.dm"
#include "code\modules\tips_and_tricks\gameplay.dm"
#include "code\modules\tips_and_tricks\jobs.dm"
#include "code\modules\tips_and_tricks\mobs.dm"
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/callbacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/// A shorthand for the callback datum, [documented here](datum/callback.html)
#define CALLBACK new /datum/callback
#define INVOKE_ASYNC world.ImmediateInvokeAsync
/// like CALLBACK but specifically for verb callbacks
#define VERB_CALLBACK new /datum/callback/verb_callback

#define CALLBACK_NEW(typepath, args) CALLBACK(GLOBAL_PROC, /proc/___callbacknew, typepath, args)
3 changes: 3 additions & 0 deletions code/__DEFINES/components.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#define COMSIG_GROUP_RITUAL "grup_ritual"
#define COMSIG_TRANSATION "transation" //from transfer_funds()

/// from datum ui_act (usr, action)
#define COMSIG_UI_ACT "COMSIG_UI_ACT"

// /atom signals
#define COMSIG_EXAMINE "examine" //from atom/examine(): (mob/user, distance)
#define COMSIG_ATOM_UPDATE_OVERLAYS "atom_update_overlays" //update_overlays()
Expand Down
63 changes: 63 additions & 0 deletions code/__DEFINES/cooldowns.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//// COOLDOWN SYSTEMS
/*
* We have 2 cooldown systems: timer cooldowns (divided between stoppable and regular) and world.time cooldowns.
*
* When to use each?
*
* * Adding a commonly-checked cooldown, like on a subsystem to check for processing
* * * Use the world.time ones, as they are cheaper.
*
* * Adding a rarely-used one for special situations, such as giving an uncommon item a cooldown on a target.
* * * Timer cooldown, as adding a new variable on each mob to track the cooldown of said uncommon item is going too far.
*
* * Triggering events at the end of a cooldown.
* * * Timer cooldown, registering to its signal.
*
* * Being able to check how long left for the cooldown to end.
* * * Either world.time or stoppable timer cooldowns, depending on the other factors. Regular timer cooldowns do not support this.
*
* * Being able to stop the timer before it ends.
* * * Either world.time or stoppable timer cooldowns, depending on the other factors. Regular timer cooldowns do not support this.
*/


//TIMER COOLDOWN MACROS

#define COMSIG_CD_STOP(cd_index) "cooldown_[cd_index]"
#define COMSIG_CD_RESET(cd_index) "cd_reset_[cd_index]"

#define TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, /proc/end_cooldown, cd_source, cd_index), cd_time))

#define TIMER_COOLDOWN_CHECK(cd_source, cd_index) LAZYACCESS(cd_source.cooldowns, cd_index)

#define TIMER_COOLDOWN_END(cd_source, cd_index) LAZYREMOVE(cd_source.cooldowns, cd_index)

/*
* Stoppable timer cooldowns.
* Use indexes the same as the regular tiemr cooldowns.
* They make use of the TIMER_COOLDOWN_CHECK() and TIMER_COOLDOWN_END() macros the same, just not the TIMER_COOLDOWN_START() one.
* A bit more expensive than the regular timers, but can be reset before they end and the time left can be checked.
*/

#define S_TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, /proc/end_cooldown, cd_source, cd_index), cd_time, TIMER_STOPPABLE))

#define S_TIMER_COOLDOWN_RESET(cd_source, cd_index) reset_cooldown(cd_source, cd_index)

#define S_TIMER_COOLDOWN_TIMELEFT(cd_source, cd_index) (timeleft(TIMER_COOLDOWN_CHECK(cd_source, cd_index)))


/*
* Cooldown system based on storing world.time on a variable, plus the cooldown time.
* Better performance over timer cooldowns, lower control. Same functionality.
*/

#define COOLDOWN_DECLARE(cd_index) var/##cd_index = 0

#define COOLDOWN_START(cd_source, cd_index, cd_time) (cd_source.cd_index = world.time + (cd_time))

//Returns true if the cooldown has run its course, false otherwise
#define COOLDOWN_FINISHED(cd_source, cd_index) (cd_source.cd_index < world.time)

#define COOLDOWN_RESET(cd_source, cd_index) cd_source.cd_index = 0

#define COOLDOWN_TIMELEFT(cd_source, cd_index) (max(0, cd_source.cd_index - world.time))
2 changes: 2 additions & 0 deletions code/__DEFINES/subsystems-priority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ var/list/bitflags = list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096
#define SS_PRIORITY_DEFAULT 50 // Default priority for both normal and background processes

// Normal
#define FIRE_PRIORITY_DELAYED_VERBS 950
#define FIRE_PRIORITY_TIMER 700
#define SS_PRIORITY_TICKER 200 // Gameticker processing.
#define FIRE_PRIORITY_TGUI 110
#define SS_PRIORITY_MOB 100 // Mob Life().
#define SS_PRIORITY_CHAT 100 // Chat subsystem.
#define SS_PRIORITY_MACHINERY 100 // Machinery + powernet ticks.
Expand Down
Loading

0 comments on commit 13c3e58

Please sign in to comment.