Ticket #3841: 3841_ingame_summary_v0.3.patch

File 3841_ingame_summary_v0.3.patch, 6.8 KB (added by Imarok, 2 years ago)

Make summary accesible to see your own score. Adds a tech to see the score of your allies that requires shared vision . Missing: a proper name for this tech, an icon, proper costs and the tooltip proposed in 3)

  • binaries/data/mods/public/gui/session/menu.js

     
    617617    pauseGame();
    618618
    619619    let extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState");
     620    let playersToShow = [];
     621
     622    if (g_ViewedPlayer < 1)
     623        playersToShow = extendedSimState.players;
     624    else
     625        for (let player in g_Players)
     626            if (player == 0 || player == g_ViewedPlayer || extendedSimState.players[g_ViewedPlayer].hasSeeAllyScore && g_Players[player].isMutualAlly[g_ViewedPlayer])
     627                playersToShow.push(extendedSimState.players[player]);
     628
    620629    Engine.PushGuiPage("page_summary.xml", {
    621630        "sim": {
    622631            "mapSettings": g_GameAttributes.settings,
    623             "playerStates": extendedSimState.players,
     632            "playerStates": playersToShow,
    624633            "timeElapsed" : extendedSimState.timeElapsed
    625634        },
    626635        "gui": {
  • binaries/data/mods/public/gui/session/menu.xml

     
    4848            style="StoneButtonFancy"
    4949            size="0 96 100% 124"
    5050            tooltip_style="sessionToolTip"
    51             enabled="false"
    5251        >
    5352            <translatableAttribute id="caption">Summary</translatableAttribute>
    5453            <action on="Press">openGameSummary();</action>
  • binaries/data/mods/public/gui/session/session.js

     
    480480    // Disable stuff observers shouldn't use
    481481    Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked;
    482482    Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver;
    483     Engine.GetGUIObjectByName("summaryButton").enabled = g_IsObserver;
    484483}
    485484
    486485function reportPerformance(time)
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    107107            "cheatsEnabled": cmpPlayer.GetCheatsEnabled(),
    108108            "disabledTemplates": cmpPlayer.GetDisabledTemplates(),
    109109            "hasSharedDropsites": cmpPlayer.HasSharedDropsites(),
     110            "hasSeeAllyScore": cmpPlayer.HasSeeAllyScore(),
    110111            "phase": phase,
    111112            "isAlly": allies,
    112113            "isMutualAlly": mutualAllies,
  • binaries/data/mods/public/simulation/components/Player.js

     
    66    "</element>" +
    77    "<element name='SharedDropsitesTech' a:help='Allies will share dropsites when this technology is researched. Leave empty to never share dropsites.'>" +
    88        "<text/>" +
     9    "</element>" +
     10    "<element name='SeeAllyScoreTech' a:help='The player will see the score of its allies. Leave empty to never let the player see the score of allies.'>" +
     11        "<text/>" +
    912    "</element>";
    1013
    1114Player.prototype.Init = function()
     
    3538    this.state = "active"; // game state - one of "active", "defeated", "won"
    3639    this.diplomacy = [];    // array of diplomatic stances for this player with respect to other players (including gaia and self)
    3740    this.sharedDropsites = false;
     41    this.seeAllyScore = false;
    3842    this.formations = [];
    3943    this.startCam = undefined;
    4044    this.controlAllUnits = false;
     
    550554    return this.sharedDropsites;
    551555};
    552556
     557Player.prototype.HasSeeAllyScore = function()
     558{
     559    return this.seeAllyScore;
     560};
     561
    553562Player.prototype.SetControlAllUnits = function(c)
    554563{
    555564    this.controlAllUnits = c;
     
    705714        this.UpdateSharedLos();
    706715    else if (msg.tech == this.template.SharedDropsitesTech)
    707716        this.sharedDropsites = true;
     717    else if (msg.tech == this.template.SeeAllyScoreTech)
     718        this.seeAllyScore = true;
    708719};
    709720
    710721Player.prototype.OnDiplomacyChanged = function()
  • binaries/data/mods/public/simulation/data/technologies/unlock_see_ally_score.json

     
     1{
     2        "genericName": "SeeAllyScore",
     3        "description": "Allows you to see the score of your allies.",
     4        "cost": { "food": 200, "wood": 200, "stone": 100, "metal": 100 },
     5        "requirements": {"tech": "unlock_shared_los"},
     6        "requirementsTooltip": "Requires Cartography",
     7        "icon": "diaspora.png",
     8        "researchTime": 40,
     9        "tooltip": "You can see the score of your allies.",
     10        "modifications": [{ "value": "Player/seeAllyScore", "replace": true }],
     11        "soundComplete": "interface/alarm/alarm_upgradearmory.xml"
     12    }
     13 No newline at end of file
  • binaries/data/mods/public/simulation/templates/special/player.xml

     
    5959  <Player>
    6060    <SharedLosTech>unlock_shared_los</SharedLosTech>
    6161    <SharedDropsitesTech>unlock_shared_dropsites</SharedDropsitesTech>
     62    <SeeAllyScoreTech>unlock_see_ally_score</SeeAllyScoreTech>
    6263  </Player>
    6364  <StatisticsTracker/>
    6465  <TechnologyManager/>
  • binaries/data/mods/public/simulation/templates/special/player_gaia.xml

     
    33  <Player>
    44    <SharedLosTech/>
    55    <SharedDropsitesTech/>
     6    <SeeAllyScoreTech/>
    67  </Player>
    78</Entity>
  • binaries/data/mods/public/simulation/templates/template_structure_economic_market.xml

     
    5656    <Technologies datatype="tokens">
    5757      unlock_shared_los
    5858      unlock_shared_dropsites
     59      unlock_see_ally_score
    5960      trade_convoys_speed
    6061      trade_convoys_armor
    6162      trade_gain_01