From 85353613328391f07eeacb016b1db0558461170f Mon Sep 17 00:00:00 2001
From: Steinar <steinar+git@dbq.no>
Date: Sun, 8 Mar 2026 16:39:31 +0100
Subject: [PATCH] Add support for different graphics set

---
 changelog.txt                           |   5 +
 data/entity.lua                         | 180 ++++++++++++++++++------
 info.json                               |   4 +-
 locale/en/InserterCranes-for-pymods.cfg |   5 +-
 settings.lua                            |   8 ++
 5 files changed, 154 insertions(+), 48 deletions(-)

diff --git a/changelog.txt b/changelog.txt
index e3ea529..770e884 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,9 @@
 ---------------------------------------------------------------------------------------------------
+Version: 1.0.8
+Date: 2026-03-08
+  Changes:
+    - Added settings for crane graphics set (default or from pyCrane (saved in pyindustrygraphics)
+---------------------------------------------------------------------------------------------------
 Version: 1.0.7
 Date: 2026-03-08
   Changes:
diff --git a/data/entity.lua b/data/entity.lua
index d2d65ac..89d9cef 100644
--- a/data/entity.lua
+++ b/data/entity.lua
@@ -148,54 +148,144 @@ local function make_crane_entity(entityName, newName, wide, forced_ips, forced_s
   entity.hand_open_picture = change_sprite_scale(entity.hand_open_picture, 1.5 * sprite_scale_val)
   entity.hand_open_shadow = change_sprite_scale(entity.hand_open_shadow, 1.5 * sprite_scale_val)
   --platform
-  -- if individual picures are used there is no ground texture (yet)
-  entity.platform_picture.north = change_sprite_scale(entity.platform_picture.north, 1.8 * sprite_scale_val)
-  entity.platform_picture.east = change_sprite_scale(entity.platform_picture.east, 1.8 * sprite_scale_val)
-  entity.platform_picture.south = change_sprite_scale(entity.platform_picture.south, 1.8 * sprite_scale_val)
-  entity.platform_picture.west = change_sprite_scale(entity.platform_picture.west, 1.8 * sprite_scale_val)
+  
   entity.localised_name = nil
-  local newSheets = {}
-  if entity.platform_picture.sheets then
-    for _, v in pairs(entity.platform_picture.sheets) do
-      table.insert(newSheets, change_sprite_scale(v, 1.8 * sprite_scale_val))
-    end
-  elseif entity.platform_picture.sheet then
-    newSheets = {change_sprite_scale(entity.platform_picture.sheet, 1.8 * sprite_scale_val)}
-    entity.platform_picture.sheet = nil
-  end
 
-  if #newSheets > 0 then
-    entity.platform_picture.sheets = {}
-    if wide then
-      table.insert(
-        entity.platform_picture.sheets,
-        {
-          filename = "__InserterCranes-for-pymods__/graphics/ground_texture_4way" .. (is_slim and "_slim" or "") .. ".png",
-          priority = "extra-high",
-          width = 768,
-          height = 768,
-          shift = {0, 0},
-          scale = 0.25
-        }
-      )
-    else
-      table.insert(
-        entity.platform_picture.sheets,
-        {
-          filename = "__InserterCranes-for-pymods__/graphics/ground_texture_4way_gray" .. (is_slim and "_slim" or "") .. ".png",
-          priority = "extra-high",
-          width = 384,
-          height = 384,
-          shift = {0, 0},
-          scale = 0.25
-        }
-      )
-    end
+  local graphics_set = settings.startup['crane_graphics_set'].value
+  
+  if graphics_set == "default" then
 
-    for _, v in pairs(newSheets) do
-      table.insert(entity.platform_picture.sheets, v)
-    end
-  end
+	  -- if individual picures are used there is no ground texture (yet)
+	  entity.platform_picture.north = change_sprite_scale(entity.platform_picture.north, 1.8 * sprite_scale_val)
+	  entity.platform_picture.east = change_sprite_scale(entity.platform_picture.east, 1.8 * sprite_scale_val)
+	  entity.platform_picture.south = change_sprite_scale(entity.platform_picture.south, 1.8 * sprite_scale_val)
+	  entity.platform_picture.west = change_sprite_scale(entity.platform_picture.west, 1.8 * sprite_scale_val)
+
+	  local newSheets = {}
+	  if entity.platform_picture.sheets then
+		for _, v in pairs(entity.platform_picture.sheets) do
+		  table.insert(newSheets, change_sprite_scale(v, 1.8 * sprite_scale_val))
+		end
+	  elseif entity.platform_picture.sheet then
+		newSheets = {change_sprite_scale(entity.platform_picture.sheet, 1.8 * sprite_scale_val)}
+		entity.platform_picture.sheet = nil
+	  end
+
+	  if #newSheets > 0 then
+		entity.platform_picture.sheets = {}
+		if wide then
+		  table.insert(
+			entity.platform_picture.sheets,
+			{
+			  filename = "__InserterCranes-for-pymods__/graphics/ground_texture_4way" .. (is_slim and "_slim" or "") .. ".png",
+			  priority = "extra-high",
+			  width = 768,
+			  height = 768,
+			  shift = {0, 0},
+			  scale = 0.25
+			}
+		  )
+		else
+		  table.insert(
+			entity.platform_picture.sheets,
+			{
+			  filename = "__InserterCranes-for-pymods__/graphics/ground_texture_4way_gray" .. (is_slim and "_slim" or "") .. ".png",
+			  priority = "extra-high",
+			  width = 384,
+			  height = 384,
+			  shift = {0, 0},
+			  scale = 0.25
+			}
+		  )
+		end
+
+		for _, v in pairs(newSheets) do
+		  table.insert(entity.platform_picture.sheets, v)
+		end
+	  end
+	
+	elseif graphics_set == "pyindustry" then
+	
+		entity.platform_picture.sheets = {}
+		if wide then
+			-- Base Platform Layer
+			entity.platform_picture = make_4way_animation_from_spritesheet({
+			  layers =
+			  {
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-6x1.png",
+				  priority = "extra-high",
+				  width = 408, 
+				  height = 384,
+				  scale = 0.5
+				},
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-6x1-sh.png",
+				  priority = "extra-high",
+				  width = 408,
+				  height = 384,
+				  draw_as_shadow = true,
+				  scale = 0.5
+				}
+			  }
+			})
+			
+			-- Overlay Platform Layer
+			entity.integration_patch_render_layer = "object"
+			entity.integration_patch = make_4way_animation_from_spritesheet({
+			  layers =
+			  {
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-6x1-oh.png",
+				  priority = "extra-high",
+				  width = 408,
+				  height = 384,
+				  scale = 0.5
+				}
+			  }
+			})
+		else
+			-- Base Platform Layer
+			entity.platform_picture = make_4way_animation_from_spritesheet({
+			  layers =
+			  {
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-3x1.png",
+				  priority = "extra-high",
+				  width = 384,
+				  height = 192,
+				  scale = 0.5
+				},
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-3x1-sh.png",
+				  priority = "extra-high",
+				  width = 384,
+				  height = 192,
+				  draw_as_shadow = true,
+				  scale = 0.5
+				}
+			  }
+			})
+			
+			-- Overlay Platform Layer
+			entity.integration_patch_render_layer = "object"
+			entity.integration_patch = make_4way_animation_from_spritesheet({
+			  layers =
+			  {
+				{
+				  filename = "__pyindustrygraphics__/graphics/entity/crane/crane-platform-3x1-oh.png",
+				  priority = "extra-high",
+				  width = 384,
+				  height = 192,
+				  scale = 0.5
+				}
+			  }
+			})
+		end	
+	
+	
+	
+	end
 
   make_layered_icon(entity, wide)
   --log(newName .. ": " ..serpent.block(entity))
diff --git a/info.json b/info.json
index ede4353..72eb9f9 100644
--- a/info.json
+++ b/info.json
@@ -1,6 +1,6 @@
 {
 	"name": "InserterCranes-for-pymods",
-	"version": "1.0.7",
+	"version": "1.0.8",
 	"title": "Inserter Cranes for Pyanodon (pymods)",
 	"author": "FoMaK",
 	"contact": "",
@@ -10,7 +10,7 @@
 	"dependencies": [
 		"base >= 2.0.33",
 		"pyalternativeenergy >= 3.1.20",
-		"pyindustry >= 3.0.13",
+		"pyindustrygraphics >= 3.0.1",
 		"? bobinserters"
 	]
 }
diff --git a/locale/en/InserterCranes-for-pymods.cfg b/locale/en/InserterCranes-for-pymods.cfg
index cd6a071..c42ba9c 100644
--- a/locale/en/InserterCranes-for-pymods.cfg
+++ b/locale/en/InserterCranes-for-pymods.cfg
@@ -1,12 +1,14 @@
 [mod-setting-name]
 wide_crane_size=Loading Crane size
 short_crane_size=Small Loading Crane size
+crane_graphics_set=Graphics set
 override_crane_stack_on_built_enabled=Override crane stack size on build
 set_override_crane_stack_on_load_enabled=Set stack size for existing cranes on load
 
 [mod-setting-description]
 wide_crane_size=Changing this option in an existing save may cause positioning problems with existing cranes
 short_crane_size=Changing this option in an existing save may cause positioning problems with existing cranes
+crane_graphics_set=Graphics set to use, default included with InserterCranes-for-PyMods or the set in pyindustry used by "pY crane" mod
 override_crane_stack_on_built_enabled=Newly built cranes will have their stack size set to 250 (only if not already overridden, e.g., by blueprint settings)
 set_override_crane_stack_on_load_enabled=All existing cranes will have their stack size set to 250 on game load (only if not already overridden)
 
@@ -14,9 +16,10 @@ set_override_crane_stack_on_load_enabled=All existing cranes will have their sta
 #<setting-name>-<dropdown-item-name>=<translated dropdown item>
 wide_crane_size-default=6x2
 wide_crane_size-slim=6x1 (x2 energy consumption)
-
 short_crane_size-default=3x2
 short_crane_size-slim=3x1 (x2 energy consumption)
+crane_graphics_set-default=Default
+crane_graphics_set-pyindustry=pY Crane (in PyIndustry)
 
 [string-mod-setting-description]
 #<setting-name>-<dropdown-item-name>=<tooltip of dropdown item>
diff --git a/settings.lua b/settings.lua
index 25b0f0b..69736a5 100644
--- a/settings.lua
+++ b/settings.lua
@@ -14,6 +14,14 @@ data:extend {
     default_value = "default",
     allowed_values = {"default", "slim"},
     order = "a2"
+  },
+   {
+    type = "string-setting",
+    name = "crane_graphics_set",
+    setting_type = "startup",
+    default_value = "default",
+    allowed_values = {"default", "pyindustry"},
+    order = "a3"
   },
   {
       type = "bool-setting",
-- 
2.34.1.windows.1

