Skip to content

New Engine Feature: Add op412#122

Open
4Luke4 wants to merge 1 commit into
Bubb13:develfrom
4Luke4:screen-effects-list
Open

New Engine Feature: Add op412#122
4Luke4 wants to merge 1 commit into
Bubb13:develfrom
4Luke4:screen-effects-list

Conversation

@4Luke4
Copy link
Copy Markdown
Contributor

@4Luke4 4Luke4 commented May 16, 2026

This pull request introduces a new opcode (op412) called ScreenEffectsList, which enables advanced Lua scripting hooks for filtering and managing batches of screen effects on sprites.

New Opcode and Lua Scripting Hooks:

  • Added support for op412, allowing registration of a global Lua function (up to 8 uppercase characters) to filter and mutate batches of effects before they are resolved on a sprite. The Lua function can remove or mutate effect objects, and engine-side hooks are provided for effect application, removal, and pre-addition logic.

Notes:
@Bubb13

  • This is mainly meant to block one or more effects conditionally to the presence of other effects. Unlike op403, it cannot block the driving opcodes (177, 182, 183, 283).
    • I.e., you can only block/edit the outermost op177/182/183/283; you can still of course inspect the chain of .EFF files by using EEex_Resource_Demand().
  • Having said that, it should work fine when used in conjunction with op403, i.e. op403 should see the survivors from op412...

Example usage:

function B3OP412(op412, list, sprite) -- CGameEffect, table<CGameEffect>, CGameSprite

    local found

    for i = #list, 1, -1 do
        local effect = list[i] -- CGameEffect
        --
        if effect.m_effectId == 74 then -- blindness
            table.remove(list, i) -- safe when going backwards
            found = true
        end
    end

    if found then

        for i = #list, 1, -1 do
            local effect = list[i] -- CGameEffect
            --
            if effect.m_effectId == 142 and effect.m_dWFlags == 8 then -- blindness
                table.remove(list, i) -- safe when going backwards
            end
        end

    end

    return list
end

Requires: Bubb13/InfinityLoader#7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant