Skip to content

Commit

Permalink
jscam: Minor fixes for levels 1 and 2.
Browse files Browse the repository at this point in the history
camMakePos(AREA) now returns the center of the area,
because returning random spot in the area causes
hard-to-reproduce bugs and not useful anyway.

refs ticket:4234
  • Loading branch information
haoNoQ committed Oct 26, 2014
1 parent 5543c6a commit 90e2f3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions data/base/script/campaign/cam1a.js
Expand Up @@ -75,6 +75,11 @@ camAreaEvent("scavbase3area", me, function(droid)
camEnableFactory("base2factory2");
});

function camEnemyBaseEliminated_scavgroup1()
{
camEnableFactory("base1factory");
}

function camEnemyBaseEliminated_scavgroup2()
{
queue("camDetectEnemyBase", 2000, "scavgroup3");
Expand Down
6 changes: 3 additions & 3 deletions data/base/script/campaign/libcampaign.js
Expand Up @@ -115,7 +115,7 @@ function camSafeRemoveObject(obj, flashy)
//;; \subsection{camMakePos(x, y | label | object)}
//;; Make a POSITION-like object, unless already done. Often useful
//;; for making functions that would accept positions in both xx,yy and {x:xx,y:yy} forms.
//;; Also accepts labels. If label of AREA is given, returns a random spot in the area.
//;; Also accepts labels. If label of AREA is given, returns the center of the area.
//;; If an existing object or label of such is given, returns a safe JavaScript
//;; object containing its x, y and id.
function camMakePos(xx, yy)
Expand Down Expand Up @@ -143,8 +143,8 @@ function camMakePos(xx, yy)
return obj;
case AREA:
return {
x: obj.x + camRand(obj.x2 - obj.x + 1),
y: obj.y + camRand(obj.y2 - obj.y + 1)
x: Math.floor((obj.x + obj.x2) / 2),
y: Math.floor((obj.y + obj.y2) / 2)
};
case GROUP:
default:
Expand Down

0 comments on commit 90e2f3c

Please sign in to comment.