Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/rmgen/group.js
Show All 28 Lines | if (centerPosition) | ||||
this.setCenterPosition(centerPosition); | this.setCenterPosition(centerPosition); | ||||
} | } | ||||
SimpleGroup.prototype.setCenterPosition = function(position) | SimpleGroup.prototype.setCenterPosition = function(position) | ||||
{ | { | ||||
this.centerPosition = deepfreeze(position.clone().round()); | this.centerPosition = deepfreeze(position.clone().round()); | ||||
}; | }; | ||||
SimpleGroup.prototype.place = function(player, constraint) | SimpleGroup.prototype.place = function(playerID, constraint) | ||||
{ | { | ||||
let entitySpecsResult = []; | let entitySpecsResult = []; | ||||
let avoidPositions = this.avoidSelf ? [] : undefined; | |||||
// Test if the Objects can be placed at the given location | // Test if the Objects can be placed at the given location | ||||
// Place none of them if one can't be placed. | // Place none of them if one can't be placed. | ||||
for (let object of this.objects) | for (let object of this.objects) | ||||
minohaka: I'm getting this error, I don't know if it's related to this change set
```
ERROR: JavaScript… | |||||
{ | { | ||||
let entitySpecs = object.place(this.centerPosition, player, this.avoidSelf, constraint); | let entitySpecs = object.place(this.centerPosition, playerID, avoidPositions, constraint, 20); | ||||
if (!entitySpecs) | if (!entitySpecs) | ||||
return undefined; | return undefined; | ||||
entitySpecsResult = entitySpecsResult.concat(entitySpecs); | entitySpecsResult = entitySpecsResult.concat(entitySpecs); | ||||
} | |||||
if (this.avoidSelf) | |||||
avoidPositions = avoidPositions.concat(entitySpecs.map(entitySpec => ({ | |||||
"position": entitySpec.position, | |||||
"distance": object.avoidDistance | |||||
}))); | |||||
} | |||||
// Create and place entities as specified | // Create and place entities as specified | ||||
let entities = []; | let entities = []; | ||||
for (let entitySpecs of entitySpecsResult) | for (let entitySpecs of entitySpecsResult) | ||||
{ | { | ||||
// The Object must ensure that non-actor entities are not placed at the impassable map-border | // The Object must ensure that non-actor entities are not placed at the impassable map-border | ||||
entities.push( | entities.push( | ||||
g_Map.placeEntityAnywhere(entitySpecs.templateName, entitySpecs.playerID, entitySpecs.position, entitySpecs.angle)); | g_Map.placeEntityAnywhere(entitySpecs.templateName, entitySpecs.playerID, entitySpecs.position, entitySpecs.angle)); | ||||
Show All 13 Lines | function RandomGroup(objects, avoidSelf = false, tileClass = undefined, centerPosition = undefined) | ||||
this.simpleGroup = new SimpleGroup([pickRandom(objects)], avoidSelf, tileClass, centerPosition); | this.simpleGroup = new SimpleGroup([pickRandom(objects)], avoidSelf, tileClass, centerPosition); | ||||
} | } | ||||
RandomGroup.prototype.setCenterPosition = function(position) | RandomGroup.prototype.setCenterPosition = function(position) | ||||
{ | { | ||||
this.simpleGroup.setCenterPosition(position); | this.simpleGroup.setCenterPosition(position); | ||||
}; | }; | ||||
RandomGroup.prototype.place = function(player, constraint) | RandomGroup.prototype.place = function(playerID, constraint) | ||||
{ | { | ||||
return this.simpleGroup.place(player, constraint); | return this.simpleGroup.place(playerID, constraint); | ||||
}; | }; |
Wildfire Games · Phabricator
I'm getting this error, I don't know if it's related to this change set