From 0a2f115a622666a60ca348baa59e501afb7d8436 Mon Sep 17 00:00:00 2001 From: GDN <96800819+GDNgit@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:15:05 -0600 Subject: [PATCH] updates the contributing guide to disallow for direct var access from function returns (#24090) --- .github/CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9cc3db12eeb..41cd2923af0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -176,6 +176,19 @@ All new user interfaces in the game must be created using the TGUI framework. Do The use of the `:` operator to override type safety checks is not allowed. You must cast the variable to the proper type. +### Do not access return value vars directly from functions + +The use of the pointer operator, `.`, should not be used to access the return values of functions directly. This can cause unintended behavior and is difficult to read. + +```dm +//Bad +var/our_x = get_turf(thing).x + +//Good +var/turf/our_turf = get_turf(thing) +var/our_x = our_turf.x +``` + ### Type paths must begin with a / eg: `/datum/thing`, not `datum/thing`