Updating Resource Art Icons

InkAxis

King
Joined
Feb 24, 2020
Messages
779
I made some code to update the cinnamon resource icon, but I can't seem to get it to work.

I know the art is working because I made a building and used the art for the building icon and it worked. I have done VFS true on the dds files, and done OnModUploaded -> UpdateDatabase for this sql file.

Code:
UPDATE Resources
SET IconAtlas = 'ATLAS_IA_MONOPOLY', PortraitIndex = 0
WHERE Type = 'RESOURCE_AMBER';

INSERT INTO IconTextureAtlases
        (Atlas,                     IconSize,     Filename,                         IconsPerRow,     IconsPerColumn)
VALUES  ('ATLAS_IA_MONOPOLY',        256,         'MonopolyIconAtlas256.dds',        8,                8),
        ('ATLAS_IA_MONOPOLY',        128,         'MonopolyIconAtlas128.dds',        8,                 8),
        ('ATLAS_IA_MONOPOLY',        80,         'MonopolyIconAtlas80.dds',        8,                 8),
        ('ATLAS_IA_MONOPOLY',         64,         'MonopolyIconAtlas64.dds',        8,                 8),
        ('ATLAS_IA_MONOPOLY',         45,         'MonopolyIconAtlas45.dds',        8,                 8),
        ('ATLAS_IA_MONOPOLY',         32,         'MonopolyIconAtlas32.dds',        8,                 8);

I am planning to use it with the Vox Populi mod, so the associated DLL. But that shouldn't change anything, as I've checked the resource files for that too.
 
Last edited:
It's worked! Turns out the problem was the mod was activating before VP was, meaning that my mod changed the textures before the mod was loaded. So I added a trigger to detect when the resource was updated. Here's the code I added, if anyone's interested:
Code:
CREATE TRIGGER ResourceIconUpdate
AFTER INSERT ON Resources
WHEN 'RESOURCE_AMBER'=NEW.Type
BEGIN
  UPDATE Resources
    SET IconAtlas = 'ATLAS_IA_MONOPOLY', PortraitIndex = 0 
    WHERE Type = 'RESOURCE_AMBER';
END;
 
Last edited:
Sounds like your mod is loading before VP. You need to make your mod depend on VP, and hence load after it
 
Top Bottom