From a65226a95fb7766cdb5280ecd7253430f9ebcb29 Mon Sep 17 00:00:00 2001 From: afterthought2 <36152617+afterthought2@users.noreply.github.com> Date: Mon, 14 Dec 2020 09:43:40 -0500 Subject: [PATCH 1/2] Merge pull request #1024 from MistakeNot4892/dedecl Added an explanatory comment to the top of decls.dm. --- code/datums/repositories/decls.dm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/datums/repositories/decls.dm b/code/datums/repositories/decls.dm index 1cce3a2acb0..478accb2a0d 100644 --- a/code/datums/repositories/decls.dm +++ b/code/datums/repositories/decls.dm @@ -1,4 +1,20 @@ -/var/repository/decls/decls_repository = new() +// /decl is a subtype used for singletons that should never have more than one instance +// in existence at a time. If you want to use a /decl you should use a pattern like: +// var/decl/somedecl/mydecl = decls_repository.get_decl(/decl/somedecl) + +// /decls are created the first time they are fetched from decls_repository and will +// automatically call Initialize() and such when created in this way. + +// decls_repository.get_decls_of_type() and decls_repository.get_decls_of_subtype() +// can be used similarly to typesof() and subtypesof(), returning assoc instance lists. + +// The /decl commandments: +// I. Thou shalt not create a /decl with new(). +// II. Thou shalt not del() or qdel() a /decl. +// III. Thou shalt not write a decl that relies on arguments supplied to New(). +// IV. Thou shalt not call Initialize() on a /decl. + +var/repository/decls/decls_repository = new() /repository/decls var/list/fetched_decls From f18fcebbe7f645b07f91dd44ee41442a9d73fe3c Mon Sep 17 00:00:00 2001 From: SkyratBot Date: Mon, 14 Dec 2020 09:44:57 -0500 Subject: [PATCH 2/2] Added an explanatory comment to the top of decls.dm.