Requests from modders to devs for 1.0 and 1.1

Edit: this got implemented

Following the above suggestion, there is also this old request: Technical suggestion about entity tags (material_tags)

Which can be done very similar. It is also backward compatible.

All you need is change this code of material.lua:

   local mat_parts = {}
   for _, tag in ipairs(radiant.util.split_string(material_string)) do
      table.insert(mat_parts, tag)

into this:

   local mat_parts = {}
   if radiant.util.is_string(material_string) then
      material_string = radiant.util.split_string(material_string)
   end
   for _, tag in ipairs(material_string) do
      table.insert(mat_parts, tag)

And also this in the unit_frame.js:

         if (catalogData) {
            var materials = catalogData.materials ? catalogData.materials.split(' ') : [];
            if (materials.indexOf('human') >= 0) {

to this:

         if (catalogData) {
            var materials = null;
            if (catalogData.materials){
               if ((typeof catalogData.materials) === 'string') {
                  materials = catalogData.materials.split(' ');
               }else{
                  materials = catalogData.materials;
               }
            }else{
               materials = []
            }
            if (materials.indexOf('human') >= 0) {

Edit:
We also need to change the shop.lua, same drill:

   local materials = {}
   local tags = entity_description.materials or ''
   for _, tag in ipairs(radiant.util.split_string(tags)) do
      materials[tag] = true

to:

   local materials = {}
   local tags = entity_description.materials or {}
   if radiant.util.is_string(tags) then
      tags = radiant.util.split_string(tags)
   end
   for _, tag in ipairs(tags) do
      materials[tag] = true
6 Likes