Ticket #1773: patch_notiftreasure.diff

File patch_notiftreasure.diff, 1.2 KB (added by Itms, 11 years ago)
  • binaries/data/mods/public/simulation/components/ResourceGatherer.js

     
    167167{
    168168    var cmpResourceSupply = Engine.QueryInterface(target, IID_ResourceSupply);
    169169    var type = cmpResourceSupply.GetType();
     170    var amount = cmpResourceSupply.GetCurrentAmount();
    170171
    171172    if (type.generic != "treasure") return false;
    172173
     
    174175
    175176    var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
    176177    cmpPlayer.AddResource(type.specific, status.amount);
     178   
     179    // GUI notification giving information about the resource collected
     180    var message = "You found " + amount + " units of " + type.specific + " !"
     181    var notification = {"player": cmpPlayer.GetPlayerID(), "message": message };
     182    var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
     183    cmpGUIInterface.PushNotification(notification);
    177184
    178185    var cmpStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
    179186    if (cmpStatisticsTracker)