From 0186f4d8b0bee96faf30f33754ebee49fc64a8a3 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 6 Jul 2024 06:12:28 +0200 Subject: [PATCH] [MIRROR] Removes stupid listlike var access code (#28658) * Removes stupid listlike var access code (#84648) ## About The Pull Request [Removes all other listlike var accesses](https://github.com/tgstation/tgstation/pull/84648/commits/4c5996b5c8b1da63740e8b4bf998b6cb6eadac33) Also fucking dumpsters an unused proc that allowed for arbitrary variable modifcation. Bad juju This is undefined behavior and errors in later 515 versions. also it's stupid as hell * Removes stupid listlike var access code --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> --- code/__HELPERS/areas.dm | 2 +- code/__HELPERS/paths/path.dm | 2 +- code/__HELPERS/records.dm | 6 ------ code/controllers/subsystem/research.dm | 2 +- code/controllers/subsystem/spatial_gridmap.dm | 2 +- code/datums/ai/_ai_controller.dm | 10 +++++++++- code/datums/components/_component.dm | 3 ++- code/datums/greyscale/_greyscale_config.dm | 3 ++- code/modules/admin/topic.dm | 2 +- code/modules/admin/view_variables/debug_variables.dm | 5 +++-- code/modules/mapping/mapping_helpers.dm | 2 +- code/modules/vehicles/_vehicle.dm | 2 +- code/modules/vehicles/mecha/mech_fabricator.dm | 2 +- tgstation.dme | 1 - 14 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 code/__HELPERS/records.dm diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm index dc2f66c2ed0..f81464013e0 100644 --- a/code/__HELPERS/areas.dm +++ b/code/__HELPERS/areas.dm @@ -148,7 +148,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(list( * A list of all machinery tied to an area along with the area itself. key=area name,value=list(area,list of machinery) * we use this to keep track of what areas are affected by the blueprints & what machinery of these areas needs to be reconfigured accordingly */ - var/area/affected_areas = list() + var/list/area/affected_areas = list() for(var/turf/the_turf as anything in turfs) var/area/old_area = the_turf.loc diff --git a/code/__HELPERS/paths/path.dm b/code/__HELPERS/paths/path.dm index 61e50601e78..189120b76c3 100644 --- a/code/__HELPERS/paths/path.dm +++ b/code/__HELPERS/paths/path.dm @@ -370,7 +370,7 @@ GLOBAL_LIST_INIT(can_pass_info_vars, GLOBAL_PROC_REF(can_pass_check_vars)) /datum/can_pass_info/proc/compare_against(datum/can_pass_info/check_against) for(var/comparable_var in GLOB.can_pass_info_vars) - if(!(vars[comparable_var] ~= check_against[comparable_var])) + if(!(vars[comparable_var] ~= check_against.vars[comparable_var])) return FALSE if(!pulling_info != !check_against.pulling_info) return FALSE diff --git a/code/__HELPERS/records.dm b/code/__HELPERS/records.dm deleted file mode 100644 index 288ef5284d2..00000000000 --- a/code/__HELPERS/records.dm +++ /dev/null @@ -1,6 +0,0 @@ - -/proc/overwrite_field_if_available(datum/record/base, datum/record/other, field_name) - if(other[field_name]) - base[field_name] = other[field_name] - - diff --git a/code/controllers/subsystem/research.dm b/code/controllers/subsystem/research.dm index c419d5eade7..2a2c11c1ac1 100644 --- a/code/controllers/subsystem/research.dm +++ b/code/controllers/subsystem/research.dm @@ -7,7 +7,7 @@ SUBSYSTEM_DEF(research) //TECHWEB STATIC var/list/techweb_nodes = list() //associative id = node datum var/list/techweb_designs = list() //associative id = node datum - var/list/datum/design/item_to_design = list() //typepath = list of design datums + var/list/list/datum/design/item_to_design = list() //typepath = list of design datums ///List of all techwebs, generating points or not. ///Autolathes, Mechfabs, and others all have shared techwebs, for example. diff --git a/code/controllers/subsystem/spatial_gridmap.dm b/code/controllers/subsystem/spatial_gridmap.dm index 81ae29f6bad..76aa484bf92 100644 --- a/code/controllers/subsystem/spatial_gridmap.dm +++ b/code/controllers/subsystem/spatial_gridmap.dm @@ -234,7 +234,7 @@ SUBSYSTEM_DEF(spatial_grid) . = list() //technically THIS list only contains lists, but inside those lists are grid cell datums and we can go without a SINGLE var init if we do this - var/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z] + var/list/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z] switch(type) if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS) diff --git a/code/datums/ai/_ai_controller.dm b/code/datums/ai/_ai_controller.dm index 7b46a7b06e8..33b63f09a01 100644 --- a/code/datums/ai/_ai_controller.dm +++ b/code/datums/ai/_ai_controller.dm @@ -176,7 +176,15 @@ multiple modular subtrees with behaviors if(ai_status == AI_STATUS_OFF) return - if(exited && (get_dist(pawn, (islist(exited) ? exited[1] : exited)) <= interesting_dist)) //is our target in between interesting cells? + var/distance = INFINITY + if(islist(exited)) + var/list/exited_list = exited + distance = get_dist(pawn, exited_list[1]) + else if(isatom(exited)) + var/atom/exited_atom = exited + distance = get_dist(pawn, exited_atom) + + if(distance <= interesting_dist) //is our target in between interesting cells? return if(should_idle()) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index acf9ceead56..108d303b72c 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -281,7 +281,8 @@ var/datum/component/C = dc[c_type] if(C) if(length(C)) - C = C[1] + var/list/component_list = C + C = component_list[1] if(C.type == c_type) return C return null diff --git a/code/datums/greyscale/_greyscale_config.dm b/code/datums/greyscale/_greyscale_config.dm index 1ef5e68510e..d549149493f 100644 --- a/code/datums/greyscale/_greyscale_config.dm +++ b/code/datums/greyscale/_greyscale_config.dm @@ -284,8 +284,9 @@ for(var/datum/greyscale_layer/layer as anything in group) var/icon/layer_icon if(islist(layer)) + var/list/layer_list = layer layer_icon = GenerateLayerGroup(colors, layer, render_steps, new_icon || last_external_icon) - layer = layer[1] // When there are multiple layers in a group like this we use the first one's blend mode + layer = layer_list[1] // When there are multiple layers in a group like this we use the first one's blend mode else layer_icon = layer.Generate(colors, render_steps, new_icon || last_external_icon) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 5291805609f..dc851793775 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1455,7 +1455,7 @@ if(response.body == "[]") dat += "
0 bans detected for [ckey]
" else - bans = json_decode(response["body"]) + bans = json_decode(response.body) //Ignore bans from non-whitelisted sources, if a whitelist exists var/list/valid_sources diff --git a/code/modules/admin/view_variables/debug_variables.dm b/code/modules/admin/view_variables/debug_variables.dm index a4035acd014..d9a1b90b0af 100644 --- a/code/modules/admin/view_variables/debug_variables.dm +++ b/code/modules/admin/view_variables/debug_variables.dm @@ -3,11 +3,12 @@ /proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value. if(owner) if(islist(owner)) + var/list/list_owner = owner var/index = name if (value) - name = owner[name] //name is really the index until this line + name = list_owner[name] //name is really the index until this line else - value = owner[name] + value = list_owner[name] . = "
  • ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_EDIT, "E", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_CHANGE, "C", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_REMOVE, "-", index)]) " else . = "
  • ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_EDIT, "E", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_CHANGE, "C", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_MASSEDIT, "M", name)]) " diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index e81425b9a1a..e830718e12e 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -1189,7 +1189,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_atoms_ontop) if(response.errored || response.status_code != 200) query_in_progress = FALSE CRASH("Failed to fetch mapped custom json from url [json_url], code: [response.status_code], error: [response.error]") - var/json_data = response["body"] + var/json_data = response.body json_cache[json_url] = json_data query_in_progress = FALSE return json_data diff --git a/code/modules/vehicles/_vehicle.dm b/code/modules/vehicles/_vehicle.dm index 5c757413e0e..155ef2b4570 100644 --- a/code/modules/vehicles/_vehicle.dm +++ b/code/modules/vehicles/_vehicle.dm @@ -30,7 +30,7 @@ var/canmove = TRUE var/list/autogrant_actions_passenger //plain list of typepaths var/list/autogrant_actions_controller //assoc list "[bitflag]" = list(typepaths) - var/list/mob/occupant_actions //assoc list mob = list(type = action datum assigned to mob) + var/list/list/datum/action/occupant_actions //assoc list mob = list(type = action datum assigned to mob) ///This vehicle will follow us when we move (like atrailer duh) var/obj/vehicle/trailer var/are_legs_exposed = FALSE diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index e2a6359bb42..c2d37ee6e83 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -375,7 +375,7 @@ for(var/datum/design/design in cached_designs) var/cost = list() - var/list/materials = design["materials"] + var/list/materials = design.materials for(var/datum/material/mat in materials) cost[mat.name] = OPTIMAL_COST(materials[mat] * component_coeff) diff --git a/tgstation.dme b/tgstation.dme index eae3975520b..fe7c98fac1d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -544,7 +544,6 @@ #include "code\__HELPERS\radio.dm" #include "code\__HELPERS\randoms.dm" #include "code\__HELPERS\reagents.dm" -#include "code\__HELPERS\records.dm" #include "code\__HELPERS\ref.dm" #include "code\__HELPERS\roundend.dm" #include "code\__HELPERS\sanitize_values.dm"