From 9fa69405cddd030d03429ed3e2a6fdee5c186406 Mon Sep 17 00:00:00 2001 From: Lily-129 <68935009+Lily-129@users.noreply.github.com> Date: Sat, 5 Feb 2022 23:29:06 -0500 Subject: [PATCH] mod that makes plants more killable test of for loop in for loop for reaction adding --- mods/nested_for_reaction_example.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 mods/nested_for_reaction_example.js diff --git a/mods/nested_for_reaction_example.js b/mods/nested_for_reaction_example.js new file mode 100644 index 00000000..01e44da3 --- /dev/null +++ b/mods/nested_for_reaction_example.js @@ -0,0 +1,10 @@ +arrayNameA = ["radiation", "alcohol", "soap", "acid", "ammonia", "acid_gas"] +arrayNameB = ["plant", "frozen_plant", "grass", "algae", "sapling", "seeds", "grass_seed", "wheat_seed", "wheat", "flower_seed", "pistil", "petal", "vine", "bamboo", "bamboo_plant", "corn_seed", "potato_seed", "root", "berry_seed", "old_berry_leaf", "berry_leaf", "berry"] +for(i = 0; i < arrayNameA.length; i++) { + if(!elements[arrayNameA[i]].reactions) { + elements[arrayNameA[i]].reactions = {} + } + for(j = 0; j < arrayNameB.length; j++) { + elements[arrayNameA[i]].reactions[arrayNameB[j]] = { "elem1":null, "elem2":"dead_plant" } + }; +}; \ No newline at end of file