Skip to content

Conversation

@IsuCake
Copy link
Contributor

@IsuCake IsuCake commented Jan 20, 2026

This fixes the action_gen.py script where incorrect method templates were being applied during generation and adds missing deprecated actions

@IsuCake IsuCake changed the title Fix action generation templates and add missing deprecated actions Fix action_gen.py and add missing deprecated actions Jan 20, 2026
Copy link
Owner

@Amp63 Amp63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated_actions.json maps deprecated action names to a list of non-deprecated replacements. For example in this entry:

"SendAnimation": ["AttackAnimation", "HurtAnimation", "WakeUpAnimation"]

This means "Instead of SendAnimation, use AttackAnimation, HurtAnimation, or WakeUpAnimation."

If an action name is not present as a key, that means it is not deprecated. If the list of replacements is empty, that means that there is no direct replacement, or I was unable to locate a decent replacement for the block. Most of the actions you added are not actually deprecated.

Please remove all of the added entries except for RngTeleport and SetSheepSheared.

SetSheepSheared should also include the Shear action as a replacement.

@IsuCake
Copy link
Contributor Author

IsuCake commented Jan 21, 2026

deprecated_actions.json maps deprecated action names to a list of non-deprecated replacements.

Thanks for the clarification. I was unsure of what to put in the list.

Most of the actions you added are not actually deprecated.

I added these actions to deprecated_actions.json to prevent duplicate methods from being generated. Targeting the methods that cannot be accessed within Diamond Fire.

Within action_classes.py most of these actions had duplicate method definitions which was overriding the previous methods.
Take a look at the method SetInvName

    @staticmethod
    def SetInvName(text: DFText, alignment_mode: Literal["Regular", "Centered"]="Regular", target: Target=DEFAULT_TARGET):
        """
        Renames a player's current inventory menu.
    
        :param DFText text: Inventory name
        :param str alignment_mode: Alignment Mode
        :param Target target: The target for the action.
        """
        return CodeBlock.new_action('player_action', ' SetInvName ', (text,), {'Alignment Mode': alignment_mode}, target=target)

Then it gets overwritten by this method. (This one gets removed)

    @staticmethod
    def SetInvName(target: Target=DEFAULT_TARGET):
        """
    :param Target target: The target for the action.
        """
        return CodeBlock.new_action('player_action', 'SetInvName', (), {}, target=target)

Please remove all of the added entries except for RngTeleport and SetSheepSheared.

Would ReturnNTimes also be a deprecated action? With Return as the replacement?

@Amp63
Copy link
Owner

Amp63 commented Jan 21, 2026

Then it gets overwritten by this method.

Ah, I see now. For some reason, the actiondump can contain duplicate action entries without any data, so that's why an "empty" method was created for SetInvName. I'll make sure to filter out those actions.

Would ReturnNTimes also be a deprecated action? With Return as the replacement?

I'm inclined to say no, because even though it's unlisted, it provides unique functionality and is fully implemented to my knowledge.
The actiondump doesn't actually list any arguments for ReturnNTimes, so I'll have to add an external entry so that the method works properly.

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.

2 participants