From 72f1f5ba626e828929893e058434a146f62b1602 Mon Sep 17 00:00:00 2001 From: Stojce Slavkovski Date: Mon, 30 Mar 2015 22:08:26 +0200 Subject: [PATCH] stop makeHouses.js gracefully remove exit cleanup --- examples/example/entities/makeHouses.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/examples/example/entities/makeHouses.js b/examples/example/entities/makeHouses.js index e31b3a7335..d49f737880 100644 --- a/examples/example/entities/makeHouses.js +++ b/examples/example/entities/makeHouses.js @@ -152,20 +152,11 @@ // max 20 per second Script.setTimeout(addHouses, 50); + } else { + Script.stop(); } }; addHouses(); - function cleanup() { - while (houses.length > 0) { - if (!houses[0].isKnownID) { - houses[0] = Entities.identifyEntity(houses[0]); - } - Entities.deleteEntity(houses.shift()); - Script.setTimeout(addHouses, 50); - } - } - - Script.scriptEnding.connect(cleanup); })();