commit 8a006de57672b7a89b4bb5e512fdf37f5d883f15 Author: Fabian Montero Date: Thu Feb 13 17:24:16 2025 -0600 initial commit diff --git a/data.lua b/data.lua new file mode 100644 index 0000000..600a421 --- /dev/null +++ b/data.lua @@ -0,0 +1 @@ +require("scripts/replace_sprites") \ No newline at end of file diff --git a/info.json b/info.json new file mode 100644 index 0000000..d8e52fe --- /dev/null +++ b/info.json @@ -0,0 +1,11 @@ +{ + "name": "high-contrast", + "version": "0.0.1", + "title": "High contrast graphics", + "author": "Fabian Montero, Alejandro Soto", + "contact": "fabian@posixlycorrect.com", + "homepage": "https://git.posixlycorrect.com/deepState/factorio_high_contrast_mod", + "description": "Flat, high contrast graphics for Factorio.", + "factorio_version": "1.1", + "dependencies": [""] + } \ No newline at end of file diff --git a/scripts/replace_sprites.lua b/scripts/replace_sprites.lua new file mode 100644 index 0000000..e66a7c7 --- /dev/null +++ b/scripts/replace_sprites.lua @@ -0,0 +1,22 @@ +local function replace_sprite_filenames(t) + if type(t) == "table" then + for key, value in pairs(t) do + if key == "filename" and type(value) == "string" then + -- Extract the base filename (assumes the original filenames are in some folder) + local base_filename = value:match("([^/\\]+)$") + -- Construct your new path using the new mod name + t[key] = "__factorio_high_contrast_mod__/graphics/" .. base_filename + else + replace_sprite_filenames(value) + end + end + end + end + + -- Iterate over all prototypes in data.raw + for type_name, prototypes in pairs(data.raw) do + for _, prototype in pairs(prototypes) do + replace_sprite_filenames(prototype) + end + end + \ No newline at end of file