mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Reveal Gaia wonders to players
Some checks are pending
Some checks are pending
This commit is contained in:
parent
dc1e7179a3
commit
0da1e0c398
1 changed files with 25 additions and 2 deletions
|
|
@ -23,7 +23,7 @@ Trigger.prototype.WonderVictoryEntityRenamed = function(data)
|
||||||
// Make the completed wonder permanently visible
|
// Make the completed wonder permanently visible
|
||||||
TriggerHelper.MakeEntityPermanentlyVisible(data.newentity);
|
TriggerHelper.MakeEntityPermanentlyVisible(data.newentity);
|
||||||
|
|
||||||
// Send "wonder completed" notifications
|
// Send "wonder completed" notifications (only for non-Gaia wonders)
|
||||||
const cmpOwnership = Engine.QueryInterface(data.newentity, IID_Ownership);
|
const cmpOwnership = Engine.QueryInterface(data.newentity, IID_Ownership);
|
||||||
if (cmpOwnership)
|
if (cmpOwnership)
|
||||||
{
|
{
|
||||||
|
|
@ -206,7 +206,7 @@ Trigger.prototype.WonderStartNotification = function(data)
|
||||||
if (owner <= 0)
|
if (owner <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TriggerHelper.MakeEntityPermanentlyVisible(data.foundation, 50);
|
TriggerHelper.MakeEntityPermanentlyVisible(data.foundation);
|
||||||
|
|
||||||
TriggerHelper.SendWonderNotifications(
|
TriggerHelper.SendWonderNotifications(
|
||||||
owner,
|
owner,
|
||||||
|
|
@ -215,6 +215,28 @@ Trigger.prototype.WonderStartNotification = function(data)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Trigger.prototype.RevealGaiaWonders = function()
|
||||||
|
{
|
||||||
|
Engine.ProfileStart("RevealGaiaWonders");
|
||||||
|
const cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager);
|
||||||
|
if (!cmpEndGameManager)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const victoryConditions = cmpEndGameManager.GetVictoryConditions();
|
||||||
|
if (!victoryConditions || !victoryConditions.includes("wonder"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Find and reveal all Gaia wonders
|
||||||
|
const gaiaWonders = Engine.GetEntitiesWithInterface(IID_Wonder).filter(
|
||||||
|
ent => TriggerHelper.GetOwner(ent) === 0
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const ent of gaiaWonders)
|
||||||
|
TriggerHelper.MakeEntityPermanentlyVisible(ent);
|
||||||
|
|
||||||
|
Engine.ProfileStop();
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
const cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
|
const cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
|
||||||
cmpTrigger.RegisterTrigger("OnEntityRenamed", "WonderVictoryEntityRenamed", { "enabled": true });
|
cmpTrigger.RegisterTrigger("OnEntityRenamed", "WonderVictoryEntityRenamed", { "enabled": true });
|
||||||
|
|
@ -222,5 +244,6 @@ Trigger.prototype.WonderStartNotification = function(data)
|
||||||
cmpTrigger.RegisterTrigger("OnDiplomacyChanged", "WonderVictoryDiplomacyChanged", { "enabled": true });
|
cmpTrigger.RegisterTrigger("OnDiplomacyChanged", "WonderVictoryDiplomacyChanged", { "enabled": true });
|
||||||
cmpTrigger.RegisterTrigger("OnPlayerWon", "WonderVictoryPlayerWon", { "enabled": true });
|
cmpTrigger.RegisterTrigger("OnPlayerWon", "WonderVictoryPlayerWon", { "enabled": true });
|
||||||
cmpTrigger.RegisterTrigger("OnConstructionStarted", "WonderStartNotification", { "enabled": true });
|
cmpTrigger.RegisterTrigger("OnConstructionStarted", "WonderStartNotification", { "enabled": true });
|
||||||
|
cmpTrigger.DoAfterDelay(0, "RevealGaiaWonders", {});
|
||||||
cmpTrigger.wonderVictoryMessages = {};
|
cmpTrigger.wonderVictoryMessages = {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue