Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various small fixes #3342

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion data/base/script/campaign/libcampaign_includes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ function cam_eventDroidBuilt(droid, structure)
{
return;
}
if (camGetNexusState() && droid.player === CAM_NEXUS && __camNextLevel === "CAM3C" && camRand(100) < 7)
{
// Occasionally hint that NEXUS is producing units on Gamma 5.
playSound(CAM_PRODUCTION_COMPLETE_SND);
}
if (!camDef(__camFactoryInfo))
{
return;
Expand Down Expand Up @@ -364,7 +369,7 @@ function cam_eventGameLoaded()
//Plays Nexus sounds if nexusActivated is true.
function cam_eventObjectTransfer(obj, from)
{
if (from === CAM_HUMAN_PLAYER && obj.player === CAM_NEXUS && __camNexusActivated === true)
if (camGetNexusState() && from === CAM_HUMAN_PLAYER && obj.player === CAM_NEXUS)
{
let snd;
if (obj.type === STRUCTURE)
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/libcampaign_includes/nexus.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function camAbsorbPlayer(who, to)
//;;
function camHackIntoPlayer(player, to)
{
if (__camNexusActivated === false)
if (!camGetNexusState())
{
return;
}
Expand Down
15 changes: 8 additions & 7 deletions data/base/script/campaign/libcampaign_includes/truck.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function __camEnumFreeTrucks(player)
return droids;
}

function __camGetClosestTruck(player, pos)
function __camGetClosestTruck(player, pos, list)
{
const droids = __camEnumFreeTrucks(player);
const droids = (camDef(list) && list !== null) ? list : __camEnumFreeTrucks(player);
if (droids.length <= 0)
{
return undefined;
Expand Down Expand Up @@ -88,6 +88,7 @@ function __camTruckTick()
{
const ti = __camTruckInfo[playerObj];
const __PLAYER = ti.player;
let freeTrucks = __camEnumFreeTrucks(__PLAYER);
let truck;

// First, build things that were explicitly ordered.
Expand All @@ -101,7 +102,7 @@ function __camTruckTick()
if (camDef(pos))
{
// Find the truck most suitable for the job.
truck = __camGetClosestTruck(__PLAYER, pos);
truck = __camGetClosestTruck(__PLAYER, pos, freeTrucks);
if (!camDef(truck))
{
break;
Expand All @@ -110,12 +111,11 @@ function __camTruckTick()
else
{
// Build near any truck if pos was not specified.
const droids = __camEnumFreeTrucks(__PLAYER);
if (droids.length <= 0)
if (freeTrucks.length <= 0)
{
break;
}
truck = droids[0];
truck = freeTrucks[0];
pos = truck;
randx = (camRand(100) < 50) ? -camRand(2) : camRand(2);
randy = (camRand(100) < 50) ? -camRand(2) : camRand(2);
Expand All @@ -127,6 +127,7 @@ function __camTruckTick()
{
if (orderDroidBuild(truck, DORDER_BUILD, __QI.stat, loc.x + randx, loc.y + randy))
{
freeTrucks = freeTrucks.filter((tr) => (tr.id !== truck.id));
ti.queue.shift(); // consider it handled
}
}
Expand All @@ -139,7 +140,7 @@ function __camTruckTick()
continue;
}
const oil = oils[0];
truck = __camGetClosestTruck(__PLAYER, oil);
truck = __camGetClosestTruck(__PLAYER, oil, freeTrucks);
if (camDef(truck) && __PLAYER !== CAM_NEXUS)
{
enableStructure("A0ResourceExtractor", __PLAYER);
Expand Down
1 change: 0 additions & 1 deletion data/base/script/campaign/libcampaign_includes/vtol.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ function camSetVtolSpawnState(state, identifier)
if (__camVtolDataSystem[idx].spawnStopObject === identifier)
{
__camVtolDataSystem[idx].active = state;
break;
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/wzapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2378,8 +2378,11 @@ bool wzapi::gameOverMessage(WZAPI_PARAMS(bool gameWon, optional<bool> _showBackD
if (gameWon && showOutro)
{
showBackDrop = false;
seq_AddSeqToList("outro.ogg", nullptr, "outro.txa", false);
seq_StartNextFullScreenVideo();
if (seq_hasVideos())
{
seq_AddSeqToList("outro.ogg", nullptr, "outro.txa", false);
seq_StartNextFullScreenVideo();
}
}
else
{
Expand Down