Skip to content

Commit

Permalink
Support even pickier dollies (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quezler committed Dec 30, 2024
1 parent e7a2c25 commit 8c4a6c5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mods_2.0/010_upcycler/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.1.3
Date: 2024. 12. 30
Info:
- Support even pickier dollies (#25)
---------------------------------------------------------------------------------------------------
Version: 1.1.2
Date: 2024. 12. 09
Info:
Expand Down
22 changes: 22 additions & 0 deletions mods_2.0/010_upcycler/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ local mod_surface_name = "upcycler"

local Handler = {}

local function on_epd_event(event)
local entity = event.moved_entity
if entity.name == "upcycler" then
local struct = storage.structs[entity.unit_number]

-- move the chest within bounds, then reposition it normally
struct.entities.upcycler_input.teleport(entity.position)
Handler.get_or_create_linkedchest_then_move(entity)
end
end

local function init_epd_event()
local epd_api = remote.interfaces['PickerDollies']
if epd_api == nil then return end

local epd_event_id = remote.call("PickerDollies", "dolly_moved_entity_id")

script.on_event(epd_event_id, on_epd_event)
end

local function reset_items_per_next_quality()
storage.items_per_next_quality = {
upcycler = settings.global["upcycling-items-per-next-quality"].value,
Expand All @@ -30,6 +50,7 @@ function Handler.init()
}

Handler.reset_on_created_entity_listeners()
init_epd_event()
end

function Handler.on_configuration_changed()
Expand Down Expand Up @@ -152,6 +173,7 @@ end

script.on_load(function()
Handler.reset_on_created_entity_listeners()
init_epd_event()
end)

function Handler.get_or_create_linkedchest_then_move(entity)
Expand Down
4 changes: 3 additions & 1 deletion mods_2.0/010_upcycler/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Upcycler",
"description": "No quality modules, sacrifice x (configurable) items to get the next tier.",

"version": "1.1.2",
"version": "1.1.3",
"author": "Quezler",
"factorio_version": "2.0",

Expand All @@ -22,6 +22,8 @@
"quality",
"? space-age",

"? even-pickier-dollies",

"! awesome-sink"
]
}

0 comments on commit 8c4a6c5

Please sign in to comment.