• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

FeiXue

Private
10 Badges
Apr 12, 2018
11
0
  • Cities: Skylines
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Stellaris: Apocalypse
  • Cities: Skylines Deluxe Edition
  • Stellaris - Path to Destruction bundle
20180419191330_1.jpg
Ideally devs would change GenerateColonistData? which for some reason doesn't set colonist.specialist for Androids and thus Colonist:GetSpecializationIcons fails (twice). Once for flat out returning "" for Androids
Code:
if traits.Child or traits.Android then
  return ""
end
and twice for
Code:
spec = ColonistClasses[self.specialist or "none"]
if spec == "" then
  spec = "Colonist"
end

But if for whatever reason they don't, you need something like this:
Code:
local traits = DataInstances.Trait
for i = 1, #traits do
  if traits[i].name == trait_id then
    cat_id = traits[i].category
    break
  end
end
   
if cat_id == "Specialization" then
  if colonist.traits.Android then
    if trait_id ~= "none" then
      local spec = ColonistClasses[trait_id]
      if spec == "" then
        spec = "Colonist"
      end
               
      colonist.ip_specialization_icon = string.format("UI/Icons/Colonists/IP/IP_%s_%s.tga", spec, colonist.entity_gender)
      colonist.pin_specialization_icon = string.format("UI/Icons/Colonists/Pin/%s_%s.tga", spec, colonist.entity_gender)
    end
  end
end
hooked to OnMsg.ColonistAddTrait. Or just overwrite Colonist:GetSpecializationIcons; I tend to avoid such solutions.

Code is probably crap but I cba to learn somebody's pet project that for some inexplicable reason is now standard for game logic. It adds nothing but some convoluted syntax and stupid restrictions. Wth is Javascript missing that Lua has? Or better yet, full Java. Python for crying out loud.

Anyway, won't be releasing mod for this. First, there are no mod tools for Linux and second, /effort. Maybe poke Ampoliros to add it to his Biorobot Fix (which you should be using anyway).

Unrelated, I'm not getting OnMsg.ColonistBorn fired for human births. Fires for Android creation but not for humans. Can see ColonistAddTrait firing and adding traits to newborn (Age=Child for instance).