Mini/Micro Machines Core Mod

by Kryzeth

Shared control module for use with Mini/Micro Machines. Enables the cycle size hotkey and adds an icon to machines that can be resized

Internal
4 days ago
2.0
823

i [Implemented] Retain quality in cursor

4 days ago
(updated 4 days ago)

Hey Kryzeth, could you please make it so that when cycling through machines, the ghost retains the selected quality?

I made the changes locally and it worked as intended, but I did not test with the quality mod disabled. It should still work though given that the underlying types define the quality fields whether the quality mod is installed or not.

I updated get_cursor_name() to this:

-- get item name and quality name from real item stack or ghost cursor
local function get_cursor(player)
    local stack = player.cursor_stack and player.cursor_stack.valid_for_read and player.cursor_stack
    if stack then
        local stack_quality_name = stack.quality and stack.quality.name
        return stack.name, stack_quality_name
    end

    local ghost = player.cursor_ghost
    if ghost then
        local ghost_quality_name = ghost.quality and ghost.quality.name
        -- this will probably never trigger, since ghost.name seems to always return a prototype
        if type(ghost.name) == "string" then
            return ghost.name, ghost_quality_name
        end
        -- ghost.name usually returns a prototype, which itself has a .name field
        if ghost.name and ghost.name.name then
            return ghost.name.name, ghost_quality_name
        end
    end
end

Then in cycle_size() when it is called, I capture the quality name:

local current_name, quality_name = get_cursor(player)

In cycle_size()'s return statement, I include the quality field in the table that is parsed as an ItemIDAndQaulityIDPair:

return { name = entry.name, quality = quality_name }

Thanks! I love your mini/micro mods <3

4 days ago
(updated 4 days ago)

Thanks for the code! Implemented the change (with some very minor tweaks to the variable naming) in v2.0.2, along with several other sweeping fixes, including the locale change for the hotkeys mentioned in the other thread, and adding a per-user runtime setting to disable the technology check, allowing players to cycle through the different sizes at will.

This setting does not bypass the technology check for placement of the actual entities though (which has also been implemented, allowing player to build resized machines without bots/space platform, if they have at least one of the vanilla item in their inventory)

Ghosts and space platforms can bypass the technology check at the moment; I'm not sure if there's a way to prevent this, if you ghost-place a resized machine that you have not researched (or if you use them in a blueprint). I might look into whether that can be fixed later, but for now, not a priority

4 days ago

Amazing, thank you so much! Thanks for your prompt responses and fixes too!

New response