Ticket #2629: ResourceModify.4.patch

File ResourceModify.4.patch, 1.7 KB (added by Niek, 9 years ago)

Without the 'if'-statement

  • binaries/data/mods/public/simulation/ai/common-api/entity.js

     
    376376    resourceDropsiteTypes: function() {
    377377        if (!this.get("ResourceDropsite"))
    378378            return undefined;
    379         return this.get("ResourceDropsite/Types").split(/\s+/);
     379       
     380        if (!this.get("ResourceDropsite/Types"))
     381            return [];
     382
     383        return (this.get("ResourceDropsite/Types")).split(/\s+/);
    380384    },
    381385
    382386
  • binaries/data/mods/public/simulation/components/ResourceDropsite.js

     
    33ResourceDropsite.prototype.Schema =
    44    "<element name='Types'>" +
    55        "<list>" +
    6             "<oneOrMore>" +
     6            "<zeroOrMore>" +
    77                "<choice>" +
    88                    "<value>food</value>" +
    99                    "<value>wood</value>" +
     
    1010                    "<value>stone</value>" +
    1111                    "<value>metal</value>" +
    1212                "</choice>" +
    13             "</oneOrMore>" +
     13            "</zeroOrMore>" +
    1414        "</list>" +
    1515    "</element>";
    1616
     
    1818/**
    1919 * Returns the list of resource types accepted by this dropsite.
    2020 */
     21
    2122ResourceDropsite.prototype.GetTypes = function()
    2223{
    23     return this.template.Types.split(/\s+/);
     24    this.types = ApplyValueModificationsToEntity("ResourceDropsite/Types", this.template.Types, this.entity);
     25
     26    return this.types === "" ? [] : this.types.split(/\s+/);
    2427};
    2528
    2629/**