Skip to content

Commit

Permalink
Merge branch 'master' into vander
Browse files Browse the repository at this point in the history
  • Loading branch information
TheManWithNoHands authored Sep 16, 2024
2 parents 6a3fc91 + 7429231 commit b9ba27c
Show file tree
Hide file tree
Showing 79 changed files with 732 additions and 374 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/auto_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.app-token-generation.outputs.token }}

- name: Run auto changelog
uses: actions/github-script@v6
with:
script: |
const { processAutoChangelog } = await import('${{ github.workspace }}/tools/pull_request_hooks/autoChangelog.js')
await processAutoChangelog({ github, context })
github-token: ${{ secrets.BOT_TOKEN_CM || secrets.GITHUB_TOKEN }}
github-token: ${{ steps.app-token-generation.outputs.token }}
15 changes: 12 additions & 3 deletions .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:
unset SECRET_EXISTS
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
echo "ACTIONS_ENABLED=$SECRET_EXISTS" >> $GITHUB_OUTPUT
- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: "Setup python"
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: actions/setup-python@v3
Expand All @@ -35,20 +43,21 @@ jobs:
with:
fetch-depth: 25
persist-credentials: false
token: ${{ steps.app-token-generation.outputs.token }}
- name: "Compile"
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
python .github/ss13_genchangelog.py html/changelogs
- name: Commit
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
git config --local user.email "action@github.com"
git config --local user.name "Changelogs"
git config --local user.email "${{ secrets.APP_PUBLIC_ID }}+${{ secrets.APP_PUBLIC_NAME }}[bot]@users.noreply.github.com"
git config --local user.name "${{ secrets.APP_PUBLIC_NAME }}[bot]"
git pull origin master
git add html/changelogs/archive
git commit -m "Automatic changelog compile [ci skip]" -a || true
- name: "Push"
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.BOT_TOKEN_CM || secrets.GITHUB_TOKEN }}
github_token: ${{ steps.app-token-generation.outputs.token }}
10 changes: 9 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ jobs:
unset SECRET_EXISTS
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
echo "ACTIONS_ENABLED=$SECRET_EXISTS" >> $GITHUB_OUTPUT
- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Get The Script
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
Expand All @@ -35,5 +43,5 @@ jobs:
python add_labels.py
env:
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOKEN: ${{ steps.app-token-generation.outputs.token }}
PR_NUMBER: ${{ github.event.number }}
9 changes: 8 additions & 1 deletion .github/workflows/run_approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ jobs:
name: Automatic Approve Workflows
runs-on: ubuntu-latest
steps:
- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Automatic Approve
uses: mheap/automatic-approve-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ steps.app-token-generation.outputs.token }}
workflows: "ci_suite.yml"
dangerous_files: "build.bat"
10 changes: 9 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ steps.app-token-generation.outputs.token }}
stale-pr-message: "This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself"
days-before-stale: 7
days-before-close: 7
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ jobs:
concurrency: changelog
runs-on: ubuntu-latest
steps:

- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps"
id: value_holder
env:
Expand All @@ -31,6 +39,8 @@ jobs:
- name: Checkout
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: actions/checkout@v3
with:
token: ${{ steps.app-token-generation.outputs.token }}
- name: Fetch Changelog
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
Expand All @@ -45,12 +55,12 @@ jobs:
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
git pull origin master
git config --local user.email "action@github.com"
git config --local user.name "Changelogs"
git config --local user.email "${{ secrets.APP_PUBLIC_ID }}+${{ secrets.APP_PUBLIC_NAME }}[bot]@users.noreply.github.com"
git config --local user.name "${{ secrets.APP_PUBLIC_NAME }}[bot]"
git add html/changelogs/archive
git commit -m "Automatic changelog compile [ci skip]" -a || true
- name: "Push"
if: steps.value_holder.outputs.ACTIONS_ENABLED
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ steps.app-token-generation.outputs.token }}
16 changes: 13 additions & 3 deletions .github/workflows/update_tgs_dmapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ jobs:
runs-on: ubuntu-latest
name: Update the TGS DMAPI
steps:

- name: Generate App Token
id: app-token-generation
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Clone
uses: actions/checkout@v3
with:
token: ${{ steps.app-token-generation.outputs.token }}

- name: Branch
run: |
Expand All @@ -28,8 +38,8 @@ jobs:
- name: Commit and Push
continue-on-error: true
run: |
git config user.name tgstation-server
git config user.email tgstation-server@users.noreply.github.com
git config user.name "${{ secrets.APP_PUBLIC_NAME }}[bot]"
git config user.email "${{ secrets.APP_PUBLIC_ID }}+${{ secrets.APP_PUBLIC_NAME }}[bot]@users.noreply.github.com"
git add .
git commit -m 'Update TGS DMAPI'
git push -f -u origin tgs-dmapi-update
Expand All @@ -44,4 +54,4 @@ jobs:
pr_body: "This pull request updates the TGS DMAPI to the latest version. Please note any breaking or unimplemented changes before merging."
pr_label: "Tools"
pr_allow_empty: false
github_token: ${{ secrets.BOT_TOKEN_CM }}
github_token: ${{ steps.app-token-generation.outputs.token }}
13 changes: 12 additions & 1 deletion code/__DEFINES/client_prefs.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#define BE_ALIEN_AFTER_DEATH (1<<0)
#define BE_AGENT (1<<1)

/// Determines how abilities are activated, whether they're activated via middle click, shift click or right click.
#define XENO_ABILITY_CLICK_MIDDLE 1
#define XENO_ABILITY_CLICK_SHIFT 2
#define XENO_ABILITY_CLICK_RIGHT 3

/// Update this to whatever the largest value of the XENO_ABILITY_CLICK_* defines is.
#define XENO_ABILITY_CLICK_MAX 3

//toggle_prefs bits from /datum/preferences
#define TOGGLE_IGNORE_SELF (1<<0) // Determines whether you will not hurt yourself when clicking yourself
#define TOGGLE_HELP_INTENT_SAFETY (1<<1) // Determines whether help intent will be completely harmless
#define TOGGLE_MIDDLE_MOUSE_CLICK (1<<2) // This toggles whether selected ability for xeno uses middle mouse clicking or shift clicking
// Deprecated. Can't remove this or bitshift values down because it would fuck up the savefiles
// Feel free to replace this whatever you want, if you can find a useful toggle for it. Alternatively, don't because savefiles using flags
// Is a complete and utter mistake.
#define TOGGLE_FREE_PLACE_YOUR_OWN_TOGGLE_HERE (1<<2)
#define TOGGLE_DIRECTIONAL_ATTACK (1<<3) // This toggles whether attacks for xeno use directional attacks
#define TOGGLE_AUTO_EJECT_MAGAZINE_OFF (1<<4) // This toggles whether guns with auto ejectors will not auto eject their magazines
// MUTUALLY EXCLUSIVE TO TOGGLE_AUTO_EJECT_MAGAZINE_TO_HAND
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ See also /datum/surgery_step/cut_larval_pseudoroots, /datum/surgery_step/retract
/obj/item/tool/surgery/scalpel/pict_system = SURGERY_TOOL_MULT_SUBOPTIMAL,\
/obj/item/attachable/bayonet = SURGERY_TOOL_MULT_SUBSTITUTE,\
/obj/item/tool/kitchen/knife = SURGERY_TOOL_MULT_SUBSTITUTE,\
/obj/item/weapon/throwing_knife = SURGERY_TOOL_MULT_AWFUL,\
/obj/item/shard = SURGERY_TOOL_MULT_AWFUL\
)

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/tgs.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tgstation-server DMAPI
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF RFC 2119.

#define TGS_DMAPI_VERSION "7.2.1"
#define TGS_DMAPI_VERSION "7.3.0"

// All functions and datums outside this document are subject to change with any version and should not be relied on.

Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#define format_frequency(f) "[floor((f) / 10)].[(f) % 10]"

#define reverse_direction(direction) ( \
( dir & (NORTH|SOUTH) ? ~dir & (NORTH|SOUTH) : 0 ) | \
( dir & (EAST|WEST) ? ~dir & (EAST|WEST) : 0 ) \
( direction & (NORTH|SOUTH) ? ~direction & (NORTH|SOUTH) : 0 ) | \
( direction & (EAST|WEST) ? ~direction & (EAST|WEST) : 0 ) \
)

// The sane, counter-clockwise angle to turn to get from /direction/ A to /direction/ B
Expand Down Expand Up @@ -1436,7 +1436,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
if(isRemoteControlling(user))
return TRUE
// If the user is not a xeno (with active ability) with the shift click pref on, we examine. God forgive me for snowflake
if(user.client?.prefs && !(user.client?.prefs?.toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK))
if(user.get_ability_mouse_key() == XENO_ABILITY_CLICK_SHIFT)
if(isxeno(user))
var/mob/living/carbon/xenomorph/X = user
if(X.selected_ability)
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

/atom/movable/screen/close
name = "close"
icon_state = "x"
icon_state = "close"


/atom/movable/screen/close/clicked(mob/user)
Expand Down
26 changes: 16 additions & 10 deletions code/_onclick/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@


/mob/living/carbon/human/click(atom/A, list/mods)
if(mods["shift"] && !mods["middle"])
if(selected_ability && client && client.prefs && !(client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK))
selected_ability.use_ability(A)
return TRUE

if(mods["middle"] && !mods["shift"])
if(selected_ability && client && client.prefs && client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK)
selected_ability.use_ability(A)
return TRUE
var/use_ability = FALSE
switch(get_ability_mouse_key())
if(XENO_ABILITY_CLICK_SHIFT)
if(mods[SHIFT_CLICK] && mods[LEFT_CLICK])
use_ability = TRUE
if(XENO_ABILITY_CLICK_MIDDLE)
if(mods[MIDDLE_CLICK] && !mods[SHIFT_CLICK])
use_ability = TRUE
if(XENO_ABILITY_CLICK_RIGHT)
if(mods[RIGHT_CLICK])
use_ability = TRUE

