mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 05:30:41 +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 housePos = Vec3.sum(MyAvatar.position, Quat.getFront(Camera.getOrientation()));
|
||||
|
||||
var housePositions = []
|
||||
for (var j = 0; j < measures.rows; j++) {
|
||||
|
||||
var posX1 = 0 - (xRange / 2);
|
||||
|
@ -87,11 +88,8 @@
|
|||
y: 0,
|
||||
z: dd
|
||||
};
|
||||
|
||||
print("House nr.:" + (houses.length + 1));
|
||||
houses.push(
|
||||
addHouseAt(Vec3.sum(housePos, posShift), (j % 2 == 0) ? rotEven : rotOdd)
|
||||
);
|
||||
|
||||
housePositions.push(Vec3.sum(housePos, posShift));
|
||||
posX1 += measures.parcelWidth;
|
||||
}
|
||||
}
|
||||
|
@ -144,14 +142,18 @@
|
|||
};
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
while (houses.length > 0) {
|
||||
if (!houses[0].isKnownID) {
|
||||
houses[0] = Entities.identifyEntity(houses[0]);
|
||||
}
|
||||
Entities.deleteEntity(houses.shift());
|
||||
var addHouses = function() {
|
||||
if (housePositions.length > 0) {
|
||||
position = housePositions.pop();
|
||||
print("House nr.:" + (houses.length + 1));
|
||||
houses.push(
|
||||
addHouseAt(position, (housePositions.length % 2 == 0) ? rotEven : rotOdd)
|
||||
);
|
||||
|
||||
// max 20 per second
|
||||
Script.setTimeout(addHouses, 50);
|
||||
}
|
||||
}
|
||||
|
||||
Script.scriptEnding.connect(cleanup);
|
||||
};
|
||||
|
||||
addHouses();
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue