Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Expands the SS13.lua module by adding loop helpers and functions to get the script runner. #186

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Skyrat: Skyrat-SS13/Skyrat-tg#24470
Original PR: tgstation/tgstation#79081

About The Pull Request

SS13.get_runner_client() and SS13.get_runner_ckey will return the client and the ckey respectively of the user who ran the lua script. Can be unreliable after the first sleep or yield.
The SS13 module can now be made local as the tables that need to be accessed globally have been moved to their own global variables.
Added SS13.start_loop(time, amount, func), SS13.end_loop(id), SS13.stop_all_loops() that allow lua scripts to more easily make loops. Removed the timer parameter from these functions, which specified the timer subsystem to use.
Documentation on all new added functions have been added in the lua/README.md

Why It's Good For The Game

Getting the client who ran the script and the ckey that ran the script is useful for self contained scripts that are looking for an entrypoint (e.g. location to spawn some item/mob/structure). dm.usr is a special variable used for other purposes and can be unreliable when used this way even if there haven't been any sleeps or yields yet, so having a dedicated variable and function to handle it makes things easier.

Being able to make the SS13 module local allows for more self-contained scripts. Although this isn't super helpful because require will still load the same object for all lua scripts loaded on the same state.

Basic looping helpers allow for lua scripts to more easily create loops without needing to recursively do a set_timeout or to do a while(true) do SS13.wait(1) end loop.

Changelog

🆑 Watermelon914
admin: Added SS13.get_runner_ckey() and SS13.get_runner_client() which stores the ckey and returns the client of the user who ran the lua script. Can be unreliable if accessed after sleeping.
admin: Added timer loop helpers to the SS13.lua module, check the docs
admin: The SS13.lua module can now be made local without causing any errors.
/:cl:

…ions to get the script runner. [MDB IGNORE] (#24470)

* Expands the SS13.lua module by adding loop helpers and functions to get the script runner. (#79081)

## About The Pull Request
`SS13.get_runner_client()` and `SS13.get_runner_ckey` will return the
client and the ckey respectively of the user who ran the lua script. Can
be unreliable after the first sleep or yield.
The SS13 module can now be made local as the tables that need to be
accessed globally have been moved to their own global variables.
Added `SS13.start_loop(time, amount, func)`, `SS13.end_loop(id)`,
`SS13.stop_all_loops()` that allow lua scripts to more easily make
loops. Removed the `timer` parameter from these functions, which
specified the timer subsystem to use.
Documentation on all new added functions have been added in the
lua/README.md

## Why It's Good For The Game
Getting the client who ran the script and the ckey that ran the script
is useful for self contained scripts that are looking for an entrypoint
(e.g. location to spawn some item/mob/structure). `dm.usr` is a special
variable used for other purposes and can be unreliable when used this
way even if there haven't been any sleeps or yields yet, so having a
dedicated variable and function to handle it makes things easier.

Being able to make the SS13 module local allows for more self-contained
scripts. Although this isn't super helpful because `require` will still
load the same object for all lua scripts loaded on the same state.

Basic looping helpers allow for lua scripts to more easily create loops
without needing to recursively do a `set_timeout` or to do a
`while(true) do SS13.wait(1) end` loop.

## Changelog
:cl:
admin: Added SS13.get_runner_ckey() and SS13.get_runner_client() which
stores the ckey and returns the client of the user who ran the lua
script. Can be unreliable if accessed after sleeping.
admin: Added timer loop helpers to the SS13.lua module, check the docs
admin: The SS13.lua module can now be made local without causing any
errors.
/:cl:

---------

Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>

* Expands the SS13.lua module by adding loop helpers and functions to get the script runner.

---------

Co-authored-by: Watermelon914 <[email protected]>
Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
@Iajret Iajret merged commit fe1de1c into master Oct 20, 2023
23 checks passed
@Iajret Iajret deleted the upstream-mirror-24470 branch October 20, 2023 23:15
AnywayFarus added a commit that referenced this pull request Oct 20, 2023
Iajret pushed a commit that referenced this pull request Jan 6, 2024
* seperates mothic from chitinclick

* modularifies mothic and adds more syllables to both languages

* removes some lines

* im el stupido

* hHHHUUAAAEGHH

* Update modular_nova/modules/customization/modules/language/mothic.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* forgot to change icon path for chitinclick

---------

Co-authored-by: GoldenAlpharex <[email protected]>
Co-authored-by: Bloop <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants