mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Fix eslint rule 'comma-spacing'
eslint --no-config-lookup --fix --rule '""comma-spacing: 1' Ref: #7812 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
7ab9416acc
commit
fd0f7cc270
10 changed files with 24 additions and 24 deletions
|
|
@ -192,7 +192,7 @@ GameSettings.prototype.Attributes.PlayerColor = class PlayerColor extends GameSe
|
|||
GameSettings.prototype.Attributes.PlayerColor.prototype.DefaultColors = [
|
||||
{ "r": 10, "g": 10, "b": 190 },
|
||||
{ "r": 230, "g": 10, "b": 10 },
|
||||
{ "r": 125 , "g": 235, "b": 15 },
|
||||
{ "r": 125, "g": 235, "b": 15 },
|
||||
{ "r": 255, "g": 255, "b": 55 },
|
||||
{ "r": 130, "g": 0, "b": 230 },
|
||||
{ "r": 255, "g": 130, "b": 0 },
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ Math.atan = function(a)
|
|||
/**
|
||||
* Approximation of arctangent of y/x, returns angle from -pi to pi
|
||||
*/
|
||||
Math.atan2 = function(y,x)
|
||||
Math.atan2 = function(y, x)
|
||||
{
|
||||
// get unsigned x,y for ease of calculation, this means all angles are in the range [0, pi/2]
|
||||
var ux = Math.abs(x);
|
||||
|
|
|
|||
|
|
@ -161,11 +161,11 @@ function* GenerateMap(mapSettings) {
|
|||
0,
|
||||
[Math.floor(fractionToTiles(0.01))]),
|
||||
[
|
||||
new LayeredPainter([tHill,tMainTerrain], [Math.floor(elevRand / 3), 40]),
|
||||
new LayeredPainter([tHill, tMainTerrain], [Math.floor(elevRand / 3), 40]),
|
||||
new SmoothElevationPainter(ELEVATION_SET, elevRand, Math.floor(elevRand / 3)),
|
||||
new TileClassPainter(clHill)
|
||||
],
|
||||
[avoidClasses(clPlayer, 16),stayClasses(clLand, 28)]);
|
||||
[avoidClasses(clPlayer, 16), stayClasses(clLand, 28)]);
|
||||
}
|
||||
|
||||
const nonMountainPosition = Vector2D.add(mapCenter, new Vector2D(0, fractionToTiles(0.10)).rotate(startAngle).rotate(Math.PI)).round();
|
||||
|
|
@ -192,7 +192,7 @@ function* GenerateMap(mapSettings) {
|
|||
new SmoothElevationPainter(ELEVATION_SET, elevRand, randIntInclusive(18, 30)),
|
||||
new TileClassPainter(clMountain)
|
||||
],
|
||||
[avoidClasses(clNotMountain,2, clMountain, 3)]);
|
||||
[avoidClasses(clNotMountain, 2, clMountain, 3)]);
|
||||
}
|
||||
for (let m = 0; m < randIntInclusive(100, 180); ++m) {
|
||||
const elevRand = randIntInclusive(24, 38);
|
||||
|
|
@ -218,7 +218,7 @@ function* GenerateMap(mapSettings) {
|
|||
const [forestTrees, stragglerTrees] = getTreeCounts(...rBiomeTreeCount(1));
|
||||
createDefaultForests(
|
||||
[tMainTerrain, tForestFloor1, tForestFloor2, pForest1, pForest2],
|
||||
[avoidClasses(clPlayer, 20, clForest, 17, clMountain, 8, clBaseResource,2), stayClasses(clLand, 4)],
|
||||
[avoidClasses(clPlayer, 20, clForest, 17, clMountain, 8, clBaseResource, 2), stayClasses(clLand, 4)],
|
||||
clForest,
|
||||
forestTrees);
|
||||
|
||||
|
|
@ -227,8 +227,8 @@ function* GenerateMap(mapSettings) {
|
|||
g_Map.log("Creating dirt patches");
|
||||
createLayeredPatches(
|
||||
[scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)],
|
||||
[[tMainTerrain,tTier1Terrain],[tTier1Terrain,tTier2Terrain], [tTier2Terrain,tTier3Terrain]],
|
||||
[1,1],
|
||||
[[tMainTerrain, tTier1Terrain], [tTier1Terrain, tTier2Terrain], [tTier2Terrain, tTier3Terrain]],
|
||||
[1, 1],
|
||||
[avoidClasses(clForest, 0, clDirt, 5, clPlayer, 12), stayClasses(clLand, 5)],
|
||||
scaleByMapSize(15, 45),
|
||||
clDirt);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ function* GenerateMap(mapSettings)
|
|||
0,
|
||||
[Math.floor(fractionToTiles(0.01))]),
|
||||
[
|
||||
new LayeredPainter([tCliff, tHill,tMainTerrain], [Math.floor(elevRand / 8), 40]),
|
||||
new LayeredPainter([tCliff, tHill, tMainTerrain], [Math.floor(elevRand / 8), 40]),
|
||||
new SmoothElevationPainter(ELEVATION_SET, elevRand, randIntInclusive(18, 25)),
|
||||
new TileClassPainter(clHill)
|
||||
],
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ ChainPlacer.prototype.place = function(constraint)
|
|||
Math.abs(this.centerPosition.y - pos.y) > this.maxDistance))
|
||||
continue;
|
||||
|
||||
if (gotRet[at(pos.x,pos.y)] != 1)
|
||||
if (gotRet[at(pos.x, pos.y)] != 1)
|
||||
continue;
|
||||
|
||||
if (pos.x > 0 && gotRet[at(pos.x - 1, pos.y)] == 0 ||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ ClumpPlacer.prototype.place = function(constraint)
|
|||
let perim = 4 * radius * 2 * Math.PI;
|
||||
let intPerim = Math.ceil(perim);
|
||||
|
||||
let ctrlPts = 1 + Math.floor(1.0/Math.max(this.smoothness,1.0/intPerim));
|
||||
let ctrlPts = 1 + Math.floor(1.0/Math.max(this.smoothness, 1.0/intPerim));
|
||||
|
||||
if (ctrlPts > radius * 2 * Math.PI)
|
||||
ctrlPts = Math.floor(radius * 2 * Math.PI) + 1;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Trigger.prototype.IntroductionMessage = function(data)
|
|||
|
||||
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||
cmpGUIInterface.PushNotification({
|
||||
"players": [1,2],
|
||||
"players": [1, 2],
|
||||
"message": markForTranslation("Collect the treasures before your enemy does! May the better win!"),
|
||||
"translateMessage": true
|
||||
});
|
||||
|
|
@ -24,7 +24,7 @@ Trigger.prototype.TreasureCollected = function(data)
|
|||
(this.treasureCount.players[otherPlayer] == this.treasureCount.maximum / 2) )
|
||||
{
|
||||
cmpGUIInterface.PushNotification({
|
||||
"players": [1,2],
|
||||
"players": [1, 2],
|
||||
"message": markForTranslation("No winner yet, prepare for battle!"),
|
||||
"translateMessage": true
|
||||
});
|
||||
|
|
@ -87,7 +87,7 @@ Trigger.prototype.BattleMessage = function()
|
|||
{
|
||||
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||
cmpGUIInterface.PushNotification({
|
||||
"players": [1,2],
|
||||
"players": [1, 2],
|
||||
"message": markForTranslation("Defeat your enemy to win!"),
|
||||
"translateMessage": true
|
||||
});
|
||||
|
|
@ -110,7 +110,7 @@ Trigger.prototype.Victory = function(playerID)
|
|||
var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
|
||||
|
||||
// TODO: It would be nice to get the total number of treasure on the map automatically somehow
|
||||
cmpTrigger.treasureCount = { "players": { "1":0,"2":0 }, "maximum": 36 };
|
||||
cmpTrigger.treasureCount = { "players": { "1":0, "2":0 }, "maximum": 36 };
|
||||
cmpTrigger.state = "start";
|
||||
cmpTrigger.DoAfterDelay(2000, "IntroductionMessage", {});
|
||||
cmpTrigger.RegisterTrigger("OnTreasureCollected", "TreasureCollected", { "enabled": true });
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ Trigger.prototype.IntervalAction = function(data)
|
|||
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||
cmpGUIInterface.PushNotification({
|
||||
"type": "dialog",
|
||||
"players": [1,2,3,4,5,6,7,8],
|
||||
"players": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
"dialogName": "yes-no",
|
||||
"data": {
|
||||
"text": {
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ BuildingAI.prototype.FireArrows = function()
|
|||
for (let target of this.targetUnits)
|
||||
addTarget(target);
|
||||
// Sort targets by preference and then by proximity.
|
||||
targets.sort( (a,b) => {
|
||||
targets.sort( (a, b) => {
|
||||
if (a.preference > b.preference)
|
||||
return 1;
|
||||
else if (a.preference < b.preference)
|
||||
|
|
|
|||
|
|
@ -1670,7 +1670,7 @@ function ClusterEntities(ents, separationDistance)
|
|||
for (let i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|
||||
for (let j = i - 1; j >= 0 && !closeClusters; --j)
|
||||
if (matrix[i][j] < distSq)
|
||||
closeClusters = [i,j];
|
||||
closeClusters = [i, j];
|
||||
|
||||
// if no more close clusters found, just return all found clusters so far
|
||||
if (!closeClusters)
|
||||
|
|
@ -1694,16 +1694,16 @@ function ClusterEntities(ents, separationDistance)
|
|||
}
|
||||
// remove the rows and columns in the matrix for the merged clusters,
|
||||
// and the clusters themselves from the cluster list
|
||||
clusters.splice(closeClusters[0],1);
|
||||
clusters.splice(closeClusters[1],1);
|
||||
matrix.splice(closeClusters[0],1);
|
||||
matrix.splice(closeClusters[1],1);
|
||||
clusters.splice(closeClusters[0], 1);
|
||||
clusters.splice(closeClusters[1], 1);
|
||||
matrix.splice(closeClusters[0], 1);
|
||||
matrix.splice(closeClusters[1], 1);
|
||||
for (let i = 0; i < matrix.length; ++i)
|
||||
{
|
||||
if (matrix[i].length > closeClusters[0])
|
||||
matrix[i].splice(closeClusters[0],1);
|
||||
matrix[i].splice(closeClusters[0], 1);
|
||||
if (matrix[i].length > closeClusters[1])
|
||||
matrix[i].splice(closeClusters[1],1);
|
||||
matrix[i].splice(closeClusters[1], 1);
|
||||
}
|
||||
// add a new row of distances to the matrix and the new cluster
|
||||
clusters.push(newCluster);
|
||||
|
|
|
|||
Loading…
Reference in a new issue