if(selected_ability && use_ability)
selected_ability.use_ability(A)
return TRUE

if(interactee)
var/result = interactee.handle_click(src, A, mods)
if(result != HANDLE_CLICK_PASS_THRU)
return result

if (mods["middle"] && !mods["shift"] && ishuman(A) && get_dist(src, A) <= 1)
if (mods[MIDDLE_CLICK] && !mods[SHIFT_CLICK] && ishuman(A) && get_dist(src, A) <= 1)
var/mob/living/carbon/human/H = A
H.receive_from(src)
return TRUE
Expand Down
25 changes: 18 additions & 7 deletions code/_onclick/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ so that it doesn't double up on the delays) so that it applies the delay immedia
handle_queued_action(target)
return TRUE

var/alt_pressed = mods["alt"] == "1"
var/shift_pressed = mods["shift"] == "1"
var/middle_pressed = mods["middle"] == "1"
var/left_pressed = mods[LEFT_CLICK] == "1"
var/alt_pressed = mods[ALT_CLICK] == "1"
var/shift_pressed = mods[SHIFT_CLICK] == "1"
var/middle_pressed = mods[MIDDLE_CLICK] == "1"
var/right_pressed = mods[RIGHT_CLICK] == "1"

if(alt_pressed && shift_pressed)
if(istype(target, /mob/living/carbon/xenomorph))
Expand All @@ -126,15 +128,24 @@ so that it doesn't double up on the delays) so that it applies the delay immedia
next_move = world.time + 3 // Some minimal delay so this isn't crazy spammy
return TRUE

var/middle_pref = client.prefs && (client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK) != 0 // client is already tested to be non-null by caller
if(selected_ability && shift_pressed == !middle_pref && middle_pressed == middle_pref)
var/preference = get_ability_mouse_key() // client is already tested to be non-null by caller
var/activate_ability = FALSE
switch(preference)
if(XENO_ABILITY_CLICK_MIDDLE)
activate_ability = middle_pressed && !shift_pressed
if(XENO_ABILITY_CLICK_RIGHT)
activate_ability = right_pressed
if(XENO_ABILITY_CLICK_SHIFT)
activate_ability = left_pressed && shift_pressed

if(activate_ability && selected_ability)
if(istype(target, /atom/movable/screen))
// Click through the UI: Currently this won't attempt to sprite click any mob there, just the turf
var/turf/turf = params2turf(mods["screen-loc"], get_turf(client.eye), client)
if(turf)
target = turf
if(selected_ability.use_ability_wrapper(target, mods))
return TRUE
selected_ability.use_ability_wrapper(target, mods)
return TRUE

if(next_move >= world.time)
return FALSE
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ This maintains a list of ip addresses that are able to bypass topic filtering.

/datum/config_entry/string/regular_adminhelp_webhook_url

/datum/config_entry/string/profiler_webhook_url

/datum/config_entry/string/adminhelp_webhook_pfp

/datum/config_entry/string/adminhelp_webhook_name
Expand Down
19 changes: 19 additions & 0 deletions code/controllers/subsystem/profiler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ SUBSYSTEM_DEF(profiler)
if(CONFIG_GET(flag/auto_profile))
DumpFile(allow_yield = FALSE)
world.Profile(PROFILE_CLEAR, type = "sendmaps")
if(CONFIG_GET(string/profiler_webhook_url))
SendInfoToDiscord()
return ..()

/datum/controller/subsystem/profiler/proc/StartProfiling()
Expand Down Expand Up @@ -70,5 +72,22 @@ SUBSYSTEM_DEF(profiler)
WRITE_FILE(sendmaps_file, current_sendmaps_data)
write_cost = MC_AVERAGE(write_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))

/proc/sort_overtime_data(list/A, list/B)
return B["over"] - A["over"]

/datum/controller/subsystem/profiler/proc/SendInfoToDiscord()
var/current_profile_data = world.Profile(PROFILE_REFRESH, format = "json")
var/list/data = json_decode(current_profile_data)

sortTim(data, GLOBAL_PROC_REF(sort_overtime_data))

var/datum/discord_embed/embed = new()
embed.title = "Profile of Round #[GLOB.round_id] - Highest Overtiming Procs"
embed.fields = list()
for(var/i in 1 to 10)
var/list/entry = data[i]
embed.fields[entry["name"]] = "**Overtime:** [entry["over"]], **Self Cost:** [entry["self"]], **Total Cost:** [entry["total"]], **Calls:** [entry["calls"]]"
send2webhook(embed, CONFIG_GET(string/profiler_webhook_url))

#undef PROFILER_FILENAME
#undef SENDMAPS_FILENAME
Loading

0 comments on commit b9ba27c

Please sign in to comment.