Where are Job Requirements Assigned?

Hello!

I took a long hiatus from modding and I am starting back up again. I was looking into changing job requirements to test things, but I don’t know where the requirements are dictated. I was primarily interested in making city tier a requirement for a job, eg. make the blacksmith upgrade require city tier 2.

Thanks in advance for any advice!

I think from using just .json files, you can only chose what the tool and previous job(+level) is necessary. Anything more will probably need other changes with .lua

1 Like

Thank you very much for the answer, I was afraid of that. I have been looking through the .lua files but I am unable to find where the requirements are checked (e.g. causing the promote ability to be clickable). Would you happen to know which .lua files this is contained in?

The interface itself is javascript .js, probably at the ui folder

Thanks! I think I have it all figured out and (at least until I can get to tier 2) have it working!

Okay, unfortunately it was not as easy as I had hoped. I am successfully retrieving the information I generated in the job descriptions in the promotion tree, however I don’t know how to retrieve the city tier there. I’m not extremely comfortable with javascript - this is my first time touching it, so I’m not totally sure what commands I should be using to access the tier, or where it is stored. Any advice?

Without looking at it myself, I think you should check the builds unlocking system? I’m not sure. There is a group of building that unlock when you have tier 2, so maybe there is also some check in that UI.

1 Like

I was thinking the same thing myself, and I went through and checked the other aspects of the UI. I thought it would be in the city_tier_success_dialog, which (I assume) updated once the tier was achieved. I found this section of code and tried to mimic it in the promotion tree,

  var achievementArr = this.get('model.data.achievements');
      var delay = 500;
      for(var i = 0; i<achievementArr.length; i++ ) {
       var achievementInfo = achievementArr[i];
         var targetBlock = this.$('#' + achievementInfo.id);
         if (targetBlock) {
            this.$('#' + achievementInfo.id).css('visibility', 'hidden');
            this.showAchievement(this.$('#' + achievementInfo.id), delay, achievementInfo.track);
            delay = delay + 1000;            
         }
      }

But when I tried using the getter, it failed at this.get(‘model.data.achievements’).

As @BrunoSupremo pointed out, there’s this check on building_templates.js:

var cityTier = App.population.getCityTier(); 
.......
(more code)
.......
if (category.required_city_tier && cityTier < category.required_city_tier) {
     Ember.set(category, 'is_visible', false);
} else {
     Ember.set(category, 'is_visible', true);
}

Maybe it helps you :confused:
(the UI is tricky to mod right now)

Well, that helped me out, and now it works perfectly. I feel kinda stupid for totally overlooking the building_templates file, didn’t think to look in the modes folder. Thank you very much both of you for the help!