Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.
/ white Public archive
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4933 commits
Select commit Hold shift + click to select a range
243e58a
бля нахуй я эту хуйню впилил
Valtosin Jun 7, 2023
c8ff7a6
revived and optimised rospilovo
Valtosin Jun 7, 2023
e66b48b
fix
Valtosin Jun 7, 2023
2cad53b
sleep, if in crit
Valtosin Jun 7, 2023
6fb2d01
set 5 seconds
Valtosin Jun 7, 2023
8e48054
ебань
Valtosin Jun 7, 2023
7348828
replace goon sprites with weird skyrat sprites I didn't ask permissio…
Valtosin Jun 9, 2023
6d9ccd0
whaaa
Valtosin Jun 11, 2023
34b860b
мяу
Valtosin Jun 11, 2023
fb06ed3
blyadota
Valtosin Jun 11, 2023
8e9525b
fix render
Valtosin Jun 11, 2023
6189de7
this is still useless
Valtosin Jun 12, 2023
e28b2cc
handle multiple freelancer shuttles
Valtosin Jun 12, 2023
acc79a2
literally bait
Valtosin Jun 13, 2023
45ddc01
Сервисный фабрикатор, Метеориты, Моды (#1955)
FelineMistress Jun 14, 2023
ad170aa
Исправляет ошибку которая, позволяет использовать чужие абилки (#1953)
tt-relay-104 Jun 14, 2023
168ca3f
fix paintings
Valtosin Jun 14, 2023
b3744e2
run generation in verb too and fix rock
Valtosin Jun 14, 2023
b4c8f02
occupied state for some inventory things
Valtosin Jun 14, 2023
c86f466
fix weapons
Valtosin Jun 14, 2023
637c1c0
фиксись
Valtosin Jun 14, 2023
4f5b2df
Теперь правильно (#1958)
tt-relay-104 Jun 15, 2023
d9fbbfe
мы прикрутим к этой телеге реактивный двигатель
Valtosin Jun 15, 2023
9df04cf
violence fixes and some funnies
Valtosin Jun 15, 2023
9762b9a
whoops
Valtosin Jun 15, 2023
f769cf1
фикс хроматографа, наверное
FelineMistress Jun 15, 2023
f6bb9b8
понапридумывают переменных
FelineMistress Jun 15, 2023
6e69aa8
this is dumb
Valtosin Jun 16, 2023
54268a8
test
Valtosin Jun 16, 2023
bac2b0e
блять
Valtosin Jun 16, 2023
ae88ea0
хуйня
Valtosin Jun 16, 2023
508e92c
fix #1964
Valtosin Jun 17, 2023
68a441c
funny
Valtosin Jun 18, 2023
b5b67c7
fix stupid
Valtosin Jun 18, 2023
aaf7dd8
Я у мамы Ахапох
FelineMistress Jun 18, 2023
0631501
fix order
Valtosin Jun 18, 2023
dc65e28
ip
Valtosin Jun 18, 2023
676d7a9
???
Valtosin Jun 18, 2023
a79f292
too high range
Valtosin Jun 18, 2023
8130e33
поебать
Valtosin Jun 18, 2023
67210d2
suka
Valtosin Jun 18, 2023
d89e68a
eeb
Valtosin Jun 18, 2023
bf62476
doing some stupid things
Valtosin Jun 18, 2023
95adf09
add to list
Valtosin Jun 19, 2023
7d6f261
less shit
Valtosin Jun 19, 2023
995d88c
adds jetpack
Valtosin Jun 19, 2023
5947837
поебать
Valtosin Jun 19, 2023
cea08a1
ass
Valtosin Jun 19, 2023
71a500c
fixed IPC
Valtosin Jun 19, 2023
9bbaa14
fixes everything
Valtosin Jun 19, 2023
06a4c40
фикс
Valtosin Jun 19, 2023
67ba645
чувствуя я как мне отрывают яйца за это
Valtosin Jun 20, 2023
c6d91f8
а это тоже надо
Valtosin Jun 20, 2023
0d3d3a6
i forgor
Valtosin Jun 20, 2023
9a2b3b7
какие же пиндосы долбоёбы я хуею
Valtosin Jun 20, 2023
7ccd012
fix #1965
Valtosin Jun 20, 2023
e5799a6
hz mb fix preview
Valtosin Jun 20, 2023
c00e5a7
aa blyad
Valtosin Jun 20, 2023
3a34eb3
hz
Valtosin Jun 20, 2023
cae58df
поебать вообще на проде потестим
Valtosin Jun 20, 2023
0a4651f
че за хуйню я накодил
Valtosin Jun 20, 2023
232a328
ах
Valtosin Jun 20, 2023
993e96f
а вот теперь тут нужна проверка
Valtosin Jun 20, 2023
7bd2787
fix autolathe
Valtosin Jun 20, 2023
1d00952
а давай так
Valtosin Jun 20, 2023
04e2783
this
Valtosin Jun 20, 2023
2d7c497
animates the *jump, *shiver, *sway, *tremble, *twitch and *twitch_s e…
kawoppi May 13, 2023
f77d2c4
ну и говнище пиздец
Mothblocks Jan 26, 2023
61caf44
remove broken signals
Valtosin Jun 21, 2023
33bf3f6
uh oh ah eh
Valtosin Jun 21, 2023
46ddd3d
aa
Valtosin Jun 21, 2023
ba11789
suka
Valtosin Jun 21, 2023
9bf8c2f
dolboyob
Valtosin Jun 22, 2023
38555d7
che za yaica
Valtosin Jun 22, 2023
b55a065
мб так пофиксится
Valtosin Jun 22, 2023
eb82db8
а че бы не генерировать сразу на все стороны
Valtosin Jun 22, 2023
a15b408
warcrimes
Valtosin Jun 22, 2023
c59cd81
давай нахуй вот эти лучше
Valtosin Jun 22, 2023
a629d27
ААААААААААААА БЛЯТААТФЛЫЬАФ НАХУй
Valtosin Jun 22, 2023
bd3e8ad
мяу
Valtosin Jun 22, 2023
4a65040
хуйня без задач
Valtosin Jun 22, 2023
e784815
basic tts caching
Valtosin Jun 23, 2023
7772193
faster prefs
Valtosin Jun 23, 2023
f026e7f
это не имеет значения
Valtosin Jun 23, 2023
e83577c
мяу
Valtosin Jun 23, 2023
ad9a0a1
eblo?
Valtosin Jun 23, 2023
a140adf
forgor
Valtosin Jun 24, 2023
820b87f
New voices
Valtosin Jun 24, 2023
0429187
еблааан
Valtosin Jun 24, 2023
c93a45e
fix helmets sprites
Valtosin Jun 25, 2023
a94486c
небольшое военное преступление
Valtosin Jun 25, 2023
43a360e
I need working sdmm
Valtosin Jun 26, 2023
23e8a0c
ааааа
Valtosin Jun 28, 2023
b94a5b3
better caching
Valtosin Jun 29, 2023
6e410b2
FUCK FUCK FUCK
Valtosin Jun 29, 2023
34d53f8
eblo
Valtosin Jun 29, 2023
3e90c57
make it little grainy
Valtosin Jun 29, 2023
068a30b
layers
Valtosin Jun 29, 2023
e768246
layer is a bad idea
Valtosin Jun 29, 2023
50a4f8a
let's do this
Valtosin Jul 1, 2023
efb2d1a
fuf
Valtosin Jul 2, 2023
63fc81c
random runtime patch
Valtosin Jul 2, 2023
b50a93b
пиндосы конечно дауны, но дауны конкретные
Valtosin Jul 2, 2023
a837392
как же заебала эта хуйня
Valtosin Jul 2, 2023
1de2a35
fix icon smoothing
Valtosin Jul 2, 2023
c5724f8
punch this
Valtosin Jul 2, 2023
cedb9b0
это конечно крутой шрифт, но пошёл ты на хуй дегенерат ебучий
Valtosin Jul 2, 2023
b90ab8e
фикс
Valtosin Jul 2, 2023
796f0f0
go fuck
Valtosin Jul 2, 2023
dca4954
add new VITS voices
Valtosin Jul 3, 2023
7a843ef
remove grain also fuck grain
Valtosin Jul 3, 2023
b470338
lowfreq
Valtosin Jul 3, 2023
3395d6e
Тесла фикс (#1988)
tt-relay-104 Jul 5, 2023
fc51943
new tts test
Valtosin Jul 6, 2023
55c2757
Это слишком опасно, убираем (#1993)
tt-relay-104 Jul 7, 2023
0d7cf36
Bump semver and mwbot in /tools/autowiki (#1983)
dependabot[bot] Jul 9, 2023
ab49b05
исторически верные имена драконов
Valtosin Jul 9, 2023
1837307
fix ci
Valtosin Jul 13, 2023
936f1b3
this is bullshit
Valtosin Jul 20, 2023
c0980dd
experimental warcrime
Valtosin Jul 20, 2023
8dc07cc
new voices
Valtosin Jul 20, 2023
58c23e0
too dark
Valtosin Jul 20, 2023
e199f08
anime ooc
Valtosin Jul 20, 2023
de0c6f3
У этой коробки нет звука (#2007)
tt-relay-104 Jul 20, 2023
7740da7
fix some dumb translation errors
Valtosin Jul 21, 2023
4cf972a
service pack yaica penis
Valtosin Jul 21, 2023
5750beb
блять говнище
Valtosin Jul 21, 2023
f4cd003
КАРГО, ПУГАЛО, МНОГА ШТУК (#2011)
FelineMistress Jul 21, 2023
8a64392
cargofix_adminreverb
FelineMistress Jul 23, 2023
07d5713
experiment1
Valtosin Jul 23, 2023
a5810f4
hz go test PIDORAS
Valtosin Jul 23, 2023
cd6d059
funny
Valtosin Jul 23, 2023
d6b1593
hzzz
Valtosin Jul 23, 2023
a6bdbc9
Bump word-wrap from 1.2.3 to 1.2.4 in /tgui (#2008)
dependabot[bot] Jul 24, 2023
a7a7857
Bump semver from 5.7.1 to 5.7.2 in /tgui (#2002)
dependabot[bot] Jul 24, 2023
c7382f1
test (#2014)
Valtosin Jul 24, 2023
4a80e63
fix random gravity shit poopers
Valtosin Jul 24, 2023
445b319
yeSS
Valtosin Jul 24, 2023
111e1ce
бля хуй его знает, но по идее норм
Valtosin Jul 25, 2023
152d296
ну и хуйня
Valtosin Jul 25, 2023
88a7105
don't count every fucking atom
Valtosin Jul 25, 2023
fae8e65
hueta
Valtosin Jul 25, 2023
a6d6914
possibly fixes crashing
Valtosin Jul 26, 2023
b80c09c
fuck this hud fuck you jannies fuck everyone fuck fuck fuck fuck
Valtosin Jul 26, 2023
c883045
телега говна
Valtosin Jul 26, 2023
bdc79ae
Do a little fixiki (#2016)
Fesiks Jul 26, 2023
4413add
fuck
Valtosin Jul 27, 2023
aa13d65
less fucky
Valtosin Jul 27, 2023
7cb3188
fix feline prikol
Valtosin Jul 27, 2023
bc8c736
keybind me
Valtosin Jul 28, 2023
a20e99b
funny ids
Valtosin Jul 28, 2023
3d7fd91
fix ctf ammo
Valtosin Jul 28, 2023
04c5b43
funny leaning
Valtosin Jul 28, 2023
514b040
funny sprites
Valtosin Jul 28, 2023
bb7ab50
fucker
Valtosin Jul 28, 2023
75d81ff
fix leaning
Valtosin Jul 28, 2023
c03ae94
fix some weird immunities and sprites
Valtosin Jul 28, 2023
e04f926
forcefield_dragon_fixes
FelineMistress Jul 28, 2023
01d96e4
remove boosty
Valtosin Jul 29, 2023
eca87d2
close
Valtosin Jul 29, 2023
6f92c4f
new prikol
Valtosin Jul 29, 2023
3cd3c32
ЕБАНОК БЛЯТЬ
Valtosin Jul 29, 2023
620e440
time to engage our powers
Valtosin Jul 29, 2023
2ba1b3a
еботня
Valtosin Jul 29, 2023
88fdcdb
random fixes
Valtosin Jul 29, 2023
a8d7760
Ионный шторм по заказу. (#2019)
AxapooH Jul 29, 2023
3ba1517
Партиклы воды и огня (#2020)
ruvn-1fgas Jul 29, 2023
c394179
I have the right to do so
Valtosin Jul 30, 2023
990280e
optimize ruin size
Valtosin Jul 30, 2023
2352df8
shit
Valtosin Jul 30, 2023
0a16969
Быстрое высыхание воды на теле (#2026)
ruvn-1fgas Jul 31, 2023
3596cd5
fix #1961 (Дюп семян)
ruvn-1fgas Jul 31, 2023
036d7b6
Раз-раз-раз (#2028)
AxapooH Jul 31, 2023
402b628
хуй блядовка
Valtosin Aug 2, 2023
49ff512
Меня это (#2031)
AxapooH Aug 2, 2023
df33acd
fix #2032
ruvn-1fgas Aug 2, 2023
9149070
Я (#2034)
AxapooH Aug 3, 2023
aecb8e9
Vomit (#2038)
SaingItsMe Aug 6, 2023
99c44d6
eva_scafs_fixes
FelineMistress Aug 6, 2023
f208ade
ебучий сука плюшкин
Valtosin Aug 10, 2023
b49bd54
stick baton inside me
Valtosin Aug 10, 2023
0e09e50
fullhd ambient
Valtosin Aug 10, 2023
853e1a2
buzz more loud
Valtosin Aug 10, 2023
f70d21f
fix ambients not playing fucker FUCK
Valtosin Aug 10, 2023
2b72752
OH FUCK
Valtosin Aug 11, 2023
c5ecc16
var
Valtosin Aug 11, 2023
4870e6c
перепилено нахуй
Valtosin Aug 11, 2023
d0bbafd
less sprites
Valtosin Aug 11, 2023
fb8e089
ебать смешная хуйня
Valtosin Aug 11, 2023
b91a636
fuckes
Valtosin Aug 11, 2023
ab346e3
another update
Valtosin Aug 11, 2023
0d62265
i hate
Valtosin Aug 11, 2023
40b882e
warcrime
Valtosin Aug 11, 2023
36fd2ab
да мне похуй блядь лол
Valtosin Aug 11, 2023
c30ea6b
dumb shit
Valtosin Aug 11, 2023
b86b025
sex 2.0
Valtosin Aug 12, 2023
3ecf2a8
holy sheet (#2041)
Fesiks Aug 12, 2023
0bcdade
some lavaland adjustments
Valtosin Aug 13, 2023
a98b2c3
ебаться хочу
Valtosin Aug 13, 2023
8897f3a
do random
Valtosin Aug 13, 2023
91dfb36
fixed brain damage and emotions cleanup
Valtosin Aug 13, 2023
c90606c
little adj
Valtosin Aug 15, 2023
99b6bfa
override signals I don't care
Valtosin Aug 15, 2023
3d94db1
Пепельницы (#2042)
ruvn-1fgas Aug 17, 2023
170678c
Meh (#2043)
AxapooH Aug 20, 2023
0f58df6
fixed fixeye and some shit
Valtosin Aug 24, 2023
a736e50
fuck
Valtosin Aug 25, 2023
191bd1a
Revert "fuck"
FelineMistress Aug 25, 2023
9292ceb
Revert "Revert "fuck""
FelineMistress Aug 25, 2023
f869bd4
works on my machine
Valtosin Aug 26, 2023
6c82427
high_pressure_delta
Valtosin Aug 26, 2023
21beff8
in case shit broken
Valtosin Aug 26, 2023
d617b16
хуй
Valtosin Aug 26, 2023
526d555
remove auxmos
Valtosin Aug 26, 2023
53a7765
да похуй
Valtosin Aug 27, 2023
abf8f40
update some vital components correctly
Valtosin Aug 28, 2023
9893565
да нахуй вообще этот турбо-атмос нужен
Valtosin Aug 29, 2023
09e904b
фикс некоторых труб
Valtosin Aug 29, 2023
0979062
артас, полина, хреноид
Valtosin Aug 30, 2023
45a3474
atmosex
Valtosin Aug 31, 2023
f9a42d6
adds opendream launch task
Valtosin Aug 31, 2023
0e8c9a1
хуйлус (#2049)
Fesiks Sep 2, 2023
043a50f
да пошло оно всё на хуй
Valtosin Sep 3, 2023
309e428
да похуй, разберутся, не маленькие уже
Valtosin Sep 4, 2023
a81aeaa
fix pipes
Valtosin Sep 4, 2023
91d114d
tts
Valtosin Sep 6, 2023
81f9ac2
сука еблан
Valtosin Sep 6, 2023
4a72e01
fix fov
Valtosin Sep 9, 2023
b200baf
PIDORI, SEICHAS BUDET ZAMES GLINI
Valtosin Sep 17, 2023
9a94556
che s ebalom
Valtosin Sep 24, 2023
466fc30
Fuck (#2060)
AxapooH Sep 25, 2023
39ab9c4
бля ты заебал
Valtosin Oct 3, 2023
3d85b37
fix tank smoothing
Valtosin Oct 3, 2023
4855596
похуй пойдёт
Valtosin Oct 3, 2023
b9b9236
Bump pillow from 9.3.0 to 10.0.1 in /tools (#2068)
dependabot[bot] Oct 4, 2023
12d818a
Отражения в зеркалах (#2069)
ruvn-1fgas Oct 9, 2023
20f99de
Port Law Panel https://github.com/tgstation/tgstation/pull/73747 (#2…
REBOLUTION228-a11 Oct 10, 2023
7fe94d3
aoe_spell_all_blyat (#2071)
May-SKiY Oct 11, 2023
3ac56bc
new tts voices
Valtosin Oct 13, 2023
d7cfc34
hotfix tts voices
Valtosin Oct 13, 2023
32cdc81
Bump @babel/traverse from 7.15.0 to 7.23.2 in /tgui (#2072)
dependabot[bot] Oct 22, 2023
f8cfa59
Операция "Дефелинизация" I (#2073)
REBOLUTION228-a11 Oct 24, 2023
42d27be
фикс атмоса
Valtosin Oct 26, 2023
c97d195
Update closet.dmi
REBOLUTION228-a11 Oct 26, 2023
129e356
Revert "фикс атмоса"
REBOLUTION228-a11 Oct 26, 2023
1eec49b
На нахуй сука черти ебанные я пошел хавать блядь охуенный тгстейшн
REBOLUTION228-a11 Oct 29, 2023
51363d3
Revert "На нахуй сука черти ебанные я пошел хавать блядь охуенный тгс…
REBOLUTION228-a11 Oct 29, 2023
4c2c1e4
Bump pillow from 9.3.0 to 10.0.1 in /tools (#2074)
dependabot[bot] Nov 10, 2023
b9d3237
Bump the npm_and_yarn at /tools/autowiki security update group (#2076)
dependabot[bot] Nov 10, 2023
4ab5d83
Bump axios from 0.21.1 to 1.6.0 in /tgui (#2077)
dependabot[bot] Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 5 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ cfg
data
SQL
node_modules
tgstation.dmb
tgstation.int
tgstation.rsc
tgstation.lk
tgstation.dyn.rsc
white.dmb
white.int
white.rsc
white.lk
white.dyn.rsc
*.dll
Dockerfile
tools/bootstrap/.cache
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,3 @@

## Force tab indents on dm files
*.dm whitespace=indent-with-non-tab

## Force changelog merging to use union
html/changelog.html text eol=lf merge=union
89 changes: 0 additions & 89 deletions .github/CODEOWNERS

This file was deleted.

253 changes: 253 additions & 0 deletions .github/HARDDEL_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
# Hard Deletes
1. [What is hard deletion](#What-is-hard-deletion)
2. [Causes of hard deletes](#causes-of-hard-deletes)
3. [Detecting hard deletes](#detecting-hard-deletes)
4. [Techniques for fixing hard deletes](#techniques-for-fixing-hard-deletes)
5. [Help my code is erroring how fix](#help-my-code-is-erroring-how-fix)

## What is Hard Deletion
Hard deletion is a very expensive operation that basically clears all references to some "thing" from memory. Objects that undergo this process are referred to as hard deletes, or simply harddels

What follows is a discussion of the theory behind this, why we would ever do it, and the what we do to avoid doing it as often as possible

I'm gonna be using words like references and garbage collection, but don't worry, it's not complex, just a bit hard to pierce

### Why do we need to Hard Delete?

Ok so let's say you're some guy called Jerry, and you're writing a programming language

You want your coders to be able to pass around objects without doing a full copy. So you'll store the pack of data somewhere in memory

```dm
/someobject
var/id = 42
var/name = "some shit"
```

Then you want them to be able to pass that object into say a proc, without doing a full copy. So you let them pass in the object's location in memory instead
This is called passing something by reference

```dm
someshit(someobject) //This isn't making a copy of someobject, it's passing in a reference to it
```

This of course means they can store that location in memory in another object's vars, or in a list, or whatever

```dm
/datum
var/reference
/proc/someshit(mem_location)
var/datum/some_obj = new()
some_obj.reference = mem_location
```

But what happens when you get rid of the object we're passing around references to? If we just cleared it out from memory, everything that holds a reference to it would suddenly be pointing to nowhere, or worse, something totally different!

So then, you've gotta do something to clean up these references when you want to delete an object

We could hold a list of references to everything that references us, but god, that'd get really expensive wouldn't it

Why not keep count of how many times we're referenced then? If an object's ref count is ever 0, nothing whatsoever cares about it, so we can freely get rid of it

But if something's holding onto a reference to us, we're not gonna have any idea where or what it is

So I guess you should scan all of memory for that reference?

```dm
del(someobject) //We now need to scan memory until we find the thing holding a ref to us, and clear it
```

This pattern is about how BYOND handles this problem of hanging references, or Garbage Collection

It's not a broken system, but as you can imagine scanning all of memory gets expensive fast

What can we do to help that?

### How we can avoid hard deletes

If hard deletion is so slow, we're gonna need to clean up all our references ourselves

In our codebase we do this with `/datum/proc/Destroy()`, a proc called by `qdel()`, whose purpose I will explain later

This procs only job is cleaning up references to the object it's called on. Nothing more, nothing else. Don't let me catch you giving it side effects

There's a long long list of things this does, since we use it a TON. So I can't really give you a short description. It will always move the object to nullspace though

## Causes Of Hard Deletes

Now that you know the theory, let's go over what can actually cause hard deletes. Some of this is obvious, some of it's much less so.

The BYOND reference has a list [Here](https://secure.byond.com/docs/ref/#/DM/garbage), but it's not a complete one

* Stored in a var
* An item in a list, or associated with a list item
* Has a tag
* Is on the map (always true for turfs)
* Inside another atom's contents
* Inside an atom's vis_contents
* A temporary value in a still-running proc
* Is a mob with a key
* Is an image object attached to an atom

Let's briefly go over the more painful ones yeah?

### Sleeping procs

Any proc that calls `sleep()`, `spawn()`, or anything that creates a seperate "thread" (not technically a thread, but it's the same in these terms. Not gonna cause any race conditions tho) will hang references to any var inside it. This includes the usr it started from, the src it was called on, and any vars created as a part of processing

### Static vars

`/static` and `/global` vars count for this too, they'll hang references just as well as anything. Be wary of this, these suckers can be a pain to solve

### Range() and View() like procs

Some internal BYOND procs will hold references to objects passed into them for a time after the proc is finished doing work, because they cache the returned info to make some code faster. You should never run into this issue, since we wait for what should be long enough to avoid this issue as a part of garbage collection

This is what `qdel()` does by the by, it literally just means queue deletion. A reference to the object gets put into a queue, and if it still exists after 5 minutes or so, we hard delete it

### Walk() procs

Calling `walk()` on something will put it in an internal queue, which it'll remain in until `walk(thing, 0)` is called on it, which removes it from the queue

This sort is very cheap to harddel, since BYOND prioritizes checking this queue first when it's clearing refs, but it should be avoided since it causes false positives

You can read more about how BYOND prioritizes these things [Here](https://www.patreon.com/posts/diving-for-35855766)

## Detecting Hard Deletes

For very simple hard deletes, simple inspection should be enough to find them. Look at what the object does during `Initialize()`, and see if it's doing anything it doesn't undo later.
If that fails, search the object's typepath, and look and see if anything is holding a reference to it without regard for the object deleting

BYOND currently doesn't have the capability to give us information about where a hard delete is. Fortunately we can search for most all of then ourselves.
The procs to perform this search are hidden behind compile time defines, since they'd be way too risky to expose to admin button pressing

If you're having issues solving a harddel and want to perform this check yourself, go to `_compile_options.dm` and uncomment `TESTING`, `REFERENCE_TRACKING`, and `GC_FAILURE_HARD_LOOKUP`

You can read more about what each of these do in that file, but the long and short of it is if something would hard delete our code will search for the reference (This will look like your game crashing, just hold out) and print information about anything it finds to the runtime log, which you can find inside the round folder inside `/data/logs/year/month/day`

It'll tell you what object is holding the ref if it's in an object, or what pattern of list transversal was required to find the ref if it's hiding in a list of some sort

## Techniques For Fixing Hard Deletes

Once you've found the issue, it becomes a matter of making sure the ref is cleared as a part of Destroy(). I'm gonna walk you through a few patterns and discuss how you might go about fixing them

### Our Tools

First and simplest we have `Destroy()`. Use this to clean up after yourself for simple cases

```dm
/someobject/Initialize()
. = ..()
GLOB.somethings += src //We add ourselves to some global list
/someobject/Destroy()
GLOB.somethings -= src //So when we Destroy() clean yourself from the list
return ..()
```

Next, and slightly more complex, pairs of objects that reference each other

This is helpful when for cases where both objects "own" each other

```dm
/someobject
var/someotherobject/buddy
/someotherobject
var/someobject/friend
/someobject/Initialize()
if(!buddy)
buddy = new()
buddy.friend = src
/someotherobject/Initialize()
if(!friend)
friend = new()
friend.buddy = src
/someobject/Destroy()
if(buddy)
buddy.friend = null //Make sure to clear their ref to you
buddy = null //We clear our ref to them to make sure nothing goes wrong
/someotherobject/Destroy()
if(friend)
friend.buddy = null //Make sure to clear their ref to you
friend = null //We clear our ref to them to make sure nothing goes wrong
```

Something similar can be accomplished with `QDELETED()`, a define that checks to see if something has started being `Destroy()`'d yet, and `QDEL_NULL()`, a define that `qdel()`'s a var and then sets it to null

Now let's discuss something a bit more complex, weakrefs

You'll need a bit of context, so let's do that now

BYOND has an internal bit of behavior that looks like this

`var/string = "\ref[someobject]"`

This essentially gets that object's position in memory directly. Unlike normal references, this doesn't count for hard deletes. You can retrieve the object in question by using `locate()`

`var/someobject/someobj = locate(string)`

This has some flaws however, since the bit of memory we're pointing to might change, which would cause issues. Fortunately we've developed a datum to handle worrying about this for you, `/datum/weakref`

You can create one using the `WEAKREF()` proc, and use weakref.resolve() to retrieve the actual object

This should be used for things that your object doesn't "own", but still cares about

For instance, a paper bin would own the paper inside it, but the paper inside it would just hold a weakref to the bin

There's no need to clean these up, just make sure you account for it being null, since it'll return that if the object doesn't exist or has been queued for deletion

```dm
/someobject
var/datum/weakref/our_coin
/someobject/proc/set_coin(/obj/item/coin/new_coin)
our_coin = WEAKREF(new_coin)
/someobject/proc/get_value()
if(!our_coin)
return 0
var/obj/item/coin/potential_coin = our_coin.resolve()
if(!potential_coin)
our_coin = null //Remember to clear the weakref if we get nothing
return 0
return potential_coin.value
```

Now, for the worst case scenario

Let's say you've got a var that's used too often to be weakref'd without making the code too expensive

You can't hold a paired reference to it because it's not like it would ever care about you outside of just clearing the ref

So then, we want to temporarily remember to clear a reference when it's deleted

This is where I might lose you, but we're gonna use signals

`qdel()`, the proc that sets off this whole deletion business, sends a signal called `COMSIG_PARENT_QDELETING`

We can listen for that signal, and if we hear it clear whatever reference we may have

Here's an example

```dm
/somemob
var/mob/target
/somemob/proc/set_target(new_target)
if(target)
UnregisterSignal(target, COMSIG_PARENT_QDELETING) //We need to make sure any old signals are cleared
target = new_target
if(target)
RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/clear_target) //Call clear_target if target is ever qdel()'d
/somemob/proc/clear_target(datum/source)
SIGNAL_HANDLER
set_target(null)
```

This really should be your last resort, since signals have some limitations. If some subtype of somemob also registered for parent_qdeleting on the same target you'd get a runtime, since signals don't support it

But if you can't do anything else for reasons of conversion ease, or hot code, this will work

## Help My Code Is Erroring How Fix

First, do a quick check.

Are you doing anything to the object in `Initialize()` that you don't undo in `Destroy()`? I don't mean like, setting its name, but are you adding it to any lists, stuff like that

If this fails, you're just gonna have to read over this doc. You can skip the theory if you'd like, but it's all pretty important for having an understanding of this problem
6 changes: 3 additions & 3 deletions .github/RUNNING_A_SERVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Double-click `BUILD.bat` in the root directory of the source code. This'll take
a little while, and if everything's done right you'll get a message like this:

```
saving tgstation.dmb (DEBUG mode)
tgstation.dmb - 0 errors, 0 warnings
saving white.dmb (DEBUG mode)
white.dmb - 0 errors, 0 warnings
```

If you see any errors or warnings, something has gone wrong - possibly a corrupt
Expand Down Expand Up @@ -43,7 +43,7 @@ and install it themselves. Directions can be found at the [rust-g
repo](https://github.com/tgstation/rust-g).

Finally, to start the server, run Dream Daemon and enter the path to your
compiled tgstation.dmb file. Make sure to set the port to the one you
compiled white.dmb file. Make sure to set the port to the one you
specified in the config.txt, and set the Security box to 'Safe'. Then press GO
and the server should start up and be ready to join. It is also recommended that
you set up the SQL backend (see below).
Expand Down
10 changes: 10 additions & 0 deletions .github/alternate_byond_versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file contains extra tests to run for specific BYOND versions.
# This is useful for making sure we maintain compatibility with both older and newer versions,
# while still having our main tests run on a guaranteed pinned version.

# Format is version: map
# Example:
# 500.1337: runtimestation

# AnturK uncomment this and then remove this line
# 515.1594: runtimestation
Loading