Commit Graph

161 Commits

Author SHA1 Message Date
Waterpig
bb70889f6e TG Upstream Part 1
3591 individual conflicts

Update build.js

Update install_node.sh

Update byond.js

oh my fucking god

hat

slow

huh

holy shit

we all fall down

2 more I missed

2900 individual conflicts

2700 Individual conflicts

replaces yarn file with tg version, bumping us down to 2200-ish

Down to 2000 individual conflicts

140 down

mmm

aaaaaaaaaaaaaaaaaaa

not yt

575

soon

900 individual conflicts

600 individual conflicts, 121 file conflicts

im not okay

160 across 19 files

29 in 4 files

0 conflicts, compiletime fix time

some minor incap stuff

missed ticks

weird dupe definition stuff

missed ticks 2

incap fixes

undefs and pie fix

Radio update and some extra minor stuff

returns a single override

no more dupe definitions, 175 compiletime errors

Unticked file fix

sound and emote stuff

honk and more radio stuff
2024-10-19 08:04:33 -07:00
Waterpig
4c4930c71d Merge branch 'master' of https://github.com/tgstation/tgstation into pulls-tg-to-fix-shit 2024-09-08 00:59:39 +02:00
klorpa
e1bf793264 Spelling and Grammar Fixes (#86022)
## About The Pull Request
Fixes several errors to spelling, grammar, and punctuation.
## Why It's Good For The Game
## Changelog
🆑
spellcheck: fixed a few typos
/🆑
2024-08-23 21:49:46 +02:00
norsvenska
aefec7cb2b Corrects 200+ instances of "it's" where it should've been "its" instead (#85169)
## About The Pull Request

it's - conjunction of "it" and "is"
its - possessive form of "it"

grammar is hard, and there were a lot of places where "it's" was used
where it shouldn't have been. i went and painstakingly searched the
entire repository for these instances, spending a few hours on it. i
completely ignored the changelog archive, and i may have missed some
outliers. most player-facing ones should be corrected, though
## Why It's Good For The Game
proper grammar is good

## Changelog
🆑
spellcheck: Numerous instances of "it's" have been properly replaced
with "its"
/🆑
2024-07-21 15:47:03 -04:00
norsvenska
5f80128fa9 Corrects 200+ instances of "it's" where it should've been "its" instead (#85169)
## About The Pull Request

it's - conjunction of "it" and "is"
its - possessive form of "it"

grammar is hard, and there were a lot of places where "it's" was used
where it shouldn't have been. i went and painstakingly searched the
entire repository for these instances, spending a few hours on it. i
completely ignored the changelog archive, and i may have missed some
outliers. most player-facing ones should be corrected, though
## Why It's Good For The Game
proper grammar is good

## Changelog
🆑
spellcheck: Numerous instances of "it's" have been properly replaced
with "its"
/🆑
2024-07-21 13:41:37 -06:00
SkyratBot
f1928357e3 [MIRROR] Fixes smoothing breaking if a map is loaded post init (#26553)
* Fixes smoothing breaking if a map is loaded post init (#81526)

## About The Pull Request

We'd finish a set of atom creation, then try and smooth those atoms The
problem is they might try and smooth with an uninitialized neighbor,
which wouldn't have its smoothing vars parsed.

This fixes that by pooling "to be smoothed" things into a list based off
the source of the init stoppage, which we then release when we're done.

Also fixes things staying in mapload, even during a sleep. This can
cause massive headaches so it's good to avoid.

This has a cost but it's minuscule (on the order of like 0.006s (6ms
over all of init), so I'm happy with it.

## Why It's Good For The Game

Closes #77040

## Changelog
🆑
fix: Maps loaded in after roundstart will no longer have broken
smoothing
/🆑

* Fixes smoothing breaking if a map is loaded post init

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2024-02-19 01:23:33 +01:00
LemonInTheDark
1e420947b1 Fixes smoothing breaking if a map is loaded post init (#81526)
## About The Pull Request

We'd finish a set of atom creation, then try and smooth those atoms The
problem is they might try and smooth with an uninitialized neighbor,
which wouldn't have its smoothing vars parsed.

This fixes that by pooling "to be smoothed" things into a list based off
the source of the init stoppage, which we then release when we're done.

Also fixes things staying in mapload, even during a sleep. This can
cause massive headaches so it's good to avoid.

This has a cost but it's minuscule (on the order of like 0.006s (6ms
over all of init), so I'm happy with it.

## Why It's Good For The Game

Closes #77040

## Changelog
🆑
fix: Maps loaded in after roundstart will no longer have broken
smoothing
/🆑
2024-02-18 02:08:53 +01:00
SkyratBot
11b8413ff6 [MIRROR] Micros bucketJoin with operator"" [MDB IGNORE] (#25274)
* Micros bucketJoin with operator"" (#79949)

## About The Pull Request

We make timers a lot. Making a unique string for each of them wastes
time (string churn).
It also means we have to do an extra ref() in the bucketJoin proc.

If we instead throw all the shit we care about in a list and just read
off it later, we get pretty decent savings ((0.013 | 0.022) -> (0.009,
0.012)) (It was way worse when ref() was hyper expensive) It's not much,
but since timers are hot I think it's worthwhile.

It also lets us add further debug information, if we want it.
Could optimize this further if we had less stuff in the list, depends on
what we want displayed as it was on insertion and what we want displayed
as it was at moment of print.

Also also this is 100% the reason I did 515 in the first place and I
need to be free

## Why It's Good For The Game

Uhhhhhhhh more flexability in timer readouts? Cost I was worried about
is mostly gone cause ref() got better I think

* Micros bucketJoin with operator""

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
2023-12-03 03:46:57 -05:00
LemonInTheDark
a45752e3c9 Micros bucketJoin with operator"" (#79949)
## About The Pull Request

We make timers a lot. Making a unique string for each of them wastes
time (string churn).
It also means we have to do an extra ref() in the bucketJoin proc.

If we instead throw all the shit we care about in a list and just read
off it later, we get pretty decent savings ((0.013 | 0.022) -> (0.009,
0.012)) (It was way worse when ref() was hyper expensive) It's not much,
but since timers are hot I think it's worthwhile.

It also lets us add further debug information, if we want it.
Could optimize this further if we had less stuff in the list, depends on
what we want displayed as it was on insertion and what we want displayed
as it was at moment of print.

Also also this is 100% the reason I did 515 in the first place and I
need to be free

## Why It's Good For The Game

Uhhhhhhhh more flexability in timer readouts? Cost I was worried about
is mostly gone cause ref() got better I think
2023-11-26 20:20:27 -07:00
SkyratBot
599156acdd [MIRROR] Fix antimagic effect never expiring [MDB IGNORE] (#23009)
* Fix antimagic effect never expiring (#77500)

## About The Pull Request

Fixes #77499

I messed this up resolving merge conflicts.

## Changelog

🆑 Melbert
fix: Fix antimagic effect not expiring
/🆑

* Fix antimagic effect never expiring

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2023-08-11 02:25:47 -04:00
MrMelbert
c6fe13bf6c Fix antimagic effect never expiring (#77500)
## About The Pull Request

Fixes #77499 

I messed this up resolving merge conflicts. 

## Changelog

🆑 Melbert
fix: Fix antimagic effect not expiring 
/🆑
2023-08-10 20:48:44 -06:00
SkyratBot
210e29ca14 [MIRROR] Optimizes timer insertion by 80% (W QDEL_IN micro) [MDB IGNORE] (#21986)
* Optimizes timer insertion by 80% (W QDEL_IN micro) (#76214)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

[Reduces timer insertion cost by
80%](c9e5b285ed)

Timer name generation involved a LOT of string shit, some in ways where
the string only existed for a moment.
This costs a good bit of time, and can be reduced with only minimal
impacts on the end product, so let's do that. Includes a compile flag to
flip it back if we ever have trouble in future.

This is about 0.1s off init, since we do a lot of timer stuff then too

[Removes STOPPABLE flag from QDEL_IN, moves it to a bespoke
macro](e7a5d7f2a7)

Its a waste most of the time, tho I would LOVE to analyze at compile
time to work out if we care
## Why It's Good For The Game

I like it when we don't spend all of our cpu time just setting the name
var on timers. that's good and not bad.
This saves time fucking everywhere. 15% off explosions, 0.1 seconds off
init, bunch of time off foam. it's just good.

Cherry picked out of #76104 since that was too cluttered (sannnnnn)

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Optimizes timer insertion by 80% (W QDEL_IN micro)

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-06-23 16:15:40 -07:00
LemonInTheDark
a8e16030f8 Optimizes timer insertion by 80% (W QDEL_IN micro) (#76214)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

[Reduces timer insertion cost by
80%](c9e5b285ed)

Timer name generation involved a LOT of string shit, some in ways where
the string only existed for a moment.
This costs a good bit of time, and can be reduced with only minimal
impacts on the end product, so let's do that. Includes a compile flag to
flip it back if we ever have trouble in future.

This is about 0.1s off init, since we do a lot of timer stuff then too

[Removes STOPPABLE flag from QDEL_IN, moves it to a bespoke
macro](e7a5d7f2a7)

Its a waste most of the time, tho I would LOVE to analyze at compile
time to work out if we care
## Why It's Good For The Game

I like it when we don't spend all of our cpu time just setting the name
var on timers. that's good and not bad.
This saves time fucking everywhere. 15% off explosions, 0.1 seconds off
init, bunch of time off foam. it's just good.

Cherry picked out of #76104 since that was too cluttered (sannnnnn)

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
2023-06-21 23:54:20 -06:00
SkyratBot
c4a58bb0c6 [MIRROR] Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars [MDB IGNORE] (#21679)
* Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars (#75769)

## About The Pull Request

[Improves the documentation of DCS lists, removes old list of callback
docs that no longer
apply](c3821d9f5f)

[Adds a second signal register to decal rotating, adds a trait to
objects under a tile. STOP DIRECTLY READING HIDDEN LISTS I SWEAR TO
GOD](6b3f97a76a)

[Removes direct reads of the timer list, they were redundant
mostly](14fcd9f8a6)

[Please stop directly reading/modifying the traits list to ensure your
dna rot follows the
brain](ec0e5237ec)

[Marks internal datum lists as well internal with
_](57c6577ff6)

[57c6577](57c6577ff6)

Does the same to _clear_signal_refs() in hopes of keeping people from
touching it

## Why It's Good For The Game

They pissed me off.

Users should not be touching these lists, especially in ways that make
assumptions about their structure and are thus prone to breaking if that
ever changes.
Most of these are close to zero cost changes, using a wrapper to solve
the problem, or just yeeting it

Two aren't, Decals with a direction have gained a second signal register
on init, and things that sit underfloor (cables/pipes) now get a trait
when inserted there.

This should have a minimal impact on memory/init time, bugging
@ Mothblocks about it just in case

* Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars

* fix

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: ghost sheep <sheepwiththemask@gmail.com>
2023-06-07 15:10:42 +00:00
LemonInTheDark
daf55e611c Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars (#75769)
## About The Pull Request

[Improves the documentation of DCS lists, removes old list of callback
docs that no longer
apply](c3821d9f5f)

[Adds a second signal register to decal rotating, adds a trait to
objects under a tile. STOP DIRECTLY READING HIDDEN LISTS I SWEAR TO
GOD](6b3f97a76a)

[Removes direct reads of the timer list, they were redundant
mostly](14fcd9f8a6)

[Please stop directly reading/modifying the traits list to ensure your
dna rot follows the
brain](ec0e5237ec)

[Marks internal datum lists as well internal with
_](57c6577ff6)

[57c6577](57c6577ff6)

Does the same to _clear_signal_refs() in hopes of keeping people from
touching it

## Why It's Good For The Game

They pissed me off.

Users should not be touching these lists, especially in ways that make
assumptions about their structure and are thus prone to breaking if that
ever changes.
Most of these are close to zero cost changes, using a wrapper to solve
the problem, or just yeeting it

Two aren't, Decals with a direction have gained a second signal register
on init, and things that sit underfloor (cables/pipes) now get a trait
when inserted there.

This should have a minimal impact on memory/init time, bugging
@Mothblocks about it just in case
2023-06-05 22:25:09 -06:00
SkyratBot
ee14edd6fa [MIRROR] Fix BUCKET_POS for ticklags with non-integer reciprocals [MDB IGNORE] (#19040)
Fix BUCKET_POS for ticklags with non-integer reciprocals (#72928)

## About The Pull Request
If the ticklag setting has a non-integer reciprocal, like 0.4, timers
will be inserted into the past because the fractional component gets
rounded down. This is bad.

Change originally made on a Bay codebase but it should work here too.
Probably no real impact on mainline TG servers because the commonly-used
ticklags like 0.2, 0.25, 0.33333, 0.5, etc. have integer reciprocals, so
dividing by them always just multiplies by an integer.

## Why It's Good For The Game
Inserting timers into a bucket in the past (behind the
`practical_offset`) causes a warning/unexpected behavior and should
probably be avoided; the best fix I can think of for it is just rounding
up so that it's placed in the closest *future* bucket.

Co-authored-by: Penelope Haze <out.of.p.haze@proton.me>
2023-01-31 02:09:59 +00:00
Penelope Haze
e871412288 Fix BUCKET_POS for ticklags with non-integer reciprocals (#72928)
## About The Pull Request
If the ticklag setting has a non-integer reciprocal, like 0.4, timers
will be inserted into the past because the fractional component gets
rounded down. This is bad.

Change originally made on a Bay codebase but it should work here too.
Probably no real impact on mainline TG servers because the commonly-used
ticklags like 0.2, 0.25, 0.33333, 0.5, etc. have integer reciprocals, so
dividing by them always just multiplies by an integer.

## Why It's Good For The Game
Inserting timers into a bucket in the past (behind the
`practical_offset`) causes a warning/unexpected behavior and should
probably be avoided; the best fix I can think of for it is just rounding
up so that it's placed in the closest *future* bucket.
2023-01-30 01:04:47 +00:00
SkyratBot
c5ca08fd01 [MIRROR] Adds spaces around logical operators [MDB IGNORE] (#18776)
* Adds spaces around logical operators

* Update code/modules/admin/verbs/admingame.dm

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2023-01-21 22:16:43 -08:00
nevimer
b095316f2f Mirrors https://github.com/tgstation/tgstation/pull/67678 (#18835)
Adds a visualizer for lighting object updating. Optimizes the same (#67678)

It occured to me, we didn't have a good way to "see" what turfs were actually being updated
Figured I'd fix that

I've also added some debug vars on SSlighting to make testing with/without some checks easier

Speaking of which, I've added a second check to lighting corner updating
Basically, if our past and current cached rgb values are the same, there's no point updating

This is possible because static lighting is relative. If you've got a
TON of blue, it'll outweight the red and green you have in smaller amounts

We also do some rounding to ensure values look right

Similarly, if you've got roughly the same lighting, and a bit of something you already have a lot of is added, you're not likely to actually enter a new "bracket" of color

Anyway uh, it's hard to profile this, but I've seen it help quite a bit, mostly with things like emergency lighting that updates lighting in small amounts often, and in constricted spaces.

To some extent just comes down to map design

(cherry picked from commit a6d4e180ad)

# Conflicts:
#	code/modules/lighting/lighting_object.dm

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-01-20 14:25:43 -05:00
Jeremiah
872e64fb05 Adds spaces around logical operators (#72603)
## About The Pull Request
Part of a prior PR that was closed (#72562). This version does not add
the check in CI.
## Why It's Good For The Game
The work is already done, so I figured why not.
## Changelog
N/A Nothing player facing

Co-authored-by: Jeremiah Snow <jlsnow301@pm.me>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2023-01-16 16:56:35 -08:00
Zonespace
f7c26bbf25 515 Compat (#17465)
* ONLY SKYRAT CHANGES

* ACTUALLY SKYRAT CHANGES

* yolo, revert later

* Update alternate_byond_versions.txt

Co-authored-by: AnturK <AnturK@users.noreply.github.com>
2022-11-15 06:59:06 +00:00
AnturK
4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00
SkyratBot
375fea374a [MIRROR] Optimizes qdel related things (slight init time savings) [MDB IGNORE] (#17240)
* Optimizes qdel related things (slight init time savings)

* lang holder

* cleanup custom spawners slightly

* ref update

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: tastyfish <crazychris32@gmail.com>
2022-10-30 23:15:38 -04:00
LemonInTheDark
85b2d5043d Optimizes qdel related things (slight init time savings) (#70729)
* Moves spawners and decals to a different init/delete scheme

Rather then fully creating and then immediately deleting these things,
we instead do the bare minimum.

This is faster, if in theory more fragile. We should be safe since any
errors should be caught in compile since this is very close to a
"static" action. It does mean these atoms cannot use signals, etc.

* Potentially saves init time, mostly cleans up a silly pattern

We use sleeps and INVOKE_ASYNC to ensure that handing back turfs doesn't
block a space reservation, but this by nature consumes up to the
threshold and a bit more of whatever working block we were in.

This is silly. Should just be a subsystem, so I made it one, with
support for awaiting its finish if you want to

* Optimizes garbage/proc/Queue slightly

Queue takes about 1.6 seconds to process 26k items right now.
The MASSIVE majority of this time is spent on using \ref
This is because \ref returns a string, and that string requires being
inserted into the global cache of strings we store

What I'm doing is caching the result of ANY \ref on the datum it's
applied to. This ensures previous uses will never decay from the string
tree.

This saves about 0.2 seconds of init
2022-10-30 00:09:15 -07:00
SkyratBot
d7c5ab7987 [MIRROR] PKP Mind Virus: Glorfing Cigs edition [MDB IGNORE] (#16995)
* PKP Mind Virus: Glorfing Cigs edition

* conflicts

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2022-10-20 12:22:53 +01:00
LemonInTheDark
cd3a778915 PKP Mind Virus: Glorfing Cigs edition (#69904)
* PKP Mind Virus: Glorfing Cigs edition

If you glorf while smoking you'll get the cig stuck in your throat, leaving you unable to breath, speak, or eat. Based off the sort of cig you have a random delay before you vomit up the cig. (Pipes last forever don't philoso-larp kids). Other players can help you by using the help action on you while you're hurt, which leads to something imitating the himelich manuver, a broken chest, and a vomited up blockage. Other forms of vomiting will work too, if that's even applicable.

Oh I fixed a bug in vomit code. Because paralyzing you forces you to the ground, thus changing your dir, paralyzing vomits always went down. This is cringe, easy fix tho.

Ah and I added some extra functionality to sound loops too. You can set them to pick and take from the provided list, then refilling it once it's empty. This keeps some variety while preventing the risk of repeat sounds

Oh and I added some new signals. Some misc ones, for force say and a different kind of help then the existing one, which I renamed. One for breathing, which I used to clean up leroxin. I was planning to hook this but didn't need to in the end.

One for vomiting too. and eating. Also added a way to update looping timer delays. Forgot about that, I also added variable delay for sound loops, because I thought it sounded better here.

Features audio courtesy of our very own san7890, and the quake jump sound.
2022-10-19 06:34:45 -04:00
SkyratBot
cdc6950e67 [MIRROR] Fix looping timers qdeleted in their callbacks being reinserted [MDB IGNORE] (#16228)
* Fix looping timers qdeleted in their callbacks being reinserted (#69879)

Fix looping timers qdeleted in their callbacks

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>

* Fix looping timers qdeleted in their callbacks being reinserted

Co-authored-by: Penelope Haze <110272328+out-of-phaze@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
2022-09-14 20:34:55 -07:00
Penelope Haze
43a6bbd2e8 Fix looping timers qdeleted in their callbacks being reinserted (#69879)
Fix looping timers qdeleted in their callbacks

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2022-09-14 13:52:10 -04:00
SkyratBot
c37f2d5e03 [MIRROR] adds grep check for improperly used timer flags. [MDB IGNORE] (#16070)
* adds grep check for improperly used timer flags. (#69668)

* adds grep check for improperly used timer flags.

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2022-09-11 20:18:36 -07:00
ShizCalev
6ef3599254 adds grep check for improperly used timer flags. (#69668) 2022-09-05 02:55:22 -07:00
SkyratBot
632b5cc6b2 [MIRROR] Fix client timers having invalid <1ds waits [MDB IGNORE] (#15982)
* Fix client timers having invalid <1ds waits (#69356)

About The Pull Request

Timers clamped their waits to >world.tick_lag and rounded it to multiples of the same, but this is invalid for clienttime timers. Clienttime timers have a resolution of one decisecond instead, so we now clamp and round it to that instead. (The stacktrace for negative waits is technically invalid but I didn't care enough to touch it.)

Thanks to LemonInTheDark and MrStonedOne for their help in tracking this issue down.
Why It's Good For The Game

These are effectively zero-wait timers, which can mess up the iteration of the clienttime timer queue by being inserted into the past or current tick's list and causing the head/index to desync, potentially leaving spent timers in the queue or firing them again.

* Fix client timers having invalid <1ds waits

Co-authored-by: Penelope Haze <110272328+out-of-phaze@users.noreply.github.com>
2022-09-02 20:30:28 -04:00
Penelope Haze
336443a3a2 Fix client timers having invalid <1ds waits (#69356)
About The Pull Request

Timers clamped their waits to >world.tick_lag and rounded it to multiples of the same, but this is invalid for clienttime timers. Clienttime timers have a resolution of one decisecond instead, so we now clamp and round it to that instead. (The stacktrace for negative waits is technically invalid but I didn't care enough to touch it.)

Thanks to LemonInTheDark and MrStonedOne for their help in tracking this issue down.
Why It's Good For The Game

These are effectively zero-wait timers, which can mess up the iteration of the clienttime timer queue by being inserted into the past or current tick's list and causing the head/index to desync, potentially leaving spent timers in the queue or firing them again.
2022-09-02 09:52:35 +12:00
LemonInTheDark
a6d4e180ad Adds a visualizer for lighting object updating. Optimizes the same (#67678)
It occured to me, we didn't have a good way to "see" what turfs were actually being updated
Figured I'd fix that

I've also added some debug vars on SSlighting to make testing with/without some checks easier

Speaking of which, I've added a second check to lighting corner updating
Basically, if our past and current cached rgb values are the same, there's no point updating

This is possible because static lighting is relative. If you've got a
TON of blue, it'll outweight the red and green you have in smaller amounts

We also do some rounding to ensure values look right

Similarly, if you've got roughly the same lighting, and a bit of something you already have a lot of is added, you're not likely to actually enter a new "bracket" of color

Anyway uh, it's hard to profile this, but I've seen it help quite a bit, mostly with things like emergency lighting that updates lighting in small amounts often, and in constricted spaces.

To some extent just comes down to map design
2022-06-18 19:50:18 -05:00
SkyratBot
e6c933c656 [MIRROR] Makes SSTimer actually recover [MDB IGNORE] (#11448)
* Makes SSTimer actually recover (#64784)

Makes SSTimer actually recover properly when it needs to. This is a follow-up for #60846 (3da51f515d) with code I added in my port of that PR to bee.

There were 3 main problems, and each was uncovered after fixing the previous:

    /datum/controller/master/New() was using faulty logic to find existing subsystems. It was adding Sound Loops twice and not adding Timer at all (Sound Loops being a subtype of Timer).
    /datum/timedevent stores a ref to the timer subsystem in var/datum/controller/subsystem/timer/timer_subsystem for performance. It wasn't being updated to the new Timer subsystem, ultimately resulting in it runtiming as an invalid timer.
    The buckets need to be reset during recovery. The TTR and other bucket-related handling is out of whack because SSTimer wasn't firing for however long recovery took. Luckily reset_buckets() can already handle all of this.

* Makes SSTimer actually recover

Co-authored-by: ike709 <ike709@users.noreply.github.com>
2022-02-11 10:31:09 +00:00
ike709
6277d21e77 Makes SSTimer actually recover (#64784)
Makes SSTimer actually recover properly when it needs to. This is a follow-up for #60846 (3da51f515d) with code I added in my port of that PR to bee.

There were 3 main problems, and each was uncovered after fixing the previous:

    /datum/controller/master/New() was using faulty logic to find existing subsystems. It was adding Sound Loops twice and not adding Timer at all (Sound Loops being a subtype of Timer).
    /datum/timedevent stores a ref to the timer subsystem in var/datum/controller/subsystem/timer/timer_subsystem for performance. It wasn't being updated to the new Timer subsystem, ultimately resulting in it runtiming as an invalid timer.
    The buckets need to be reset during recovery. The TTR and other bucket-related handling is out of whack because SSTimer wasn't firing for however long recovery took. Luckily reset_buckets() can already handle all of this.
2022-02-11 01:41:19 -08:00
SkyratBot
f12c584241 [MIRROR] Fix: Avoid timer scheduling too far events into short queue [MDB IGNORE] (#10903)
* Fix: Avoid timer scheduling too far events into short queue (#64242)

Previously it was possible for events to enter the short queue when the timer is offset by more than BUCKET_LEN
Now it is forced to schedule events into the second queue if the timer is processing slower then world time goes allowing the timer to keep up

This PR provides a better definition of TIMER_MAX to avoid scheduling timed events that are more than one window of buckets away in terms of timeToRun into buckets queue and properly passing them into the second queue.

Ports ss220-space/Paradise#578

Should be merged with/after #64138
Detailed explanation

The timer subsystem mainly uses two concepts, buckets, and second queue

Buckets is a fixed-length list of linked lists, where each "bucket" contains timers scheduled to run on the same tick
The second queue is a simple list containing sorted timers that scheduled too far in future

To process buckets, the timer uses two variables named head_offset and practical_offset

head_offset determines the offset of the first bucket in time
while practical_offset determines offset from bucket list beginning

There are two equations responsible for determining where timed event would end up scheduled
TIMER_MAX and BUCKET_POS

TIMER_MAX determines the maximum value of timeToRun for timed event to schedule into buckets and not the second queue
While BUCKET_POS determines where to put timed event relative to current head_offset

Let's look at BUCKET_POS first
BUCKET_POS(timer) = (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)

Let's imagine we have our tick_lag set to 0.5, due to that we will have BUCKET_LEN = (10 / 0.5) * 60 = 1200
And head_offset of 100, that would make any timed event with timeToRun = 100 + 600N to get bucket_pos of 1

Now let's look at the current implementation of TIMER_MAX

TIMER_MAX = (world.time + TICKS2DS(min(BUCKET_LEN-(SStimer.practical_offset-DS2TICKS(world.time - SStimer.head_offset))-1, BUCKET_LEN-1)))

Let's say our world.time = 100 and practical_offset = 1 for now
So TIMER_MAX = 100 + min(1200 - (1 - (100 - 100)/0.5) - 1, 1200 - 1) * 0.5 = 100 + 1198 * 0.5 = 699
As you might see, in that example we're fine and no events can be scheduled in buckets past boundary

But let's now imagine a situation: some high priority subsystem lagged and caused the timer not to fire for a bit
Now our world.time = 200 and practical_offset = 1 still
So now our TIMER_MAX would be calculated as follow
TIMER_MAX = 200 + min(Q, 1199) * 0.5
Where Q = 1200 - 1 - (1 - (200 - 100) / 0.5) = 1200 - 1 - 1 + (200 - 100) / 0.5 = 1398
Which is bigger then 1199, so we will choose 1199 instead
TIMER_MAX = 200 + 599.5 = 799.5

Let's now schedule repetitive timed event with timeToRun = world.time + 500
It will be scheduled into buckets since, 700 < TIMER_MAX
BUCKET_POS will be ((700 - 100) / 0.5 + 1) % 1200 = 1

Let's run the timer subsystem
During the execution of that timer, we will try to reschedule it for the next fire at timeToRun = world.time + 500
Which would end up adding it in the same bucket we are currently processing, locking subsystem in a loop till suspending
On next tick we will try to continue and will reschedule at timeToRun = world.time + 0.5 + 500
Which would end up in bucket 2, constantly blocking the timer from processing normally
Why It's Good For The Game

Increases chances of smooth experience
Changelog

cl Semoro
fix: Avoid timer scheduling too far events into short queue
/cl

* Fix: Avoid timer scheduling too far events into short queue

Co-authored-by: Aziz Chynaliev <azizonkg@gmail.com>
2022-01-22 22:21:29 +00:00
SkyratBot
893cb616be [MIRROR] Fix: timers not removing from second queue on init [MDB IGNORE] (#10902)
* Fix: timers not removing from second queue on init (#64138)

Fixes #56292
Why It's Good For The Game

Increases chances of smooth experience
Changelog

cl Semoro
fix: timers not removing from second queue on init
/cl

* Fix: timers not removing from second queue on init

Co-authored-by: Aziz Chynaliev <azizonkg@gmail.com>
2022-01-22 22:20:57 +00:00
Aziz Chynaliev
2ce983ecb5 Fix: timers not removing from second queue on init (#64138)
Fixes #56292
Why It's Good For The Game

Increases chances of smooth experience
Changelog

cl Semoro
fix: timers not removing from second queue on init
/cl
2022-01-23 10:25:33 +13:00
Aziz Chynaliev
8639d293f2 Fix: Avoid timer scheduling too far events into short queue (#64242)
Previously it was possible for events to enter the short queue when the timer is offset by more than BUCKET_LEN
Now it is forced to schedule events into the second queue if the timer is processing slower then world time goes allowing the timer to keep up

This PR provides a better definition of TIMER_MAX to avoid scheduling timed events that are more than one window of buckets away in terms of timeToRun into buckets queue and properly passing them into the second queue.

Ports ss220-space/Paradise#578

Should be merged with/after #64138
Detailed explanation

The timer subsystem mainly uses two concepts, buckets, and second queue

Buckets is a fixed-length list of linked lists, where each "bucket" contains timers scheduled to run on the same tick
The second queue is a simple list containing sorted timers that scheduled too far in future

To process buckets, the timer uses two variables named head_offset and practical_offset

head_offset determines the offset of the first bucket in time
while practical_offset determines offset from bucket list beginning

There are two equations responsible for determining where timed event would end up scheduled
TIMER_MAX and BUCKET_POS

TIMER_MAX determines the maximum value of timeToRun for timed event to schedule into buckets and not the second queue
While BUCKET_POS determines where to put timed event relative to current head_offset

Let's look at BUCKET_POS first
BUCKET_POS(timer) = (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)

Let's imagine we have our tick_lag set to 0.5, due to that we will have BUCKET_LEN = (10 / 0.5) * 60 = 1200
And head_offset of 100, that would make any timed event with timeToRun = 100 + 600N to get bucket_pos of 1

Now let's look at the current implementation of TIMER_MAX

TIMER_MAX = (world.time + TICKS2DS(min(BUCKET_LEN-(SStimer.practical_offset-DS2TICKS(world.time - SStimer.head_offset))-1, BUCKET_LEN-1)))

Let's say our world.time = 100 and practical_offset = 1 for now
So TIMER_MAX = 100 + min(1200 - (1 - (100 - 100)/0.5) - 1, 1200 - 1) * 0.5 = 100 + 1198 * 0.5 = 699
As you might see, in that example we're fine and no events can be scheduled in buckets past boundary

But let's now imagine a situation: some high priority subsystem lagged and caused the timer not to fire for a bit
Now our world.time = 200 and practical_offset = 1 still
So now our TIMER_MAX would be calculated as follow
TIMER_MAX = 200 + min(Q, 1199) * 0.5
Where Q = 1200 - 1 - (1 - (200 - 100) / 0.5) = 1200 - 1 - 1 + (200 - 100) / 0.5 = 1398
Which is bigger then 1199, so we will choose 1199 instead
TIMER_MAX = 200 + 599.5 = 799.5

Let's now schedule repetitive timed event with timeToRun = world.time + 500
It will be scheduled into buckets since, 700 < TIMER_MAX
BUCKET_POS will be ((700 - 100) / 0.5 + 1) % 1200 = 1

Let's run the timer subsystem
During the execution of that timer, we will try to reschedule it for the next fire at timeToRun = world.time + 500
Which would end up adding it in the same bucket we are currently processing, locking subsystem in a loop till suspending
On next tick we will try to continue and will reschedule at timeToRun = world.time + 0.5 + 500
Which would end up in bucket 2, constantly blocking the timer from processing normally
Why It's Good For The Game

Increases chances of smooth experience
Changelog

cl Semoro
fix: Avoid timer scheduling too far events into short queue
/cl
2022-01-23 10:25:18 +13:00
SkyratBot
e33577856c [MIRROR] Fix: potential bucket corruption in timer reset_buckets [MDB IGNORE] (#10156)
* Fix: potential bucket corruption in timer reset_buckets (#63427)

Ports Semoro's fix (ss220-space/Paradise#511) related to potential SStimer bucket corruption which caused infinite loop.

    The essence of the fix is that earlier timers with a built linkedlist could get into the second queue, which could cause an incorrect state. It works super stupidly, resets the state to the original correct one

BUT THERE IS STILL A BUG IN THE CODE RELATED TO THE INFINITE LOOP!

For some reason the SStimer on our server started to break recently at the beginning of the round. Found that code for waterfall drip effect was causing the issue. Found that setting frequensy to 0 (and calling reset_bucket sometimes) can be used to reproduce the bug. Tried to fix it with this PR

there is an oustanding bug with airlocks causing SStimer to brake sometimes.

cl
fix: fixed potential bucket corruption in timer reset_buckets
/cl

* Fix: potential bucket corruption in timer reset_buckets

Co-authored-by: Aziz Chynaliev <azizonkg@gmail.com>
2021-12-22 14:48:24 +00:00
Aziz Chynaliev
ca3a1c908a Fix: potential bucket corruption in timer reset_buckets (#63427)
Ports Semoro's fix (ss220-space/Paradise#511) related to potential SStimer bucket corruption which caused infinite loop.

    The essence of the fix is that earlier timers with a built linkedlist could get into the second queue, which could cause an incorrect state. It works super stupidly, resets the state to the original correct one

BUT THERE IS STILL A BUG IN THE CODE RELATED TO THE INFINITE LOOP!

For some reason the SStimer on our server started to break recently at the beginning of the round. Found that code for waterfall drip effect was causing the issue. Found that setting frequensy to 0 (and calling reset_bucket sometimes) can be used to reproduce the bug. Tried to fix it with this PR

there is an oustanding bug with airlocks causing SStimer to brake sometimes.


cl
fix: fixed potential bucket corruption in timer reset_buckets
/cl
2021-12-21 09:34:53 +13:00
SkyratBot
fa519bdde3 [MIRROR] cleanup _HELPERS/_lists.dm and all the necessary files [MDB IGNORE] (#8783)
* cleanup _HELPERS/_lists.dm and all the necessary files

* Epbic

Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-10-13 21:07:35 +01:00
Ghilker
95c8e00af7 cleanup _HELPERS/_lists.dm and all the necessary files (#61827)
Bring _HELPERS/_lists.dm to latest standards by:
-Adding proper documentation and fixing existing one
-Giving vars proper names
-Procs now use snake case as per standard (many files that use those procs will be affected)
2021-10-12 14:48:51 +01:00
SkyratBot
5170b9ecda The Failsafe can now recover from an deleted MC (#60846) (#7664)
* The Failsafe can now recover from an deleted MC
Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck

* Reset defcon level correctly
Oops left that in from debugging the levels

* Correctly recover SSasset

* Only decrease defcon if MC creation failed
Also add some sort sleep between emergency loops

* Makes the last two emergency actions manual procs
Since they are kinda unstantable its probalby best
if only admins call these manually

Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck
You can also now debug Master/New()

While there will most likely never be any situation where the MC is just gone its still good to know that the game can recover from such a situation
For example maybe someone messed up a SDQL query or maybe someone wanted to delete the MC to create a new one hoping the Failsafe would do so for him

Co-authored-by: Gamer025 <33846895+Gamer025@users.noreply.github.com>
2021-08-20 18:53:14 +01:00
Gamer025
3da51f515d The Failsafe can now recover from an deleted MC (#60846)
* The Failsafe can now recover from an deleted MC
Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck

* Reset defcon level correctly
Oops left that in from debugging the levels

* Correctly recover SSasset

* Only decrease defcon if MC creation failed
Also add some sort sleep between emergency loops

* Makes the last two emergency actions manual procs
Since they are kinda unstantable its probalby best
if only admins call these manually

Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck
You can also now debug Master/New()

While there will most likely never be any situation where the MC is just gone its still good to know that the game can recover from such a situation
For example maybe someone messed up a SDQL query or maybe someone wanted to delete the MC to create a new one hoping the Failsafe would do so for him
2021-08-19 22:30:39 -07:00
SkyratBot
cab78dcf78 [MIRROR] Changes how weather sends sound to players, reduces sound loop overtime (#6627)
* Changes how weather sends sound to players, reduces sound loop overtime (#59284)

* Converts looping sounds from a list of play locations to just the one

* Updates all uses of looping sounds to match the new arg

* Adds an area based sound manager that hooks into looping sounds to drive the actual audio. I'll be using this to redo how weather effects handle sound

* Some structrual stuff to make everything else smoother
Timers now properly return the time left for client based timers
Weather sends global signals when it starts/stops
Looping sounds now use their timerid var for all their sound related timers, not just the main loop

* This is the painful part
Adds an area sound manager component, it handles the logic of moving into new areas potentially creating new
sound loops. We do some extra work to prevent stacking sound loops.
Adds an ash storm listener element that adds a tailored area sound manager to clients on the lavaland z level.
It's removed on logout.
Adds the ash_storm_sounds assoc list, a reference to this is passed into area sound managers, and it's modified
in a manner that doesn't break the reference in ash_storm (This is what I hate)

* Hooks ash storm listener into cliented mobs and possessed objects

* Documents the odd ref stuff, adds an ignore start var to looping sounds, fixes some errors and lint issues

* Applies kyler's review

banging

Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>

* Cleans up some var names, reduces the amount of looping we do in some areas

* Makes the code compile, redoes the movement listener to be more general

* fuck

* We don't need to detach on del if we're just removing signals on detach

* Should? work

* if(direct) memes

Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>

* Changes how weather sends sound to players, reduces sound loop overtime

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>
2021-07-01 02:18:04 +01:00
LemonInTheDark
d368e4d49d Changes how weather sends sound to players, reduces sound loop overtime (#59284)
* Converts looping sounds from a list of play locations to just the one

* Updates all uses of looping sounds to match the new arg

* Adds an area based sound manager that hooks into looping sounds to drive the actual audio. I'll be using this to redo how weather effects handle sound

* Some structrual stuff to make everything else smoother
Timers now properly return the time left for client based timers
Weather sends global signals when it starts/stops
Looping sounds now use their timerid var for all their sound related timers, not just the main loop

* This is the painful part
Adds an area sound manager component, it handles the logic of moving into new areas potentially creating new
sound loops. We do some extra work to prevent stacking sound loops.
Adds an ash storm listener element that adds a tailored area sound manager to clients on the lavaland z level.
It's removed on logout.
Adds the ash_storm_sounds assoc list, a reference to this is passed into area sound managers, and it's modified
in a manner that doesn't break the reference in ash_storm (This is what I hate)

* Hooks ash storm listener into cliented mobs and possessed objects

* Documents the odd ref stuff, adds an ignore start var to looping sounds, fixes some errors and lint issues

* Applies kyler's review

banging

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

* Cleans up some var names, reduces the amount of looping we do in some areas

* Makes the code compile, redoes the movement listener to be more general

* fuck

* We don't need to detach on del if we're just removing signals on detach

* Should? work

* if(direct) memes

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
2021-06-30 20:51:35 -04:00
SkyratBot
c96dcd4506 [MIRROR] Port: fixes of SStimer subsystem from RU SS220 Paradise (#6446)
* Port: fixes of SStimer subsystem from RU SS220 Paradise (#59718)

Unobvious problem spot

#define BUCKET_POS(timer) (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)

With tick_lag equal to 0.1, 0.25, 0.5, rounding of division is normal. But at other values it may be shifted either more or less due to the specifics of floating-point storage and processing. Numbers 0.1, 0.25, 0.5 have blank mantissa, unlike others which lead to numbers such as 245.0000004 when divided.
PS: tick_lag is rounded to the first two decimal places.

Fixes

    Rewrote the circular doubly linked list to a regular doubly linked list, because it could cause timers to loop infinitely.
    Fixed re-creation of a bucket if the timer does not have a callback.
    Added debug stat indicator RST to MC SStimer.
    Added optional ability to log dump all timers on crash.
    Fixed subsystem logic when a bucket position is misplaced due to division and rounding inaccuracy. The system now captures such rounding errors and restores the correct timer position.

References

[RU] SS220 Paradise port process from TGstation and fixes:

    ss220-space/Paradise#5
    ss220-space/Paradise#10
    ss220-space/Paradise#26
    ss220-space/Paradise#32
    ss220-space/Paradise#37

Contributors

    @ semoro: fixes
    @ Bizzonium: port

Changelog

cl Semoro and azizonkg
fix: Ported fixes of SStimer subsystem from RU SS220 Paradise
config: Added a new config var: flag/log_timers_on_bucket_reset
/cl

* Port: fixes of SStimer subsystem from RU SS220 Paradise

Co-authored-by: Aziz Chynaliev <azizonkg@gmail.com>
2021-06-22 22:38:52 +01:00
Aziz Chynaliev
0dc279397f Port: fixes of SStimer subsystem from RU SS220 Paradise (#59718)
Unobvious problem spot

#define BUCKET_POS(timer) (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)

With tick_lag equal to 0.1, 0.25, 0.5, rounding of division is normal. But at other values it may be shifted either more or less due to the specifics of floating-point storage and processing. Numbers 0.1, 0.25, 0.5 have blank mantissa, unlike others which lead to numbers such as 245.0000004 when divided.
PS: tick_lag is rounded to the first two decimal places.


Fixes

    Rewrote the circular doubly linked list to a regular doubly linked list, because it could cause timers to loop infinitely.
    Fixed re-creation of a bucket if the timer does not have a callback.
    Added debug stat indicator RST to MC SStimer.
    Added optional ability to log dump all timers on crash.
    Fixed subsystem logic when a bucket position is misplaced due to division and rounding inaccuracy. The system now captures such rounding errors and restores the correct timer position.

References

[RU] SS220 Paradise port process from TGstation and fixes:

    ss220-space/Paradise#5
    ss220-space/Paradise#10
    ss220-space/Paradise#26
    ss220-space/Paradise#32
    ss220-space/Paradise#37

Contributors

    @semoro: fixes
    @Bizzonium: port

Changelog

cl Semoro and azizonkg
fix: Ported fixes of SStimer subsystem from RU SS220 Paradise
config: Added a new config var: flag/log_timers_on_bucket_reset
/cl
2021-06-22 23:06:40 +12:00
SkyratBot
6c54894872 [MIRROR] Makes timer subsystems available as a new subsystem type (#5719)
* Makes timer subsystems available as a new subsystem type (#59073)

* Makes timer subsystems available as a new subsystem type

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2021-05-15 19:52:50 +01:00