From e6384223be6cf0b120dfdc998fe6027e24e2d25d Mon Sep 17 00:00:00 2001 From: Amy <3855802+amylizzle@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:27:53 +0000 Subject: [PATCH] Fix initial filter in object defs and adds test (#2121) Co-authored-by: amylizzle --- .../DMProject/Tests/filter_initial.dm | 16 ++++++++++++++++ Content.IntegrationTests/DMProject/code.dm | 1 + .../DMProject/environment.dme | 1 + DMCompiler/DM/DMCodeTree.Vars.cs | 1 + 4 files changed, 19 insertions(+) create mode 100644 Content.IntegrationTests/DMProject/Tests/filter_initial.dm diff --git a/Content.IntegrationTests/DMProject/Tests/filter_initial.dm b/Content.IntegrationTests/DMProject/Tests/filter_initial.dm new file mode 100644 index 0000000000..65812623c0 --- /dev/null +++ b/Content.IntegrationTests/DMProject/Tests/filter_initial.dm @@ -0,0 +1,16 @@ +/obj/blurry + filters = filter(type="blur", size=2) + +/obj/veryblurry + filters = list(type="blur", size=4) + +/obj/notatallblurry + filters = list() + +/proc/test_filter_init() + var/obj/veryblurry/VB = new() + ASSERT(length(VB.filters) == 1) + var/obj/blurry/B = new() + ASSERT(length(B.filters) == 1) + var/obj/notatallblurry/NAB = new() + ASSERT(length(NAB.filters) == 0) \ No newline at end of file diff --git a/Content.IntegrationTests/DMProject/code.dm b/Content.IntegrationTests/DMProject/code.dm index ebb99dd087..22379ac075 100644 --- a/Content.IntegrationTests/DMProject/code.dm +++ b/Content.IntegrationTests/DMProject/code.dm @@ -30,4 +30,5 @@ test_color_matrix() test_range() test_verb_duplicate() + test_filter_init() world.log << "IntegrationTests successful, /world/New() exiting..." \ No newline at end of file diff --git a/Content.IntegrationTests/DMProject/environment.dme b/Content.IntegrationTests/DMProject/environment.dme index a4abe97328..f58687b514 100644 --- a/Content.IntegrationTests/DMProject/environment.dme +++ b/Content.IntegrationTests/DMProject/environment.dme @@ -3,5 +3,6 @@ #include "Tests/color_matrix.dm" #include "Tests/range.dm" #include "Tests/verb_duplicate.dm" +#include "Tests/filter_initial.dm" #include "map.dmm" #include "interface.dmf" \ No newline at end of file diff --git a/DMCompiler/DM/DMCodeTree.Vars.cs b/DMCompiler/DM/DMCodeTree.Vars.cs index 0657c8cccd..b259047fb3 100644 --- a/DMCompiler/DM/DMCodeTree.Vars.cs +++ b/DMCompiler/DM/DMCodeTree.Vars.cs @@ -74,6 +74,7 @@ private bool IsValidRightHandSide(DMCompiler compiler, DMObject dmObject, DMExpr "file" => true, "sound" => true, "nameof" => true, + "filter" => true, _ => false },