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 2018 年 8 月 24 日 下午 1:30
Fix: Missing mod icons
For any users that want icons in outdated mods, you can use this mod to fix them: https://psteamcommunity.yuanyoumao.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)
最后由 ChoGGi 编辑于; 2022 年 6 月 2 日 上午 6:32
< >
正在显示第 1 - 15 条,共 41 条留言
Drake 1 2018 年 9 月 30 日 下午 4:40 
Thank you very much.
ChoGGi 456 2019 年 4 月 27 日 下午 3:21 
For any users that want icons in older mods, you can use this one to fix them: https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1725437808
最后由 ChoGGi 编辑于; 2019 年 4 月 27 日 下午 3:21
enzovirus 47 2019 年 5 月 18 日 上午 4:44 
Hi, is there a fix for missing crop icons?
Apparently they have a similar issue.
ChoGGi 456 2019 年 5 月 18 日 上午 10:52 
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?
最后由 ChoGGi 编辑于; 2019 年 5 月 18 日 下午 6:31
enzovirus 47 2019 年 5 月 19 日 上午 7:47 
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 2019 年 5 月 24 日 上午 10:27 
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 2019 年 5 月 24 日 下午 12:15 
No it doesn't apply to unpacked mods. The devs don't try to fix those up, since they don't need to.
DARKNESS 2019 年 5 月 24 日 下午 2:41 
What do you mean it doesn't apply? I tested it myself and the reason I found this fix.
ChoGGi 456 2019 年 5 月 24 日 下午 2:47 
The devs don't fix up the paths on unpacked mods.
DARKNESS 2019 年 5 月 24 日 下午 2:53 
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 2019 年 5 月 24 日 下午 3:12 
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 2019 年 5 月 24 日 下午 3:23 
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.
最后由 DARKNESS 编辑于; 2019 年 5 月 24 日 下午 3:24
ChoGGi 456 2019 年 5 月 24 日 下午 3:31 
Oh, then I guess they updated it in Armstrong?
DARKNESS 2019 年 5 月 24 日 下午 3:35 
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 2019 年 5 月 24 日 下午 3:40 
Nah, a path is a path.
< >
正在显示第 1 - 15 条,共 41 条留言
每页显示数: 1530 50