Surviving Mars

Surviving Mars

Modify your Mars journey
Modify your Surviving Mars experience using mods created and shared by the Surviving Mars community.
ChoGGi 456 24 Aug, 2018 @ 1:30pm
Fix: Missing mod icons
For any users that want icons in outdated mods, you can use this mod to fix them: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1725437808




For Modders only:


This is ONLY needed when you use in-game assets, custom ones you've added don't need it (if you mix and match then you only need fix the in-game ones).



In your mod\items.lua it shows stuff like:
'display_icon', "UI/Icons/Buildings/water_extractor.tga",
the problem is when the mod is uploaded to steam, it's packed in ModContent.hpk, and when that is loaded in-game you get:
'display_icon' = 'PackedMods/D:\SteamGames\steamapps\workshop\content\464920\1411210466/UI/Icons/Buildings/water_extractor.tga'
and since that file doesn't exist it shows a blank space instead of an icon.

On the bright side it's easy enough to workaround; add a "Code" section in the mod editor (or use an existing one) and paste this into it:
-- Building_Template_Id is the Id of your building (see items.lua) local Building_Template_Id = "WaterExtractor_Example" local function FixIcons() -- local the building template local bt = BuildingTemplates[Building_Template_Id] -- local the class template local ct = ClassTemplates.Building[Building_Template_Id] -- building menu icon bt.display_icon = "UI/Icons/Buildings/water_extractor.tga" -- encyclopedia entry icon bt.encyclopedia_image = "UI/Encyclopedia/WaterExtractor.tga" -- upgrade icons (Thanks Silva) ct.upgrade1_icon = "UI/Icons/Upgrades/fueled_extractor_01.tga" ct.upgrade2_icon = "UI/Icons/Upgrades/amplify_01.tga" ct.upgrade3_icon = "UI/Icons/Upgrades/magnetic_extraction_01.tga" -- pinned icon ct.display_icon = "UI/Icons/Buildings/water_extractor.tga" -- crops menu icon local crops = CropPresets[Building_Template_Id] crops.icon = "UI/Icons/Buildings/crops_apples.tga" -- building menu submenu cat icon local bsm = BuildMenuSubcategories[Building_Template_Id] bsm.icon = "UI/Icons/Buildings/lakes.tga" -- research tech icon local tech = TechDef[Building_Template_Id] tech.icon = "UI/Icons/Research/atomic_accumulator.tga" -- you can remove any of the above icons you don't use end -- new games OnMsg.CityStart = FixIcons -- saved games OnMsg.LoadGame = FixIcons



If you're not sure what the id is: Check items.lua, or install ECM and in the console type ~BuildingTemplates (the name on the right is the id)
Last edited by ChoGGi; 2 Jun, 2022 @ 6:32am
< >
Showing 1-15 of 41 comments
Drake 1 30 Sep, 2018 @ 4:40pm 
Thank you very much.
ChoGGi 456 27 Apr, 2019 @ 3:21pm 
For any users that want icons in older mods, you can use this one to fix them: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1725437808
Last edited by ChoGGi; 27 Apr, 2019 @ 3:21pm
enzovirus 47 18 May, 2019 @ 4:44am 
Hi, is there a fix for missing crop icons?
Apparently they have a similar issue.
ChoGGi 456 18 May, 2019 @ 10:52am 
got a mod link?

Edit: Updated with a crop example.

It seems anything using a path of an in-game image/whatever will have the same issue, not sure why the devs can't use AsyncGetFileAttribute to check if the file exists in the mod folder?
Last edited by ChoGGi; 18 May, 2019 @ 6:31pm
enzovirus 47 19 May, 2019 @ 7:47am 
You beauty, I tried a few variations and came to the same conculsion, anything that needs an icon seems to have the same issue. Thought it was worth mentioning so it's all in one place :)
(Thanks for keeping it in one easy location!)
DARKNESS 24 May, 2019 @ 10:27am 
Thank you ChoGGi for sharing this. This problem exists not only for packed .hpk files, but also for unpacked local mods in the mod folder. Ridiculous that code is needed for this. Shame on the devs. :shit:
ChoGGi 456 24 May, 2019 @ 12:15pm 
No it doesn't apply to unpacked mods. The devs don't try to fix those up, since they don't need to.
DARKNESS 24 May, 2019 @ 2:41pm 
What do you mean it doesn't apply? I tested it myself and the reason I found this fix.
ChoGGi 456 24 May, 2019 @ 2:47pm 
The devs don't fix up the paths on unpacked mods.
DARKNESS 24 May, 2019 @ 2:53pm 
Are you justifying that for them? Thats no excuse. There are mods on the nexus that do not come packed in hpk. All my mods for personal use are also unpacked.

Also, I misunderstood the way your wrote your response - you made it sound like this fix doesn't work on unpacked mods, which it does. Confusing....:csgogun::nerdattack:
ChoGGi 456 24 May, 2019 @ 3:12pm 
What? No I'm saying they don't try and change the paths of unpacked mods, I'd have to see the mods you mean, since if they are unpacked then my mod shouldn't make a difference.
DARKNESS 24 May, 2019 @ 3:23pm 
Real simple to reproduce. Just create a new mod and add a new building template. I used a clone/copy of the solar array and gave it a unique id to add it to my custom sponsor.

Upon loading the game the icon is missing even though the paths in items.lua are correct. Added the code then restarted and icon is there all the time. This code does make a difference.
Last edited by DARKNESS; 24 May, 2019 @ 3:24pm
ChoGGi 456 24 May, 2019 @ 3:31pm 
Oh, then I guess they updated it in Armstrong?
DARKNESS 24 May, 2019 @ 3:35pm 
I don't know...I'm the new guy here.

<stupid theory>Do you think it could be because the building I used is a DLC object?</stupid theory>
ChoGGi 456 24 May, 2019 @ 3:40pm 
Nah, a path is a path.
< >
Showing 1-15 of 41 comments
Per page: 1530 50