Lists follow a similar pattern, but `\` isn't required. It is \Ī way I have of driving off the spleen and regulating \ Particular to interest me on shore, I thought I would sail \Ībout a little and see the watery part of the world. having little or no money in my purse, and nothing \ Some years ago-never mind how long precisely \ It is a way I have of driving off the spleen and regulating the circulation. Some years ago-never mind how long precisely-having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. When doing this, indent each line past the first to 1 tab past the start of the right side of the definition (or whatever is similar- for proc calls, 1 tab past the proc name, etc). With the recommended extension pack, a vertical line will appear in the editor if your code goes far beyond this line, it's time to split the code into multiple lines. Var/whatever2 = multiply_some_numbers(2, 2, 2)įor long lines, use `\` at the end of the line to split onto multiple lines. Var/whatever2=multiply_some_numbers(2,2,2) # Spacing in lists, proc definitions/calls, and arithmeticĪlways put spaces after commas or operators, and before operators: This is heavily frowned upon for changing with little to no reason. Return pick(filtered_concrete_typesof(/obj/item/hat, /proc/is_hat_cool)) Again, the result is cached (so the `filter` proc should not depend on outisde variables or randomness). `filter` is a proc that should return 1 if you want to include the item. by the value of a var or by a blacklist) consider using `filtered_concrete_typesof(type, filter)`. If you want to filter the results of `concrete_typesof` further (e.g. (As a consequence please `.Copy` the list if you want to make changes to it locally.) Proper usage of `ABSTRACT_TYPE` + `concrete_typesof` is preferred to using `typesof` and `childrentypesof` *usually* though exceptions apply. To get a list of all concrete (non-abstract) subtypes of a type you should use `concrete_typesof(type)`, the result is cached so no need to store it yourself. You can check if a type is abstract using the `IS_ABSTRACT(type)` macro. Mark those using the `ABSTRACT_TYPE(type)` macro. Some types exist just as a parent and should never be created in-game (e.g. It's also faster (~6%), for internal bytecode reasons (which don't really matter). The `.len` syntax runtimes on a null `foo`, whereas the `length()` syntax will not. Our codebase uses the latter, the `length(foo)` syntax. We don't want dozens of nesting levels, don't enclose a proc inside an if block if you can just return on a condition instead. If you don't need the define anywhere outside this file/proc, make sure you undefine it after: Instead, it's reccomended that you either put it into a const variable, a local file #define, or a global #define. These can be chained like so: `100 MILLI WATTS` or `1 KILO METER`.ĭon't use numbers that have no explanation behind them. If you're using a derived unit, add its formula to the defines. These should be used whenever you're dealing with a quantity that's a SI unit. There are also SI unit prefixes for use, such as `MILLI`. The codebase also has defines for other SI units, such as `WATTS`. Using these is preferred over using a literal amount in deciseconds. `SECONDS`) which will automatically multiply a number by the correct amount to get a number in deciseconds. For example:įor more detailed information on this system, see the (). / If TRUE the suit will hide whoever is wearing it's hairīy using this, when you hover over a variable or object, it'll display information in the comment. This is as simple as commenting code like: Unless the code is extremely complex, what one generally wants to comment is the *motivation* behind a certain piece of code, or what it's supposed to fix - rather than what it's actually doing.Īdditionally, we have a 'documentation comment' system set up. When possible, we always want people to document their code clearly so that others (or perhaps yourself in the future) can understand and learn why a piece of code was written. * Use `x in y` rather than `y.Find(x)` unless you need the index. * Use `FALSE` and `TRUE` instead of `0` and `1` for booleans. * Use `'foo.ogg'` instead of `"foo.ogg"` for resources unless you need to build a string (e.g. * Bitflags (`&`) - Write as `bitfield & bitflag` * Use `TIME` instead of `world.timeofday` Use `!=` instead, as it's infinitely more sane. * Don't use ``, it's completely unused in the land of SS13. * Don't use `del`, it's horrendously slow. Instead, cast the variable to the proper type. * Don't use the `:` operator to override type safety checks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |