mirror of
https://github.com/overte-org/overte.git
synced 2025-06-15 11:06:29 +02:00
limit 20 per sec. / don't delete on script stop
This commit is contained in:
parent
80ecbed02b
commit
42a1079322
1 changed files with 16 additions and 14 deletions
|
@ -70,6 +70,7 @@
|
||||||
var rotOdd = Quat.fromPitchYawRollDegrees(0, 90.0 + MyAvatar.bodyYaw, 0.0);
|
var rotOdd = Quat.fromPitchYawRollDegrees(0, 90.0 + MyAvatar.bodyYaw, 0.0);
|
||||||
var housePos = Vec3.sum(MyAvatar.position, Quat.getFront(Camera.getOrientation()));
|
var housePos = Vec3.sum(MyAvatar.position, Quat.getFront(Camera.getOrientation()));
|
||||||
|
|
||||||
|
var housePositions = []
|
||||||
for (var j = 0; j < measures.rows; j++) {
|
for (var j = 0; j < measures.rows; j++) {
|
||||||
|
|
||||||
var posX1 = 0 - (xRange / 2);
|
var posX1 = 0 - (xRange / 2);
|
||||||
|
@ -88,10 +89,7 @@
|
||||||
z: dd
|
z: dd
|
||||||
};
|
};
|
||||||
|
|
||||||
print("House nr.:" + (houses.length + 1));
|
housePositions.push(Vec3.sum(housePos, posShift));
|
||||||
houses.push(
|
|
||||||
addHouseAt(Vec3.sum(housePos, posShift), (j % 2 == 0) ? rotEven : rotOdd)
|
|
||||||
);
|
|
||||||
posX1 += measures.parcelWidth;
|
posX1 += measures.parcelWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,14 +142,18 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
var addHouses = function() {
|
||||||
while (houses.length > 0) {
|
if (housePositions.length > 0) {
|
||||||
if (!houses[0].isKnownID) {
|
position = housePositions.pop();
|
||||||
houses[0] = Entities.identifyEntity(houses[0]);
|
print("House nr.:" + (houses.length + 1));
|
||||||
}
|
houses.push(
|
||||||
Entities.deleteEntity(houses.shift());
|
addHouseAt(position, (housePositions.length % 2 == 0) ? rotEven : rotOdd)
|
||||||
}
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
// max 20 per second
|
||||||
|
Script.setTimeout(addHouses, 50);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
addHouses();
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue