Skip to content

Commit

Permalink
Destroy non-droids blocking spawn locations or LZ reinforcements
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Jan 17, 2024
1 parent f0f7bfc commit 9321a87
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions data/base/script/campaign/libcampaign_includes/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,38 @@ function camCountStructuresInArea(label, playerFilter)
return ret;
}

//;; ## camCleanTileOfObstructions(x, y | pos)
//;;
//;; Obliterates player structures and features near the tile around certain coordinates.
//;; Can be used for spawn locations or transport reinforcement spots. May not
//;; delete very large objects like factories or skyscrapers.
//;;
//;; @param {number|Object} x
//;; @param {number} [y]
//;; @returns {void}
//;;
function camCleanTileOfObstructions(x, y)
{
if (!camDef(x))
{
camDebug("invalid parameters?");
return;
}

const __TILE_SWEEP_RADIUS = 1;
const pos = (camDef(y)) ? {x: x, y: y} : x;
const objects = enumRange(pos.x, pos.y, __TILE_SWEEP_RADIUS, CAM_HUMAN_PLAYER, false);

for (let i = 0, len = objects.length; i < len; ++i)
{
const obj = objects[i];
if (obj.type !== DROID)
{
camSafeRemoveObject(obj, true);
}
}
}

//;; ## camChangeOnDiff(numericValue)
//;;
//;; Change a numeric value based on campaign difficulty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ function camSendReinforcement(playerId, position, templates, kind, data)
order_data = data.data;
}
}
if (playerId !== CAM_HUMAN_PLAYER)
{
camCleanTileOfObstructions(pos);
}
switch (kind)
{
case CAM_REINFORCE_GROUND:
Expand Down

0 comments on commit 9321a87

Please sign in to comment.