Edit: this got implemented
Really simple and still backward compatible change. Change the
"roles":"role1 role2 role3"
in the job_description to an array as
"roles":[
"role1",
"role2",
"role3"
]
This way we can easily add more roles as we want without mod conflicts.
To make it work you would need to also change job_component.lua, this:
if self._job_json.roles then
local split_roles = radiant.util.split_string(self._job_json.roles)
for _, job_role in ipairs(split_roles) do
into this:
if self._job_json.roles then
local split_roles = self._job_json.roles
if radiant.util.is_string(split_roles) then
split_roles = radiant.util.split_string(split_roles)
end
for _, job_role in ipairs(split_roles) do
Then in the job_info_controller.lua, change this:
self._sv.roles = {}
local split_roles = radiant.util.split_string(self._description_json.roles)
for _, job_role in ipairs(split_roles) do
to this:
self._sv.roles = {}
local split_roles = self._description_json.roles
if radiant.util.is_string(split_roles) then
split_roles = radiant.util.split_string(split_roles)
end
for _, job_role in ipairs(split_roles) do
And last, the app.js:
if (job.description.roles && !job.description.is_npc_job) {
var rolesString = job.description.roles;
var rolesArray = rolesString.split(" ");
for (var i=0; i < rolesArray.length; ++i) {
to this:
if (job.description.roles && !job.description.is_npc_job) {
var rolesArray = job.description.roles;
if ((typeof rolesArray) === 'string') {
rolesArray = rolesArray.split(" ");
}
for (var i=0; i < rolesArray.length; ++i) {
Edit:
Oh, and also the roles in equipment, change this in equipment_piece_component.lua:
if self._json and self._json.roles then
local split_roles = radiant.util.split_string(self._json.roles)
for _, job_role in ipairs(split_roles) do
to this:
if self._json and self._json.roles then
local split_roles = self._json.roles
if radiant.util.is_string(split_roles) then
split_roles = radiant.util.split_string(split_roles)
end
for _, job_role in ipairs(split_roles) do
Edit2:
You also need to change this in two functions (findRelevantClassesArray and getJobsForRole) in object.js (in radiant mod):
var classArray = [];
var roles = roleString.split(" ");
var jobData = App.jobConstants;
to this:
var classArray = [];
var roles = roleString;
if ((typeof roles) === 'string') {
roles = roles.split(" ");
}
var jobData = App.jobConstants;